query
stringlengths 7
9.55k
| document
stringlengths 10
363k
| metadata
dict | negatives
sequencelengths 0
101
| negative_scores
sequencelengths 0
101
| document_score
stringlengths 3
10
| document_rank
stringclasses 102
values |
---|---|---|---|---|---|---|
Sets the requiredResourceAccess property value. Specifies the resources that the application needs to access. This property also specifies the set of delegated permissions and application roles that it needs for each of those resources. This configuration of access to the required resources drives the consent experience. No more than 50 resource services (APIs) can be configured. Beginning midOctober 2021, the total number of required permissions must not exceed 400. For more information, see Limits on requested permissions per app. Not nullable. Supports $filter (eq, not, ge, le). | def required_resource_access=(value)
@required_resource_access = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_access=(value)\n @resource_access = value\n end",
"def resource_access=(value)\n @resource_access = value\n end",
"def required_resource_access\n return @required_resource_access\n end",
"def allowed_resource_actions=(value)\n @allowed_resource_actions = value\n end",
"def set_resource\n @assignment = Assignment.find(params[:id])\n authorize @assignment\n end",
"def authorize_resource\n EffectiveResources.authorize!(self, action_name.to_sym, resource)\n end",
"def resource_access\n return @resource_access\n end",
"def resource_access\n return @resource_access\n end",
"def required_permission\n #\n # return the permission record if we have the Permission model\n #\n @required_permission ||= defined?(Permission) ? wulin_permits_required_permission : OpenStruct.new(name: [controller_name, action_name].join(\"#\"))\n end",
"def add_resource(resource, key_name, read_only)\n self.class.ensure_resource!(resource)\n @data[key_name] << { 'resourceUri' => resource['uri'], 'readOnly' => read_only }\n end",
"def permissions\n @resource_permissions\n end",
"def can_edit?(required_role)\n \n perm = current_user.permissions.select { |p| p.role.name == required_role}[0]\n \n @readonly= perm.nil? ? false : perm.readOnly?\n \n end",
"def permission(access_rules)\n access_rules.each_pair do |verb, role|\n @resource_config[:roles].validate_role(role)\n @resource_config[:permission][verb] = role\n end\n end",
"def has_resource_permission()\n resource = resource().find(params[:id])\n unless (current_user.admin? or current_user == resource.user)\n render 'shared/403', :status => 403\n return false\n end\n return true\n end",
"def set_resource\n @course = Course.find(params[:id])\n authorize @course\n end",
"def resource_role_scopes=(value)\n @resource_role_scopes = value\n end",
"def set_access\n @access = @current_event.accesses.find(params[:id])\n authorize @access\n end",
"def assert_read_granted(resource, principal)\n @read_priv.assert_granted(resource, principal) unless @read_priv.nil?\n end",
"def resource_requests=(value)\n @resource_requests = value\n end",
"def allowed_resource_actions\n return @allowed_resource_actions\n end",
"def read_only_recommended\n @read_only = 2\n end",
"def authorize(required = nil, options)\n if options.key? :through\n name = options[:through].to_s.singularize.to_sym\n elsif options.key? :with\n name = options[:with].to_s.singularize.to_sym\n else\n raise ArgumentError, 'find_and_authorize must be called with either '\\\n ':through or :with option. The resource referenced by the value '\\\n 'of this option should be an instance of a class that includes '\\\n 'Roleable.'\n end\n\n record = instance_variable_get(\"@#{name}\")\n\n if record.nil? # must be devise scope\n record = send(\"current_#{name}\")\n send \"authenticate_#{name}!\"\n end\n\n role_attr = record.class.role_attribute_name\n actual = record.send(role_attr)\n\n required ||= options[role_attr]\n required = [required] unless Array === required\n\n # actual roles must have at least\n # one required role (array intersection)\n ((required & actual).size > 0).tap do |res|\n raise Denied.new(role_attr, required, actual) unless res\n end\n end",
"def allowed_resources\n %w( )\n end",
"def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end",
"def resource_scopes=(value)\n @resource_scopes = value\n end",
"def resource_scopes=(value)\n @resource_scopes = value\n end",
"def set_resource_group\n @resource_group = ResourceGroup.find(params[:id])\n # authorize(@resource_group)\n end",
"def restrict_access\n authenticate_or_request_with_http_token do |token, options|\n ApiKey.exists?(access_token: token)\n end\n end",
"def restrict_access\n authenticate_or_request_with_http_token do |token, options|\n ApiKey.exists?(access_token: token)\n end\n end",
"def restrict_access\n authenticate_or_request_with_http_token do |token, options|\n ApiKey.exists?(access_token: token)\n end\n end",
"def has_permissions?(resource_permissions)\n resource_permissions.any? do |res, perm|\n @resource_permissions[res].include? Definition::PERMISSIONS[perm]\n end\n end",
"def set_access(*args)\n options = args.extract_options!\n options[:object] ||= Array(@_controller).first.to_s.singularize.to_sym if @_controller.present?\n permissions.add(*args, options)\n end",
"def authorize!\n Ability.allowed?(context[:current_user], :read_milestone, parent) || raise_resource_not_available_error!\n end",
"def resource_params\n params.require(resource_name).permit(*permitted_params)\n end",
"def permits_read_acccess_for(user)\n end",
"def update!(**args)\n @granted = args[:granted] if args.key?(:granted)\n @permission = args[:permission] if args.key?(:permission)\n @resource = args[:resource] if args.key?(:resource)\n @resource_attributes = args[:resource_attributes] if args.key?(:resource_attributes)\n end",
"def set_scope\n if (scope = params[:scope])\n if @resource.respond_to?(scope)\n @resource = @resource.send(scope)\n else\n not_allowed\n end\n end\n end",
"def resources_permitted? kind, identifiers, privilege\n options = {\n privilege: privilege,\n identifiers: identifiers\n }\n resp = RestClient::Resource.new(Conjur::Authz::API.host, credentials)[\"#{Conjur.account}/resources/#{kind}?check=true\"].post(options)\n if resp.code == 204\n [true, []]\n else\n [false, JSON.parse(resp.body)]\n end\n end",
"def check_api_access\n current_resource_owner&.can_use_api?\n end",
"def learning_resource_params\n params.require(:learning_resource).permit(:reference, :accessed)\n end",
"def read_permitted?\n true\n end",
"def can_manage?(*resources)\n self.is_superuser? or (allowed_resources & resources) == resources\n end",
"def has_resource_permission()\n resource = resource().find(params[:id])\n unless (current_user.admin? or current_user == resource)\n redirect_to(user_path(current_user), :alert => t(:permission_denied))\n end\n return true\n end",
"def can_read?(resource)\n scope_name = resource.class.to_s.downcase.pluralize\n self.send(\"readable_#{scope_name}\").where(\"`permissions`.resource_type = ? AND `permissions`.resource_id = ?\", resource.class.to_s, resource.id).exists?\n end",
"def authorize_resource(*args); end",
"def allow(actions, resources)\n add_rule(true, actions, resources)\n end",
"def able_to_any?(*required_permissions)\n perms = required_permissions.map(&:to_sym)\n permissions.any? do |p| \n perms.include?(p.name.to_sym) \n end\n end",
"def restrict_access\n authenticate_or_request_with_http_token do |token, _options|\n ApiToken.exists?(access_token: token)\n end\n end",
"def read_access_check\n resource_check('read')\n end",
"def read_access_check\n resource_check('read')\n end",
"def read_access_check\n resource_check('read')\n end",
"def have_access?(resource)\n # Master User always have access to all\n return true if self.master?\n # cache the acl hash\n @have_access ||= {}\n # add some caching...\n @have_access[resource.to_s] ||= begin\n res = Resource.find_by_resource(resource)\n res.nil? || resource_ids.include?(res.id) || roles.any? { |r| r.resource_ids.include?(res.id) }\n end\n end",
"def linked_resources=(value)\n @linked_resources = value\n end",
"def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end",
"def resource_scope=(resource_scope)\n @resource_scope = \"/#{resource_scope}\"\n end",
"def permission_resources\n %w{roles sites employees classrooms students gapps_org_units}\n end",
"def ensure_permit_access_authorized!\n unless @_bsm_rails_api_authorized\n raise NotSecure, \"This action failed because permit_access filters were not run. Add permit_access to secure this endpoint.\"\n end\n end",
"def has_access?(required_roles)\n (self.roles.collect { |r| r.name } & required_roles).size > 0\n end",
"def lookup_required_resources\n \n # Marketplace admin user - required to administer users, and store\n # application-level properties\n unless session['marketplace_admin_user_name']\n marketeer_user = User.where(role: 'marketeer').first\n session['marketplace_admin_user_name'] = marketeer_user ? marketeer_user.name : nil\n end\n \n # Determine whether any required resources are missing.\n session['required_resources_present'] = !session['marketplace_admin_user_name'].nil?\n \n unless session['required_resources_present']\n \n # An action is being invoked before all the required resources have\n # been initialized. Redirect the user back to the landing page, unless\n # the user has initiated an \"/init_XYZ\" request to create a resource.\n # redirect_to root_url\n end\n end",
"def can_access?(profile, options)\n \n can_access_resource = options.include?(attribute_get(:permission_modifier_all)) \n \n if profile and not can_access_resource\n superuser_access = profile.is_superuser?\n can_access_group = (options.include?(attribute_get(:permission_modifier_group)) and profile.usergroups.map{|item| item.group }.include?(attribute_get(:permission_group))) \n can_access_owner = (options.include?(attribute_get(:permission_modifier_owner)) and profile.username == attribute_get(:permission_owner))\n \n can_access_resource = (superuser_access or can_access_group or can_access_owner)\n end\n \n return can_access_resource\n \n end",
"def has_permissions?(resource_permissions)\n fetch_permissions! resource_permissions.keys unless @fetched_all\n super\n end",
"def can_admin?(resource)\n scope_name = resource.class.to_s.downcase.pluralize\n self.send(\"adminable_#{scope_name}\").where(\"`permissions`.resource_type = ? AND `permissions`.resource_id = ?\", resource.class.to_s, resource.id).exists?\n end",
"def resource_params\n @resource_params ||= current_model_service.permit params\n end",
"def permitted?(resource, privilege, options = {})\n resource = cast(resource, :resourceid)\n # NOTE: in previous versions there was 'kind' passed separately. Now it is part of id\n self[\"?check&resource_id=#{query_escape resource}&privilege=#{query_escape privilege}\"].get(options)\n true\n rescue RestClient::ResourceNotFound\n false\n end",
"def __set_synchromesh_permission_granted(old_rel, new_rel, obj, acting_user, args = [], &block)\n saved_acting_user = obj.acting_user\n obj.acting_user = acting_user\n new_rel.__synchromesh_permission_granted =\n obj.instance_exec(*args, &block) || (old_rel && old_rel.try(:__synchromesh_permission_granted))\n new_rel\n ensure\n obj.acting_user = saved_acting_user\n end",
"def access(request, _unused_call)\n user_id = request.accessing_user_id\n owner_id = request.resource_owner_id\n mrids = request.medical_records.to_a\n\n record_ids = ResourceMapping.where(\n accessing_user_id: user_id,\n resource_owner_id: owner_id,\n status: to_enum(:GRANTED)).pluck(:medical_record_ids)\n\n if record_ids.include?(mrids)\n access_response(:GRANTED, I18n.t('resources.access_already_granted'))\n else\n Event.notify(owner_id, user_id, mrids)\n create_mapping(user_id, owner_id, mrids, :AWAITING_RESPONSE)\n access_response(:AWAITING_RESPONSE, I18n.t('resources.request_sent_to_user'))\n end\n rescue => ex\n # access_response()\n puts \"#{ex.message} - #{ex.backtrace}\"\n end",
"def authorization_required\n authorized? || authorization_denied\n end",
"def require_privilege(action, *type_and_perm_obj)\n perm_obj = nil\n type_and_perm_obj.each do |obj|\n perm_obj=obj if obj.is_a?(ActiveRecord::Base)\n end\n @perm_obj = perm_obj\n unless check_privilege(action, *type_and_perm_obj)\n raise PermissionError.new(\n \"You do not have permission to access this resource\")\n end\n end",
"def additional_advanced_permissions_included resource,scope\n if resource.respond_to?(:policy) && resource.policy && (resource.policy.sharing_scope == scope) && resource.has_advanced_permissions?\n \"<span class='additional_permissions'>there are also additional Advanced Permissions defined below</span>\"\n end\n end",
"def can_request_review\n if rule.locked\n errors.add(:base, 'Cannot request a review on a locked control')\n elsif !rule.review_requestor_id.nil?\n errors.add(:base, 'Control is already under review')\n end\n end",
"def authorize_warehouse_allocation\n authorize WarehouseAllocation\n end",
"def set_access_rights\n @access_rights = current_v1_user.rights.find_by(campground_id: params[:campground_id])\n end",
"def set_access_rights\n @access_rights = current_v1_user.rights.find_by(campground_id: params[:campground_id])\n end",
"def set_access_rights\n @access_rights = current_v1_user.rights.find_by(campground_id: params[:campground_id])\n end",
"def set_access_rights\n @access_rights = current_v1_user.rights.find_by(campground_id: params[:campground_id])\n end",
"def set_access_rights\n @access_rights = current_v1_user.rights.find_by(campground_id: params[:campground_id])\n end",
"def azure_rights_management_services_allowed=(value)\n @azure_rights_management_services_allowed = value\n end",
"def requires_client_authorization\n to_bool description['RequiresClientAuthorization']\n end",
"def enable_on_behalf_requestors_to_update_access=(value)\n @enable_on_behalf_requestors_to_update_access = value\n end",
"def admin_access_required\n access_denied unless admin?\n end",
"def admin_access_required\n access_denied unless admin?\n end",
"def admin_access_required\n access_denied unless admin?\n end",
"def can_approve\n perms = project_permissions\n if rule.review_requestor_id.nil?\n errors.add(:base, 'Control is not currently under review')\n elsif perms != 'admin' && perms != 'reviewer'\n errors.add(:base, 'Only admins and reviewers can approve')\n elsif perms == 'reviewer' && user.id == rule.review_requestor_id\n errors.add(:base, 'Reviewers cannot review their own review requests')\n end\n end",
"def include_resource_data=(value)\n @include_resource_data = value\n end",
"def access\n @user = User.find_by_user(params[:id])\n @datasetID, @fileID = params[:resource].split '/'\n\n is_restricted = AccessLevel.dataset_is_restricted(@datasetID)\n category = is_restricted ? :b : :a\n\n permissions = @user.permissions_for_dataset(category, @datasetID, @fileID)\n\n pv = permissions\n .reject { |e| e.permissionvalue == 0 }\n .inject(0) { |a, e| a == 0 ? e.permissionvalue : a * e.permissionvalue }\n\n # # General datasets have analyse and download permissions if browse access is granted\n # if !is_restricted\n # pv *= UserPermissionB::PERMISSION_VALUES[:analyse] * UserPermissionB::PERMISSION_VALUES[:download]\n # end\n\n # result = {:browse => pv > 0 && pv % UserPermissionB::PERMISSION_VALUES[:browse] == 0,\n # :analyse => pv > 0 && pv % UserPermissionB::PERMISSION_VALUES[:analyse] == 0,\n # :download => pv > 0 && pv % UserPermissionB::PERMISSION_VALUES[:download] == 0}\n\n if is_restricted\n result = {\n :browse => pv > 0 && pv % UserPermissionB::PERMISSION_VALUES[:browse] == 0,\n :analyse => pv > 0 && pv % UserPermissionB::PERMISSION_VALUES[:analyse] == 0,\n :download => pv > 0 && pv % UserPermissionB::PERMISSION_VALUES[:download] == 0 }\n else\n result = {\n :browse => true,\n :analyse => true,\n :download => pv > 0 }\n end\n\n render :json => result\n end",
"def can_write?(resource)\n scope_name = resource.class.to_s.downcase.pluralize\n self.send(\"writable_#{scope_name}\").where(\"`permissions`.resource_type = ? AND `permissions`.resource_id = ?\", resource.class.to_s, resource.id).exists?\n end",
"def resource_for(*paths)\n @authz_client.resource(*paths)\n end",
"def permission_required \n render_403 unless admin? || @item.is_editable_by?(current_user)\n end",
"def set_readonly_access(grant_access=true, manual_set=false)\n unless Rails.env.test? || self.queued_for_deletion || self.detached\n if manual_set || self.public_changed? || self.new_record?\n if self.firecloud_workspace.present? && self.firecloud_project.present? && ApplicationController.read_only_firecloud_client.present?\n access_level = self.public? ? 'READER' : 'NO ACCESS'\n if !grant_access # revoke all access\n access_level = 'NO ACCESS'\n end\n Rails.logger.info \"#{Time.zone.now}: setting readonly access on #{self.name} to #{access_level}\"\n readonly_acl = ApplicationController.firecloud_client.create_workspace_acl(ApplicationController.read_only_firecloud_client.issuer, access_level, false, false)\n ApplicationController.firecloud_client.update_workspace_acl(self.firecloud_project, self.firecloud_workspace, readonly_acl)\n end\n end\n end\n end",
"def set_permissions\n return if @permissions_set\n\n @permissions_set = true\n resource[:configure_permission] ||= configure_permission\n resource[:read_permission] ||= read_permission\n resource[:write_permission] ||= write_permission\n rabbitmqctl(\n 'set_permissions',\n '-p', should_vhost,\n should_user,\n resource[:configure_permission],\n resource[:write_permission],\n resource[:read_permission]\n )\n end",
"def set_permissions(*args)\n self.permissions = {}\n args.each do | permission |\n raise InvalidPermissionError.new(\"Permission #{permission} is invalid.\") unless ALLOWED_PERMISSIONS.include?(permission)\n self.permissions[permission] = true\n end\n end",
"def set_Resources(value)\n set_input(\"Resources\", value)\n end",
"def set_required_role\n @required_role = RequiredRole.find(params[:id])\n end",
"def can?(auth, resource_type = :general)\n has_access_to? :access, resource_type, auth\n end",
"def has_permission?(required_permission)\n return true if self.is_admin\n load_permissions unless self.loaded_permissions.present?\n\n if self.loaded_permissions.include?(required_permission.upcase)\n return true\n else\n return false\n end\n end",
"def enable_on_behalf_requestors_to_add_access=(value)\n @enable_on_behalf_requestors_to_add_access = value\n end",
"def permitted? privilege, role: nil\n url_for(:resources_check, credentials, id, privilege, role)\n true\n rescue RestClient::Forbidden\n false\n rescue RestClient::ResourceNotFound\n false\n end",
"def has_permission?\n return true if administrator?\n \n # Load the Model based on the controller name\n klass = self.controller_name.classify.constantize\n \n # Load the possible parent requested\n @parents = (klass.has_parent?) ? get_parents_from_request_params(klass, params) : nil\n \n # Load the resource requested\n if params[:id]\n if [\"index\", \"destroy\", \"update\"].include?(params[:action]) && klass.respond_to?(:in_set)\n @resource = klass.in_set(params[:id])\n @resource = @resource.first if @resource.size == 1\n else\n @resource = klass.find(params[:id])\n end\n end\n \n # Let's let the Model decide what is acceptable\n # NOTE: It is still the concrete controller's job to filter inaccessible resources (accessed via the index)!\n # This presumably happens in the with_parent named scope\n \n authorized = case params[:action]\n when \"edit\", \"update\"\n if [email protected]_a?(Array)\n return @resource.updatable_by?(current_user, @parents) # this is 'returned' to authorized\n end\n \n verify_set_accessablility(@resource, :updatable_by?) do |unauthorized_ids|\n permission_denied(\n :status => :conflict,\n :message => \"#{unauthorized_ids.to_a.join(',')} is not available for update.\"\n ) if unauthorized_ids.size > 0\n end\n true # if it gets past verification, authorized is true\n \n when \"destroy\" \n if [email protected]_a?(Array)\n return @resource.deletable_by?(current_user, @parents)\n end\n \n verify_set_accessablility(@resource, :deletable_by?) do |unauthorized_ids|\n permission_denied(\n :status => :conflict,\n :message => \"#{unauthorized_ids.to_a.join(',')} is not available for deletion.\"\n ) if unauthorized_ids.size > 0\n end\n true # if it gets past verification, authorized is true\n \n when \"index\" then klass.indexable_by?(current_user, @parents)\n when \"new\", \"create\" then klass.creatable_by?(current_user, @parents)\n when \"show\" then @resource.readable_by?(current_user, @parents)\n else check_non_restful_route(current_user, klass, @resource, @parents)\n end\n \n permission_denied unless authorized\n \n #rescue NoMethodError => e\n # Misconfiguration: A RESTful_ACL specific method is missing.\n #raise_error(klass, e)\n #rescue\n # Failsafe: If any funny business is going on, log and redirect\n #routing_error\n #end\n end",
"def assign_required_steps\n self.steps = resource.required_steps\n end",
"def resource_params\n @resource_params ||= build_resource_params\n end"
] | [
"0.6596939",
"0.6596939",
"0.6355991",
"0.5554773",
"0.5357362",
"0.5313956",
"0.52175397",
"0.52175397",
"0.51960015",
"0.51475227",
"0.51391524",
"0.511961",
"0.5076016",
"0.5035926",
"0.5021054",
"0.49745542",
"0.4968509",
"0.49488378",
"0.49470198",
"0.49083832",
"0.49060768",
"0.49025732",
"0.48931178",
"0.488538",
"0.48807937",
"0.48807937",
"0.48692688",
"0.48437074",
"0.48437074",
"0.4817531",
"0.48150837",
"0.48084995",
"0.48024994",
"0.4793862",
"0.47885823",
"0.47778106",
"0.4772041",
"0.4761445",
"0.47469983",
"0.47385934",
"0.46898648",
"0.46785527",
"0.46726203",
"0.46661368",
"0.46638787",
"0.4659971",
"0.46593794",
"0.4645394",
"0.46452186",
"0.46452186",
"0.46452186",
"0.46450356",
"0.46439886",
"0.46401235",
"0.4635152",
"0.46343774",
"0.4633996",
"0.4623212",
"0.4619525",
"0.46164265",
"0.46152738",
"0.46088636",
"0.46087852",
"0.46041992",
"0.45967415",
"0.45932692",
"0.45896605",
"0.45775503",
"0.45745087",
"0.45731172",
"0.45571607",
"0.4551781",
"0.4551781",
"0.4551781",
"0.4551781",
"0.4551781",
"0.45357943",
"0.4534869",
"0.45259124",
"0.4522988",
"0.4522988",
"0.4522988",
"0.45157272",
"0.45149106",
"0.45069405",
"0.4501454",
"0.4496919",
"0.44965938",
"0.4495572",
"0.44954154",
"0.4493704",
"0.4493201",
"0.4491207",
"0.44895115",
"0.44874483",
"0.4476692",
"0.4476217",
"0.44654304",
"0.44644365",
"0.44629014"
] | 0.8004473 | 0 |
Gets the samlMetadataUrl property value. The URL where the service exposes SAML metadata for federation. This property is valid only for singletenant applications. Nullable. | def saml_metadata_url
return @saml_metadata_url
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def saml_metadata_url=(value)\n @saml_metadata_url = value\n end",
"def saml_provider_metadata_url\n @attributes[:saml_provider_metadata_url]\n end",
"def saml_provider_sso_target_url\n @attributes[:saml_provider_sso_target_url]\n end",
"def saml_provider_slo_target_url\n @attributes[:saml_provider_slo_target_url]\n end",
"def saml_provider_metadata_content\n @attributes[:saml_provider_metadata_content]\n end",
"def saml_provider_issuer_url\n @attributes[:saml_provider_issuer_url]\n end",
"def metadata_url\n \"#{service_url}/$metadata\"\n end",
"def metadata_url\n \"#{service_url}/$metadata\"\n end",
"def application_destination_url\n @application_destination_url = expected_saml_node_content( @saml_doc, '/samlp:Response/saml:Assertion/saml:AttributeStatement/saml:Attribute[@Name = \"targetUrl\"]/saml:AttributeValue' )\n rescue Intuit::MissingExpectedSamlNode\n raise NoDestinationURL.new\n return @application_destination_url\n end",
"def preview_saml_metadata_for_application(app_id, options = {})\n get(\"/apps/#{app_id}/sso/saml/metadata\", options)\n end",
"def namespace\n \"saml\"\n end",
"def ssoe_slo_url\n Settings.saml_ssoe.logout_url\n end",
"def metadata_url(rft_id)\n metadata(rft_id).url\n end",
"def service_management_url\n return @service_management_url\n end",
"def daurl\n\t\treturn get_configuration['sa_application_url']\n end",
"def host_meta_url\n host_meta_uri.to_s\n end",
"def store_location\n session[:saml_url] = request.original_url\n end",
"def privacy_statement_url\n return @children['privacy-statement-url'][:value]\n end",
"def privacy_information_url\n return @privacy_information_url\n end",
"def privacy_information_url\n return @privacy_information_url\n end",
"def server_management_url\n self.auth_response[:server_management_url]\n end",
"def saml_provider_cert_fingerprint\n @attributes[:saml_provider_cert_fingerprint]\n end",
"def url_attribute\n @url\n end",
"def url\n @attributes.fetch('url', nil)\n end",
"def canonical_url\n response[\"canonicalUrl\"]\n end",
"def url\n @valueset_model.url\n end",
"def redirect_url\n @data[:redirect_url]\n end",
"def redirect_url\n @data[:redirect_url]\n end",
"def lifecycle_notification_url\n return @lifecycle_notification_url\n end",
"def get_idp_metadata\n\t\t\n\t\t\treturn false if @settings.idp_metadata.nil?\n\t\t\n\t\t\t# Look up the metdata in cache first\n\t\t\tid = Digest::MD5.hexdigest(@settings.idp_metadata)\n\t\t\tlookup = @cache.read(id)\n\t\t\tif lookup != nil\n\t\t\t\tLogging.debug \"IdP metadata cached lookup for #{@settings.idp_metadata}\"\n\t\t\t\tdoc = REXML::Document.new( lookup )\n\t\t\t\textract_certificate( doc )\n\t\t\t\treturn doc\n\t\t\tend\n\t\t\t\n\t\t\tLogging.debug \"IdP metadata cache miss on #{@settings.idp_metadata}\"\n\t\t\t# cache miss\n\t\t\tif File.exists?(@settings.idp_metadata)\n\t\t\t\tfp = File.open( @settings.idp_metadata, \"r\")\n\t\t\t\tmeta_text = fp.read\n\t\t\telse\n\t\t\t\turi = URI.parse(@settings.idp_metadata)\n\t\t\t\tif uri.scheme == \"http\"\n\t\t\t\t\tresponse = Net::HTTP.get_response(uri)\n\t\t\t\t\tmeta_text = response.body\n\t\t\t\telsif uri.scheme == \"https\"\n\t\t\t\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\t\t\thttp.use_ssl = true\n\t\t\t\t\t# Most IdPs will probably use self signed certs\n\t\t\t\t\t#http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n\t\t\t\t\thttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\t\t\t\t\tget = Net::HTTP::Get.new(uri.request_uri)\n\t\t\t\t\tresponse = http.request(get)\n\t\t\t\t\tmeta_text = response.body\n\t\t\t\tend\n\t\t\tend\n\t\t\t# Add it to the cache\n\t\t\[email protected](id, meta_text, @settings.idp_metadata_ttl )\n\t\t\tdoc = REXML::Document.new( meta_text )\n\t\t\textract_certificate(doc)\n\t\t\treturn doc\n\t\tend",
"def metadata_graph_uri(slug)\n \"#{data_graph_uri(slug)}/metadata\"\n end",
"def application_url\n raise Exception.new('You need to load the configuration before using it.') if @config.nil?\n\n return @config[APPLICATION_URL_KEY]\n end",
"def url\n get_attribute(Yoti::Attribute::APPLICATION_URL)\n end",
"def app_url\n return @app_url\n end",
"def service_management_url=(value)\n @service_management_url = value\n end",
"def redirect_uri_settings\n return @redirect_uri_settings\n end",
"def public_url\n @attributes[:public_url]\n end",
"def url\n @manifest_options[:url] || \"\"\n end",
"def metadata=(value)\n @metadata = value\n end",
"def metadata=(value)\n @metadata = value\n end",
"def saml\n RubyAem::Resources::Saml.new(@client)\n end",
"def metadata\n configuration.metadata\n end",
"def url\n @attributes[:url]\n end",
"def url\n @attributes[:url]\n end",
"def metadata\n @data[:metadata]\n end",
"def iss_url\n session[:iss_url]\n end",
"def metadata\n return @metadata\n end",
"def metadata\n return @metadata\n end",
"def sld\n self.domain.sld\n end",
"def store_saml_request_in_session\n session[:saml_request_url] = request.original_url\n end",
"def store_saml_request_in_session\n session[:saml_request_url] = request.original_url\n end",
"def metadata\n @metadata\n end",
"def metadata\n @meta_data\n end",
"def metadata_options\n data[:metadata_options]\n end",
"def access_token_url\n Settings.lighthouse_health_immunization.access_token_url\n end",
"def store_saml_request_attributes_in_session\n add_sp_metadata_to_session\n session[:saml_request_url] = request.original_url\n end",
"def metadata\n return @metadata unless @metadata.nil?\n @metadata = fetch_metadata\n configure_with_metadata(@metadata)\n @metadata\n end",
"def content_url\n return @content_url\n end",
"def content_url\n return @content_url\n end",
"def metadata\n stream.metadata\n end",
"def metadata\n stream.metadata\n end",
"def notification_url\n return @notification_url\n end",
"def notification_url_app_id\n return @notification_url_app_id\n end",
"def sections_url\n return @sections_url\n end",
"def documentation_url\n @error['documentation_url']\n end",
"def openid_config_url\n \"https://login.windows.net/#{tenant}/.well-known/openid-configuration\"\n end",
"def information_url\n return @information_url\n end",
"def information_url\n return @information_url\n end",
"def url\n # URL(@list.url).join(attributes[\"ServerUrl\"]).to_s\n attributes[\"ServerUrl\"]\n end",
"def redirect_uri\n @redirect_uri\n end",
"def metadata\n DatasetService.get_metadata dataset_id\n end",
"def acl_feed_url\n return self.document_feed_url + \"/acl\"\n end",
"def privacy_information_url=(value)\n @privacy_information_url = value\n end",
"def privacy_information_url=(value)\n @privacy_information_url = value\n end",
"def endpoint_url\n protocol = @secure ? 'https' : 'http'\n endpoint_host = SmsNotify::Api.endpoint_host\n \"#{protocol}://#{endpoint_host}/\"\n end",
"def getserverurl\r\n return getvalue(@@SERVER_URL)\r\n end",
"def pages_url\n return @pages_url\n end",
"def server_certificate_metadata\n data.server_certificate_metadata\n end",
"def url_value\n xml_value\n end",
"def stream_uri\n @stream_uri\n end",
"def landing_page_url\n svc = minter\n return nil unless svc.present?\n\n svc.respond_to?(:landing_page_url) ? svc.landing_page_url : nil\n end",
"def documentation_url\n data[:documentation_url] if data.is_a? Hash\n end",
"def sid\n @previous_resolver.sid\n end",
"def snapshot_metadata_url\n \"#{artifact_directory_url}/maven-metadata.xml\"\n end",
"def is_share_point_newsfeed_enabled\n return @is_share_point_newsfeed_enabled\n end",
"def landing_page_url\n svc = minter\n return nil if svc.blank?\n\n svc.respond_to?(:landing_page_url) ? svc.landing_page_url : nil\n end",
"def root_url\n @response.env[:url].to_s if @response\n end",
"def sso_url(sso)\n sso.to_url\n end",
"def canonical_url\n page_url || image_url\n end",
"def lifecycle_notification_url=(value)\n @lifecycle_notification_url = value\n end",
"def get_idp_metadata\n return false if @settings.idp_metadata.nil?\n \n # Look up the metdata in cache first\n id = Digest::MD5.hexdigest(@settings.idp_metadata)\n\n uri = URI.parse(@settings.idp_metadata)\n if uri.scheme == \"http\"\n response = Net::HTTP.get_response(uri)\n meta_text = response.body\n elsif uri.scheme == \"https\"\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n # Most IdPs will probably use self signed certs\n #http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n get = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(get)\n meta_text = response.body\n end\n testo_response = meta_text.sub!(' xmlns:xml=\"http://www.w3.org/XML/1998/namespace\"', '')\n doc = REXML::Document.new(testo_response)\n extract_certificate(doc)\n return doc\n\n # USE OF CACHE WITH CERTIFICATE\n # lookup = @cache.read(id)\n # if lookup != nil\n # Logging.debug \"IdP metadata cached lookup for #{@settings.idp_metadata}\"\n # doc = REXML::Document.new( lookup )\n # extract_certificate( doc )\n # return doc\n # end\n \n # Logging.debug \"IdP metadata cache miss on #{@settings.idp_metadata}\"\n # # cache miss\n # if File.exists?(@settings.idp_metadata)\n # fp = File.open( @settings.idp_metadata, \"r\")\n # meta_text = fp.read\n # else\n # uri = URI.parse(@settings.idp_metadata)\n # if uri.scheme == \"http\"\n # response = Net::HTTP.get_response(uri)\n # meta_text = response.body\n # elsif uri.scheme == \"https\"\n # http = Net::HTTP.new(uri.host, uri.port)\n # http.use_ssl = true\n # # Most IdPs will probably use self signed certs\n # #http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n # http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n # get = Net::HTTP::Get.new(uri.request_uri)\n # response = http.request(get)\n # meta_text = response.body\n # end\n # end\n # # Add it to the cache\n # @cache.write(id, meta_text, @settings.idp_metadata_ttl )\n # doc = REXML::Document.new( meta_text )\n # extract_certificate(doc)\n # return doc\n end",
"def url\n @url.to_s\n end",
"def server_url\n url\n end",
"def getMetadata\n\n\t\tString sXML = '<metadata xsi:type=\"ns2:CustomField\" xmlns:ns2=\"http://soap.sforce.com/2006/04/metadata\">'\n\t\t@@attributes.each do |attr|\n\n\t\t\tvalue = send attr\n\t\t\tif(value != nil)\n\t\t\t\tsXML+='<'+attr.to_s+'>'+value+'</'+attr.to_s+'>'\n\t\t\tend\n\t\tend\n\t\tsXML+='</metadata>'\n\t\t\n\t\treturn sXML\n\tend",
"def url\n page&.url_path || read_attribute(:url).presence\n end",
"def signing_keys_url\n return openid_config['jwks_uri'] if openid_config.include? 'jwks_uri'\n fail StandardError, 'No jwks_uri in OpenId config response.'\n end",
"def sso_url(params={})\n auth_pds_login_url \"sso\", params\n end",
"def details_url\n raw_data[:DetailsUrl]\n end",
"def getURL\r\n\t\t\t\t\treturn @url\r\n\t\t\t\tend",
"def getURL\r\n\t\t\t\t\treturn @url\r\n\t\t\t\tend"
] | [
"0.78090054",
"0.76745623",
"0.6710798",
"0.6479363",
"0.59456694",
"0.5932607",
"0.57739663",
"0.57739663",
"0.55283344",
"0.5523419",
"0.53016025",
"0.51514137",
"0.50956404",
"0.5084086",
"0.4931067",
"0.49233738",
"0.48870504",
"0.48845437",
"0.47900614",
"0.47900614",
"0.47639644",
"0.47538358",
"0.47385463",
"0.46795693",
"0.46487877",
"0.46294427",
"0.46161324",
"0.46161324",
"0.46123877",
"0.45856956",
"0.45674136",
"0.45513466",
"0.4551202",
"0.45267257",
"0.45128793",
"0.44886664",
"0.44874516",
"0.44655794",
"0.44638035",
"0.44638035",
"0.44559",
"0.44462162",
"0.44452542",
"0.44452542",
"0.44269517",
"0.44237652",
"0.44053",
"0.44053",
"0.43867552",
"0.43777788",
"0.43777788",
"0.4373766",
"0.43618777",
"0.43506932",
"0.43485448",
"0.43449956",
"0.43444934",
"0.43408737",
"0.43408737",
"0.43391672",
"0.43391672",
"0.43341526",
"0.43317375",
"0.43173698",
"0.43171012",
"0.43170515",
"0.43042943",
"0.43042943",
"0.42986313",
"0.4295703",
"0.4293038",
"0.4286727",
"0.42803833",
"0.42803833",
"0.42748022",
"0.42738724",
"0.4271064",
"0.42599252",
"0.4256943",
"0.42553228",
"0.4254282",
"0.42526382",
"0.42516425",
"0.42492568",
"0.42355353",
"0.422789",
"0.42229554",
"0.42207575",
"0.42137265",
"0.42117783",
"0.42109945",
"0.42043698",
"0.41947117",
"0.41888028",
"0.41877934",
"0.41843757",
"0.41830704",
"0.4179476",
"0.41708848",
"0.41708848"
] | 0.84347904 | 0 |
Sets the samlMetadataUrl property value. The URL where the service exposes SAML metadata for federation. This property is valid only for singletenant applications. Nullable. | def saml_metadata_url=(value)
@saml_metadata_url = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def saml_metadata_url\n return @saml_metadata_url\n end",
"def saml_provider_metadata_url\n @attributes[:saml_provider_metadata_url]\n end",
"def saml_provider_sso_target_url\n @attributes[:saml_provider_sso_target_url]\n end",
"def saml_provider_slo_target_url\n @attributes[:saml_provider_slo_target_url]\n end",
"def metadata=(value)\n @metadata = value\n end",
"def metadata=(value)\n @metadata = value\n end",
"def preview_saml_metadata_for_application(app_id, options = {})\n get(\"/apps/#{app_id}/sso/saml/metadata\", options)\n end",
"def metadata_url\n \"#{service_url}/$metadata\"\n end",
"def metadata_url\n \"#{service_url}/$metadata\"\n end",
"def metadata=(metadata)\n @metadata = metadata\n end",
"def metadata=(metadata)\n @metadata = metadata\n end",
"def metadata=(metadata)\n @metadata = metadata\n end",
"def metadata=(metadata)\n @metadata = metadata\n end",
"def service_management_url=(value)\n @service_management_url = value\n end",
"def saml_provider_issuer_url\n @attributes[:saml_provider_issuer_url]\n end",
"def initialize(request, config, metadata)\n @sp_metadata = (eval \"Rack::Saml::#{config['assertion_handler'].to_s.capitalize}Metadata\").new(request, config, metadata)\n end",
"def management_server_url=(management_server_url)\n\n if !management_server_url.nil? && management_server_url.to_s.length > 200\n fail ArgumentError, \"invalid value for 'management_server_url', the character length must be smaller than or equal to 200.\"\n end\n\n @management_server_url = management_server_url\n end",
"def access_token_url=(access_token_url)\n if access_token_url.nil?\n fail ArgumentError, 'invalid value for \"access_token_url\", access_token_url cannot be nil.'\n end\n @access_token_url = access_token_url\n end",
"def store_location\n session[:saml_url] = request.original_url\n end",
"def store_saml_request_attributes_in_session\n add_sp_metadata_to_session\n session[:saml_request_url] = request.original_url\n end",
"def xmlUrl=(url)\n @xmlUrl = url\n end",
"def saml_provider_metadata_content\n @attributes[:saml_provider_metadata_content]\n end",
"def application_destination_url\n @application_destination_url = expected_saml_node_content( @saml_doc, '/samlp:Response/saml:Assertion/saml:AttributeStatement/saml:Attribute[@Name = \"targetUrl\"]/saml:AttributeValue' )\n rescue Intuit::MissingExpectedSamlNode\n raise NoDestinationURL.new\n return @application_destination_url\n end",
"def privacy_information_url=(value)\n @privacy_information_url = value\n end",
"def privacy_information_url=(value)\n @privacy_information_url = value\n end",
"def url=(url)\n\n if !url.nil? && url.to_s.length > 500\n fail ArgumentError, \"invalid value for 'url', the character length must be smaller than or equal to 500.\"\n end\n\n @url = url\n end",
"def user_metadata=(new_metadata)\n raise ArgumentError.new(\"Cannot set user metadata to nil\") unless new_metadata\n self.service.setUserMetadata([new_metadata])\n self.refresh_details()\n end",
"def redirect_uri_settings=(value)\n @redirect_uri_settings = value\n end",
"def user_metadata=(new_metadata)\n raise ArgumentError, \"Cannot set user metadata to nil\" unless new_metadata\n self.service.setUserMetadata([new_metadata])\n self.refresh_details()\n end",
"def spoonacular_source_url=(spoonacular_source_url)\n if spoonacular_source_url.nil?\n fail ArgumentError, 'spoonacular_source_url cannot be nil'\n end\n\n if spoonacular_source_url.to_s.length < 1\n fail ArgumentError, 'invalid value for \"spoonacular_source_url\", the character length must be great than or equal to 1.'\n end\n\n @spoonacular_source_url = spoonacular_source_url\n end",
"def url=(new_url)\n @url = sanitize_url(new_url)\n end",
"def namespace\n \"saml\"\n end",
"def store_saml_request_in_session\n session[:saml_request_url] = request.original_url\n end",
"def store_saml_request_in_session\n session[:saml_request_url] = request.original_url\n end",
"def setTaskURL(taskUrl)\r\n\t\t\t\t\t@taskUrl = taskUrl\r\n\t\t\t\tend",
"def url=(url)\n @@url = url\n end",
"def setserverurl(value)\r\n setvalue(@@SERVER_URL, value)\r\n end",
"def metadata=(metadata_hash)\n\t\tif metadata_hash.nil? or metadata_hash.is_a? Hash\n\t\t\t@metadata = metadata_hash\n\t\telse\n\t\t\traise TypeError, 'A hash is required'\n\t\tend\n\tend",
"def saml\n RubyAem::Resources::Saml.new(@client)\n end",
"def app_url=(value)\n @app_url = value\n end",
"def url=(url)\n if url.nil?\n fail ArgumentError, 'url cannot be nil'\n end\n\n if url.to_s.length > 2083\n fail ArgumentError, 'invalid value for \"url\", the character length must be smaller than or equal to 2083.'\n end\n\n if url.to_s.length < 1\n fail ArgumentError, 'invalid value for \"url\", the character length must be great than or equal to 1.'\n end\n\n @url = url\n end",
"def lifecycle_notification_url=(value)\n @lifecycle_notification_url = value\n end",
"def redirectUris=(uris)\n self.redirect_url = uris.first\n end",
"def setURL(url)\r\n\t\t\t\t\t@url = url\r\n\t\t\t\tend",
"def setURL(url)\r\n\t\t\t\t\t@url = url\r\n\t\t\t\tend",
"def setURL(url)\r\n\t\t\t\t\t@url = url\r\n\t\t\t\tend",
"def setURL(url)\r\n\t\t\t\t\t@url = url\r\n\t\t\t\tend",
"def setURL(url)\r\n\t\t\t\t\t@url = url\r\n\t\t\t\tend",
"def set_container_metadata(name, metadata, options={})\n query = { 'comp' => 'metadata'}\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n\n headers = service_properties_headers\n add_metadata_to_headers(metadata, headers) if metadata\n\n call(:put, container_uri(name, query), nil, headers)\n nil\n end",
"def doc_url=(value)\n @children['doc-url'][:value] = value\n end",
"def set_url\n @url = DEFAULT_URL\n end",
"def url=(value)\n @url = value\n Curl.set_option(:url, value_for(value, :string), handle)\n end",
"def feed_url=(url)\n self.feed_updated_at = nil unless url == feed_url \n super(url)\n end",
"def url=(url)\n @@url = url\n end",
"def set_vm_metadata(vm_id, metadata)\n @logger.info('Setting virtual machine metadata...')\n end",
"def eventstore_url=(value)\n @eventstore_url =\n if value.is_a?(Connection::Url)\n value\n else\n Connection::UrlParser.new.call(value)\n end\n end",
"def set_metadata(*args)\n self.metadata.set(*args)\n end",
"def url=(url)\n if url =~ /^http(s?)\\:\\/\\//i\n @url = url\n write_settings\n else\n $stderr.puts \"Please include a leading http://\"\n end\n end",
"def create_saml_configuration!(params)\n HyperResource::Link.new(\n self,\n 'href' => \"#{href}/saml_configurations\"\n ).post(self.class.normalize_params(params))\n end",
"def is_share_point_newsfeed_enabled=(value)\n @is_share_point_newsfeed_enabled = value\n end",
"def spotify_playlist_url=(url)\n if url.present?\n url = url[\"spotify:\"] ? url[url.rindex(\"spotify:\")..-1] : url #\n write_attribute(:spotify_playlist_url, url)\n end\n end",
"def ssoe_slo_url\n Settings.saml_ssoe.logout_url\n end",
"def setHeaderUrl(url)\n unless /(?i)^https?:\\/\\/.*$/.match(url)\n raise Error.new(Pdfcrowd.create_invalid_value_message(url, \"setHeaderUrl\", \"html-to-pdf\", \"The supported protocols are http:// and https://.\", \"set_header_url\"), 470);\n end\n \n @fields['header_url'] = url\n self\n end",
"def url_is(url = nil)\n url_is_empty if url.nil? && url_attribute.nil?\n url_is_empty if url.nil? || url.empty?\n @url = url\n end",
"def set_container_metadata(name, metadata, options={})\n # Query\n query = { 'comp' => 'metadata' }\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n\n # Headers\n headers = StorageService.common_headers\n StorageService.add_metadata_to_headers(metadata, headers) if metadata\n\n # Call\n call(:put, container_uri(name, query), nil, headers, options)\n \n # Result\n nil\n end",
"def pages_url=(value)\n @pages_url = value\n end",
"def set_url\n url 'set'\n end",
"def put_vapp_metadata_item_metadata(vm_id, metadata_key, metadata_value)\n body=\"\n <MetadataValue xmlns=\\\"http://www.vmware.com/vcloud/v1.5\\\">\n <Value>#{metadata_value}</Value>\n </MetadataValue>\"\n\n request(\n :body => body,\n :expects => 202,\n :headers => {'Content-Type' => \"application/vnd.vmware.vcloud.metadata.value+xml\"},\n :method => 'PUT',\n :parser => Fog::ToHashDocument.new,\n :path => \"vApp/#{vm_id}/metadata/#{URI.escape(metadata_key)}\"\n )\n end",
"def url=(v)\n @url = v ? URI.parse(v) : nil\n end",
"def url=(url)\n uri = URI.parse(url)\n @scheme = uri.scheme\n @app_id = uri.path.split('/').last\n @key = uri.user\n @secret = uri.password\n @host = uri.host\n @port = uri.port\n end",
"def publisher_url=(v)\n @publisher_url = v ? URI.parse(v) : nil\n end",
"def content_url=(value)\n @content_url = value\n end",
"def content_url=(value)\n @content_url = value\n end",
"def site_url=(site_url)\n if site_url.nil?\n fail ArgumentError, \"site_url cannot be nil\"\n end\n\n if site_url.to_s.length > 100\n fail ArgumentError, \"invalid value for 'site_url', the character length must be smaller than or equal to 100.\"\n end\n\n @site_url = site_url\n end",
"def store_metadata\n html = HTMLParse.new(url)\n self.meta_title = html.title\n self.meta_desc = html.desc\n end",
"def sections_url=(value)\n @sections_url = value\n end",
"def url(url)\n @url = url\n end",
"def allow_partner_to_collect_i_o_s_personal_application_metadata=(value)\n @allow_partner_to_collect_i_o_s_personal_application_metadata = value\n end",
"def set(key, value)\n filename = filename_from_url(key)\n mkpath(filename)\n\n # Save metadata in a parallel file\n if value.respond_to?(:meta)\n filename_meta = \"#{filename}.meta\"\n meta = value.meta\n meta[:status] = value.status if value.respond_to?(:status)\n meta[:content_type] = value.content_type if value.respond_to?(:content_type)\n meta[:base_uri] = value.base_uri if value.respond_to?(:base_uri)\n File.open(filename_meta, 'wb') {|f| YAML::dump(meta, f)}\n end\n\n # Save file contents\n File.open(filename, 'wb'){|f| f.write value.read }\n value.rewind\n value\n end",
"def set_cms_social_link\n @cms_social_link = CmsSocialLink.find(params[:id])\n end",
"def statement_url=(value)\n @statement_url = value\n end",
"def set_url_host_model\n if @url.present?\n @url.url_host = @url_host\n end\n end",
"def set(key, value)\n @metadata[key] = value\n end",
"def notification_url=(value)\n @notification_url = value\n end",
"def tweak_session_attrs\n tweak_session_attrs_saml\n end",
"def update!(**args)\n @inbound_saml_configs = args[:inbound_saml_configs] if args.key?(:inbound_saml_configs)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end",
"def federation_configurations=(value)\n @federation_configurations = value\n end",
"def set_redirect_location\n @redirect_location = @shareable\n end",
"def set_feed_url\n @feed_url = FeedUrl.find(params[:id])\n end",
"def store_saml_request_in_session\n session[:SAMLRequest] = request.original_url\n end",
"def []=(key, value)\n @metadata[key.to_s] = value\n end",
"def []=(key, value)\n @metadata[key.to_s] = value\n end",
"def url=(url)\n if not (self.type == :link || self.type == :image)\n raise NodeError, \"can't set URL for non-link or image\"\n end\n if !url.kind_of?(String)\n raise NodeError, \"url must be a String\"\n end\n # Make our own copy so ruby won't garbage-collect it:\n c_url = FFI::MemoryPointer.from_string(url)\n res = CMark.node_set_url(@pointer, c_url)\n if res == 0 then raise NodeError, \"could not set header level\" end\n end",
"def tweak_session_attrs_saml\n return unless valid_saml_session?\n saml_profile_attr_map.each do |d, s|\n tweak_session_attr_saml(d, s)\n end\n end",
"def url\n @valueset_model.url\n end",
"def add_feed_url\n return false if parse_feed_url.nil?\n update_attribute(:feed_url, parse_feed_url)\n end",
"def set_URL(value)\n set_input(\"URL\", value)\n end",
"def allow_partner_to_collect_i_o_s_application_metadata=(value)\n @allow_partner_to_collect_i_o_s_application_metadata = value\n end",
"def url\n @manifest_options[:url] || \"\"\n end",
"def metadata_url(rft_id)\n metadata(rft_id).url\n end"
] | [
"0.68723184",
"0.6211676",
"0.54967153",
"0.53565323",
"0.514694",
"0.514694",
"0.5007568",
"0.48922774",
"0.48922774",
"0.48286548",
"0.48286548",
"0.48286548",
"0.48286548",
"0.47466567",
"0.4605662",
"0.45475265",
"0.45199558",
"0.44898373",
"0.44772848",
"0.44593483",
"0.44483736",
"0.4382791",
"0.43743488",
"0.433578",
"0.433578",
"0.43258584",
"0.4325043",
"0.43229187",
"0.43178824",
"0.43153825",
"0.43119112",
"0.43033218",
"0.42533022",
"0.42533022",
"0.42500824",
"0.4236583",
"0.42320317",
"0.42185068",
"0.42138943",
"0.41960055",
"0.4194333",
"0.41653407",
"0.41568923",
"0.4147374",
"0.4147374",
"0.4147374",
"0.4147374",
"0.4147374",
"0.4145889",
"0.41319352",
"0.41185194",
"0.41108602",
"0.40918812",
"0.40869015",
"0.4085861",
"0.40858003",
"0.40806246",
"0.40586376",
"0.40547052",
"0.40284958",
"0.40191826",
"0.40164992",
"0.40091372",
"0.40087992",
"0.40085497",
"0.3998916",
"0.39850768",
"0.39804828",
"0.39786443",
"0.39680254",
"0.39623138",
"0.3957768",
"0.3957768",
"0.39549592",
"0.39469752",
"0.39459112",
"0.39436054",
"0.39399922",
"0.39150387",
"0.3910025",
"0.38996217",
"0.3895113",
"0.38886356",
"0.38854682",
"0.3880522",
"0.38659126",
"0.38513693",
"0.38505965",
"0.38437414",
"0.38271978",
"0.3821435",
"0.3821435",
"0.38192818",
"0.38182572",
"0.38142735",
"0.38102108",
"0.37969366",
"0.3772147",
"0.37681553",
"0.37648684"
] | 0.8115865 | 0 |
Serializes information the current object | def serialize(writer)
raise StandardError, 'writer cannot be null' if writer.nil?
super
writer.write_collection_of_object_values("addIns", @add_ins)
writer.write_object_value("api", @api)
writer.write_string_value("appId", @app_id)
writer.write_collection_of_object_values("appManagementPolicies", @app_management_policies)
writer.write_collection_of_object_values("appRoles", @app_roles)
writer.write_string_value("applicationTemplateId", @application_template_id)
writer.write_object_value("certification", @certification)
writer.write_date_time_value("createdDateTime", @created_date_time)
writer.write_object_value("createdOnBehalfOf", @created_on_behalf_of)
writer.write_string_value("defaultRedirectUri", @default_redirect_uri)
writer.write_string_value("description", @description)
writer.write_string_value("disabledByMicrosoftStatus", @disabled_by_microsoft_status)
writer.write_string_value("displayName", @display_name)
writer.write_collection_of_object_values("extensionProperties", @extension_properties)
writer.write_collection_of_object_values("federatedIdentityCredentials", @federated_identity_credentials)
writer.write_string_value("groupMembershipClaims", @group_membership_claims)
writer.write_collection_of_object_values("homeRealmDiscoveryPolicies", @home_realm_discovery_policies)
writer.write_collection_of_primitive_values("identifierUris", @identifier_uris)
writer.write_object_value("info", @info)
writer.write_boolean_value("isDeviceOnlyAuthSupported", @is_device_only_auth_supported)
writer.write_boolean_value("isFallbackPublicClient", @is_fallback_public_client)
writer.write_collection_of_object_values("keyCredentials", @key_credentials)
writer.write_object_value("logo", @logo)
writer.write_string_value("notes", @notes)
writer.write_boolean_value("oauth2RequirePostResponse", @oauth2_require_post_response)
writer.write_object_value("optionalClaims", @optional_claims)
writer.write_collection_of_object_values("owners", @owners)
writer.write_object_value("parentalControlSettings", @parental_control_settings)
writer.write_collection_of_object_values("passwordCredentials", @password_credentials)
writer.write_object_value("publicClient", @public_client)
writer.write_string_value("publisherDomain", @publisher_domain)
writer.write_object_value("requestSignatureVerification", @request_signature_verification)
writer.write_collection_of_object_values("requiredResourceAccess", @required_resource_access)
writer.write_string_value("samlMetadataUrl", @saml_metadata_url)
writer.write_string_value("serviceManagementReference", @service_management_reference)
writer.write_string_value("signInAudience", @sign_in_audience)
writer.write_object_value("spa", @spa)
writer.write_object_value("synchronization", @synchronization)
writer.write_collection_of_primitive_values("tags", @tags)
writer.write_guid_value("tokenEncryptionKeyId", @token_encryption_key_id)
writer.write_collection_of_object_values("tokenIssuancePolicies", @token_issuance_policies)
writer.write_collection_of_object_values("tokenLifetimePolicies", @token_lifetime_policies)
writer.write_object_value("verifiedPublisher", @verified_publisher)
writer.write_object_value("web", @web)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize\n end",
"def serialize(object) end",
"def serialize; end",
"def serialize; end",
"def serialize\n \n end",
"def serialize\n raise NotImplementedError\n end",
"def serialize\n raise NotImplementedError\n end",
"def dump\r\n super + to_s\r\n end",
"def serialize\n self.to_hash.to_json\n end",
"def serialized\n serializer_class.new(self).serializable_hash\n end",
"def serialize\n @raw_data\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"details\", @details)\n writer.write_string_value(\"identityType\", @identity_type)\n end",
"def serialize\n @serializer.serialize(self.output)\n end",
"def serialize(_object, data); end",
"def serialize(_object, data); end",
"def to_json\n\t\t\tself.instance_variable_hash\n\t\tend",
"def serializer; end",
"def serialize!\n end",
"def serialize(object)\n object.serializable_hash\n end",
"def serialize(object)\n object.to_s\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_object_value(\"device\", @device)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_enum_value(\"keyStrength\", @key_strength)\n end",
"def marshal\n Marshal.dump self\n end",
"def marshal\n Marshal.dump self\n end",
"def marshal\n Marshal.dump self\n end",
"def inspect\n serialize.to_s\n end",
"def serialize\n YAML::dump(self)\n end",
"def inspect()\n serialize.to_s()\n end",
"def inspect()\n serialize.to_s()\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"accessPackage\", @access_package)\n writer.write_collection_of_object_values(\"answers\", @answers)\n writer.write_object_value(\"assignment\", @assignment)\n writer.write_date_time_value(\"completedDateTime\", @completed_date_time)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_collection_of_object_values(\"customExtensionCalloutInstances\", @custom_extension_callout_instances)\n writer.write_enum_value(\"requestType\", @request_type)\n writer.write_object_value(\"requestor\", @requestor)\n writer.write_object_value(\"schedule\", @schedule)\n writer.write_enum_value(\"state\", @state)\n writer.write_string_value(\"status\", @status)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"initiator\", @initiator)\n writer.write_collection_of_object_values(\"members\", @members)\n writer.write_date_time_value(\"visibleHistoryStartDateTime\", @visible_history_start_date_time)\n end",
"def inspect\n fields = serializable_hash.map { |k, v| \"#{k}=#{v}\" }\n \"#<#{self.class.name}:#{object_id} #{fields.join(' ')}>\"\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_primitive_values(\"aliases\", @aliases)\n writer.write_collection_of_object_values(\"countriesOrRegionsOfOrigin\", @countries_or_regions_of_origin)\n writer.write_object_value(\"description\", @description)\n writer.write_date_time_value(\"firstActiveDateTime\", @first_active_date_time)\n writer.write_collection_of_object_values(\"indicators\", @indicators)\n writer.write_enum_value(\"kind\", @kind)\n writer.write_object_value(\"summary\", @summary)\n writer.write_collection_of_primitive_values(\"targets\", @targets)\n writer.write_string_value(\"title\", @title)\n writer.write_object_value(\"tradecraft\", @tradecraft)\n end",
"def serialize(object, data); end",
"def serialize\n JSON.generate(to_h)\n end",
"def serialiaze\n Logger.d(\"Serializing the User object\")\n save_to_shared_prefs(@context, self.class, self)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_object_value(\"cost\", @cost)\n writer.write_object_value(\"life\", @life)\n writer.write_object_value(\"per\", @per)\n writer.write_object_value(\"salvage\", @salvage)\n writer.write_additional_data(@additional_data)\n end",
"def inspect\n id_string = (respond_to?(:id) && !id.nil?) ? \" id=#{id}\" : ''\n \"#<#{self.class}:0x#{object_id.to_s(16)}#{id_string}> JSON: \" +\n Clever::JSON.dump(@values, pretty: true)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"owner\", @owner)\n writer.write_collection_of_object_values(\"properties\", @properties)\n writer.write_string_value(\"status\", @status)\n writer.write_collection_of_primitive_values(\"targetTypes\", @target_types)\n end",
"def write\n hash = attributes_hash\n write_value(serializer_class.dump(hash))\n @_cache = hash # set @_cache after the write\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"appDisplayName\", @app_display_name)\n writer.write_string_value(\"dataType\", @data_type)\n writer.write_boolean_value(\"isSyncedFromOnPremises\", @is_synced_from_on_premises)\n writer.write_string_value(\"name\", @name)\n writer.write_collection_of_primitive_values(\"targetObjects\", @target_objects)\n end",
"def instance_to_json\n\t\t# byebug\n\t\t{\n\t\tid: self.id,\n\t\tname: self.name,\n\t\theight: self.height,\n\t\tlast_watered: self.last_watered,\n\t\tlast_watered_amount: self.last_watered_amount,\n\t\tgrow_zone: self.grow_zone,\n\t\tnotes: self.notes,\n\t\tplanted_date: self.planted_date,\n\t\tfarm: self.farm,\t\n\t\tsensor: self.sensor\n\t\t# farm: { \n\t\t# \tfarm: self.farm.name,\n\t\t# \tfarm: self.farm.id,\n\t\t# },\n\t\t}\n\tend",
"def _dump(depth)\n scrooge_fetch_remaining\n scrooge_invalidate_updateable_result_set\n scrooge_dump_flag_this\n str = Marshal.dump(self)\n scrooge_dump_unflag_this\n str\n end",
"def to_s\n \"#<#{self.class.name}:#{object_id} #{info}>\"\n end",
"def to_dump\n @time = Time.now\n Base64.encode64(Marshal.dump(self))\n end",
"def dump\n\t\t\t\tflatten!\n\t\t\t\t\n\t\t\t\tMessagePack.dump(@attributes)\n\t\t\tend",
"def inspect\n serialize.to_s\n end",
"def inspect\n serialize.to_s\n end",
"def inspect\n serialize.to_s\n end",
"def serialize(options={})\n raise NotImplementedError, \"Please implement this in your concrete class\"\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"apiConnectorConfiguration\", @api_connector_configuration)\n writer.write_collection_of_object_values(\"identityProviders\", @identity_providers)\n writer.write_collection_of_object_values(\"languages\", @languages)\n writer.write_collection_of_object_values(\"userAttributeAssignments\", @user_attribute_assignments)\n writer.write_collection_of_object_values(\"userFlowIdentityProviders\", @user_flow_identity_providers)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"clientContext\", @client_context)\n writer.write_object_value(\"resultInfo\", @result_info)\n writer.write_enum_value(\"status\", @status)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_number_value(\"memberCount\", @member_count)\n writer.write_collection_of_object_values(\"members\", @members)\n writer.write_enum_value(\"tagType\", @tag_type)\n writer.write_string_value(\"teamId\", @team_id)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_object_value(\"resource\", @resource)\n writer.write_object_value(\"weight\", @weight)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"comment\", @comment)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_date_time_value(\"deletedDateTime\", @deleted_date_time)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_collection_of_object_values(\"history\", @history)\n writer.write_boolean_value(\"hostOnly\", @host_only)\n writer.write_string_value(\"hostOrDomain\", @host_or_domain)\n writer.write_object_value(\"lastModifiedBy\", @last_modified_by)\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_string_value(\"path\", @path)\n writer.write_enum_value(\"sourceEnvironment\", @source_environment)\n writer.write_enum_value(\"status\", @status)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"category\", @category)\n writer.write_date_time_value(\"firstSeenDateTime\", @first_seen_date_time)\n writer.write_object_value(\"host\", @host)\n writer.write_date_time_value(\"lastSeenDateTime\", @last_seen_date_time)\n writer.write_string_value(\"name\", @name)\n writer.write_string_value(\"version\", @version)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"large\", @large)\n writer.write_object_value(\"medium\", @medium)\n writer.write_object_value(\"small\", @small)\n writer.write_object_value(\"source\", @source)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"accessPackage\", @access_package)\n writer.write_enum_value(\"allowedTargetScope\", @allowed_target_scope)\n writer.write_object_value(\"automaticRequestSettings\", @automatic_request_settings)\n writer.write_object_value(\"catalog\", @catalog)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_collection_of_object_values(\"customExtensionStageSettings\", @custom_extension_stage_settings)\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_object_value(\"expiration\", @expiration)\n writer.write_date_time_value(\"modifiedDateTime\", @modified_date_time)\n writer.write_collection_of_object_values(\"questions\", @questions)\n writer.write_object_value(\"requestApprovalSettings\", @request_approval_settings)\n writer.write_object_value(\"requestorSettings\", @requestor_settings)\n writer.write_object_value(\"reviewSettings\", @review_settings)\n writer.write_collection_of_object_values(\"specificAllowedTargets\", @specific_allowed_targets)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_string_value(\"deviceId\", @device_id)\n writer.write_string_value(\"key\", @key)\n writer.write_enum_value(\"volumeType\", @volume_type)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"assignedTo\", @assigned_to)\n writer.write_date_time_value(\"closedDateTime\", @closed_date_time)\n writer.write_object_value(\"createdBy\", @created_by)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_object_value(\"dataSubject\", @data_subject)\n writer.write_enum_value(\"dataSubjectType\", @data_subject_type)\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_collection_of_object_values(\"history\", @history)\n writer.write_object_value(\"insight\", @insight)\n writer.write_date_time_value(\"internalDueDateTime\", @internal_due_date_time)\n writer.write_object_value(\"lastModifiedBy\", @last_modified_by)\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_collection_of_object_values(\"notes\", @notes)\n writer.write_collection_of_primitive_values(\"regulations\", @regulations)\n writer.write_collection_of_object_values(\"stages\", @stages)\n writer.write_enum_value(\"status\", @status)\n writer.write_object_value(\"team\", @team)\n writer.write_enum_value(\"type\", @type)\n end",
"def serializable_hash\n self.attributes\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_date_time_value(\"endDateTime\", @end_date_time)\n writer.write_string_value(\"joinWebUrl\", @join_web_url)\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_collection_of_object_values(\"modalities\", @modalities)\n writer.write_object_value(\"organizer\", @organizer)\n writer.write_collection_of_object_values(\"participants\", @participants)\n writer.write_collection_of_object_values(\"sessions\", @sessions)\n writer.write_date_time_value(\"startDateTime\", @start_date_time)\n writer.write_enum_value(\"type\", @type)\n writer.write_object_value(\"version\", @version)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"axes\", @axes)\n writer.write_object_value(\"dataLabels\", @data_labels)\n writer.write_object_value(\"format\", @format)\n writer.write_object_value(\"height\", @height)\n writer.write_object_value(\"left\", @left)\n writer.write_object_value(\"legend\", @legend)\n writer.write_string_value(\"name\", @name)\n writer.write_collection_of_object_values(\"series\", @series)\n writer.write_object_value(\"title\", @title)\n writer.write_object_value(\"top\", @top)\n writer.write_object_value(\"width\", @width)\n writer.write_object_value(\"worksheet\", @worksheet)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"description\", @description)\n writer.write_object_value(\"details\", @details)\n writer.write_string_value(\"name\", @name)\n writer.write_enum_value(\"scenarios\", @scenarios)\n end",
"def serialize\n JSON.dump(@hash)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_boolean_value(\"isUsable\", @is_usable)\n writer.write_boolean_value(\"isUsableOnce\", @is_usable_once)\n writer.write_number_value(\"lifetimeInMinutes\", @lifetime_in_minutes)\n writer.write_string_value(\"methodUsabilityReason\", @method_usability_reason)\n writer.write_date_time_value(\"startDateTime\", @start_date_time)\n writer.write_string_value(\"temporaryAccessPass\", @temporary_access_pass)\n end",
"def to_s\r\n dump\r\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"callee\", @callee)\n writer.write_object_value(\"caller\", @caller)\n writer.write_date_time_value(\"endDateTime\", @end_date_time)\n writer.write_object_value(\"failureInfo\", @failure_info)\n writer.write_collection_of_object_values(\"media\", @media)\n writer.write_date_time_value(\"startDateTime\", @start_date_time)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_number_value(\"deviceCount\", @device_count)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_collection_of_object_values(\"managedDevices\", @managed_devices)\n writer.write_enum_value(\"platform\", @platform)\n writer.write_string_value(\"publisher\", @publisher)\n writer.write_object_value(\"sizeInByte\", @size_in_byte)\n writer.write_string_value(\"version\", @version)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_collection_of_object_values(\"members\", @members)\n writer.write_string_value(\"roleTemplateId\", @role_template_id)\n writer.write_collection_of_object_values(\"scopedMembers\", @scoped_members)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"options\", @options)\n writer.write_boolean_value(\"protected\", @protected)\n end",
"def serialize(io)\n Encoder.encode(io, self)\n io\n end",
"def _dump() end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"authenticationConfiguration\", @authentication_configuration)\n writer.write_object_value(\"clientConfiguration\", @client_configuration)\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_object_value(\"endpointConfiguration\", @endpoint_configuration)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"container\", @container)\n writer.write_string_value(\"containerId\", @container_id)\n writer.write_object_value(\"lastModifiedBy\", @last_modified_by)\n writer.write_object_value(\"member\", @member)\n writer.write_string_value(\"memberId\", @member_id)\n writer.write_enum_value(\"outlierContainerType\", @outlier_container_type)\n writer.write_enum_value(\"outlierMemberType\", @outlier_member_type)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"body\", @body)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_string_value(\"imageUrl\", @image_url)\n writer.write_collection_of_object_values(\"indicators\", @indicators)\n writer.write_boolean_value(\"isFeatured\", @is_featured)\n writer.write_date_time_value(\"lastUpdatedDateTime\", @last_updated_date_time)\n writer.write_object_value(\"summary\", @summary)\n writer.write_collection_of_primitive_values(\"tags\", @tags)\n writer.write_string_value(\"title\", @title)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_date_time_value(\"completedDateTime\", @completed_date_time)\n writer.write_object_value(\"progress\", @progress)\n writer.write_enum_value(\"status\", @status)\n writer.write_string_value(\"storageLocation\", @storage_location)\n writer.write_date_time_value(\"submittedDateTime\", @submitted_date_time)\n writer.write_string_value(\"userId\", @user_id)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"accessPackages\", @access_packages)\n writer.write_enum_value(\"catalogType\", @catalog_type)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_collection_of_object_values(\"customWorkflowExtensions\", @custom_workflow_extensions)\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_boolean_value(\"isExternallyVisible\", @is_externally_visible)\n writer.write_date_time_value(\"modifiedDateTime\", @modified_date_time)\n writer.write_collection_of_object_values(\"resourceRoles\", @resource_roles)\n writer.write_collection_of_object_values(\"resourceScopes\", @resource_scopes)\n writer.write_collection_of_object_values(\"resources\", @resources)\n writer.write_enum_value(\"state\", @state)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"bundles\", @bundles)\n writer.write_string_value(\"driveType\", @drive_type)\n writer.write_collection_of_object_values(\"following\", @following)\n writer.write_collection_of_object_values(\"items\", @items)\n writer.write_object_value(\"list\", @list)\n writer.write_object_value(\"owner\", @owner)\n writer.write_object_value(\"quota\", @quota)\n writer.write_object_value(\"root\", @root)\n writer.write_object_value(\"sharePointIds\", @share_point_ids)\n writer.write_collection_of_object_values(\"special\", @special)\n writer.write_object_value(\"system\", @system)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_enum_value(\"classification\", @classification)\n writer.write_string_value(\"feature\", @feature)\n writer.write_string_value(\"featureGroup\", @feature_group)\n writer.write_string_value(\"impactDescription\", @impact_description)\n writer.write_boolean_value(\"isResolved\", @is_resolved)\n writer.write_enum_value(\"origin\", @origin)\n writer.write_collection_of_object_values(\"posts\", @posts)\n writer.write_string_value(\"service\", @service)\n writer.write_enum_value(\"status\", @status)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"connectors\", @connectors)\n writer.write_boolean_value(\"hasPhysicalDevice\", @has_physical_device)\n writer.write_boolean_value(\"isShared\", @is_shared)\n writer.write_date_time_value(\"lastSeenDateTime\", @last_seen_date_time)\n writer.write_date_time_value(\"registeredDateTime\", @registered_date_time)\n writer.write_collection_of_object_values(\"shares\", @shares)\n writer.write_collection_of_object_values(\"taskTriggers\", @task_triggers)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"assignments\", @assignments)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_string_value(\"description\", @description)\n writer.write_collection_of_object_values(\"deviceStates\", @device_states)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_string_value(\"informationUrl\", @information_url)\n writer.write_object_value(\"installSummary\", @install_summary)\n writer.write_object_value(\"largeCover\", @large_cover)\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_string_value(\"privacyInformationUrl\", @privacy_information_url)\n writer.write_date_time_value(\"publishedDateTime\", @published_date_time)\n writer.write_string_value(\"publisher\", @publisher)\n writer.write_collection_of_object_values(\"userStateSummary\", @user_state_summary)\n end",
"def inspect\n attributes = [\n \"name=#{name.inspect}\",\n \"key=#{key.inspect}\",\n \"data_type=#{data_type.inspect}\",\n ]\n \"#<#{self.class.name}:#{object_id} #{attributes.join(', ')}>\"\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"assignments\", @assignments)\n writer.write_collection_of_object_values(\"categories\", @categories)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"developer\", @developer)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_string_value(\"informationUrl\", @information_url)\n writer.write_boolean_value(\"isFeatured\", @is_featured)\n writer.write_object_value(\"largeIcon\", @large_icon)\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_string_value(\"notes\", @notes)\n writer.write_string_value(\"owner\", @owner)\n writer.write_string_value(\"privacyInformationUrl\", @privacy_information_url)\n writer.write_string_value(\"publisher\", @publisher)\n writer.write_enum_value(\"publishingState\", @publishing_state)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_enum_value(\"platformType\", @platform_type)\n writer.write_number_value(\"settingCount\", @setting_count)\n writer.write_collection_of_object_values(\"settingStates\", @setting_states)\n writer.write_enum_value(\"state\", @state)\n writer.write_number_value(\"version\", @version)\n end",
"def _dump()\n #This is a stub, used for indexing\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_string_value(\"templateId\", @template_id)\n writer.write_collection_of_object_values(\"values\", @values)\n end",
"def marshal_dump\n { \n :klass => self.class.to_s, \n :values => @attribute_values_flat, \n :joined => @joined_models\n }\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"containers\", @containers)\n writer.write_object_value(\"controller\", @controller)\n writer.write_collection_of_object_values(\"ephemeralContainers\", @ephemeral_containers)\n writer.write_collection_of_object_values(\"initContainers\", @init_containers)\n writer.write_object_value(\"labels\", @labels)\n writer.write_string_value(\"name\", @name)\n writer.write_object_value(\"namespace\", @namespace)\n writer.write_object_value(\"podIp\", @pod_ip)\n writer.write_object_value(\"serviceAccount\", @service_account)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_enum_value(\"detectionStatus\", @detection_status)\n writer.write_object_value(\"imageFile\", @image_file)\n writer.write_string_value(\"mdeDeviceId\", @mde_device_id)\n writer.write_date_time_value(\"parentProcessCreationDateTime\", @parent_process_creation_date_time)\n writer.write_object_value(\"parentProcessId\", @parent_process_id)\n writer.write_object_value(\"parentProcessImageFile\", @parent_process_image_file)\n writer.write_string_value(\"processCommandLine\", @process_command_line)\n writer.write_date_time_value(\"processCreationDateTime\", @process_creation_date_time)\n writer.write_object_value(\"processId\", @process_id)\n writer.write_object_value(\"userAccount\", @user_account)\n end",
"def inspect\n self.to_hash.inspect\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"administrativeUnits\", @administrative_units)\n writer.write_collection_of_object_values(\"attributeSets\", @attribute_sets)\n writer.write_collection_of_object_values(\"customSecurityAttributeDefinitions\", @custom_security_attribute_definitions)\n writer.write_collection_of_object_values(\"deletedItems\", @deleted_items)\n writer.write_collection_of_object_values(\"federationConfigurations\", @federation_configurations)\n writer.write_collection_of_object_values(\"onPremisesSynchronization\", @on_premises_synchronization)\n end",
"def inspect\n \"#<#{self.class}:0x#{object_id.to_s(16)}> JSON: \" +\n JSON.pretty_generate(@data)\n end",
"def encode\n raise Errors::SerializerNotConfigured if serializer_missing?\n\n serializer.encode(self)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"activationUrl\", @activation_url)\n writer.write_string_value(\"activitySourceHost\", @activity_source_host)\n writer.write_string_value(\"appActivityId\", @app_activity_id)\n writer.write_string_value(\"appDisplayName\", @app_display_name)\n writer.write_object_value(\"contentInfo\", @content_info)\n writer.write_string_value(\"contentUrl\", @content_url)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_date_time_value(\"expirationDateTime\", @expiration_date_time)\n writer.write_string_value(\"fallbackUrl\", @fallback_url)\n writer.write_collection_of_object_values(\"historyItems\", @history_items)\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_enum_value(\"status\", @status)\n writer.write_string_value(\"userTimezone\", @user_timezone)\n writer.write_object_value(\"visualElements\", @visual_elements)\n end",
"def serialize\n super(ATTR_NAME_ARY)\n end",
"def serialize\n super(ATTR_NAME_ARY)\n end",
"def serialize\n super(ATTR_NAME_ARY)\n end",
"def serialize\n super(ATTR_NAME_ARY)\n end",
"def serialize\n super(ATTR_NAME_ARY)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_object_value(\"basis\", @basis)\n writer.write_object_value(\"cost\", @cost)\n writer.write_object_value(\"datePurchased\", @date_purchased)\n writer.write_object_value(\"firstPeriod\", @first_period)\n writer.write_object_value(\"period\", @period)\n writer.write_object_value(\"rate\", @rate)\n writer.write_object_value(\"salvage\", @salvage)\n writer.write_additional_data(@additional_data)\n end",
"def serialize(writer) \n super\n writer.write_collection_of_primitive_values(\"categories\", @categories)\n writer.write_string_value(\"changeKey\", @change_key)\n writer.write_date_value(\"createdDateTime\", @created_date_time)\n writer.write_date_value(\"lastModifiedDateTime\", @last_modified_date_time)\n end"
] | [
"0.7951372",
"0.7645999",
"0.7579812",
"0.7579812",
"0.7440032",
"0.720861",
"0.720861",
"0.7207583",
"0.7016516",
"0.70007193",
"0.6992252",
"0.69838214",
"0.69723576",
"0.69666415",
"0.69666415",
"0.6942002",
"0.69417155",
"0.6933786",
"0.6913977",
"0.6891677",
"0.68810964",
"0.687664",
"0.687664",
"0.687664",
"0.6875119",
"0.68510306",
"0.68364877",
"0.68364877",
"0.6825542",
"0.6815931",
"0.68061364",
"0.68006235",
"0.67944074",
"0.67717844",
"0.67341864",
"0.67289317",
"0.66964674",
"0.66828746",
"0.6673492",
"0.6668077",
"0.6666333",
"0.6659732",
"0.6656788",
"0.66513675",
"0.6635875",
"0.66275525",
"0.66275525",
"0.66275525",
"0.6627384",
"0.66165835",
"0.66141444",
"0.6611379",
"0.6597342",
"0.65968686",
"0.6594517",
"0.6592636",
"0.6583964",
"0.6580536",
"0.65803635",
"0.6575503",
"0.65716475",
"0.65712893",
"0.6566952",
"0.6560253",
"0.65554273",
"0.65410006",
"0.65378475",
"0.65346783",
"0.6527361",
"0.6525178",
"0.65242875",
"0.65235287",
"0.65174305",
"0.65141636",
"0.6508169",
"0.6499713",
"0.6498714",
"0.6496881",
"0.6486202",
"0.6482482",
"0.64814615",
"0.6479782",
"0.6476621",
"0.6475453",
"0.64677024",
"0.64633876",
"0.64619535",
"0.6461202",
"0.6457243",
"0.64497435",
"0.6439583",
"0.6433183",
"0.643078",
"0.6424316",
"0.6420337",
"0.6420337",
"0.6420337",
"0.6420337",
"0.6420337",
"0.6418776",
"0.64156514"
] | 0.0 | -1 |
Gets the serviceManagementReference property value. References application or service contact information from a Service or Asset Management database. Nullable. | def service_management_reference
return @service_management_reference
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def service_management_reference=(value)\n @service_management_reference = value\n end",
"def service_management_url\n return @service_management_url\n end",
"def cloud_service_management(options = {})\n Azure::CloudServiceManagement::CloudServiceManagementService.new(default_client(options))\n end",
"def management_endpoint\n ENV['AZURE_MANAGEMENT_ENDPOINT'] || (SERVICE_MANAGEMENT_ENDPOINT + '/')\n end",
"def service_management_url=(value)\n @service_management_url = value\n end",
"def ref\n @messaging['optin']['ref']\n end",
"def ems_ref_string\n object_send(:ems_ref)\n end",
"def service\n return @service\n end",
"def reference\n value_for('reference')\n end",
"def get_management_url(conn)\n return conn.instance_variable_get(:@openstack_management_url)\n end",
"def contact\n ::HubEdos::Common::Reference::Descriptor.new(@data['contact']) if @data['contact']\n end",
"def resource_reference\n return @resource_reference\n end",
"def service_id\n return @service_id\n end",
"def reference\n @reference\n end",
"def service_descriptor_href\n resp = http.resource(sys_shep.capabilities_uri).get(:accept => 'application/vnd.absolute-performance.sysshep+json')\n \n service_descriptors = JSON.parse(resp.body)['items']\n sd_ref = service_descriptors.find{|sd| sd['service_type'] == service_type} || \n raise(NoSuchService, \"<#{service_type}> service is not available in this SystemShepherd\")\n \n sd_ref['href']\n end",
"def managed?\n @managed.nil? ? true : @managed\n end",
"def management_certificate\n ENV['AZURE_MANAGEMENT_CERTIFICATE']\n end",
"def service\n @service\n end",
"def service_manager\n (!@service_manager.nil? ? @service_manager : (fetch(\"#{name}_service_manager\", nil) || fetch(:default_service_manager, nil)))\n end",
"def set_management\n @management = Management.friendly.find(params[:id])\n end",
"def base_management(options = {})\n Azure::BaseManagement::BaseManagementService.new(default_client(options))\n end",
"def managed?\n (options[:managed].present? && options[:managed] === true)\n end",
"def user_ref\n @messaging['optin']['user_ref']\n end",
"def reference_credit_note\n object.credit_note_ref.to_s\n end",
"def get_contact\n if self.contact_id\n return self.contact\n end\n end",
"def service_name\n @documents.service_name\n end",
"def host_by_moref(moref)\n vim.serviceInstance.content.hostSpecManager.RetrieveHostSpecification(host: moref, fromHost: false).host\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 client\n Contentful::Management::Client.shared_instance\n end",
"def lookup_service_host\n # Allow manual overrides\n return config[:lookup_service_host] unless config[:lookup_service_host].nil?\n\n # Retrieve SSO service via RbVmomi, which is always co-located with the Lookup Service.\n vim = RbVmomi::VIM.connect @connection_options\n vim_settings = vim.serviceContent.setting.setting\n sso_url = vim_settings.select { |o| o.key == \"config.vpxd.sso.sts.uri\" }&.first&.value\n\n # Configuration fallback, if no SSO URL found for some reason\n ls_host = sso_url.nil? ? config[:vcenter_host] : URI.parse(sso_url).host\n debug(\"Using Lookup Service at: \" + ls_host)\n\n ls_host\n end",
"def reference\n if success?\n nil\n else\n body ? self[\"reference\"] : \"No reference\"\n end\n end",
"def vm_management(options = {})\n Azure::VirtualMachineManagement::VirtualMachineManagementService.new(default_client(options))\n end",
"def reference_attribute\n\t\tcontent = self.send(self.class.reference_attribute)\n\t\tif extra = self.class.get_belongs_to_extra_info\n\t\t\tcontent = \"#{content} #{extra.call(self)}\"\n\t\tend\n\t\tcontent\n\tend",
"def management_sdk_version\n return @management_sdk_version\n end",
"def references(collection)\n manager_refs_by_association.try(:[], collection).try(:[], :ems_ref)&.to_a || []\n end",
"def status(reference_id, **params)\n\n self.get(MESSAGING_STATUS_RESOURCE % {:reference_id => reference_id},\n **params)\n end",
"def android_mobile_application_management_enabled\n return @android_mobile_application_management_enabled\n end",
"def contact\n @contact ||= get_contact(@data_object.user_contact)\n end",
"def service\n @service ||= fetcher.get(Service, service_id)\n end",
"def references(collection)\n target.manager_refs_by_association&.dig(collection, :ems_ref)&.to_a&.compact || []\n end",
"def model_reference_config(model_reference)\n return unless references\n\n references[model_reference.to_record_result_key.to_sym] ||\n references[model_reference.to_record.class.table_name.singularize.to_sym] ||\n references[model_reference.to_record.class.name.ns_underscore.singularize.to_sym]\n end",
"def contact(options={})\n if self.padma_contact.nil? || options[:force_service_call]\n self.padma_contact = PadmaContact.find(contact_id, {select: :all, account_name: self.account_name})\n end\n ret = padma_contact\n if options[:decorated] && padma_contact\n ret = PadmaContactDecorator.decorate(padma_contact)\n end\n ret\n end",
"def service_name\n return @service_name\n end",
"def referenced_url\n read_attribute(:referenced_url) || referenced_guid.try(:with_http)\n end",
"def service\n softlayer_client[:Software_Component].object_with_id(self.id)\n end",
"def odata_table_reference\n @odata_table_reference\n end",
"def contact_phone\n self.contact[:contact_phone]\n end",
"def reference\n @data['reference']\n end",
"def ios_mobile_application_management_enabled\n return @ios_mobile_application_management_enabled\n end",
"def IsManaged\n Read()\n @new_service_id_name != \"network\"\n end",
"def mobile_phone\n pull unless @details\n begin\n return @details.mobile_phone.free_form_number\n rescue\n return nil\n end\n end",
"def service\n softlayer_client[:User_Customer_External_Binding].object_with_id(self.id)\n end",
"def service\n softlayer_client[:Network_Message_Delivery].object_with_id(self.id)\n end",
"def ref\n @ref ||= maybe_ref || api.master_ref.ref\n end",
"def autosizedReferenceCapacity\n\n return self.model.getAutosizedValue(self, 'Reference Capacity', 'W')\n\n end",
"def get_service_class\n return @m_service_class\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 service_type\n return nil unless self.service_type_id \n ServiceType.find(self.service_type_id)\n end",
"def administrator\n if self.administrator_id\n return Contact.find(self.administrator_id)\n else\n return false\n end\n end",
"def contact; Contact.get(self.contact_id); end",
"def contact; Contact.get(self.contact_id); end",
"def contact; Contact.get(self.contact_id); end",
"def contact; Contact.get(self.contact_id); end",
"def contact; Contact.get(self.contact_id); end",
"def referencing_link_name\n error(\"referencing_link_name on #{name} is invalid as #{characteristic_container.characteristic_kind} is not a reference\") unless reference?\n \"#{name}#{referenced_entity.primary_key.name}\"\n end",
"def rights_management_services_template_id\n return @rights_management_services_template_id\n end",
"def storage_management(options = {})\n Azure::StorageManagement::StorageManagementService.new(default_client(options))\n end",
"def set_material_management\n @material_management = MaterialManagement.find(params[:id])\n end",
"def contact\n @contact ||= ActsAsIcontact::Contact.find(contactId.to_i) if contactId.to_i > 0\n end",
"def ref?\n schema[\"$ref\"]\n end",
"def get_order_reference_details(\n amazon_order_reference_id,\n address_consent_token: nil,\n access_token: nil,\n merchant_id: @merchant_id,\n mws_auth_token: nil\n )\n\n parameters = {\n 'Action' => 'GetOrderReferenceDetails',\n 'SellerId' => merchant_id,\n 'AmazonOrderReferenceId' => amazon_order_reference_id\n }\n\n optional = {\n # Preseving address_consent_token for backwards compatibility\n # AccessToken returns all data in AddressConsentToken plus new data\n 'AccessToken' => access_token || address_consent_token,\n 'MWSAuthToken' => mws_auth_token\n }\n\n operation(parameters, optional)\n end",
"def phone\n if @data.attribute_names.include?(:cmupreferredtelephone)\n @phone ||= @data[:cmupreferredtelephone].last.gsub(/[^0-9]/,'')\n else\n @phone ||= nil\n end\n end",
"def mobile_phone\n return @mobile_phone\n end",
"def entitlement_management\n return @entitlement_management\n end",
"def is_pcb_management?\n self.pcb_management_role != nil\n end",
"def service_io_id\n service.present? ? service.io_id : nil\n end",
"def azure_rights_management_services_allowed\n return @azure_rights_management_services_allowed\n end",
"def service\n options[:service]\n end",
"def get_remote_value\n return nil if service.blank?\n case service\n when 'kshema'\n school.fetch_stat(self.name,ref_date)\n when 'crm'\n school.fetch_stat_from_crm(self.name,ref_date)\n when 'overmind'\n ls = LocalStat.new(name: self.name, ref_date: ref_date, school: school)\n ls.value\n else\n raise \"Unknown service : #{service}\"\n end\n end",
"def model_id\n return @reference.model_id if reference?\n @gapi_json[:modelReference][:modelId]\n end",
"def set_medical_service\n @medical_service = MedicalService.find(params[:id])\n end",
"def referencing_link_name\n Domgen.error(\"referencing_link_name on #{name} is invalid as #{characteristic_container.characteristic_kind} is not a reference\") unless reference?\n base_name = \"#{self.respond_to?(:component_name) ? component_name : name}#{referenced_entity.primary_key.name}\"\n self.collection? ? Reality::Naming.pluralize(base_name) : base_name\n end",
"def service_company\n self.well_info.service_company\n end",
"def reference\n %x{ #{ Firebase.new `#@native.ref().toString()` } }\n end",
"def card_payment_service\n card_merchant_config&.payment_service\n end",
"def service_principal_id\n return @service_principal_id\n end",
"def component_manager_id\n self.class.default_component_manager_id\n end",
"def sql_database_management(options = {})\n Azure::SqlDatabaseManagement::SqlDatabaseManagementService.new(default_client(options))\n end",
"def resource_reference=(value)\n @resource_reference = value\n end",
"def reference?\n @grpc.nil?\n end",
"def reference\n data['caseReference']\n end",
"def cloud_service_name\n return @cloud_service_name\n end",
"def status\n ::HubEdos::Common::Reference::Descriptor.new(@data['status']) if @data['status']\n end",
"def service\n unless defined?(@service)\n p = parent\n while p && !(SwiftStorage::Service === p)\n p = p.parent\n end\n @service = p\n end\n @service\n end",
"def service_name\n resource[:name]\n end",
"def managed(manager_id)\n return Manage.where(\"manager_id = ?\", manager_id)\n end",
"def security_contact\n get_user security_contact_id\n end",
"def sql_database_management_endpoint\n ENV['AZURE_SQL_DATABASE_MANAGEMENT_ENDPOINT'] || \"#{SERVICE_MANAGEMENT_ENDPOINT}:8443/\"\n end",
"def service_account\n return @service_account\n end",
"def get_service_detail(opts = {})\n data, _status_code, _headers = get_service_detail_with_http_info(opts)\n data\n end"
] | [
"0.7204387",
"0.5686265",
"0.5103519",
"0.5025822",
"0.5007907",
"0.49675417",
"0.4890502",
"0.48817918",
"0.4854919",
"0.47961468",
"0.4769057",
"0.47688484",
"0.47457162",
"0.4715931",
"0.4693028",
"0.46914056",
"0.4660478",
"0.45944092",
"0.4582326",
"0.45754018",
"0.45537987",
"0.4536289",
"0.45303956",
"0.44618487",
"0.44276753",
"0.4413277",
"0.44110027",
"0.4409534",
"0.43930534",
"0.4392577",
"0.43707213",
"0.43406284",
"0.4332663",
"0.43261394",
"0.43214348",
"0.43188578",
"0.43083718",
"0.429171",
"0.4286783",
"0.42828745",
"0.42742413",
"0.42503527",
"0.42481726",
"0.4247346",
"0.42463508",
"0.42443895",
"0.42411646",
"0.42398846",
"0.42398182",
"0.42210728",
"0.42202997",
"0.42152652",
"0.42111602",
"0.4204478",
"0.42018622",
"0.4197338",
"0.4184623",
"0.41749415",
"0.4153917",
"0.41471428",
"0.41471428",
"0.41471428",
"0.41471428",
"0.41471428",
"0.41362566",
"0.41310397",
"0.41161144",
"0.41015086",
"0.40962145",
"0.40877473",
"0.4085865",
"0.4083394",
"0.40826005",
"0.40792453",
"0.40706837",
"0.40697643",
"0.40630823",
"0.40617132",
"0.40558967",
"0.40529287",
"0.40526336",
"0.40459433",
"0.40367112",
"0.403592",
"0.4031598",
"0.40143198",
"0.40130898",
"0.40013528",
"0.4000396",
"0.3999613",
"0.3999495",
"0.3993423",
"0.3993049",
"0.39890033",
"0.39845943",
"0.39845002",
"0.3979107",
"0.39772904",
"0.39764476",
"0.3975462"
] | 0.7867816 | 0 |
Sets the serviceManagementReference property value. References application or service contact information from a Service or Asset Management database. Nullable. | def service_management_reference=(value)
@service_management_reference = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def service_management_reference\n return @service_management_reference\n end",
"def service_management_url=(value)\n @service_management_url = value\n end",
"def cloud_service_management(options = {})\n Azure::CloudServiceManagement::CloudServiceManagementService.new(default_client(options))\n end",
"def set_management\n @management = Management.friendly.find(params[:id])\n end",
"def set_material_management\n @material_management = MaterialManagement.find(params[:id])\n end",
"def set_medical_service\n @medical_service = MedicalService.find(params[:id])\n end",
"def vm_management(options = {})\n Azure::VirtualMachineManagement::VirtualMachineManagementService.new(default_client(options))\n end",
"def managed=(managed)\n pointer.managed = managed\n end",
"def set_reference\n @reference = Reference.find(params[:id])\n end",
"def set_reference\n @reference = Reference.find(params[:id])\n end",
"def reference=(ref)\n @reference = ref\n end",
"def base_management(options = {})\n Azure::BaseManagement::BaseManagementService.new(default_client(options))\n end",
"def set_product_management\n @product_management = ProductManagement.find(params[:id])\n end",
"def set_admin_service\n @service = Service.find(params[:id])\n end",
"def set_referral_service\n @referral_service = ReferralService.find(params[:id])\n end",
"def service_management_url\n return @service_management_url\n end",
"def set_reference\n @reference = Reference.find(params[:id])\n end",
"def management_endpoint\n ENV['AZURE_MANAGEMENT_ENDPOINT'] || (SERVICE_MANAGEMENT_ENDPOINT + '/')\n end",
"def service=(service)\n @service = service\n end",
"def azure_rights_management_services_allowed=(value)\n @azure_rights_management_services_allowed = value\n end",
"def storage_management(options = {})\n Azure::StorageManagement::StorageManagementService.new(default_client(options))\n end",
"def service=(value)\n @service = value\n end",
"def set_service_detail\n @service_detail = ServiceDetail.find(params[:id])\n end",
"def set_admin_service\n @admin_service = Admin::Service.find(params[:id])\n end",
"def resource_reference=(value)\n @resource_reference = value\n end",
"def reference=(reference)\n\n if !reference.nil? && reference.to_s.length > 50\n fail ArgumentError, \"invalid value for 'reference', the character length must be smaller than or equal to 50.\"\n end\n\n @reference = reference\n end",
"def set_serviceordemservice\n @serviceordemservice = Serviceordemservice.find(params[:id])\n end",
"def entitlement_management=(value)\n @entitlement_management = value\n end",
"def set_admin_service_center\n @service_center = ServiceCenter.find(params[:id])\n end",
"def management_console_endpoint=(value)\n reset_agent\n @management_console_endpoint = value\n end",
"def set_adminref\n @adminref = Adminref.find(params[:id])\n end",
"def set_management\n @admin = Admin.find(params[:id])\n @management = Admin.find(params[:id])\n end",
"def set_users_management\n @users_management = Users::Management.find(params[:id])\n end",
"def set_service\n @service = Service.friendly.find(params[:id])\n end",
"def reference_id=(reference_id)\n if !reference_id.nil? && reference_id.to_s.length > 50\n fail ArgumentError, 'invalid value for \"reference_id\", the character length must be smaller than or equal to 50.'\n end\n\n @reference_id = reference_id\n end",
"def set_service\n @service = Service.find(params[:id])\n add_breadcrumb \"Service\"\n add_breadcrumb @service.nombre, [@client, @place, @service]\n end",
"def set_m_pref\n @m_pref = MPref.find(params[:id])\n end",
"def change_reference(new_reference)\n\n # In datamapper it's not possible to update the key value, so we use adapter\n # https://stackoverflow.com/questions/32302407/updating-a-property-set-as-the-key-in-datamapper\n BookingItem.change_item_reference(new_reference, reference)\n # Update the item references assigned\n BookingDataSystem::BookingLineResource.all(booking_item_reference: reference).update(booking_item_reference: new_reference)\n # Update stock locking references\n BookingDataSystem::BookingPrereservationLine.all(booking_item_reference: reference).update(booking_item_reference: new_reference)\n\n end",
"def set_incidentmanagement\n @incidentmanagement = Incidentmanagement.find(params[:id])\n end",
"def set_service_master\n @service_master = ServiceMaster.find(params[:id])\n end",
"def set_service_group\n @service_group = ServiceGroup.find(params[:id])\n end",
"def set_service_location\n @service_location = ServiceLocation.find(params[:id])\n end",
"def set_service_location\n @service_location = ServiceLocation.find(params[:id])\n end",
"def management_server_url=(management_server_url)\n\n if !management_server_url.nil? && management_server_url.to_s.length > 200\n fail ArgumentError, \"invalid value for 'management_server_url', the character length must be smaller than or equal to 200.\"\n end\n\n @management_server_url = management_server_url\n end",
"def set_service\n @service = current_user.services.find(params[:id])\n end",
"def dd_service=(dd_service)\n if dd_service.nil?\n fail ArgumentError, 'invalid value for \"dd_service\", dd_service cannot be nil.'\n end\n @dd_service = dd_service\n end",
"def set_service_mechanic\n @service_mechanic = ServiceMechanic.find(params[:id])\n end",
"def service_name=(service_name)\n allowed_values = [\"ContactCenter\", \"ContentManagement\", \"PeoplePermissions\", \"Quality\", \"LanguageUnderstanding\", \"TopicsDefinitions\", \"PredictiveEngagement\", \"WorkforceManagement\", \"Triggers\", \"ResponseManagement\"]\n if service_name && !allowed_values.include?(service_name)\n fail ArgumentError, \"invalid value for 'service_name', must be one of #{allowed_values}.\"\n end\n @service_name = service_name\n end",
"def set_ref\n @ref = Ref.find(params[:id])\n end",
"def network_management(options = {})\n Azure::VirtualNetworkManagement::VirtualNetworkManagementService.new(default_client(options))\n end",
"def set_resource_management14\n @resource_management14 = ResourceManagement14.find(params[:id])\n end",
"def set_housing_detail_management\n @housing_detail_management = HousingDetailManagement.find(params[:id])\n end",
"def referenced_guid=(v)\n write_attribute(:referenced_guid, v.present? ? v.strip.without_http : nil)\n end",
"def set_reference_list\n @reference_list = ReferenceList.find(params[:id])\n end",
"def set_service\n @service = Service.find(params[:id])\n end",
"def set_service\n @service = Service.find(params[:id])\n end",
"def set_service\n @service = Service.find(params[:id])\n end",
"def set_service\n @service = Service.find(params[:id])\n end",
"def set_service\n @service = Service.find(params[:id])\n end",
"def set_service\n @service = Service.find(params[:id])\n end",
"def set_service\n @service = Service.find(params[:id])\n end",
"def set_service\n @service = Service.find(params[:id])\n end",
"def set_service\n @service = Service.find(params[:id])\n end",
"def set_service\n @service = Service.find(params[:id])\n end",
"def set_service\n @service = Service.find(params[:id])\n end",
"def set_service\n @service = Service.find(params[:id])\n end",
"def set_service\n @service = Service.find(params[:id])\n end",
"def set_service\n @service = Service.find(params[:id])\n end",
"def set_service\n @service = Service.find(params[:id])\n end",
"def set_service\n @service = Service.find(params[:id])\n end",
"def set_service\n @service = Service.find(params[:id])\n end",
"def set_service\n @service = Service.find(params[:id])\n end",
"def set_service\n @service = Service.find(params[:id])\n end",
"def set_service\n @service = Service.find(params[:id])\n end",
"def set_service\n @service = Service.find(params[:id])\n end",
"def set_service\n @service = Service.find(params[:id])\n end",
"def set_order_reference_details(\n amazon_order_reference_id,\n amount,\n currency_code: @currency_code,\n platform_id: nil,\n seller_note: nil,\n seller_order_id: nil,\n request_payment_authorization: nil,\n store_name: nil,\n order_item_categories: nil,\n custom_information: nil,\n supplementary_data: nil,\n merchant_id: @merchant_id,\n mws_auth_token: nil\n )\n\n parameters = {\n 'Action' => 'SetOrderReferenceDetails',\n 'SellerId' => merchant_id,\n 'AmazonOrderReferenceId' => amazon_order_reference_id,\n 'OrderReferenceAttributes.OrderTotal.Amount' => amount,\n 'OrderReferenceAttributes.OrderTotal.CurrencyCode' => currency_code\n }\n\n optional = {\n 'OrderReferenceAttributes.PlatformId' => platform_id,\n 'OrderReferenceAttributes.RequestPaymentAuthorization' => request_payment_authorization,\n 'OrderReferenceAttributes.SellerNote' => seller_note,\n 'OrderReferenceAttributes.SellerOrderAttributes.SellerOrderId' => seller_order_id,\n 'OrderReferenceAttributes.SellerOrderAttributes.StoreName' => store_name,\n 'OrderReferenceAttributes.SellerOrderAttributes.CustomInformation' => custom_information,\n 'OrderReferenceAttributes.SellerOrderAttributes.SupplementaryData' => supplementary_data,\n 'MWSAuthToken' => mws_auth_token\n }\n\n if order_item_categories\n optional.merge!(\n get_categories_list(\n 'OrderReferenceAttributes',\n order_item_categories\n )\n )\n end\n\n operation(parameters, optional)\n end",
"def set_manage_section\n @manage_section = Manage::Section.find(params[:id])\n end",
"def ios_mobile_application_management_enabled=(value)\n @ios_mobile_application_management_enabled = value\n end",
"def set_management_patient\n @management_patient = Management::Patient.find(params[:id])\n end",
"def set_service\r\n @service = Service.find(params[:id])\r\n end",
"def set_service\r\n @service = Service.find(params[:id])\r\n end",
"def references=(value)\n @references = value\n end",
"def android_mobile_application_management_enabled=(value)\n @android_mobile_application_management_enabled = value\n end",
"def set_reference\n extract_reference_data\n values = reference_data.split\n @reference = Reference.new(thermometer: Float(values[1]), humidity: Float(values[2]))\n end",
"def set_service\n @service = @enterprise.services.find(params[:id])\n end",
"def set_multi_agent_service\n @multi_agent_service = MultiAgentService.find(params[:id])\n end",
"def set_service\n @supplier = Supplier.find(params[:supplier_id])\n @service = Service.find(params[:id])\n end",
"def set_service_invoice\n @service_invoice = ServiceInvoice.find(params[:id])\n end",
"def set_microservice_document\n @microservice_document = MicroserviceDocument.find(params[:id])\n end",
"def referenced_guid=(v)\n write_attribute(:referenced_guid, v.present? ? v.strip.to_guid : nil)\n end",
"def user_reference=(ref)\n #self.update_attribute 'user_reference', ref # infinite loop, must call this setter\n write_attribute(:user_reference, ref)\n fetch\n end",
"def sql_database_management(options = {})\n Azure::SqlDatabaseManagement::SqlDatabaseManagementService.new(default_client(options))\n end",
"def set_contact_property\n @contact_property = ContactProperty.find(params[:id])\n end",
"def management_mode=(management_mode)\n validator = EnumAttributeValidator.new('String', [\"IntersightStandalone\", \"UCSM\", \"Intersight\"])\n unless validator.valid?(management_mode)\n fail ArgumentError, \"invalid value for \\\"management_mode\\\", must be one of #{validator.allowable_values}.\"\n end\n @management_mode = management_mode\n end",
"def set_lesson_reference\n @lesson_reference = LessonReference.find(params[:id])\n end",
"def set_cleaning!(property)\n property.services_cleaning = false\n property.services_cleaning_required = nil\n property.services_cleaning_rate = nil\n end",
"def set_service_fee_master\n @service_fee_master = ServiceFeeMaster.find(params[:id])\n end",
"def set_service\r\n @service = Service.find(params[:id])\r\n end",
"def set_service\n @service = Service.find_by_id(params[:id])\n end"
] | [
"0.637827",
"0.54707825",
"0.5396368",
"0.5028023",
"0.49350053",
"0.49207026",
"0.49000823",
"0.4807381",
"0.48064858",
"0.48064858",
"0.47952816",
"0.4744465",
"0.470535",
"0.46906224",
"0.4642008",
"0.4592612",
"0.45859787",
"0.45762724",
"0.45591646",
"0.4538194",
"0.45187604",
"0.44992954",
"0.44968987",
"0.44830278",
"0.44800234",
"0.44794354",
"0.44766343",
"0.445014",
"0.4441699",
"0.44369602",
"0.44339195",
"0.44107077",
"0.43886644",
"0.4350652",
"0.43451244",
"0.43437612",
"0.43228978",
"0.43205345",
"0.4319264",
"0.4307865",
"0.43065056",
"0.4301737",
"0.4301737",
"0.42993742",
"0.42970738",
"0.42905033",
"0.42902818",
"0.42900872",
"0.4268636",
"0.42675167",
"0.42597654",
"0.42552415",
"0.42527413",
"0.42487997",
"0.42396638",
"0.42396638",
"0.42396638",
"0.42396638",
"0.42396638",
"0.42396638",
"0.42396638",
"0.42396638",
"0.42396638",
"0.42396638",
"0.42396638",
"0.42396638",
"0.42396638",
"0.42396638",
"0.42396638",
"0.42396638",
"0.42396638",
"0.42396638",
"0.42396638",
"0.42396638",
"0.42396638",
"0.42396638",
"0.4238842",
"0.42382252",
"0.42226195",
"0.42184046",
"0.4213926",
"0.4213926",
"0.42132354",
"0.42126358",
"0.42099103",
"0.42085415",
"0.42048487",
"0.42000628",
"0.4185511",
"0.4182283",
"0.41793883",
"0.417789",
"0.4168687",
"0.416066",
"0.41562006",
"0.4148999",
"0.41426504",
"0.4125715",
"0.41180056",
"0.4117027"
] | 0.7795603 | 0 |
Gets the signInAudience property value. Specifies the Microsoft accounts that are supported for the current application. The possible values are: AzureADMyOrg, AzureADMultipleOrgs, AzureADandPersonalMicrosoftAccount (default), and PersonalMicrosoftAccount. See more in the table. The value of this object also limits the number of permissions an app can request. For more information, see Limits on requested permissions per app. The value for this property has implications on other app object properties. As a result, if you change this property, you may need to change other properties first. For more information, see Validation differences for signInAudience.Supports $filter (eq, ne, not). | def sign_in_audience
return @sign_in_audience
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sign_in_audience=(value)\n @sign_in_audience = value\n end",
"def audience\n @audience\n end",
"def audience\n @grpc.audience\n end",
"def fetch_aud\n Settings.oidc.isolated_audience.claims\n end",
"def fetch_aud\n Settings.oidc.isolated_audience.claims\n end",
"def get_audience request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_get_audience_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Analytics::Admin::V1alpha::Audience.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def audiences\n respond_to?(:audience) ? audience : []\n end",
"def sign_in_frequency\n return @sign_in_frequency\n end",
"def sign_in\n SAML::User::AUTHN_CONTEXTS.fetch(authn_context)\n .fetch(:sign_in)\n .merge(account_type:)\n rescue\n { service_name: 'unknown', account_type: 'N/A' }\n end",
"def signed_in?\n current_user.present?\n end",
"def signed_in?\n current_user.present?\n end",
"def signed_in?\n !!current_user\n end",
"def signed_in?\n !!current_user\n end",
"def signed_in?\n !!current_user\n end",
"def signed_in?\n !!current_user\n end",
"def target_audience\n @target_audience\n end",
"def signed_in\n @status = 200\n @signed_in = user_signed_in? ? true : false\n end",
"def signed_in?\n \tcurrent_user\n end",
"def access_consent\n return @access_consent\n end",
"def valid_audience?(token)\n audience = token[/&?Audience=([^&]+)/, 1]\n [audiences].flatten.include?(CGI.unescape(audience))\n end",
"def is_usable_for_sign_in=(value)\n @is_usable_for_sign_in = value\n end",
"def signed_in?\n authenticated?\n end",
"def signed_in?\n current_user.present?\n end",
"def signed_in?(scope)\n warden.authenticate?(:scope => scope)\n end",
"def alchemy_user_signed_in?\n current_alchemy_user.present?\n end",
"def audiences\n return [] if @audience_ids.nil?\n @audience_ids.map { |id| Audience.find(id) }\n end",
"def whoIsSignedIn\n if params[:i_am_client]\n username = authenticateClient\n elsif session[:username]\n username = session[:username]\n end\n \n if username == nil\n return nil\n end\n \n user = User.find_by_username(username)\n if user == nil\n return nil\n end\n return user\n end",
"def signed_in?\n # Force sign in again if defined\n @resignin, @session_id, Base.session_id = nil if @resignin\n\n is_signed_in = (@session_id || Base.session_id) ? true : false\n @resignin = nil if is_signed_in\n is_signed_in\n end",
"def signed_in?\n\t\t# Returns true if current_user is not(!) nil\n\t\t!current_user.nil?\n\tend",
"def signed_in?\n !!current_user\n end",
"def signed_in?\n !!current_user\n end",
"def logged_in?\n account_signed_in?\n end",
"def is_usable_for_sign_in\n return @is_usable_for_sign_in\n end",
"def signed_in?\n\t\t!current_user.nil?\n\tend",
"def signed_in?\n\t\t!current_user.nil?\n\tend",
"def signed_in?\n\t\t!current_user.nil?\n\tend",
"def signed_in?\n\t\t!current_user.nil?\n\tend",
"def signed_in?\n\t\t!current_user.nil?\n\tend",
"def signed_in?\n\t\t!current_user.nil?\n\tend",
"def signed_in?\n\t\t!current_user.nil?\n\tend",
"def signed_in?\n\t\t!current_user.nil?\n\tend",
"def signed_in?\n\t\t!current_user.nil?\n\tend",
"def user_signed_in?\n api_current_user.present?\n end",
"def signed_in?\n %W( Client expiry uid access-token ).each do |header|\n return false unless response.headers.include?(header)\n end\n return true\n end",
"def signed_in?\n\t\t!!current_user\n\tend",
"def signed_in?\n\t\t!current_usernil?\n\tend",
"def sign_in_as(user)\n @request.env[:clearance].sign_in(user)\n user\n end",
"def user_signed_in?\n !!current_user\n end",
"def consent_type\n return @consent_type\n end",
"def signed_in?\n this_user.present?\n end",
"def signed_in?\n !!current_user\n end",
"def in\n field_fetch('IN')\n end",
"def is_signed\n return @is_signed\n end",
"def signed_in?\n !current_user.nil?\n end",
"def signed_in?\n !current_user.nil? # a user is signed_in if current_user is not nil\n end",
"def signin\n embed_screen api_args.select_keys(\"redirect_uri\", \"client_id\", \"response_type\")\n end",
"def signed_in?\n !signed_user.nil?\n end",
"def signin\n oauth_authorize\n end",
"def user_signed_in?\n current_user.present?\n end",
"def user_signed_in?\n current_user.present?\n end",
"def user_signed_in?\n current_auth0_user.present?\n end",
"def aud; Settings.jwt.aud end",
"def is_signed_in\n if user_signed_in?\n render json: \"\", status: 200\n else\n render json: \"\", status: 401\n end\n end",
"def signed_in?\n puts \"Current User: #{current_user}\"\n !current_user.nil?\n end",
"def anybody_signed_in?\n Devise.mappings.keys.any? { |scope| signed_in?(scope) }\n end",
"def consent_activity?\n @activity_type.to_s.include? \"Consent\"\n end",
"def signed_in? \n\t\t!current_user.nil?\n\tend",
"def audience_restricted?\n xml.attribute('audience_restricted') == 'true'\n end",
"def signed_in?\n !!@me\n end",
"def user_signed_in?\n user.present?\n end",
"def user_signed_in?\n user.present?\n end",
"def authorized_gae_applications\n settings[:authorized_gae_applications]\n end",
"def declared_in\n options[:declared_in]\n end",
"def show?\n if user.type == 'ReferralAgency'\n user.tenants.include?(app.tenant)\n else\n user.properties.each do |property|\n return true if property.applications.include?(app)\n end\n false\n end\n end",
"def signed_in?\n !current_user.nil?\n end",
"def signed_in?\n !current_user.nil?\n end",
"def signed_in?\n !current_user.nil?\n end",
"def signed_in?\n !current_user.nil?\n end",
"def signed_in?\n !current_user.nil?\n end",
"def signed_in?\n !current_user.nil?\n end",
"def signed_in?\n !current_user.nil?\n end",
"def signed_in?\n !current_user.nil?\n end",
"def signed_in?\n !current_user.nil?\n end",
"def signed_in?\n !current_user.nil?\n end",
"def signed_in?\n !current_user.nil?\n end",
"def signed_in?\n !current_user.nil?\n end",
"def signed_in?\n !current_user.nil?\n end",
"def signed_in?\n !current_user.nil?\n end",
"def signed_in?\n !current_user.nil?\n end",
"def signed_in?\n !current_user.nil?\n end",
"def signed_in?\n !current_user.nil?\n end",
"def signed_in?\n !current_user.nil?\n end",
"def signed_in?\n !current_user.nil?\n end",
"def signed_in?\n !current_user.nil?\n end",
"def signed_in?\n !current_user.nil?\n end",
"def signed_in?\n !current_user.nil?\n end",
"def signed_in?\n !current_user.nil?\n end",
"def signed_in?\n !current_user.nil?\n end",
"def signed_in?\n !current_user.nil?\n end",
"def signed_in?\n !current_user.nil?\n end"
] | [
"0.66773254",
"0.53994596",
"0.52634376",
"0.5098446",
"0.5098446",
"0.4512611",
"0.4480541",
"0.44076794",
"0.44075477",
"0.438257",
"0.438257",
"0.42678478",
"0.42678478",
"0.42678478",
"0.42299217",
"0.42268968",
"0.4212942",
"0.4209724",
"0.41964656",
"0.41947728",
"0.41892177",
"0.4185396",
"0.41764885",
"0.4173055",
"0.41629574",
"0.4159014",
"0.4129849",
"0.41239816",
"0.41114497",
"0.40827054",
"0.40827054",
"0.4074915",
"0.40700787",
"0.40508568",
"0.40508568",
"0.40508568",
"0.40508568",
"0.40508568",
"0.40508568",
"0.40508568",
"0.40508568",
"0.40508568",
"0.40462926",
"0.40346897",
"0.40314046",
"0.4030171",
"0.4018815",
"0.4018059",
"0.4005756",
"0.4000714",
"0.39956424",
"0.39954585",
"0.39902705",
"0.39886183",
"0.3985217",
"0.39716592",
"0.39619794",
"0.39581144",
"0.39491567",
"0.39491567",
"0.39486107",
"0.3946432",
"0.39357352",
"0.39248437",
"0.39213544",
"0.39154595",
"0.3904595",
"0.3904101",
"0.39039087",
"0.39024875",
"0.39024875",
"0.3901968",
"0.38749734",
"0.38610685",
"0.38534832",
"0.38530487",
"0.38530487",
"0.38530487",
"0.38530487",
"0.38530487",
"0.38530487",
"0.38530487",
"0.38530487",
"0.38530487",
"0.38530487",
"0.38530487",
"0.38530487",
"0.38530487",
"0.38530487",
"0.38530487",
"0.38530487",
"0.38530487",
"0.38530487",
"0.38530487",
"0.38530487",
"0.38530487",
"0.38530487",
"0.38530487",
"0.38530487",
"0.38530487"
] | 0.70853376 | 0 |
Sets the signInAudience property value. Specifies the Microsoft accounts that are supported for the current application. The possible values are: AzureADMyOrg, AzureADMultipleOrgs, AzureADandPersonalMicrosoftAccount (default), and PersonalMicrosoftAccount. See more in the table. The value of this object also limits the number of permissions an app can request. For more information, see Limits on requested permissions per app. The value for this property has implications on other app object properties. As a result, if you change this property, you may need to change other properties first. For more information, see Validation differences for signInAudience.Supports $filter (eq, ne, not). | def sign_in_audience=(value)
@sign_in_audience = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sign_in_audience\n return @sign_in_audience\n end",
"def audience= new_audience\n @audience = new_audience\n end",
"def audience=(audience)\n self.to = audience if self.respond_to?(:to=)\n end",
"def audience= new_audience\n @grpc.audience = new_audience\n end",
"def target_audience= new_target_audience\n @target_audience = new_target_audience\n end",
"def update_audience request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_update_audience_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Analytics::Admin::V1alpha::Audience.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def audience\n @audience\n end",
"def set_AwardingAgency(value)\n set_input(\"AwardingAgency\", value)\n end",
"def update\n @audience = Audience.find(params[:id])\n\n respond_to do |format|\n if @audience.update_attributes(params[:audience])\n format.html { redirect_to @audience, notice: 'Audience was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @audience.errors, status: :unprocessable_entity }\n end\n end\n end",
"def is_usable_for_sign_in=(value)\n @is_usable_for_sign_in = value\n end",
"def audience\n @grpc.audience\n end",
"def update!(**args)\n @audience = args[:audience] if args.key?(:audience)\n @service_account_email = args[:service_account_email] if args.key?(:service_account_email)\n end",
"def update_audience_v2(audience_id, body, opts = {})\n data, _status_code, _headers = update_audience_v2_with_http_info(audience_id, body, opts)\n data\n end",
"def audiences=(value)\n @audiences = value\n end",
"def sign_in!(user)\n user.is_a?(Account) ? self.current_account = user : self.current_user = user\n end",
"def set_FundingAgency(value)\n set_input(\"FundingAgency\", value)\n end",
"def sign_in(*args)\n warden.set_user *args\n end",
"def set_claim\n @claim = Claim.new(claim_params)\n end",
"def access_consent=(value)\n @access_consent = value\n end",
"def create\n @audience = Audience.new(params[:audience])\n\n respond_to do |format|\n if @audience.save\n format.html { redirect_to @audience, notice: 'Audience was successfully created.' }\n format.json { render json: @audience, status: :created, location: @audience }\n else\n format.html { render action: \"new\" }\n format.json { render json: @audience.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @audience = args[:audience] if args.key?(:audience)\n @email = args[:email] if args.key?(:email)\n @expires_in = args[:expires_in] if args.key?(:expires_in)\n @issued_to = args[:issued_to] if args.key?(:issued_to)\n @scope = args[:scope] if args.key?(:scope)\n @user_id = args[:user_id] if args.key?(:user_id)\n @verified_email = args[:verified_email] if args.key?(:verified_email)\n end",
"def sign_in_frequency=(value)\n @sign_in_frequency = value\n end",
"def set_audience\n @campaign = Campaign.find(params[:id])\n\n if @campaign.update_attributes(params[:campaign])\n flash[:notice] = \"Has configurado la audiencia para la campaña\"\n redirect_to [:admin, @campaign]\n else\n flash.now[:error] = \"Hubo un error al configurar la audiencia de la campaña\"\n render action: :audience\n end\n end",
"def target_audience\n @target_audience\n end",
"def sign_in (user)\n current_user = user\n end",
"def signed_in\n @status = 200\n @signed_in = user_signed_in? ? true : false\n end",
"def set_APIToken(value)\n set_input(\"APIToken\", value)\n end",
"def set_APIToken(value)\n set_input(\"APIToken\", value)\n end",
"def set_APIToken(value)\n set_input(\"APIToken\", value)\n end",
"def set_APIToken(value)\n set_input(\"APIToken\", value)\n end",
"def audiences\n respond_to?(:audience) ? audience : []\n end",
"def valid_audience?(token)\n audience = token[/&?Audience=([^&]+)/, 1]\n [audiences].flatten.include?(CGI.unescape(audience))\n end",
"def update!(**args)\n @audience = args[:audience] if args.key?(:audience)\n @grant_type = args[:grant_type] if args.key?(:grant_type)\n @options = args[:options] if args.key?(:options)\n @requested_token_type = args[:requested_token_type] if args.key?(:requested_token_type)\n @scope = args[:scope] if args.key?(:scope)\n @subject_token = args[:subject_token] if args.key?(:subject_token)\n @subject_token_type = args[:subject_token_type] if args.key?(:subject_token_type)\n end",
"def mark_signed!\n @signed = true\n end",
"def set_IncludeUserEntities(value)\n set_input(\"IncludeUserEntities\", value)\n end",
"def set_IncludeUserEntities(value)\n set_input(\"IncludeUserEntities\", value)\n end",
"def set_IncludeUserEntities(value)\n set_input(\"IncludeUserEntities\", value)\n end",
"def set_IncludeUserEntities(value)\n set_input(\"IncludeUserEntities\", value)\n end",
"def set_IncludeUserEntities(value)\n set_input(\"IncludeUserEntities\", value)\n end",
"def custom_audiences(id = nil, opts = {})\n load_resource(CustomAudience, id, opts)\n end",
"def is_signed=(value)\n @is_signed = value\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end",
"def set_AccessToken(value)\n set_input(\"AccessToken\", value)\n end"
] | [
"0.54753804",
"0.54474807",
"0.54278564",
"0.5259395",
"0.46961635",
"0.46553728",
"0.4595113",
"0.4434218",
"0.44269216",
"0.44050542",
"0.43663096",
"0.434013",
"0.43375903",
"0.43068126",
"0.42865458",
"0.4219092",
"0.42098325",
"0.42030323",
"0.4146522",
"0.41220498",
"0.4114317",
"0.41088197",
"0.41081",
"0.4055809",
"0.4026726",
"0.40212348",
"0.40101716",
"0.40101716",
"0.40101716",
"0.40101716",
"0.39823148",
"0.39704004",
"0.39675438",
"0.3965631",
"0.390603",
"0.39056224",
"0.39056224",
"0.39056224",
"0.39056224",
"0.390389",
"0.38941813",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906",
"0.38896906"
] | 0.7368519 | 0 |
Gets the spa property value. Specifies settings for a singlepage application, including sign out URLs and redirect URIs for authorization codes and access tokens. | def spa
return @spa
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_settings\n settings.get\n end",
"def setting\n return @setting\n end",
"def spa=(value)\n @spa = value\n end",
"def appl_settings\n @appl_settings\n end",
"def settings\n @settings ||= get('/settings')['settings']\n end",
"def get_site_setting(site, setting = nil)\n if setting && site_settings(site) && site_settings(site)[setting.to_sym]\n site_settings(site)[setting.to_sym]\n else \n nil\n end\n end",
"def get_site_property( site_id, property_name )\n client = prepare_request( @service_wsdl )\n\n response = do_request_and_handle_errors do\n client.request :get_site_property do |soap|\n soap.body = {:sessionid => @session, :siteid => site_id, :propname => property_name}\n end\n end\n\n result = response.to_hash[:get_site_property_response][:get_site_property_return]\n\n (result.kind_of? Hash) ? (return false) : (return true)\n end",
"def get_value(property)\n if @env_properties.get_value(property)\n return @env_properties.get_value(property)\n end\n @file_properties.get_value(property)\n end",
"def redirect_uri_settings\n return @redirect_uri_settings\n end",
"def mg_uplink_settings\r\n MGUplinkSettingsController.instance\r\n end",
"def settings\n Thread.current[:shoppe_settings] ||= Shoppe::Settings.new(Shoppe::Setting.to_hash)\n end",
"def get_property\n @xml = client.call(url).parsed_response.css('property').first\n @attributes.merge!(parse_xml_to_hash)\n end",
"def user_setting_page\n\t\t@notification_settings = current_user.notification_setting\n\n\tend",
"def setting\n resource[:name].split('/', 2).last\n end",
"def settings\n CucumberSupport.current_page_settings\n end",
"def get(setting, default = nil)\n prov = backend.provider\n raise Errors::NoProviderSpecifiedError unless prov\n\n prov.get(setting, site_name, environment_name, default)\n end",
"def get_settings\n return @client.raw(\"get\", \"/config/settings\")\n end",
"def settings\n return @settings\n end",
"def settings\n return @settings\n end",
"def show\n @global_page_setting = GlobalPageSetting.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @global_page_setting }\n end\n end",
"def settings\n attributes.fetch(:settings)\n end",
"def get_sale_setting\n service_response = ClientManagement::GetSaleSetting.new(params).perform\n render_api_response(service_response)\n end",
"def show\n render json: @user_page_setting\n end",
"def primary_property\n pp = self.variant_properties.find_by(primary: true)\n pp ? pp : self.product_sku_properties.first\n end",
"def get_settings\n request :get, \"_settings\"\n end",
"def get_settings\n request :get, \"_settings\"\n end",
"def uplink_settings\r\n UplinkSettingsController.instance\r\n end",
"def profile\n @property[:profile]\n end",
"def find_user_setting\n\t\t# find the user setting\n\t\t@user = current_user.profile_setting\n\tend",
"def get_settings\n get_uri = @data['uri'] + '/settings'\n response = @client.rest_get(get_uri, {}, @api_version)\n @client.response_handler(response)\n end",
"def s(identifier)\n Setting.get(identifier)\n end",
"def s(identifier)\n Setting.get(identifier)\n end",
"def s(identifier)\n Setting.get(identifier)\n end",
"def get_settings\n get_uri = @data['uri'] + '/settings'\n response = @client.rest_get(get_uri, {}, @api_version)\n @client.response_handler(response)\n end",
"def show\n @user = current_user\n @setting = current_user.setting\n end",
"def settings\n @settings\n end",
"def setting_name\n return @setting_name\n end",
"def teams_app_settings\n return @teams_app_settings\n end",
"def load_appl_settings\n Configuration::Application::SETTINGS\n end",
"def phone_configuration\n MfaContext.new(current_user).phone_configurations.first\n end",
"def active_directory_settings\n MsRestAzure::ActiveDirectoryServiceSettings.get_azure_settings\n end",
"def redirect_uri_settings=(value)\n @redirect_uri_settings = value\n end",
"def find_user_setting\n\t\t# find the user setting\n\t\t@user = devise_current_user.profile_setting\n\tend",
"def property\n @property\n end",
"def settings\n self.class.settings\n end",
"def set_app_setting\n @app_setting = AppSetting.settings\n end",
"def primary_property\n pp = self.variant_properties.find_by(primary: true)\n pp ? pp : self.variant_properties.first\n end",
"def settings\r\n @@settings\r\n end",
"def settings\n get('/account/settings.json')\n end",
"def get_property property_name\n\n begin\n\n if property_name == ''\n raise 'Property name not specified.'\n end\n\n str_uri = $product_uri + '/words/' + @filename + '/documentProperties/' + property_name\n signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)\n\n response_stream = RestClient.get(signed_str_uri, {:accept => 'application/json'})\n\n stream_hash = JSON.parse(response_stream)\n stream_hash['Code'] == 200 ? stream_hash['DocumentProperty'] : false\n\n rescue Exception => e\n print e\n end\n\n end",
"def site_path\n settings.site_path\n end",
"def get_property property_name\n \n begin\n \n if @filename == ''\n raise 'Base file not specified.'\n end\n \n if property_name == ''\n raise 'Property name not specified.'\n end\n \n str_uri = $product_uri + '/slides/' + @filename + '/documentProperties/' + property_name\n signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)\n \n response_stream = RestClient.get(signed_str_uri,{:accept=>'application/json'})\n \n stream_hash = JSON.parse(response_stream)\n \n if(stream_hash['Code'] == 200)\n return stream_hash['DocumentProperty']\n else\n return false\n end\n \n rescue Exception=>e\n print e\n end\n \n end",
"def property(name)\n get(\"/session/#{session_id}/element/#{element_id}/property/#{name}\").value\n end",
"def get_settings\n @bridge.get_settings\n end",
"def value\n @property_hash[:value]\n end",
"def short_url\n @short_url ||= details_page.css(\"#share_a_link\").attr(\"value\").value\n end",
"def short_url\n @short_url ||= details_page.css(\"#share_a_link\").attr(\"value\").value\n end",
"def splash_settings\r\n SplashSettingsController.instance\r\n end",
"def daurl\n\t\treturn get_configuration['sa_application_url']\n end",
"def show\n redirect_to settings_app_path(@app)\n end",
"def show\n @settings = current_user.settings\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @settings }\n end\n end",
"def mg_lan_settings\r\n MGLANSettingsController.instance\r\n end",
"def saml_provider_sso_target_url\n @attributes[:saml_provider_sso_target_url]\n end",
"def set_setting\n ap @setting = Setting.first\n end",
"def get_settings\n settings = {}\n settings['sharing_scope'] = self.sharing_scope\n settings['access_type'] = self.access_type\n settings['use_custom_sharing'] = self.use_custom_sharing\n settings['use_whitelist'] = self.use_whitelist\n settings['use_blacklist'] = self.use_blacklist\n return settings\n end",
"def property_id\n @property_id ||= Avantio::PropertyId.from_avantio_ids(\n accommodation_code, user_code, login_ga\n ).property_id\n end",
"def property_id\n @property_id ||= Avantio::PropertyId.from_avantio_ids(\n accommodation_code, user_code, login_ga\n ).property_id\n end",
"def property_id\n @property_id ||= Avantio::PropertyId.from_avantio_ids(\n accommodation_code, user_code, login_ga\n ).property_id\n end",
"def current_property\n @property = Property.find(params[:id])\n end",
"def set_landing_page_config\n @landing_page_config = LandingPageConfig.find(params[:id])\n end",
"def setting_value(setting_name)\n if Setting.exists?(name: setting_name)\n setting = Setting.find_by(name: setting_name)\n setting.value.empty? ? default_setting_value(setting_name) : setting.value\n else\n default_setting_value(setting_name)\n end\n end",
"def show\n @setting = Setting.find(params[:id])\n pref_id = Station.search_pref(current_user)\n @pref = Setting.prefecture_index_show(pref_id)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @setting }\n end\n end",
"def settings\n get \"/setup/api/settings\", password_hash\n end",
"def get_property _property\n send_cmd(\"get_property #{_property}\")\n end",
"def show\n @general_setting = GeneralSetting.first\n end",
"def current_settings\n Weby::Settings\n end",
"def class_settings\n if controller.controller_name == 'settings'\n \"current\"\n end\n end",
"def saml_metadata_url\n return @saml_metadata_url\n end",
"def settings\n @settings ||= Settings.new\n end",
"def settings\n @settings ||= Settings.new\n end",
"def get_mfa_session_settings\n service_response = ClientManagement::GetMfaSessionSettings.new(params).perform\n render_api_response(service_response)\n end",
"def get_property(name, default= \"\")\n\t\treturn @transport.get_path(\"meta\",\"properties\", name) { default }\n\tend",
"def set_app_setting\n @app_setting = AppSetting.find(params[:id])\n end",
"def set_property\n @property = current_client.properties.find(params[:id])\n end",
"def saml_provider_metadata_url\n @attributes[:saml_provider_metadata_url]\n end",
"def settings\n @settings ||= OpenStruct.new(opts[:dm_config].first)\n # dm_js_location, dm_css_location\n # dm_js_location: javascripts\n # dm_css_location: stylesheets\n end",
"def to_s\n '<Twilio.Voice.V1.SettingsPage>'\n end",
"def seo_current_landing_page\n @seo_current_landing_page ||= SeoLandingPages::Model.where(slug: seo_request_path).first\n end",
"def settings\n @scope.settings\n end",
"def set_user_page_setting\n @user_page_setting = UserPageSetting.find(params[:id])\n end",
"def get_property(property, data, uri = nil, is_url: false, single: true, &block)\n values = data ? data[property] : nil\n if values.is_a?(Array)\n values = values.map { |value| get_property_value(value, is_url: is_url, &block) }\n single ? values[0] : values\n else\n value = get_property_value(values, is_url: is_url, &block)\n single ? value : [value]\n end\n end",
"def config_setting\n @config_access_name = \"config_setting\"\n @setting ||= Setting.new(ContainerAdapter.new(self))\n end",
"def setting_params\n params[:setting]\n end",
"def settings\n @settings_manager\n end",
"def app_config_key_value\n return @app_config_key_value\n end",
"def get_property property_name\n \n begin\n \n if @filename == \"\"\n raise \"Base file not specified.\"\n end\n \n if property_name == \"\"\n raise \"Property name not specified.\"\n end\n \n str_uri = $productURI + \"/words/\" + @filename + \"/documentProperties/\" + property_name\n signed_str_uri = Common::Utils.sign(str_uri)\n \n response_stream = RestClient.get(signed_str_uri,{:accept=>\"application/json\"})\n \n stream_hash = JSON.parse(response_stream)\n \n if(stream_hash[\"Code\"] == 200)\n return stream_hash[\"DocumentProperty\"]\n else\n return false\n end\n \n rescue Exception=>e\n print e\n end\n \n end",
"def site_admin\n @attributes[:site_admin]\n end",
"def site_admin\n @attributes[:site_admin]\n end",
"def sign_card_setting_detail\n self.sign_card_setting_id ? SignCardSetting.find(self.sign_card_setting_id) : nil\n end",
"def settings\n # JSONSettingDataSource.file_semaphore.synchronize do\n return @settings\n # end\n end"
] | [
"0.5921343",
"0.59077984",
"0.58852",
"0.5763956",
"0.5691002",
"0.5599317",
"0.55513316",
"0.5427233",
"0.54270005",
"0.53937095",
"0.5382936",
"0.5351722",
"0.5322982",
"0.53055406",
"0.5303136",
"0.53030145",
"0.52876216",
"0.5245059",
"0.5245059",
"0.5242669",
"0.52287143",
"0.52209324",
"0.52124333",
"0.52086294",
"0.52079487",
"0.52079487",
"0.52001435",
"0.5199465",
"0.51968086",
"0.5189715",
"0.5183671",
"0.5183671",
"0.5183671",
"0.5181125",
"0.51725113",
"0.5167836",
"0.5164592",
"0.51532394",
"0.5146031",
"0.51371807",
"0.5134671",
"0.51345265",
"0.5121595",
"0.5104495",
"0.50943834",
"0.5091348",
"0.508843",
"0.50688356",
"0.50528336",
"0.5052378",
"0.5045513",
"0.5016962",
"0.50102437",
"0.49961838",
"0.49954095",
"0.49916857",
"0.49916857",
"0.4989829",
"0.49886984",
"0.49783018",
"0.49742225",
"0.49724343",
"0.4967279",
"0.49647662",
"0.49615502",
"0.49600932",
"0.49600932",
"0.49600932",
"0.4957292",
"0.4951739",
"0.49479723",
"0.4938584",
"0.49313036",
"0.49311596",
"0.49296778",
"0.49257854",
"0.4923623",
"0.49130154",
"0.49089906",
"0.49089906",
"0.4908285",
"0.49055788",
"0.49015877",
"0.49003774",
"0.4896158",
"0.4893935",
"0.48927093",
"0.48864278",
"0.48800725",
"0.4879218",
"0.4877577",
"0.48719567",
"0.48688126",
"0.48681337",
"0.48648348",
"0.48627988",
"0.48622516",
"0.48622516",
"0.48563233",
"0.48514533"
] | 0.63674164 | 0 |
Sets the spa property value. Specifies settings for a singlepage application, including sign out URLs and redirect URIs for authorization codes and access tokens. | def spa=(value)
@spa = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def redirect_uri_settings=(value)\n @redirect_uri_settings = value\n end",
"def set_app_setting\n @app_setting = AppSetting.settings\n end",
"def set_config\n redirect\n end",
"def set_setting\n ap @setting = Setting.first\n end",
"def set_user_page_setting\n @user_page_setting = UserPageSetting.find(params[:id])\n end",
"def set_landing_page_config\n @landing_page_config = LandingPageConfig.find(params[:id])\n end",
"def set_setting\n end",
"def app_settings=(value)\n @children['app-settings'][:value] = value\n end",
"def app_settings=(value)\n @children['app-settings'][:value] = value\n end",
"def setting=(value)\n @setting = value\n end",
"def set_setting\n @setting = Setting.first\n end",
"def config_set_app_setting(document, settingName, settingValue)\n\t config_set_attribute(document, '//configuration/appSettings/add', 'key', settingName, 'value', settingValue)\n\tend",
"def set_RedirectURI(value)\n set_input(\"RedirectURI\", value)\n end",
"def set_RedirectURI(value)\n set_input(\"RedirectURI\", value)\n end",
"def setting(property, value)\n\t\tproperty + ':' + value + ';'\n\tend",
"def set_site_setting\n @site_setting = Site::Setting.api(@api_keys_array).find(params[:id])\n end",
"def set_app_setting\n @app_setting = AppSetting.find(params[:id])\n end",
"def set_Property(value)\n set_input(\"Property\", value)\n end",
"def settings=(value)\n @settings = value\n end",
"def settings=(value)\n @settings = value\n end",
"def add_property_to_site( site_id, property )\n return true if get_site_property(site_id, property[:propname])\n client = prepare_request( @service_wsdl )\n\n begin\n response = client.request :set_site_property do |soap|\n soap.body = {:sessionid => @session,\n :siteid => site_id,\n :propname => property[:propname],\n :propvalue => property[:propvalue]}\n end\n rescue ArgumentError, \"Wasabi needs a WSDL document\"\n raise StandardError, \"Incorrect login url supplied.\"\n rescue Errno::ECONNREFUSED => error\n raise \"Server doesn't seem to be there: #{error.to_s}\"\n rescue Savon::SOAP::Fault => fault\n raise fault.to_s\n end\n\n (response.to_hash[:set_site_property_response][:set_site_property_return] == \"success\") ? true : false\n end",
"def set_setting\n @setting = Setting.for_user(current_user).find(params[:id])\n end",
"def set_property\n @property = current_client.properties.find(params[:id])\n end",
"def set(settings, access_token:)\n response = post '', body: settings.to_json, query: {\n access_token: access_token\n }\n\n raise_errors(response)\n\n true\n end",
"def config=(value)\n Thread.current[:rails_amp_config] = value\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 saml_metadata_url=(value)\n @saml_metadata_url = value\n end",
"def teams_app_settings=(value)\n @teams_app_settings = value\n end",
"def spa\n return @spa\n end",
"def set_admin_landing_page\n @landing_page = LandingPage.find(params[:id])\n end",
"def setting; 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(setting, value)\n setting = setting.to_sym\n if setting == :estream\n self.estream = value\n elsif setting == :ostream\n self.ostream = value\n else\n @settings[setting.to_sym] = value\n end\n end",
"def set_resource\n @setting = Setting.first!\n end",
"def set_anatomic_site\n @anatomic_site = AnatomicSite.find(params[:id])\n end",
"def set_setting\n @o_single = Setting.find(params[:id])\n end",
"def fullpath_with_setting_slug=(fullpath)\n if fullpath && self.slug.nil?\n self.slug = File.basename(fullpath)\n end\n\n self.fullpath_without_setting_slug = fullpath\n end",
"def ssl=(value)\n conf['dashboard']['ssl'] = value\n end",
"def set_application_setting\n @application_setting = ApplicationSetting.find(params[:id])\n end",
"def set_url\n url 'set'\n end",
"def set_soa_section\n unless @soa_section = SoaSection.find(params[:id])\n flash[:alert] = 'SoaSection not found.'\n redirect_to domains_url\n end\n end",
"def set_user_setting\n @current_user.create_default_user_setting unless @current_user.user_setting\n @user_setting = @current_user.user_setting\n end",
"def automatic_user_consent_settings=(value)\n @automatic_user_consent_settings = value\n end",
"def settings\n frm.link(:text=>\"Settings\").click\n AssessmentSettings.new(@browser)\n end",
"def set_setting\n if current_user.id != params[:id].try(:to_i)\n return redirect_to settings_path(current_user.id)\n end\n @setting = Setting.find_by_user_id(params[:id])\n @user = @setting.user\n return \n end",
"def set_auth_property\n @auth_property = AuthProperty.find(params[:id])\n end",
"def set_redirect_location\n @redirect_location = @shareable\n end",
"def set_security_preference(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'SetSecurityPreference'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'https'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :enable_save_m_f_a_ticket\n\t\t\targs[:query]['EnableSaveMFATicket'] = optional[:enable_save_m_f_a_ticket]\n\t\tend\n\t\tself.run(args)\n\tend",
"def setserverurl(value)\r\n setvalue(@@SERVER_URL, value)\r\n end",
"def set_client_landing_page\n\t\t\t@client_landing_page = ClientLandingPage.find(params[:id])\n\t\tend",
"def init\n redirect_to Maestrano::Saml::Request[params[:tenant]].new(params, session).redirect_url\n end",
"def set_site_appraisal\n @site_appraisal = SiteAppraisal.find(params[:id])\n end",
"def set_property_ga\r\n @property_ga = PropertyGa.find(params[:id])\r\n end",
"def config=(value); end",
"def set_sanchaypatra\n @sanchaypatra = current_user.sanchaypatras.find(params[:id] || params[:sanchaypatra_id])\n end",
"def set_property\n @property = current_store.properties.find(params[:id])\n end",
"def set_site_page_keystore\n @site_page_keystore = SitePageKeystore.find(params[:id])\n end",
"def set_sys_property\n @sys_property = Sys::Property.account_scope.find_by_id(params[:id])\n redirect_to(action: \"index\") and return if @sys_property.blank?\n end",
"def app_url=(value)\n @app_url = value\n end",
"def set_registration_landing_page\n @registration_landing_page = RegistrationLandingPage.find(params[:id])\n end",
"def sa=(value)\n self[:sa] = value\n end",
"def sa=(value)\n self[:sa] = value\n end",
"def sa=(value)\n self[:sa] = value\n end",
"def sa=(value)\n self[:sa] = value\n end",
"def sa=(value)\n self[:sa] = value\n end",
"def sa=(value)\n self[:sa] = value\n end",
"def sa=(value)\n self[:sa] = value\n end",
"def sa=(value)\n self[:sa] = value\n end",
"def sa=(value)\n self[:sa] = value\n end",
"def sa=(value)\n self[:sa] = value\n end",
"def sa=(value)\n self[:sa] = value\n end",
"def sa=(value)\n self[:sa] = value\n end",
"def sa=(value)\n self[:sa] = value\n end",
"def sa=(value)\n self[:sa] = value\n end",
"def sa=(value)\n self[:sa] = value\n end",
"def sa=(value)\n self[:sa] = value\n end",
"def sa=(value)\n self[:sa] = value\n end",
"def sa=(value)\n self[:sa] = value\n end",
"def sa=(value)\n self[:sa] = value\n end",
"def sa=(value)\n self[:sa] = value\n end",
"def sa=(value)\n self[:sa] = value\n end",
"def sa=(value)\n self[:sa] = value\n end",
"def show\n redirect_to settings_app_path(@app)\n end",
"def set_profile\n end",
"def set_setting_by_code\n @setting = current_user.settings.where(code: params[:code]).take\n end",
"def set_user_setting\n @user_setting = UserSetting.find(params[:id])\n end",
"def sso \n sso = SingleSignOn.parse(request.query_string, DISCOURSE_CONFIG[:sso_secret])\n sso.email = current_user.email # from devise\n sso.name = \"#{current_user.first_name} #{current_user.last_name}\" # this is a custom method on the User class\n sso.username = current_user.username # from devise\n sso.external_id = current_user.id # from devise\n sso.avatar_url = current_user.avatar.url\n # sso.custom_fields[\"avatar_url\"] = current_user.avatar_url\n sso.sso_secret = DISCOURSE_CONFIG[:sso_secret]\n\n redirect_to sso.to_url(DISCOURSE_CONFIG[:sso_redirect_url])\n end",
"def user_setting_page\n\t\t@notification_settings = current_user.notification_setting\n\n\tend",
"def set_property property_name, property_value\n\n begin\n\n raise 'Property name not specified.' if property_name.empty?\n raise 'Property value not specified.' if property_value.empty?\n\n post_hash = {'Value' => property_value}\n json_data = post_hash.to_json\n\n str_uri = $product_uri + '/words/' + @filename + '/documentProperties/' + property_name\n signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)\n\n response_stream = RestClient.put(signed_str_uri, json_data, {:content_type => :json})\n\n xmldoc = REXML::Document.new(response_stream)\n\n if xmldoc.elements.to_a('SaaSposeResponse/Status').first.text == 'OK'\n return xmldoc.elements.to_a('SaaSposeResponse/DocumentProperty')\n end\n\n false\n\n rescue Exception => e\n print e\n end\n\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end"
] | [
"0.60505795",
"0.5789335",
"0.574907",
"0.5546631",
"0.5495912",
"0.54479164",
"0.5424899",
"0.53792125",
"0.53792125",
"0.53726184",
"0.536914",
"0.5319",
"0.52725166",
"0.52725166",
"0.52655566",
"0.51737934",
"0.51331186",
"0.5090533",
"0.5056888",
"0.5056888",
"0.5054236",
"0.5050665",
"0.50503427",
"0.5044227",
"0.5031251",
"0.5021221",
"0.50110996",
"0.5009031",
"0.499664",
"0.49525517",
"0.49185616",
"0.49111372",
"0.48997068",
"0.48976293",
"0.48962143",
"0.48958153",
"0.48944268",
"0.48816267",
"0.4880241",
"0.48671",
"0.48604673",
"0.48536524",
"0.48454475",
"0.48447227",
"0.4788683",
"0.4788288",
"0.47847503",
"0.47809544",
"0.47767037",
"0.4757545",
"0.47545716",
"0.47521785",
"0.4749255",
"0.47492492",
"0.4747018",
"0.47454825",
"0.47454587",
"0.47409183",
"0.47327074",
"0.47292286",
"0.47219643",
"0.47219643",
"0.47219154",
"0.47219154",
"0.47219154",
"0.47219154",
"0.47219154",
"0.47219154",
"0.47219154",
"0.47219154",
"0.47219154",
"0.47219154",
"0.47219154",
"0.47219154",
"0.47219154",
"0.47219154",
"0.47219154",
"0.47219154",
"0.47219154",
"0.47219154",
"0.47219154",
"0.47219154",
"0.47095546",
"0.47094265",
"0.46971953",
"0.46943453",
"0.46910635",
"0.46877837",
"0.4681955",
"0.4678039",
"0.4678039",
"0.4678039",
"0.4678039",
"0.4678039",
"0.4678039",
"0.4678039",
"0.4678039",
"0.4678039",
"0.4678039",
"0.4678039"
] | 0.66852075 | 0 |
Gets the synchronization property value. Represents the capability for Azure Active Directory (Azure AD) identity synchronization through the Microsoft Graph API. | def synchronization
return @synchronization
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def synchronization\n attributes.fetch(:synchronization)\n end",
"def synchronization=(value)\n @synchronization = value\n end",
"def last_synchronization\n HasRemote::Synchronization.for(self.name).last\n end",
"def sync_token\n if @carddav_backend.is_a?(Backend::SyncSupport)\n return @address_book_info['{DAV:}sync-token'] if @address_book_info.key?('{DAV:}sync-token')\n return @address_book_info['{http://sabredav.org/ns}sync-token'] if @address_book_info.key?('{http://sabredav.org/ns}sync-token')\n end\n\n nil\n end",
"def synchronization_job_settings\n return @synchronization_job_settings\n end",
"def synchronization_prevention_type\n return @synchronization_prevention_type\n end",
"def is_course_activity_sync_enabled\n return @is_course_activity_sync_enabled\n end",
"def remote_sync_other\n @attributes[:remote_sync_other]\n end",
"def sharing_capability\n return @sharing_capability\n end",
"def last_sync_date_time\n return @last_sync_date_time\n end",
"def last_sync_date_time\n return @last_sync_date_time\n end",
"def remote_sync_interval\n @attributes[:remote_sync_interval]\n end",
"def authentication\n if @property_hash[:authentication] == 'SERVER' and @resource[:authentication].upcase == 'DCS'\n return @resource[:authentication]\n else\n return @property_hash[:authentication]\n end\n end",
"def calendar_sync_enabled\n return @calendar_sync_enabled\n end",
"def on_premises_synchronization\n return @on_premises_synchronization\n end",
"def is_user_contacts_syncable?\n return get(:should_sync) == true\n end",
"def is_course_activity_sync_enabled=(value)\n @is_course_activity_sync_enabled = value\n end",
"def current_lock_value\n lock_column_name = self.class.locking_column\n has_attribute?(lock_column_name) && read_attribute(lock_column_name).to_i\n end",
"def to_param\n sync_token\n end",
"def authentication_token\n object.authentication_token if !current_user || object.id == current_user.id\n end",
"def scim_authentication_method\n @attributes[:scim_authentication_method]\n end",
"def are_synced\n where(sync_status: true).to_a\n end",
"def get_lock_id\n @lock_id\n end",
"def google_account_block_auto_sync\n return @google_account_block_auto_sync\n end",
"def authentication_method\n @attributes[:authentication_method]\n end",
"def authentication_method\n @attributes[:authentication_method]\n end",
"def insync?(is)\n if is == :true && resource[:authorization_services_enabled] == :true\n true\n elsif is == :absent && resource[:authorization_services_enabled] == :false\n true\n else\n false\n end\n end",
"def authenticating_authority\n @authenticating_authority ||= []\n end",
"def access_consent\n return @access_consent\n end",
"def notebook_document_sync\n attributes.fetch(:notebookDocumentSync)\n end",
"def sharing_capability=(value)\n @sharing_capability = value\n end",
"def capability\n return @capability\n end",
"def work_profile_data_sharing_type\n return @work_profile_data_sharing_type\n end",
"def current_access_control\n @access_control\n end",
"def is_locked\n @attributes[:is_locked]\n end",
"def to_credential_struct\n @cred_struct\n end",
"def active_person_authorization\n return @children['active-person-authorization'][:value]\n end",
"def synchronization_prevention_type=(value)\n @synchronization_prevention_type = value\n end",
"def grant_permission\n @attributes[:grant_permission]\n end",
"def sign_in_audience\n return @sign_in_audience\n end",
"def get_authentication_url\n @wll.getConsentUrl(\"Contacts.Invite\")\n end",
"def tsync=(value)\n set_attr(:tsync, value ? 1 : 0)\n @tsync = value\n end",
"def sync_token\n # Will be 'null' in the first round, and will increment ever after.\n @token\n end",
"def calendar_sync_enabled=(value)\n @calendar_sync_enabled = value\n end",
"def last_synchronize\n last_update\n end",
"def set_sync_status\n sync_status = ActiveModel::Type::Boolean.new.cast(directory_listing_params[:sync_status])\n if sync_status.nil?\n @directory_listing.update(sync_status: true)\n else\n @directory_listing.update(sync_status: sync_status)\n end\n end",
"def authenticator_token\n @authenticator ||= self.get_authenticator_token\n end",
"def syncing_get(opts = {})\n data, _status_code, _headers = syncing_get_with_http_info(opts)\n data\n end",
"def credential_authentication_inverso(h)\n [credential(h), authentication(h), inverso(h)].compact.join(\" \")\n end",
"def sync_type\n if %w(blacklist whitelist).include?(type = self['type'])\n type\n end\n end",
"def sync\n @sync ||= Sync.new self\n end",
"def sync\n @sync ||= Sync.new self\n end",
"def get_rotation\n return @rotation\n end",
"def set_sync_token\n self.sync_token = OaUtils::generate_random_key[0..7]\n end",
"def synced?\n contabilium_id.present? && ucrm_id.present?\n end",
"def permission\n Ricer::Irc::Permission.by_permission(self.permissions, authenticated?)\n end",
"def synchronization_job_settings=(value)\n @synchronization_job_settings = value\n end",
"def social_identity\n auth = request.env['omniauth.auth']\n end",
"def attributes_to_sync\n self.class.attributes_to_sync(attributes)\n end",
"def authentication_strength\n return @authentication_strength\n end",
"def txn_id\n authorization\n end",
"def synced?(record)\n record.synced?\n end",
"def on_premises_synchronization=(value)\n @on_premises_synchronization = value\n end",
"def share_id\n return @share_id\n end",
"def insync?(_is)\n case @resource['enable']\n when :true\n # If a transition should occur, the resource is not insync.\n [email protected]?\n else\n # Return true, since a disabled transition is always insync.\n true\n end\n end",
"def last_sync\n time_parser(self[:last_sync])\n end",
"def last_sync_date_time=(value)\n @last_sync_date_time = value\n end",
"def last_sync_date_time=(value)\n @last_sync_date_time = value\n end",
"def set_sync_setting\n @sync_setting = SyncSetting.find(params[:id])\n end",
"def bitlocker\n return @bitlocker\n end",
"def current_user\n authentication.account\n end",
"def sync_rate\n rtcm = RoomTypeChannelMapping.find_by_channel_id_and_room_type_id(self.channel.id, self.room_type.id)\n rtcm.sync_rate\n end",
"def capability\n one_data_response(\"CAPABILITY\").transform{ |response| response.data }\n end",
"def auth_token\n JWT.encode({ id: self.id }, '65bc368fbc69306')\n end",
"def remote_sync_ftp\n @attributes[:remote_sync_ftp]\n end",
"def current_user\n current_login_credential\n end",
"def mediaspot_set_syncing_status client\r\n\r\n\t\t# time since last sync\r\n\t\tclient['synced_ago'] = nil\r\n\t\tclient['synced_date'] = nil\r\n\t\tbegin\r\n\t\t\trepoSyncLastCompletedTime = client['RepoSyncLastCompletedTime']['_value']\r\n\t\t\tif repoSyncLastCompletedTime != '' and repoSyncLastCompletedTime != 'No Info'\r\n\t\t\t\tclient['synced_ago'] = time_ago_in_words(repoSyncLastCompletedTime, include_seconds: true) + ' ago'\r\n\t\t\t\tclient['synced_date'] = repoSyncLastCompletedTime\r\n\t\t\tend\r\n\t\trescue\r\n\t\tend\r\n\r\n\t\tlog = ''\r\n\t\tbegin\r\n\t\t\tlog = client['RepoSyncLog']['_value']\r\n\t\trescue\r\n\t\tend\r\n\r\n\t\t# is it syncing now?\r\n\t\tclient['syncing'] = false\r\n\r\n\t\tif client.key?('IsSyncing') and client['IsSyncing'].key?('_value')\r\n\r\n\t\t\tclient['syncing'] = client['IsSyncing']['_value'] == 'true' or\r\n\t\t\t\tclient['IsSyncing']['_value'] == true or\r\n\t\t\t\tclient['IsSyncing']['_value'] == 'stuck'\r\n\t\t\t\t\r\n\t\telse\r\n\t\t\tunless (log||'').strip == '' or\r\n\t\t\t\tlog.lines.last.include?('ERROR:') or\r\n\t\t\t\tlog.lines.last.include?('error:') or\r\n\t\t\t\tlog.lines.any?{|line| line.start_with?('Done.') or line.start_with?('INFO: Done.') }\r\n\t\t\t\tclient['syncing'] = true\r\n\t\t\tend\r\n\t\tend\r\n\r\n\r\n\t\t# were there an error?\r\n\t\tclient['sync_error'] = false\r\n\t\tbegin\r\n\t\t\tlastLine = log.split(\"\\n\").last\r\n\t\t\tif lastLine.include?('ERROR:') or\r\n\t\t\t\tlastLine.include?('error:')\r\n\t\t\t\tclient['sync_error'] = true\r\n\t\t\tend\r\n\t\trescue\r\n\t\tend\r\n\r\n\tend",
"def google_account_block_auto_sync=(value)\n @google_account_block_auto_sync = value\n end",
"def security_contact\n get_user security_contact_id\n end",
"def automatic_user_consent_settings\n return @automatic_user_consent_settings\n end",
"def tde_credential_arn\n @dbi.tde_credential_arn\n end",
"def tde_credential_arn\n @dbi.tde_credential_arn\n end",
"def text_document_sync\n attributes.fetch(:textDocumentSync)\n end",
"def params\n { resource: @resource, sync: @sync }.compact\n end",
"def device_account\n return @device_account\n end",
"def arm_sync\n val = wordread(:sync_arm)\n val &= ~1 # Turn off desired bit\n wordwrite(:sync_arm, val)\n wordwrite(:sync_arm, val | 1)\n wordwrite(:sync_arm, val)\n end",
"def auth_oauth_custom\n @attributes[:auth_oauth_custom]\n end",
"def authentication_token\n generate_token(:authentication_token)\n end",
"def sync_bytes_received\n @attributes[:sync_bytes_received]\n end",
"def sync_bytes_received\n @attributes[:sync_bytes_received]\n end",
"def consent_type\n return @consent_type\n end",
"def authorization_reference\n if authorization = self.order_transactions.where(action: 'authorization').and(success: true).asc(:id).first\n authorization.reference\n end\n end",
"def to_i\n @permissions\n end",
"def activity_identifier\n return @activity_identifier\n end",
"def master_property\n @data[\"master_property\"]\n end",
"def current_account_contact_ids\n current_account.added_contact_ids + current_account.mutual_contact_ids\n end",
"def identity\n return @identity\n end",
"def identity\n data = perform_get(IDENTITY_PATH)\n data || {}\n end",
"def spin\n @ob.get_spin_multiplicity\n end",
"def get_managed_care(managed_care)\n text_box managed_care.authorization_id, :at => [360, 272]\n end"
] | [
"0.7542722",
"0.62939674",
"0.5924117",
"0.5718314",
"0.5345825",
"0.5344675",
"0.52751666",
"0.5245117",
"0.5124715",
"0.50521386",
"0.50521386",
"0.50375307",
"0.50056034",
"0.49452323",
"0.49285868",
"0.49093217",
"0.49088615",
"0.49029997",
"0.48447",
"0.47811636",
"0.47707373",
"0.47686052",
"0.47629413",
"0.4709211",
"0.47031495",
"0.47031495",
"0.46759868",
"0.46557382",
"0.46117032",
"0.45374432",
"0.4534198",
"0.45264006",
"0.4522074",
"0.45177615",
"0.4509008",
"0.44973582",
"0.4477081",
"0.44745177",
"0.4460011",
"0.4448754",
"0.44421667",
"0.44417357",
"0.4436416",
"0.44264355",
"0.44151506",
"0.44136402",
"0.4409711",
"0.43998674",
"0.43715757",
"0.43678427",
"0.43656552",
"0.43656552",
"0.4363333",
"0.43448824",
"0.43399793",
"0.43394646",
"0.43390566",
"0.43340302",
"0.43211114",
"0.4311213",
"0.4301802",
"0.42922643",
"0.4287535",
"0.4286524",
"0.42797455",
"0.42757583",
"0.42732286",
"0.42732286",
"0.42676163",
"0.42543635",
"0.42522886",
"0.42517406",
"0.42508608",
"0.42489287",
"0.42418447",
"0.4241513",
"0.42391217",
"0.4236004",
"0.4233996",
"0.42326534",
"0.42281118",
"0.42281118",
"0.4223558",
"0.42205533",
"0.42174757",
"0.42149904",
"0.421443",
"0.4210187",
"0.4206881",
"0.4206881",
"0.42045602",
"0.4204376",
"0.41992247",
"0.4191865",
"0.4190462",
"0.41885242",
"0.41837487",
"0.41835997",
"0.41814625",
"0.4171802"
] | 0.64549464 | 1 |
Sets the synchronization property value. Represents the capability for Azure Active Directory (Azure AD) identity synchronization through the Microsoft Graph API. | def synchronization=(value)
@synchronization = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def synchronization\n attributes.fetch(:synchronization)\n end",
"def set_sync_status\n sync_status = ActiveModel::Type::Boolean.new.cast(directory_listing_params[:sync_status])\n if sync_status.nil?\n @directory_listing.update(sync_status: true)\n else\n @directory_listing.update(sync_status: sync_status)\n end\n end",
"def tsync=(value)\n set_attr(:tsync, value ? 1 : 0)\n @tsync = value\n end",
"def is_course_activity_sync_enabled=(value)\n @is_course_activity_sync_enabled = value\n end",
"def synchronization_job_settings=(value)\n @synchronization_job_settings = value\n end",
"def set_sync_token\n self.sync_token = OaUtils::generate_random_key[0..7]\n end",
"def sync=(arg0)\n end",
"def google_account_block_auto_sync=(value)\n @google_account_block_auto_sync = value\n end",
"def calendar_sync_enabled=(value)\n @calendar_sync_enabled = value\n end",
"def set_sync_setting\n @sync_setting = SyncSetting.find(params[:id])\n end",
"def sharing_capability=(value)\n @sharing_capability = value\n end",
"def synchronization_prevention_type=(value)\n @synchronization_prevention_type = value\n end",
"def contact_sync=(contact_sync)\n validator = EnumAttributeValidator.new('String', [\"FL\", \"LF\", \"CFL\", \"CLF\"])\n unless validator.valid?(contact_sync)\n fail ArgumentError, \"invalid value for 'contact_sync', must be one of #{validator.allowable_values}.\"\n end\n @contact_sync = contact_sync\n end",
"def i_cloud_block_document_sync=(value)\n @i_cloud_block_document_sync = value\n end",
"def on_premises_synchronization=(value)\n @on_premises_synchronization = 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_photo_stream_sync=(value)\n @i_cloud_block_photo_stream_sync = value\n end",
"def last_sync_date_time=(value)\n @last_sync_date_time = value\n end",
"def last_sync_date_time=(value)\n @last_sync_date_time = value\n end",
"def sync=(p1)\n #This is a stub, used for indexing\n end",
"def work_profile_bluetooth_enable_contact_sharing=(value)\n @work_profile_bluetooth_enable_contact_sharing = value\n end",
"def sync=(value)\n\t\t\t\tsuper\n\t\t\t\t\n\t\t\t\tcase self.protocol\n\t\t\t\twhen 0, IPPROTO_TCP\n\t\t\t\t\tself.setsockopt(IPPROTO_TCP, TCP_NODELAY, value ? 1 : 0)\n\t\t\t\telse\n\t\t\t\t\tConsole.logger.warn(self) {\"Unsure how to sync=#{value} for #{self.protocol}!\"}\n\t\t\t\tend\n\t\t\trescue Errno::EINVAL\n\t\t\t\t# On Darwin, sometimes occurs when the connection is not yet fully formed. Empirically, TCP_NODELAY is enabled despite this result.\n\t\t\trescue Errno::EOPNOTSUPP\n\t\t\t\t# Some platforms may simply not support the operation.\n\t\t\t\t# Console.logger.warn(self) {\"Unable to set sync=#{value}!\"}\n\t\t\tend",
"def arm_sync\n val = wordread(:sync_arm)\n val &= ~1 # Turn off desired bit\n wordwrite(:sync_arm, val)\n wordwrite(:sync_arm, val | 1)\n wordwrite(:sync_arm, val)\n end",
"def synchronization\n return @synchronization\n end",
"def set_AuthenticationToken(value)\n set_input(\"AuthenticationToken\", value)\n end",
"def set_AuthenticationToken(value)\n set_input(\"AuthenticationToken\", value)\n end",
"def touch_sync\n self.lastSyncAt = Time.now if self.respond_to?(:lastSyncAt=)\n end",
"def sync=\n end",
"def lock=(value)\n doc['lock'] = value\n end",
"def sync(toggle)\n self.sync_up = toggle\n self.sync_down = toggle\n end",
"def sync(params = {})\n params ||= {}\n params[:id] = @attributes[:id]\n raise MissingParameterError.new(\"Current object doesn't have a id\") unless @attributes[:id]\n raise InvalidParameterError.new(\"Bad parameter: id must be an Integer\") if params[:id] and !params[:id].is_a?(Integer)\n raise MissingParameterError.new(\"Parameter missing: id\") unless params[:id]\n\n Api.send_request(\"/sso_strategies/#{@attributes[:id]}/sync\", :post, params, @options)\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 synced_save(association)\n set_callback(\n :save,\n :after,\n if: ->(doc) { doc._syncable?(association) }\n ) do |doc|\n doc.update_inverse_keys(association)\n end\n self\n end",
"def sync=(sync)\n if sync\n @target_stream.sync = true\n MiniTest::Unit.output = @target_stream\n end\n\n super\n end",
"def mark_as_modified\r\n update_attribute :synchronized, false\r\n end",
"def set_Share(value)\n set_input(\"Share\", value)\n end",
"def activation_lock_allow_when_supervised=(value)\n @activation_lock_allow_when_supervised = value\n end",
"def mediaspot_set_syncing_status client\r\n\r\n\t\t# time since last sync\r\n\t\tclient['synced_ago'] = nil\r\n\t\tclient['synced_date'] = nil\r\n\t\tbegin\r\n\t\t\trepoSyncLastCompletedTime = client['RepoSyncLastCompletedTime']['_value']\r\n\t\t\tif repoSyncLastCompletedTime != '' and repoSyncLastCompletedTime != 'No Info'\r\n\t\t\t\tclient['synced_ago'] = time_ago_in_words(repoSyncLastCompletedTime, include_seconds: true) + ' ago'\r\n\t\t\t\tclient['synced_date'] = repoSyncLastCompletedTime\r\n\t\t\tend\r\n\t\trescue\r\n\t\tend\r\n\r\n\t\tlog = ''\r\n\t\tbegin\r\n\t\t\tlog = client['RepoSyncLog']['_value']\r\n\t\trescue\r\n\t\tend\r\n\r\n\t\t# is it syncing now?\r\n\t\tclient['syncing'] = false\r\n\r\n\t\tif client.key?('IsSyncing') and client['IsSyncing'].key?('_value')\r\n\r\n\t\t\tclient['syncing'] = client['IsSyncing']['_value'] == 'true' or\r\n\t\t\t\tclient['IsSyncing']['_value'] == true or\r\n\t\t\t\tclient['IsSyncing']['_value'] == 'stuck'\r\n\t\t\t\t\r\n\t\telse\r\n\t\t\tunless (log||'').strip == '' or\r\n\t\t\t\tlog.lines.last.include?('ERROR:') or\r\n\t\t\t\tlog.lines.last.include?('error:') or\r\n\t\t\t\tlog.lines.any?{|line| line.start_with?('Done.') or line.start_with?('INFO: Done.') }\r\n\t\t\t\tclient['syncing'] = true\r\n\t\t\tend\r\n\t\tend\r\n\r\n\r\n\t\t# were there an error?\r\n\t\tclient['sync_error'] = false\r\n\t\tbegin\r\n\t\t\tlastLine = log.split(\"\\n\").last\r\n\t\t\tif lastLine.include?('ERROR:') or\r\n\t\t\t\tlastLine.include?('error:')\r\n\t\t\t\tclient['sync_error'] = true\r\n\t\t\tend\r\n\t\trescue\r\n\t\tend\r\n\r\n\tend",
"def sync_success(timestamp = Time.now)\n logger.debug \"#{self} sync success\"\n self.last_sync = timestamp\n save!\n end",
"def sharing=(sharing)\n validator = EnumAttributeValidator.new('String', [\"sharingNone\", \"sharingMultiWriter\"])\n unless validator.valid?(sharing)\n fail ArgumentError, \"invalid value for \\\"sharing\\\", must be one of #{validator.allowable_values}.\"\n end\n @sharing = sharing\n end",
"def sharing_detection=(b)\n Ractor.current[:pp_sharing_detection] = b\n end",
"def device_sharing_allowed=(value)\n @device_sharing_allowed = value\n end",
"def gen_sw_sync\n val = wordread(:sync_arm)\n val &= ~0x10 # Turn off desired bit\n wordwrite(:sync_arm, val)\n wordwrite(:sync_arm, val | 0x10)\n wordwrite(:sync_arm, val)\n end",
"def sync(&b)\n @m.synchronize &b\n end",
"def sync= sync_list\n cur_list = sync \n @removed_from_sync_list = cur_list[:with] - sync_list[:with] if sync_list[:with] && cur_list[:with]\n sync_list[:with] = sync_list[:with].select{|id| id != self.campaign_id } if sync_list[:with]\n super(sync_list.to_json)\n end",
"def stamp_sync_remote_user(t)\n machine = RemoteMachine.find(session[:machine].id)\n machine.last_synced = t || -1\n machine.update\n rescue => e\n raise \"Error assigning new last_synced timestamp. #{e.inspect}\"\n end",
"def socket_sync=(socket_sync)\n @session_manager.socket_sync = socket_sync\n end",
"def perform(organization_id, opts = {})\n organization = Maestrano::Connector::Rails::Organization.find(organization_id)\n return unless organization&.sync_enabled\n\n # Check if previous synchronization is still running\n if Maestrano::Connector::Rails::Synchronization.where(organization_id: organization.id, status: 'RUNNING').where(created_at: (30.minutes.ago..Time.now.utc)).exists?\n Maestrano::Connector::Rails::ConnectorLogger.log('info', organization, 'Synchronization skipped: Previous synchronization is still running')\n return\n end\n\n # Check if recovery mode: last 3 synchronizations have failed\n if !opts[:forced] && organization.last_three_synchronizations_failed? \\\n && organization.synchronizations.order(created_at: :desc).limit(1).first.updated_at > 1.day.ago\n Maestrano::Connector::Rails::ConnectorLogger.log('info', organization, 'Synchronization skipped: Recovery mode (three previous synchronizations have failed)')\n return\n end\n\n # Trigger synchronization\n Maestrano::Connector::Rails::ConnectorLogger.log('info', organization, \"Start synchronization, opts=#{opts}\")\n current_synchronization = Maestrano::Connector::Rails::Synchronization.create_running(organization)\n\n begin\n last_synchronization = organization.last_successful_synchronization\n last_synchronization_date = organization.last_synchronization_date\n connec_client = Maestrano::Connector::Rails::ConnecHelper.get_client(organization)\n external_client = Maestrano::Connector::Rails::External.get_client(organization)\n\n # First synchronization should be from external to Connec! only to let the smart merging works\n # We do a doube sync: only from external, then only from connec!\n # We also do batched sync as the first one can be quite huge\n if last_synchronization.nil?\n Maestrano::Connector::Rails::ConnectorLogger.log('info', organization, 'First synchronization ever. Doing two half syncs to allow smart merging to work its magic.')\n organization.synchronized_entities.each do |entity, settings|\n next unless settings[:can_push_to_connec] || settings[:can_push_to_external]\n\n Maestrano::Connector::Rails::ConnectorLogger.log('info', organization, \"First synchronization ever. Doing half sync from external for #{entity}.\")\n first_sync_entity(entity.to_s, organization, connec_client, external_client, last_synchronization_date, opts, true)\n Maestrano::Connector::Rails::ConnectorLogger.log('info', organization, \"First synchronization ever. Doing half sync from Connec! for #{entity}.\")\n first_sync_entity(entity.to_s, organization, connec_client, external_client, last_synchronization_date, opts, false)\n end\n elsif opts[:only_entities]\n Maestrano::Connector::Rails::ConnectorLogger.log('info', organization, \"Synchronization is partial and will synchronize only #{opts[:only_entities].join(' ')}\")\n # The synchronization is marked as partial and will not be considered as the last-synchronization for the next sync\n current_synchronization.mark_as_partial\n opts[:only_entities].each do |entity|\n sync_entity(entity, organization, connec_client, external_client, last_synchronization_date, opts)\n end\n else\n organization.synchronized_entities.each do |entity, settings|\n next unless settings[:can_push_to_connec] || settings[:can_push_to_external]\n\n sync_entity(entity.to_s, organization, connec_client, external_client, last_synchronization_date, opts)\n end\n end\n\n Maestrano::Connector::Rails::ConnectorLogger.log('info', organization, \"Finished synchronization, organization=#{organization.uid}, status=success\")\n current_synchronization.mark_as_success\n rescue => e\n Maestrano::Connector::Rails::ConnectorLogger.log('warn', organization, \"Finished synchronization, organization=#{organization.uid}, status=error, message=\\\"#{e.message}\\\" backtrace=\\\"#{e.backtrace}\\\"\")\n current_synchronization.mark_as_error(e.message)\n end\n end",
"def credential=(value)\n @children['credential'][:value] = value\n end",
"def lock_type=(val)\n @lock_type = val.to_sym\n end",
"def set_claim_syn\n @claim_syn = ClaimSyn.find(params[:id])\n end",
"def automatic_user_consent_settings=(value)\n @automatic_user_consent_settings = value\n end",
"def set_client_sync\n @client_sync = ClientSync.where(id: params[:id]).first\n client_sync_hash()\n end",
"def attach(instance)\n synchronization_id = instance.record.SynchronizationId__c\n return unless synchronization_id\n\n database_model, record_id = parsed_uuid(synchronization_id)\n return unless valid_model?(database_model)\n\n # If the instance is already synchronized, then we just want to wipe the\n # Synchronization ID and proceed to the next instance.\n if instance.synced?\n instance.update!(\"SynchronizationId__c\" => nil)\n return\n end\n\n record = @mapping.database_model.find_by(\n id: record_id,\n @mapping.lookup_column => nil,\n )\n\n if record\n attach_to = Instances::ActiveRecord.new(@mapping.database_model, record, @mapping)\n attach_to.update!(@mapping.lookup_column => instance.id)\n end\n\n instance.update!(\"SynchronizationId__c\" => nil)\n rescue Faraday::Error::ClientError => e\n DB.logger.error(SynchronizationError.new(e, instance))\n end",
"def synchronize\n\n # individual settings are done e.g. in customers_controller.rb#deprovision\n @partentTargets = nil if @partentTargets.nil? \n\n @async_all = true if @async && @async_all.nil?\n @async_individual = true if @async && @async_individual.nil?\n\n @recursive_all = false if @recursive_all.nil?\n @recursive_individual = true if @recursive_individual.nil?\n\n if @async_all\n being_all = \"being \"\n else\n being_all = \"\"\n end\n\n if @async_individual\n being_individual = \"being \"\n else\n being_individual = \"\"\n end\n \n #raise ENV[\"WEBPORTAL_SYNCHRONIZE_ALL_ABORT_ON_ABORT\"].inspect\n #raise (!@async_all).inspect\n if ENV[\"WEBPORTAL_SYNCHRONIZE_ALL_ABORT_ON_ABORT\"] == \"true\" || @async_all\n # in case of asynchronous synchronization, we always allow to abort on abort, since this will trigger delayed_job to retry\n # in case of synchronous synchronization, we allow to abort on abort only, if WEBPORTAL_SYNCHRONIZE_ALL_ABORT_ON_ABORT is set to \"true\"\n @abortOnAbort = true\n else\n # in case of synchronous synchronization and WEBPORTAL_SYNCHRONIZE_ALL_ABORT_ON_ABORT is not set to \"true\", we proceed even after an abort (e.g. if a target is unreachable, other targets will still be synchronized)\n @abortOnAbort = false\n end\n #raise @abortOnAbort.inspect\n\n # note: @id needs to be set in the individual child classes (e.g. Customer/Site/User)\n if @id.nil?\n #\n # PATCH /customers/synchronize\n #\n # if @id is nil, we assume that all Customers/Sites/Users needs to be synchronized:\n\n @myClass.synchronizeAll(@partentTargets, @async_all, @recursive_all, @abortOnAbort)\n redirect_to :back, notice: \"All #{@myClass.name.pluralize} are #{being_all}synchronized.\"\n else\n #\n # PATCH /customers/1/synchronize\n #\n # if @id is not nil, an individual Customer/Site/User with id==@id is synchronized:\n \n @provisioningobject = @myClass.find(@id)\n @provisioningobject.synchronize(@async_individual, @recursive_individual)\n redirect_to :back, notice: \"#{@provisioningobject.class.name} #{@provisioningobject.name} is #{being_individual}synchronized.\"\n end\n end",
"def can_share=(value)\n @can_share = value\n end",
"def set_wo_lock(obj)\n @obj = obj\n end",
"def bitlocker=(value)\n @bitlocker = value\n end",
"def authorization=(auth)\n write_attribute(column_for_attribute('authorization').name, auth)\n end",
"def is_shared=(value)\n @is_shared = value\n end",
"def perform(organization, opts)\n return unless organization.sync_enabled\n\n # Check if previous synchronization is still running\n if Synchronization.where(organization_id: organization.id, status: 'RUNNING').where(created_at: (30.minutes.ago..Time.now)).exists?\n ConnectorLogger.log('info', organization, \"Synchronization skipped: Previous synchronization is still running\")\n return\n end\n\n # Check if recovery mode: last 3 synchronizations have failed\n if !opts[:forced] && organization.last_three_synchronizations_failed? \\\n && organization.synchronizations.order(created_at: :desc).limit(1).first.updated_at > 1.day.ago\n ConnectorLogger.log('info', organization, \"Synchronization skipped: Recovery mode (three previous synchronizations have failed)\")\n return\n end\n\n # Trigger synchronization\n ConnectorLogger.log('info', organization, \"Start synchronization, opts=#{opts}\")\n current_synchronization = Synchronization.create_running(organization)\n\n begin\n last_synchronization = organization.last_successful_synchronization\n connec_client = Maestrano::Connec::Client[organization.tenant].new(organization.uid)\n external_client = External.get_client(organization)\n\n if opts[:only_entities]\n ConnectorLogger.log('info', organization, \"Synchronization is partial and will synchronize only #{opts[:only_entities].join(' ')}\")\n # The synchronization is marked as partial and will not be considered as the last-synchronization for the next sync\n current_synchronization.set_partial\n opts[:only_entities].each do |entity|\n sync_entity(entity, organization, connec_client, external_client, last_synchronization, opts)\n end\n else\n organization.synchronized_entities.select{|k, v| v}.keys.each do |entity|\n sync_entity(entity.to_s, organization, connec_client, external_client, last_synchronization, opts)\n end\n end\n\n ConnectorLogger.log('info', organization, \"Finished synchronization, organization=#{organization.uid}, status=success\")\n current_synchronization.set_success\n rescue => e\n ConnectorLogger.log('info', organization, \"Finished synchronization, organization=#{organization.uid}, status=error, message=#{e.message} backtrace=#{e.backtrace.join(\"\\n\\t\")}\")\n current_synchronization.set_error(e.message)\n end\n end",
"def work_profile_data_sharing_type=(value)\n @work_profile_data_sharing_type = value\n end",
"def set_AllowShare(value)\n set_input(\"AllowShare\", value)\n end",
"def set_client_contact_sync\n @client_contact_sync = ClientContactSync.where(id: params[:id]).first\n client_contact_sync_hash()\n end",
"def set_activity_participant\n @activity_participant = current_user\n end",
"def share_id=(value)\n @share_id = value\n end",
"def set_calendar_sync\n @calendar_sync = CalendarSync.find(params[:id])\n end",
"def set_manifestation_custom_property\n @manifestation_custom_property = ManifestationCustomProperty.find(params[:id])\n authorize @manifestation_custom_property\n end",
"def b2b_collaboration_inbound=(value)\n @b2b_collaboration_inbound = value\n end",
"def synchronization_prevention_type\n return @synchronization_prevention_type\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 is_mac_sync_app_enabled=(value)\n @is_mac_sync_app_enabled = value\n end",
"def is_locked=(value)\n @is_locked = value\n end",
"def bearing=(val)\n self[:bearing] = sanitize_bearing(val)\n end",
"def set_CollaborationID(value)\n set_input(\"CollaborationID\", value)\n end",
"def set_CollaborationID(value)\n set_input(\"CollaborationID\", value)\n end",
"def set_CollaborationID(value)\n set_input(\"CollaborationID\", value)\n end",
"def authentication=(authentication)\n validator = EnumAttributeValidator.new('String', ['N', 'S', 'M'])\n unless validator.valid?(authentication)\n fail ArgumentError, 'invalid value for \"authentication\", must be one of #{validator.allowable_values}.'\n end\n @authentication = authentication\n end",
"def sharing_domain_restriction_mode=(value)\n @sharing_domain_restriction_mode = value\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.windowsInformationProtection\"\n end",
"def synchronize(mapping)\n Synchronizer.new(mapping).run(@changes)\n end",
"def is_user_contacts_syncable?\n return get(:should_sync) == true\n end",
"def merge_requests_enabled=(value)\n write_feature_attribute_boolean(:merge_requests_access_level, value)\n end",
"def set_CollaborationID(value)\n set_input(\"CollaborationID\", value)\n end",
"def set_CollaborationID(value)\n set_input(\"CollaborationID\", value)\n end",
"def sync_setting_params\n params.require(:sync_setting).permit(:job_name, :schedule, :schedule_period, :schedule_time, :last_sync)\n end",
"def sync_token\n if @carddav_backend.is_a?(Backend::SyncSupport)\n return @address_book_info['{DAV:}sync-token'] if @address_book_info.key?('{DAV:}sync-token')\n return @address_book_info['{http://sabredav.org/ns}sync-token'] if @address_book_info.key?('{http://sabredav.org/ns}sync-token')\n end\n\n nil\n end",
"def air_play_force_pairing_password_for_outgoing_requests=(value)\n @air_play_force_pairing_password_for_outgoing_requests = value\n end",
"def mon_synchronize(&b)\n @mon_data.synchronize(&b)\n end",
"def i_cloud_block_activity_continuation=(value)\n @i_cloud_block_activity_continuation = value\n end",
"def siri_blocked_when_locked=(value)\n @siri_blocked_when_locked = value\n end",
"def sync\n @sync ||= Sync.new self\n end",
"def sync\n @sync ||= Sync.new self\n end",
"def client_contact_sync_params\n params.require(:client_contact_sync).permit(:client_contact_id, :acc_system_id, :time_stamp)\n end",
"def sync_token\n # Will be 'null' in the first round, and will increment ever after.\n @token\n end",
"def old_sync=(_arg0); end",
"def enable_on_behalf_requestors_to_update_access=(value)\n @enable_on_behalf_requestors_to_update_access = value\n end",
"def last_synchronization\n HasRemote::Synchronization.for(self.name).last\n end",
"def to_param\n sync_token\n end",
"def bit_locker_enabled=(value)\n @bit_locker_enabled = value\n end"
] | [
"0.6427624",
"0.6031918",
"0.60266083",
"0.56633145",
"0.5512804",
"0.5512557",
"0.5496163",
"0.5496112",
"0.54396945",
"0.5433727",
"0.5398089",
"0.5316536",
"0.5260434",
"0.5241888",
"0.5177468",
"0.5157971",
"0.5122583",
"0.50537753",
"0.50537753",
"0.50092834",
"0.49882513",
"0.49082467",
"0.48337048",
"0.48312727",
"0.47622356",
"0.47622356",
"0.4661823",
"0.4643964",
"0.46223968",
"0.46107966",
"0.4592221",
"0.4576869",
"0.45748",
"0.45567113",
"0.45563465",
"0.45547464",
"0.45447722",
"0.45329994",
"0.45186025",
"0.45053586",
"0.44874698",
"0.44791433",
"0.44655344",
"0.44631863",
"0.4455375",
"0.44522882",
"0.4450746",
"0.44486213",
"0.44428268",
"0.44352257",
"0.443355",
"0.44310236",
"0.4428862",
"0.44171092",
"0.44164607",
"0.441579",
"0.44145852",
"0.441172",
"0.44091895",
"0.44050208",
"0.44029942",
"0.4388981",
"0.43865427",
"0.43840784",
"0.43813223",
"0.4379046",
"0.4368814",
"0.43668213",
"0.4348991",
"0.4338733",
"0.4331754",
"0.4331067",
"0.43293622",
"0.43208894",
"0.43116224",
"0.43116224",
"0.43116224",
"0.42981187",
"0.428899",
"0.42744377",
"0.4274299",
"0.42727986",
"0.4272429",
"0.4266972",
"0.4266972",
"0.4261293",
"0.42539942",
"0.4251642",
"0.42497355",
"0.4243943",
"0.42423692",
"0.4241786",
"0.4241786",
"0.4238264",
"0.42342255",
"0.42331114",
"0.42260605",
"0.4225582",
"0.4225368",
"0.42251194"
] | 0.76964325 | 0 |
Gets the tags property value. Custom strings that can be used to categorize and identify the application. Not nullable. Strings added here will also appear in the tags property of any associated service principals.Supports $filter (eq, not, ge, le, startsWith) and $search. | def tags
return @tags
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tags\n attributes.fetch(:tags)\n end",
"def tags\n attributes.fetch(:tags)\n end",
"def tags\n attributes[:tags] || []\n end",
"def tags\n\t\tt = read_attribute(:tags)\n\t\tt.nil? ? \"\" : t.join(', ')\n\tend",
"def tags\n data[:tags]\n end",
"def tags\n data[:tags]\n end",
"def tags\n data[:tags]\n end",
"def tags\n data[:tags]\n end",
"def tags\n data[:tags]\n end",
"def tags\n @obj['tags']\n end",
"def tags=(value)\n @tags = value\n end",
"def tags=(value)\n @tags = value\n end",
"def tags=(value)\n @tags = value\n end",
"def tags\n @values.fetch('tags') { \n @values['tags'] = {}\n }\n end",
"def tags\n normal[:tags] = Array(normal[:tags])\n normal[:tags]\n end",
"def tags\n tags = get_user_tags\n # prevents resource from being applied on every run if clearing tags with ''\n tags = [''] if tags == []\n tags\n end",
"def tags()\n\t\t\treturn @metadata.attributes[:tags].to_a\n\t\tend",
"def tags\n ['any'] + @tags\n end",
"def tags\n ['any'] + @tags\n end",
"def tags\n @data['tags']\n end",
"def getTags\r\n\t\t\t\t\treturn @tags\r\n\t\t\t\tend",
"def tag(tags = self.tags)\n tags.to_s.split(/\\s*,\\s*/).uniq\n end",
"def tags\n get('tags')\n end",
"def tags\n response[\"tags\"]\n end",
"def tag_names\n @tag_names || tags.map(&:name).join(',')\n end",
"def tags_names\n\t\t@tags_names ||= self.tags.nil? ? '' : self.tags.collect(&:name).join(' ')\n\tend",
"def tags\n @tags ||= []\n end",
"def tags\r\n return @tags if @tags\r\n\r\n if @options.has_key? :only\r\n @tags = convert_methods(@options[:only])\r\n elsif @options.has_key? :except\r\n @tags = @@tag_titles.keys - convert_methods(@options[:except])\r\n else\r\n @tags = @@tag_titles.keys\r\n end\r\n\r\n @tags\r\n end",
"def tags\n self.new_record? ? '' : Tag.get_friendly_tags(self)\n end",
"def tags\n Types::Tags.deserialize(@tags)\n end",
"def tags\n get.tagGuids\n end",
"def tags_string\n tags.map(&:name).join(\" \")\n end",
"def tags=(tags)\n @tags = \n case tags\n when String\n tags\n when Array\n tags.map(&:to_s).join(',')\n end\n @tags\n end",
"def tag_names\n self.tags.map(&:name).join(\", \")\n end",
"def tagging_tags\n filtered_tags(:tagtype_x => [11, :Collection, :List])\n end",
"def tag_names\n @tag_names ||= tags.map(&:name).join(' ')\n end",
"def tags\n object.tags.each do |tag|\n tag.name\n end\n end",
"def tags\n @tags ||= []\n end",
"def user_tags\n return @user_tags\n end",
"def tags\n @tags ||= get(\"/repos/show/#{owner.login}/#{name}/tags\")['tags']\n end",
"def tags\n @attributes.select { |k, _| tag_names.include?(k.to_s) }\n end",
"def tags\n if new?\n @fake_tags || []\n else\n @tags ||= tags_dataset.all\n end\n end",
"def aws_tags_list\n @aws.tags\n end",
"def tags\n @values.keys.map { |key| @tag_names[key] }\n end",
"def tag_names\n self.tags.map{ |t| t.name }.join(\", \")\n end",
"def tags\n Tags.new(@tags)\n end",
"def tags\n article_tags = data.tags || data.tag\n \n if article_tags.is_a? String\n article_tags.split(',').map(&:strip)\n else\n Array(article_tags).map(&:to_s)\n end \n end",
"def tags=(value)\n if value == @defaults['tags']\n @values.delete 'tags' if @values.key? 'tags'\n else\n @values['tags'] = value\n end\n end",
"def tags(options={})\n self.class.parse_tags(request(singular(user_id) + \"/tags\", options))\n end",
"def tags_field\n try_until -> { @tags_field } do\n send_message(Protocol::Device::GetTags.new)\n end\n @tags_field\n end",
"def tags=(value)\n if value.kind_of?(String)\n @tags = value.split(\",\").uniq.map(&:strip)\n elsif value.kind_of?(Array)\n @tags = value.uniq.map(&:strip)\n end\n end",
"def tags\n @values.keys.map {|tag| Values.tag_map[tag]}\n end",
"def tags(*tags)\n if tags.size == 0\n attribute('tags')\n else\n tags = tags[0] if tags.size == 1 && tags[0].kind_of?(Array)\n attribute 'tags', tags.map { |tag| tag.to_s }\n end\n end",
"def tags(*tags)\n @_tags = tags unless tags.empty?\n @_tags\n end",
"def skill_tags=(value)\n @skill_tags = value\n end",
"def tag_list\n\t\tself.tags.map(&:name).join(\", \")\n\tend",
"def tags\n @tags ||= ApiFactory.new 'GitData::Tags'\n end",
"def tags\n @fields.tag_list\n end",
"def tags\n @tags ||= Fotolia::Tags.new(self)\n end",
"def tagNames\n @options[:tagNames] ||= fetch(:tagNames)\n end",
"def tag(*tags)\n attribute 'tags' do |existing_tags|\n existing_tags ||= []\n tags.each do |tag|\n if !existing_tags.include?(tag.to_s)\n existing_tags << tag.to_s\n end\n end\n existing_tags\n end\n end",
"def _tagging\n t_tagging[:tag_id].in(self.tags) unless self.tags.length == 0\n end",
"def tag_list\n self.tags.collect do |tag|\n tag.name\n end.join(\", \")\n end",
"def tags\n Tags.new(self)\n end",
"def tag_list\n\t\t@tag_list ||= self.tags.map { |tag| tag.name }.join(', ')\n\tend",
"def tags_from_params\n search_filter_params[:tagged_with].to_s.split(\",\")\n end",
"def tags\n @tags ||= tags_from_collection.merge(tags_from_item).values.select(&:release)\n end",
"def tags\n\t\tresponse = self.server.run_with_json_template( :tags )\n\t\treturn response.flatten.map {|tag| Hglib::Repo::Tag.new(self, **tag) }\n\tend",
"def tags\n @vpc.tags\n end",
"def tags\n article_tags = data['tags']\n\n if article_tags.is_a? String\n article_tags.split(',').map(&:strip)\n else\n Array(article_tags).map(&:to_s)\n end\n end",
"def tagged\n taggings.collect(&:taggable)\n end",
"def tags=(value)\n @tags = value.is_a?(String) ? value.gsub(', ', ',').split(',') : value\n end",
"def all_tags\n self.tags.map(&:name).join(\", \")\n end",
"def all_tags\n self.tags.map(&:name).join(\", \")\n end",
"def all_tags\n self.tags.map(&:name).join(\", \")\n end",
"def user_tags=(value)\n @user_tags = value\n end",
"def tag_list\n self.tags.collect do |tag|\n tag.name\n end.join(\", \")\n end",
"def tags() ; info[:tags] ; end",
"def tags() ; info[:tags] ; end",
"def product_tags\n self.tag_list.join(\", \")\n end",
"def tagged_with(_tags)\n _tags = convert_string_tags_to_array(_tags) if _tags.is_a? String\n criteria.all_in(tags_field => _tags)\n end",
"def _get_tags(tag)\n tags = if tag.attr['tags'] && !tag.attr['tags'].blank?\n Tag.from_list(tag.attr['tags'], false) # false parameter -> not to create missing tags\n elsif tag.locals.page.respond_to?(:requested_tags)\n tag.locals.page.requested_tags\n elsif tag.locals.page\n tag.locals.page.attached_tags.visible\n else\n []\n end\n tag.locals.tags = tags.uniq.compact\n end",
"def user_tags\n self.tag_list.join(\" , \")\n end",
"def tags\n tags = nil\n\n # Jekyll v3 has it in data, while v2 have it at the root\n if @file.data.key?('tags')\n tags = @file.data['tags']\n elsif @file.respond_to? :tags\n tags = @file.tags\n end\n\n return tags if tags.nil?\n\n # Anyway, we force cast it to string as some plugins will extend the tags to\n # full featured objects\n tags.map(&:to_s)\n end",
"def tags\n entries = Entry.all\n # Create a list of all the tags, as a String\n tags_list = String.new\n entries.each do |entry|\n tags_list << entry.tags + \" \"\n end\n # Convert the String to a global array, removing the duplicate elements\n $tags_array = tags_list.split.uniq\n end",
"def tags=(value)\n\t\t#Rails.logger.info(\">>>TAGS===: #{value}\")\n\t\twrite_attribute(:tags, value.split(/\\W+/))\n\tend",
"def tags_text\n\t\tself.tags.join(', ') #convertir el arreglo en una cadena de texto separado por ,\n\tend",
"def tags\n _get(\"/query/image/tags\") { |json| json }\n end",
"def tags\n @stack.tags\n end",
"def tags\n @tags ||= tag_class.in_challenge(collection).group(:id)\n end",
"def tag_list\n tags.map(&:name).join(\", \")\n end",
"def tag_list\n\t\tself.tags.collect do |tag|\n\t\t\ttag.name\n\t\tend.join(\", \") #When we joined the array Ruby called the default #to_s method on every one of these Tag instances \n\tend",
"def tag_names\n # only return the name from the associated tag object\n object.tags.map(&:name)\n end",
"def current_tags\n\t\t@tags ||= qualities.pluck(:name)\n\tend",
"def tag_names\n self.entity_tags.map(&:tag).map(&:name)\n end",
"def added_tags\n @added_tags\n end",
"def added_tags=(value)\n @added_tags = value\n end",
"def tags\n self.lib.tags.map { |r| tag(r) }\n end"
] | [
"0.6982453",
"0.6982453",
"0.6944779",
"0.69132215",
"0.67882276",
"0.67882276",
"0.67882276",
"0.67882276",
"0.67882276",
"0.67822677",
"0.6767291",
"0.6767291",
"0.6767291",
"0.66563827",
"0.66306293",
"0.66230714",
"0.6610666",
"0.65514666",
"0.65514666",
"0.6550959",
"0.6538422",
"0.6485128",
"0.64683425",
"0.64653057",
"0.64508426",
"0.6442831",
"0.64285374",
"0.6424308",
"0.6418408",
"0.64094007",
"0.6392193",
"0.6365315",
"0.6354882",
"0.6353961",
"0.6350739",
"0.6344676",
"0.63420475",
"0.6317583",
"0.6317493",
"0.6287991",
"0.62783587",
"0.627511",
"0.62617886",
"0.62538177",
"0.623691",
"0.6234096",
"0.62066287",
"0.6192298",
"0.616904",
"0.61676604",
"0.6159769",
"0.6155485",
"0.6151181",
"0.6133016",
"0.61304265",
"0.6127862",
"0.61242473",
"0.611454",
"0.60969585",
"0.6091998",
"0.6082699",
"0.6078939",
"0.6054854",
"0.6049804",
"0.6048868",
"0.60407144",
"0.60324323",
"0.6031859",
"0.6027658",
"0.6025091",
"0.60131776",
"0.60116404",
"0.6010301",
"0.6010301",
"0.6010301",
"0.6010054",
"0.60056245",
"0.60000867",
"0.60000867",
"0.59999394",
"0.59994966",
"0.599559",
"0.5993891",
"0.59879786",
"0.59745204",
"0.5974125",
"0.5957901",
"0.5947485",
"0.5936053",
"0.5933774",
"0.5930759",
"0.59254473",
"0.5918379",
"0.5916479",
"0.59148955",
"0.5905678",
"0.58936626",
"0.5886594"
] | 0.6643961 | 16 |
Sets the tags property value. Custom strings that can be used to categorize and identify the application. Not nullable. Strings added here will also appear in the tags property of any associated service principals.Supports $filter (eq, not, ge, le, startsWith) and $search. | def tags=(value)
@tags = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tags=(value)\n if value == @defaults['tags']\n @values.delete 'tags' if @values.key? 'tags'\n else\n @values['tags'] = value\n end\n end",
"def tags=(tags)\n @tags = \n case tags\n when String\n tags\n when Array\n tags.map(&:to_s).join(',')\n end\n @tags\n end",
"def tags=(value)\n\t\t#Rails.logger.info(\">>>TAGS===: #{value}\")\n\t\twrite_attribute(:tags, value.split(/\\W+/))\n\tend",
"def tags=(value)\n\t\t\traise Bibmix::ReferenceError.new(\"Tags have invalid type (#{value.class}, #{value})\") if value.class != Hash\n\t\t\t@tags = value\n\t\tend",
"def tags=(tags)\n assert_unloaded\n @tags = names_to_tags(tags)\n end",
"def tags=(tags)\n @tags = tags.map { |name| Tag.new(:name => name) }\n end",
"def tags=(tags)\n @tags = tags.map { |name| Tag.new(:name => name) }\n end",
"def setTags(tags)\r\n\t\t\t\t\t@tags = tags\r\n\t\t\t\tend",
"def filtered_tags=(filtered_tags)\n assert_unloaded\n @filtered_tags = names_to_tags(filtered_tags)\n end",
"def set_tags(tags)\n @tags.update(tags)\n end",
"def tags=(value)\n @tags = value.is_a?(String) ? value.gsub(', ', ',').split(',') : value\n end",
"def user_tags=(value)\n @user_tags = value\n end",
"def set_tags(given_tags = {})\n @tags.merge!(given_tags)\n end",
"def set_Tags(value)\n set_input(\"Tags\", value)\n end",
"def set_Tags(value)\n set_input(\"Tags\", value)\n end",
"def set_Tags(value)\n set_input(\"Tags\", value)\n end",
"def set_Tags(value)\n set_input(\"Tags\", value)\n end",
"def set_Tags(value)\n set_input(\"Tags\", value)\n end",
"def set_Tags(value)\n set_input(\"Tags\", value)\n end",
"def tag(tags)\n tags.each do |key, value|\n @tags[key.to_s] = value\n end\n end",
"def added_tags=(value)\n @added_tags = value\n end",
"def tags=(value)\n if value.kind_of?(String)\n @tags = value.split(\",\").uniq.map(&:strip)\n elsif value.kind_of?(Array)\n @tags = value.uniq.map(&:strip)\n end\n end",
"def product_tags=(values)\n self.tag_list = values\n end",
"def tags_to_add=(value)\n @tags_to_add = value\n end",
"def skill_tags=(value)\n @skill_tags = value\n end",
"def tag_list=(tags_string)\n tag_names = tags_string.split(\",\").collect{|s| s.strip.downcase}.uniq\n new_or_found_tags = tag_names.collect { |name| Tag.find_or_create_by(name: name) }\n self.tags = new_or_found_tags\n end",
"def tags=(value)\n value = value.split(',') if value.is_a?(String)\n\n write_attribute(:tags, Taggable.sanitize_tag_list(Array(value)))\n end",
"def set_tag(key, value)\n sanitized_value = valid_tag_value?(value) ? value : value.to_s\n @tags = @tags.merge(key.to_s => sanitized_value)\n end",
"def tag_list=(tags_string)\n tag_names = tags_string.split(\",\").collect{|s| s.strip.downcase}.uniq\n new_or_found_tags = tag_names.collect { |name| Tag.find_or_create_by(name: name) }\n self.tags = new_or_found_tags\n end",
"def tag_list=(tags_string)\n tag_names = tags_string.split(/[\\s,\",\"]/).map{ |s| s.strip.downcase }.uniq\n new_or_found_tags = tag_names.map { |name| Tag.find_or_create_by(name: name) }\n self.tags = new_or_found_tags\n end",
"def tag_list=(tags_string)\n tag_names = tags_string.split(\",\").map{ |s| s.strip.downcase }.uniq\n new_or_found_tags = tag_names.map { |name| Tag.find_or_create_by(name: name) }\n self.tags = new_or_found_tags\n end",
"def set_tags(tags)\n self.tags = tags.map.each do |tag|\n Tag.find_or_create_by_name tag\n end\n end",
"def tags(*tags)\n @_tags = tags unless tags.empty?\n @_tags\n end",
"def tag_names=(tags=[])\n self.entity_tags = tags.map do |name|\n tag = Tag.find_or_initialize_by name: name\n self.entity_tags.new(tag: tag)\n end\n end",
"def tags\n @values.fetch('tags') { \n @values['tags'] = {}\n }\n end",
"def tag_names=(tags)\n tag_array = tags.split(\",\").map{|tag| tag.strip}\n tag_array.each do |tag|\n new_tag = Tag.find_or_create_by(name: tag)\n if self.tags.include?(new_tag)\n next\n end\n self.tags << new_tag\n self.owner.tags << new_tag\n end\n end",
"def tags=(list)\n @tags = makelist(list)\n end",
"def additional_tags=(value)\n @additional_tags = value\n end",
"def tag_list= value\n self.tags = value.split(',').map(&:strip)\n end",
"def tag_list= value\n self.tags = value.split(',').map(&:strip)\n end",
"def selected_tags=(value)\n @selected_tags = value\n end",
"def tag_list=(tags_string)\n\t\t# splits array, strips non-meaningful whitespace, case insensitive, no duplicates\n\t\ttag_names = tags_string.split(\",\").collect{ |s| s.strip.downcase }.uniq\n\t\t\n\t\t# find or create tag with cleaned up names from array string\n\t\tnew_or_found_tags = tag_names.collect { |name| Tag.find_or_create_by(name: name) }\n\t\t\n\t\t# assign tags to article instance\n\t\tself.tags = new_or_found_tags \t\n\tend",
"def tags=(string_or_array)\n if string_or_array.kind_of?(Array)\n @tags = string_or_array\n else\n @tags = string_or_array.split(' ').map { |t| t.gsub('_', ' ') }\n end\n end",
"def tag_names=(tag_names)\n self.tags = tag_names.map do |tag_name|\n tag_name.strip!\n self.tags.find_or_create_by(name: tag_name)\n end\n end",
"def tags=(tags)\n if !tags.nil? && tags.length > 5\n fail ArgumentError, 'invalid value for \"tags\", number of items must be less than or equal to 5.'\n end\n @tags = tags\n end",
"def tags=(tags)\n if !tags.nil? && tags.length > 5\n fail ArgumentError, 'invalid value for \"tags\", number of items must be less than or equal to 5.'\n end\n @tags = tags\n end",
"def tag(*tags)\n attribute 'tags' do |existing_tags|\n existing_tags ||= []\n tags.each do |tag|\n if !existing_tags.include?(tag.to_s)\n existing_tags << tag.to_s\n end\n end\n existing_tags\n end\n end",
"def tags=(tags)\n if tags.first.is_a? Hash\n tags = tags.collect { |tag| Tag.new(tag) }\n end\n\n tags.each { |tag|\n if not tag.is_a? Tag\n raise \"Wrong class for attempted tag #{tag.inspect}\"\n end\n }\n\n @tags = tags\n end",
"def tag_names=(tag_names)\n tag_list = tag_names.split(',')\n cleaned_tag_list = clean(tag_list)\n self.tags = find_or_create_tags(cleaned_tag_list)\n end",
"def tag_names=(list)\n # Throw away extra space and blank tags\n list = list.map {|x| x.strip}.reject {|x| x.blank?}\n \n # Re-use any tags that already exist\n self.tags = device.account.tags.all(:conditions => {:name => list})\n tag_names = self.tags.map(&:name)\n \n # Create new tags for any names left in the list\n list.reject! {|x| tag_names.find {|name| name.casecmp(x) == 0}}\n self.tags += device.account.tags.create(list.map {|n| {:name => n}}).select(&:valid? )\n end",
"def tags\n normal[:tags] = Array(normal[:tags])\n normal[:tags]\n end",
"def tags(*tags)\n if tags.size == 0\n attribute('tags')\n else\n tags = tags[0] if tags.size == 1 && tags[0].kind_of?(Array)\n attribute 'tags', tags.map { |tag| tag.to_s }\n end\n end",
"def tags_to_remove=(value)\n @tags_to_remove = value\n end",
"def tag_list=(tags_string)\n tag_names = tags_string.split(\",\").collect{|s| s.strip.downcase}.uniq\n new_or_found_tags = tag_names.collect { |name| Tag.find_or_create_by(name: name) }\n self.tags = new_or_found_tags\nend",
"def sanitized_allowed_tags=(tags); end",
"def sanitized_allowed_tags=(tags); end",
"def tags=(tags)\n\t\t\tupdate_metadata(:tags => tags)\n\t\t\[email protected] do |u|\n\t\t\t\tu.set(:tags => tags)\n\t\t\t\tu.add(:idenity => 1)\n\t\t\tend\n\t\t\treturn nil\n\t\tend",
"def set_tag(key, value)\n tags[key] = value.to_s\n self\n end",
"def set_tag(key, value)\n tags[key] = value.to_s\n self\n end",
"def selected_tags=(data)\n self.tags.clear\n data.split('tag').each { |id| self.tags << Tag.find(id) if id.length > 0 }\n end",
"def tags=(tag_string)\n # tag_array = tag_string.split(/,\\s*/)\n # story.add_tags(tag_array)\n story.set_tag_string(tag_string)\n end",
"def []=(key, value)\n add_tags if @tags.nil?\n @tags[key] = value\n end",
"def tags=(tags_names)\n tags_names.each do |tag_name|\n tag = Tag.find_or_create_by_name(tag_name.downcase)\n self.tags << tag if !self.tags.find_by_id(tag)\n end\n self.tags.map(&:name)\n end",
"def tags=(list)\n tag(self.class.name)\n tag(*list)\n end",
"def set_tags(tags = Array.new)\n\n if tags.is_a?(String) and tags.downcase == 'all'\n @@default_tags.each do |value|\n @@edit_tags[value] = ''\n end\n elsif tags.is_a?(Array)\n tags.each do |value|\n @@edit_tags[value] = ''\n end\n elsif tags.is_a?(Hash)\n # NOTE: might need some adjustment here\n # Not sure this is used at all\n @@edit_tags = tags\n else\n\n\n # Try to match tags\n if tags.is_a?(String)\n\n @@edit_tags = {}\n tagsForEditing = tags.split(',')\n tagsForEditing.each do |value|\n\n # Matchin for seperator\n separator = @@edit_separator\n if value.match(/#{separator}/)\n\n self.log('debug', 'Found tag value assignment.')\n tagmatching = value.split(separator)\n\n # Check date for validity\n if tagmatching[0] == 'createdate'\n validatedDate = validateDate(tagmatching[1])\n if !validatedDate\n self.log('error',\"Date not recognized: '#{tagmatching[1]}'.\")\n abort 'Date format not recognized. Abort.'\n else\n self.log('debug',\"Identified date: #{validatedDate} \")\n @@edit_tags[tagmatching[0]] = validatedDate\n end\n else\n self.log('debug', \"Identified key #{tagmatching[0]} with value '#{tagmatching[1]}'.\")\n @@edit_tags[tagmatching[0]] = tagmatching[1]\n end\n else\n @@edit_tags[value] = ''\n end\n\n end\n\n end\n\n end\n\n\n end",
"def tag=(value)\n @tag = value\n self.status = TAG_STATUS.fetch(value)\n @tag\n end",
"def []=(key, value)\n @tags[key.to_s] = value\n end",
"def tag_names=(rhs)\n self.tags = rhs.strip.split(/\\s*,\\s*/).map do |tag_name|\n Tag.find_or_initialize_by(name: tag_name)\n end\n end",
"def tags!\n @tags = nil\n tags\n end",
"def tag_names=(rhs)\n self.tags = rhs.strip.split(/\\s*,\\s*/).map do |tag_name|\n Tag.find_or_initialize_by(name: tag_name)\n end\n end",
"def spaced_tags=(value)\n self.tag_list = value.to_s.split(' ')\n end",
"def tags=(new_tags)\n raise 'Tags must be an array!' unless new_tags.is_a?(Array)\n raise 'Tags must be up to 20 items!' unless new_tags.size < 20\n raise 'Tag length must not be over 50 characters!' unless new_tags.select { |v| v.length > 50 }.empty?\n\n @tags = new_tags unless new_tags.empty?\n end",
"def tags_raw=(values)\n self.tags = []\n self.tags = values.split(\"\\n\").map(&:strip)\n end",
"def tags=(list)\n tags.clear\n for id in list\n tags << Tag.find(id) if !id.empty?\n end\n end",
"def tags(*values)\n values.inject(self) { |res, val| res._tags(val) or fail ArgumentError, \"Unknown value for tags: #{val}\" }\n end",
"def tags(*values)\n values.inject(self) { |res, val| res._tags(val) or fail ArgumentError, \"Unknown value for tags: #{val}\" }\n end",
"def tags(*values)\n values.inject(self) { |res, val| res._tags(val) or fail ArgumentError, \"Unknown value for tags: #{val}\" }\n end",
"def tags(*values)\n values.inject(self) { |res, val| res._tags(val) or fail ArgumentError, \"Unknown value for tags: #{val}\" }\n end",
"def tags(*values)\n values.inject(self) { |res, val| res._tags(val) or fail ArgumentError, \"Unknown value for tags: #{val}\" }\n end",
"def tags(*values)\n values.inject(self) { |res, val| res._tags(val) or fail ArgumentError, \"Unknown value for tags: #{val}\" }\n end",
"def tag_list=(tags_string)\n self.taggings.destroy_all\n\n tag_names = tags_string.split(\",\").collect{|s| s.strip.downcase}.uniq\n\n tag_names.each do |tag_name|\n tag = Tag.find_or_create_by_name(tag_name)\n tagging = self.taggings.new\n tagging.tag_id = tag.id\n end # end of do iteration\n end",
"def add_tags\n \tunless tags_field.blank?\n\t\t\ttags = tags_field.split(\",\")\n\t\t\ttags.each do |tag|\n self.tags << Tag.find_or_initialize_by_name(tag.strip)\n\t\t\tend\n\t\tend\t\n end",
"def tag_list=(names)\n self.tags = names.split(\",\").map do |n|\n SimpleTags::Tag.where(name: n.strip).first_or_create!\n end\n end",
"def tags\n if new?\n @fake_tags || []\n else\n @tags ||= tags_dataset.all\n end\n end",
"def add_tags(new_tags)\n new_tags.each do |k, v|\n self.tags[k.to_s] = v\n end\n self\n end",
"def tags\n tags = get_user_tags\n # prevents resource from being applied on every run if clearing tags with ''\n tags = [''] if tags == []\n tags\n end",
"def tags_raw=(values)\n self.tags = []\n self.tags = values.split(\"\\n\").map { |w| w.strip }\n end",
"def set_tags(page)\n tags = page.data['tags']\n\n if tags\n tags = (tags.kind_of?(Array) ? tags : tags.split)\n else\n tags = []\n end\n\n tags << page.data['category']\n page.data['tags'] = tags.sort\n end",
"def tag_names=(rhs)\n self.tags = rhs.strip.split(/\\s*,\\s*/).map do |tag_name|\n # Finds the first record with given\n # attributes, or initializes a record\n # (Tag.new) with attributes if one is\n # not found.\n Tag.find_or_initialize_by(name: tag_name)\n end\n end",
"def tag(*tags)\n tags.each { |tag| @tags << tag }\n end",
"def tag_text=(value)\n self.tag=(value)\n end",
"def tags\n @tags ||= ApiFactory.new 'GitData::Tags'\n end",
"def tags_string=(titles)\n self.tags = titles.split(',').map do |title|\n Tag.find_or_create_by(title: title, user: user)\n end\n end",
"def pending_tags=(tags)\n @pending_tags = Array(tags)\n end",
"def tag_names=(rhs)\n self.tags = rhs.strip.split(/\\s*,\\s*/).map do |tag_name|\n # Finds the first record with the given attributes, or\n # initializes a record (Tag.new) with the attributes\n # if one is not found.\n Tag.find_or_initialize_by(name: tag_name)\n # If a tag with name tag_name is not found,\n # it will call Tag.new(name: tag_name)\n end\n end",
"def setTag(tag)\n @fields['tag'] = tag\n self\n end",
"def setTag(tag)\n @fields['tag'] = tag\n self\n end",
"def setTag(tag)\n @fields['tag'] = tag\n self\n end"
] | [
"0.7618521",
"0.7394186",
"0.7276187",
"0.727412",
"0.7270079",
"0.72397435",
"0.72397435",
"0.71779656",
"0.71516395",
"0.7101047",
"0.7090982",
"0.6997965",
"0.69918466",
"0.69885087",
"0.69885087",
"0.69885087",
"0.69885087",
"0.69885087",
"0.69885087",
"0.6983422",
"0.69584775",
"0.69524443",
"0.6921995",
"0.69208944",
"0.6920201",
"0.68825907",
"0.68646395",
"0.6849829",
"0.6826756",
"0.6826153",
"0.6809794",
"0.6770745",
"0.6769177",
"0.67347723",
"0.6707509",
"0.6697574",
"0.6656051",
"0.66544586",
"0.6648343",
"0.6648343",
"0.663478",
"0.6633158",
"0.6618182",
"0.6617396",
"0.6568259",
"0.6568259",
"0.65302634",
"0.65236175",
"0.6512338",
"0.65122247",
"0.6489365",
"0.6445169",
"0.64419365",
"0.6432115",
"0.64252734",
"0.64252734",
"0.641458",
"0.6397208",
"0.6397208",
"0.6396865",
"0.6378476",
"0.6375083",
"0.6370076",
"0.63495743",
"0.6336167",
"0.62951654",
"0.62908554",
"0.62747765",
"0.6272881",
"0.6240527",
"0.62306654",
"0.62161857",
"0.6215",
"0.61924213",
"0.610909",
"0.610909",
"0.610909",
"0.610909",
"0.610909",
"0.610909",
"0.6092606",
"0.60883355",
"0.60815114",
"0.60802776",
"0.6076665",
"0.607327",
"0.6059941",
"0.60522157",
"0.6051983",
"0.60406804",
"0.60402787",
"0.60385716",
"0.60152316",
"0.6014768",
"0.60110265",
"0.5998884",
"0.5998884",
"0.5998884"
] | 0.80212224 | 2 |
Gets the tokenEncryptionKeyId property value. Specifies the keyId of a public key from the keyCredentials collection. When configured, Azure AD encrypts all the tokens it emits by using the key this property points to. The application code that receives the encrypted token must use the matching private key to decrypt the token before it can be used for the signedin user. | def token_encryption_key_id
return @token_encryption_key_id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def token_encryption_key_id=(value)\n @token_encryption_key_id = value\n end",
"def encryption_key\n @encryption_key ||= @keys.last.tap do |key|\n key.public_tags.encrypted_data_key_id = key.id if ActiveRecord::Encryption.config.store_key_references\n end\n\n @encryption_key\n end",
"def kms_key_id\n data[:kms_key_id]\n end",
"def kms_key_id\n data[:kms_key_id]\n end",
"def kms_key_id\n @dbi.kms_key_id\n end",
"def kms_key_id\n @dbi.kms_key_id\n end",
"def key_id\n return @key_id\n end",
"def key_id\n return @key_id\n end",
"def key_id\n return @key_id\n end",
"def key_id\n GlobalConstant::Aws::Kms.get_key_id_for(@purpose)\n end",
"def key_id\n GlobalConstant::Aws::Kms.get_key_id_for(@purpose)\n end",
"def encryptionKey=(value)\n\t\t\t@encryptionKey = value\n\t\tend",
"def encryption_key\n\tself.data_encrypting_key ||= DataEncryptingKey.primary\n\tdata_encrypting_key.key\n end",
"def key_id\n metadata[\"keyid\"]\n end",
"def encryption_key\n return @encryption_fu_attrs['-encryption-key-'] if @encryption_fu_attrs['-encryption-key-']\n \n public_key = self.send self.encryption_fu_options[:public_key_field]\n if public_key.blank?\n public_key = self.generate_public_encryption_key\n self.send \"#{self.encryption_fu_options[:public_key_field]}=\".to_sym, public_key\n end\n private_key = self.private_encryption_key\n \n @encryption_fu_attrs['-encryption-key-'] = Digest::SHA256.hexdigest(\"-#{private_key}-#{public_key}-\")\n end",
"def encryption_certificate_id\n return @encryption_certificate_id\n end",
"def token_key\n @token_key\n end",
"def performance_insights_kms_key_id\n data[:performance_insights_kms_key_id]\n end",
"def performance_insights_kms_key_id\n data[:performance_insights_kms_key_id]\n end",
"def key_credentials\n return @key_credentials\n end",
"def get_key(id)\n @encryption_io.get_key(id)\n end",
"def authentication_keys\n @authentication_keys ||= [mapping.to.token_authentication_key]\n end",
"def private_key\n @key\n end",
"def key_id=(value)\n @key_id = value\n end",
"def key_id=(value)\n @key_id = value\n end",
"def key_id=(value)\n @key_id = value\n end",
"def encrypted_keys\n @encrypted_keys ||= encrypted_attributes.keys\n end",
"def key_iv\r\n @key_iv\r\n end",
"def custom_key_identifier\n return @custom_key_identifier\n end",
"def custom_key_identifier\n return @custom_key_identifier\n end",
"def crypto_key\n # Returns singleton object\n EmailEncryptionKey.instance.key\n end",
"def decryption_keys(encrypted_message)\n if encrypted_message.headers.encrypted_data_key_id\n keys_grouped_by_id[encrypted_message.headers.encrypted_data_key_id]\n else\n @keys\n end\n end",
"def kms_key\n @gapi.kms_key_name\n end",
"def encryption_certificate_id=(value)\n @encryption_certificate_id = value\n end",
"def access_key_id\n credentials['access_key']\n end",
"def current_key\n\n unserialized_key = nil\n\n if serialized_key_or_id_string = @cursor_instance.get_key\n\n # if we have an index we have serialized key\n if @parent_index\n unserialized_key = @parent_bucket.parent_adapter.class::SerializationClass.__send__( @parent_bucket.parent_adapter.class::UnserializationMethod, serialized_key_or_id_string )\n # if not we just have an ID string\n else\n unserialized_key = serialized_key_or_id_string.to_i\n end\n \n end\n \n # return ID\n return unserialized_key\n \n end",
"def encryption_key\n ENV[\"FASTLANE_CI_ENCRYPTION_KEY\"]\n end",
"def encryption_key\n ENV[\"FASTLANE_CI_ENCRYPTION_KEY\"]\n end",
"def get_encrypted_user_id()\n\t\t\tkparams = {}\n\t\t\tclient.queue_service_action_call('ottuser', 'getEncryptedUserId', 'KalturaStringValue', 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 aws_access_key_id\n aws_ssm_parameter_store && aws_ssm_parameter_store[:access_key_id]\n end",
"def aes_key\n self.encrypted_data_will_change!\n \"dfdsdsfsdfsdfwefsdfds\"\n end",
"def private_key\n return self.authentication.private_key\n end",
"def private_key\n return self.authentication.private_key\n end",
"def get_encryption_key\n key_bytes = @sha_size / 8\n if @alg.respond_to?(:preshared_key)\n key = @alg.preshared_key\n unless key.size == key_bytes\n raise Sandal::KeyError, \"The pre-shared content key must be #{@sha_size} bits.\"\n end\n key\n else\n SecureRandom.random_bytes(key_bytes)\n end\n end",
"def key_ids\n @keys.keys\n end",
"def key\n refresh_key unless key_valid?\n @key\n end",
"def authority_key_identifier\n extensions[R509::Cert::Extensions::AuthorityKeyIdentifier]\n end",
"def get_keys\n @encryption_io.get_keys\n end",
"def token_store_key\n @token_store_key ||=\n begin\n # Strip the host part to just the hostname (i.e. no scheme or port)\n host = @settings.host!\n host = URI(host).hostname if host =~ /\\Ahttps?:\\/\\//\n identity_segment = if fmid_token = @settings.fmid_token\n require \"digest\"\n Digest::SHA256.hexdigest(fmid_token)\n else\n @settings.username!\n end\n \"#{host}:#{@settings.database!}:#{identity_segment}\"\n end\n end",
"def key\n return @key\n end",
"def key\n return @key\n end",
"def jwt_key\n 'ec6a8b69ae22049f900af9bd9f14ffb4dc6937f69575ab49b4df2d28364055b8'\n end",
"def get_key\n @key = Base64.decode64('MzRlZTc5ODMtNWVlNi00MTQ3LWFhODYtNDQzZWEwNjJhYmY3NzQ0OTNkNmEtMmExNS00M2ZlLWFhY2UtZTc4NTY2OTI3NTg1Cg==')\n end",
"def public_key\n return self.authentication.public_key\n end",
"def public_key\n return self.authentication.public_key\n end",
"def key\n self.class._key\n end",
"def activity_stream_kms_key_id\n data[:activity_stream_kms_key_id]\n end",
"def activity_stream_kms_key_id\n data[:activity_stream_kms_key_id]\n end",
"def client_key\n @client_key ||= CredentialCache.cache(cache_key(:client_key)) do\n hmac(salted_password, 'Client Key')\n end\n end",
"def key_for(token)\n \"afid-access-token:#{token}\".to_sym\n end",
"def key_size\n @key_size ||= if (value = @node['keySize'])\n value.to_i\n end\n end",
"def api_key_id\n @attributes[:api_key_id]\n end",
"def get_crypto_key_hex\n return @crypto_key if ! @crypto_key\n @crypto_key.unpack(\"H*\")\n end",
"def auth_token_for(key)\n @username_auth_tokens[secure_auth_token_key(key)]\n end",
"def session_key\n @session_key\n end",
"def subject_key_identifier\n extensions[R509::Cert::Extensions::SubjectKeyIdentifier]\n end",
"def key\n attributes['key'] or raise NoKeySpecified\n end",
"def current_auth_api_key\n @current_auth_api_key ||= lambda do\n authenticate_knox_api_key!\n api_key\n end.call\n end",
"def key\n @key\n end",
"def key\n @key\n end",
"def next_available_token_id\n raise \"Not yet implemented\"\n # implementation idea: list token ids owned by our backend (ie the public key associated w/ AIRDROP_PRIVATE_KEY)\n # https://ethereum.stackexchange.com/questions/54959/list-erc721-tokens-owned-by-a-user-on-a-web-page\n #\n # return nil unless we find a token id that can be delivered\n end",
"def _hashback_id_key\n self.__send__(self.class.__send__(:class_variable_get, :@@_key_method_sym))\n end",
"def key(key_id)\n from_resource :key,\n connection.get(api_uri(\"keys/#{key_id}\"))\n end",
"def session_id_key\n @session_id_key\n end",
"def public_key\n @priv.public_key\n end",
"def key_symbol\n @key\n end",
"def authentication_token\n @authentication_token ||= JWT.encode(payload, secret, algorithm)\n end",
"def authentication_keys\n @authentication_keys ||= User.authentication_keys\n end",
"def custom_key_identifier=(value)\n @custom_key_identifier = value\n end",
"def custom_key_identifier=(value)\n @custom_key_identifier = value\n end",
"def current_token(key)\n Token.where(\"expiration >= ?\", Time.now).find{|t| t.key == key}\n end",
"def id_token\n @id_token ||= nil\n end",
"def determine_natural_key\n Array(configuration[:natural_key]).collect(&:to_sym)\n end",
"def key\n (key_name || name).to_sym\n end",
"def current_key(keyspace)\n keyspace.key(last_modified_time)\n end",
"def _key\n @_key || self.class.key.(self)\n end",
"def key\n @agent.private_key\n end",
"def key\n @key or raise MissingKey\n end",
"def key_path\n @key_path\n end",
"def shared_key(env)\n token = env[options[:header_token]]\n\n shared_token = options[:klass].send(options[:method].to_s, token)\n shared_token.to_s\n end",
"def key(password)\n decrypt(@encrypted_key, key_encryption_key(password))\n end",
"def public_key=(k)\n return self.authentication.public_key = k\n end",
"def public_key=(k)\n return self.authentication.public_key = k\n end",
"def encryption_certificate\n return @encryption_certificate\n end",
"def key\n int = @declared_fields['key'].value(java_self)\n int < 256 ? int.chr : int\n end",
"def key\n int = @declared_fields['key'].value(java_self)\n int < 256 ? int.chr : int\n end",
"def save_encryption_key\n namespaced_redis = self.redis_connection\n if defined?(self.user_id)\n key = self.user_id.to_s\n else\n key = self.id.to_s\n end\n #just to stay on safe side\n raise 'Encryption key already exists' if namespaced_redis.get(key)\n namespaced_redis.set(key, @encryption_key)\n end",
"def x509v3_authority_key_identifier\n @x509v3_authority_key_identifier ||= if (node = @node.at('X509v3AuthorityKeyIdentifier'))\n node.inner_text\n end\n end",
"def private_key\n @priv\n end",
"def client_key_authentication\n if request.headers['JWT'].present?\n auth_header = request.headers['JWT'].split(' ').last\n @token_payload = decodeJWT auth_header.strip\n if @token_payload\n @creators_id = @token_payload[0]['creators_id']\n else\n selected_format({ error: 'The provided token wasn´t correct' },:bad_request)\n end\n else\n selected_format({ error: 'Need to include the Authorization header JWT with correct key' },:forbidden)\n end\n end"
] | [
"0.69160014",
"0.628274",
"0.6117712",
"0.6117712",
"0.5919309",
"0.5919309",
"0.5809701",
"0.5809701",
"0.5809701",
"0.5752905",
"0.5752905",
"0.5665416",
"0.5615933",
"0.5589209",
"0.55610096",
"0.5545068",
"0.5497334",
"0.5326138",
"0.5326138",
"0.5218951",
"0.52065885",
"0.5200208",
"0.5198561",
"0.51958096",
"0.51958096",
"0.51958096",
"0.51935655",
"0.51399064",
"0.5136536",
"0.5136536",
"0.50688565",
"0.5065661",
"0.50254536",
"0.50211716",
"0.50194216",
"0.5017659",
"0.4985247",
"0.4985247",
"0.49686807",
"0.49147123",
"0.49140492",
"0.489813",
"0.489813",
"0.48773792",
"0.4822174",
"0.4814041",
"0.48035172",
"0.4760769",
"0.47595316",
"0.47215572",
"0.47215572",
"0.47186482",
"0.47172397",
"0.47113594",
"0.47113594",
"0.46846282",
"0.4683513",
"0.4683513",
"0.46724525",
"0.46620587",
"0.46581218",
"0.4645952",
"0.4630409",
"0.46301925",
"0.45985574",
"0.45942485",
"0.45938602",
"0.45722717",
"0.4562762",
"0.4562762",
"0.45510894",
"0.45493582",
"0.45451286",
"0.44993237",
"0.4498599",
"0.44929135",
"0.4492175",
"0.4476564",
"0.44665816",
"0.44665816",
"0.446245",
"0.44620118",
"0.4459793",
"0.4453937",
"0.44525892",
"0.44513458",
"0.44458917",
"0.44450065",
"0.44412324",
"0.44335744",
"0.44297546",
"0.4428295",
"0.4428295",
"0.44184244",
"0.44156054",
"0.4414862",
"0.44055456",
"0.44016543",
"0.44012958",
"0.4385171"
] | 0.73587084 | 0 |
Sets the tokenEncryptionKeyId property value. Specifies the keyId of a public key from the keyCredentials collection. When configured, Azure AD encrypts all the tokens it emits by using the key this property points to. The application code that receives the encrypted token must use the matching private key to decrypt the token before it can be used for the signedin user. | def token_encryption_key_id=(value)
@token_encryption_key_id = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def token_encryption_key_id\n return @token_encryption_key_id\n end",
"def encryptionKey=(value)\n\t\t\t@encryptionKey = value\n\t\tend",
"def key_id=(value)\n @key_id = value\n end",
"def key_id=(value)\n @key_id = value\n end",
"def key_id=(value)\n @key_id = value\n end",
"def encryption_key\n @encryption_key ||= @keys.last.tap do |key|\n key.public_tags.encrypted_data_key_id = key.id if ActiveRecord::Encryption.config.store_key_references\n end\n\n @encryption_key\n end",
"def set_key_iv\r\n @cipher.key = @key_iv[:key]\r\n @cipher.iv = @key_iv[:iv]\r\n end",
"def set_otp_key(id, key)\n @otp_keys[id] = encrypt(key.to_s) unless key.to_s.empty?\n end",
"def id_token= new_id_token\n @id_token = new_id_token\n end",
"def set_token\n self.token ||= encrypted_data\n end",
"def key_credentials=(value)\n @key_credentials = value\n end",
"def encryption_key=(encryption_key)\n if !encryption_key.nil? && encryption_key.to_s.length > 100\n fail ArgumentError, 'invalid value for \"encryption_key\", the character length must be smaller than or equal to 100.'\n end\n\n @encryption_key = encryption_key\n end",
"def kms_key_id\n data[:kms_key_id]\n end",
"def kms_key_id\n data[:kms_key_id]\n end",
"def encryption_certificate_id=(value)\n @encryption_certificate_id = value\n end",
"def set_encoded_key(enc)\n set_session_key(EzCrypto::Key.decode(enc))\n end",
"def custom_key_identifier=(value)\n @custom_key_identifier = value\n end",
"def custom_key_identifier=(value)\n @custom_key_identifier = value\n end",
"def token=(token)\n self.encrypted_token = ::Digest::SHA2.hexdigest(token)\n end",
"def kms_key_id\n @dbi.kms_key_id\n end",
"def kms_key_id\n @dbi.kms_key_id\n end",
"def set_session_key(key) \n @session_key=key\n self.decrypt_attributes if self.class.include? Encrypted\n end",
"def set_token model\n challenge = generate_challenge model\n model[challenge_column] = encrypt challenge\n build_token model, challenge\n end",
"def setKeyVal(keyVal)\n @@keyVal = keyVal\n end",
"def set_auth_token\n @auth_token = AuthToken.find(params[:id])\n end",
"def set_auth_token\n @auth_token = AuthToken.find(params[:id])\n end",
"def authentication_keys\n @authentication_keys ||= [mapping.to.token_authentication_key]\n end",
"def set_token\n @token = @instance.tokens.find(params[:id] || params[:token_id])\n end",
"def set_token\n @token = @instance.tokens.find(params[:id] || params[:token_id])\n end",
"def kms_key= new_kms_key_name\n frozen_check!\n @gapi.kms_key_name = new_kms_key_name\n end",
"def set_data_encrypting_key\n\tself.data_encrypting_key ||= DataEncryptingKey.primary\n end",
"def assign_authentication_token\n self.authentication_token = generate_authentication_token\n end",
"def set_connection_token\n @connection_token = ConnectionToken.find_by(token: params[:id])\n end",
"def encrypt_token(password, token)\n key = obtain_key(password)\n cipher = OpenSSL::Cipher::AES256.new(:CBC)\n cipher.encrypt\n cipher.key = key\n @iv = cipher.random_iv\n @encrypted_token = cipher.update(token) + cipher.final\n end",
"def key_id\n GlobalConstant::Aws::Kms.get_key_id_for(@purpose)\n end",
"def key_id\n GlobalConstant::Aws::Kms.get_key_id_for(@purpose)\n end",
"def set_token\n @token = @instance.tokens.find(params[:id] || params[:token_id])\n end",
"def encrypted_keys\n @encrypted_keys ||= encrypted_attributes.keys\n end",
"def key=(value)\n raise TypeError, 'key must respond to #to_i' unless value.respond_to?(:to_i)\n \n @key = value.to_i\n end",
"def set_token\n self.token ||= Cart.generate_token\n end",
"def key=(new_key)\n @key = new_key\n end",
"def save_encryption_key\n namespaced_redis = self.redis_connection\n if defined?(self.user_id)\n key = self.user_id.to_s\n else\n key = self.id.to_s\n end\n #just to stay on safe side\n raise 'Encryption key already exists' if namespaced_redis.get(key)\n namespaced_redis.set(key, @encryption_key)\n end",
"def set_keypair\n # The generated keypair is stored in PEM encoding.\n self._keypair ||= OpenSSL::PKey::RSA.new(2048).to_pem\n self.jwk_kid = public_jwk.kid\n end",
"def set_keypair\n # The generated keypair is stored in PEM encoding.\n self._keypair ||= OpenSSL::PKey::RSA.new(2048).to_pem\n self.jwk_kid = public_jwk.kid\n end",
"def private_key=(k)\n return self.authentication.private_key = k\n end",
"def private_key=(k)\n return self.authentication.private_key = k\n end",
"def put_authcontrols_exemptmids_token(token, opts = {})\n put_authcontrols_exemptmids_token_with_http_info(token, opts)\n nil\n end",
"def set_key\n @key = Key.find(params[:id])\n end",
"def token_key\n @token_key\n end",
"def initialize(cipher, key)\n raise \"Cipher block size must be #{BLOCK_SIZE}\" unless cipher.block_size == BLOCK_SIZE\n\n @cipher = cipher\n @cipher.encrypt\n @cipher.key = @key = key\n\n generate_subkeys\n reset\n end",
"def session_key=(key)\n @session_key = key\n end",
"def public_key=(k)\n return self.authentication.public_key = k\n end",
"def public_key=(k)\n return self.authentication.public_key = k\n end",
"def set_clientlogin_token(auth_token)\n @token = auth_token\n end",
"def token=(value)\n @token = value\n resources.each do |klass|\n update_token_header(klass)\n end\n end",
"def encrypt_kms_keys\n updates = {}\n self.class.kms_keys.each do |key_method, key|\n instance_var = \"@#{key_method}\"\n key_column = \"encrypted_#{key_method}\"\n plaintext_key = instance_variable_get(instance_var)\n\n if !send(key_column) && plaintext_key\n updates[key_column] = KmsEncrypted::Database.new(self, key_method).encrypt(plaintext_key)\n end\n end\n if updates.any?\n current_time = current_time_from_proper_timezone\n timestamp_attributes_for_update_in_model.each do |attr|\n updates[attr] = current_time\n end\n update_columns(updates)\n end\n end",
"def set_keylist\n @keylist = Keylist.find(params[:id])\n end",
"def signing_key= new_key\n @signing_key = new_key\n end",
"def set_running_key\n @running_key = RunningKey.find(params[:id])\n end",
"def key_iv\r\n @key_iv\r\n end",
"def key_id\n return @key_id\n end",
"def key_id\n return @key_id\n end",
"def key_id\n return @key_id\n end",
"def encryption_key\n\tself.data_encrypting_key ||= DataEncryptingKey.primary\n\tdata_encrypting_key.key\n end",
"def key= key\n @agent.private_key = key\n end",
"def map_auth_token(key, auth_token)\n @username_auth_tokens[secure_auth_token_key(key)] = auth_token\n end",
"def set_key_set\n @key_set = KeySet.find(params[:id])\n end",
"def store_encryption_key_sha\n self.encryption_key_sha = ENCRYPTION_KEY_SHA\n end",
"def set_token\n @token = Token.find(params[:id])\n end",
"def encryption_key\n return @encryption_fu_attrs['-encryption-key-'] if @encryption_fu_attrs['-encryption-key-']\n \n public_key = self.send self.encryption_fu_options[:public_key_field]\n if public_key.blank?\n public_key = self.generate_public_encryption_key\n self.send \"#{self.encryption_fu_options[:public_key_field]}=\".to_sym, public_key\n end\n private_key = self.private_encryption_key\n \n @encryption_fu_attrs['-encryption-key-'] = Digest::SHA256.hexdigest(\"-#{private_key}-#{public_key}-\")\n end",
"def aes_key\n self.encrypted_data_will_change!\n \"dfdsdsfsdfsdfwefsdfds\"\n end",
"def transform_keys(&block)\n @key_transformer = block\n end",
"def set_session_key(key) \n if self.new_record?\n @session_key=key\n else\n ActiveRecord::Base.session_keys[session_key_id]=key\n end\n decrypt_attributes if self.class.include? Encrypted #if respond_to?(:decrypt_attributes)\n \n end",
"def aes_key_core(k, i)\n t = 0\n 0.upto(3) do |j|\n t = aes_set_byte(t, (j-1) % 4, AES_SBOX[aes_get_byte(k, j)])\n end\n aes_set_byte(t, 0, aes_get_byte(t,0) ^ AES_RCON[i])\n end",
"def set_credential_key\n @credential_key = CredentialKey.find(params[:id])\n end",
"def key_id\n metadata[\"keyid\"]\n end",
"def key(key_id, key, opts=OPTS)\n unless key_id.is_a?(Integer) && key_id >= 0 && key_id <= 255\n raise Error, \"invalid key_id argument, must be integer between 0 and 255\"\n end\n\n unless key.is_a?(String) && key.bytesize == 32\n raise Error, \"invalid key argument, must be string with exactly 32 bytes\"\n end\n\n if opts.has_key?(:padding)\n if padding = opts[:padding]\n unless padding.is_a?(Integer) && padding >= 1 && padding <= 120\n raise Error, \"invalid :padding option, must be between 1 and 120\"\n end\n end\n else\n padding = Cryptor::DEFAULT_PADDING\n end\n\n @keys << [key_id, key, opts[:auth_data].to_s, padding].freeze\n end",
"def decryption_keys(encrypted_message)\n if encrypted_message.headers.encrypted_data_key_id\n keys_grouped_by_id[encrypted_message.headers.encrypted_data_key_id]\n else\n @keys\n end\n end",
"def set_key_indicate_map_indicator_key\n @key_indicate_map_indicator_key = KeyIndicateMap::IndicatorKey.find(params[:id])\n end",
"def key_for(token)\n \"afid-access-token:#{token}\".to_sym\n end",
"def encrypt_username(key = @key)\n # TODO: add different sql statements for different DBs.\n sql = \"UPDATE login_details\n SET encrypted_username =\n AES_ENCRYPT(#{quote_value(self.decrypted_username)}, #{quote_value(key)})\n WHERE id = #{self.id}\"\n # Run this update manually.\n self.connection.execute sql\n end",
"def encryption_key\n ENV[\"FASTLANE_CI_ENCRYPTION_KEY\"]\n end",
"def encryption_key\n ENV[\"FASTLANE_CI_ENCRYPTION_KEY\"]\n end",
"def performance_insights_kms_key_id\n data[:performance_insights_kms_key_id]\n end",
"def performance_insights_kms_key_id\n data[:performance_insights_kms_key_id]\n end",
"def set_encrypter\n @encrypter = Encrypter.find(params[:id])\n end",
"def principal_token=(token)\n end",
"def key=(value)\n @key = value\n end",
"def key=(value)\n @key = value\n end",
"def request_token=(token)\n @request_token = token\n end",
"def set_player_id\n\t\tself.player_id = current_player.id\n\tend",
"def set_key_map(key_map)\n @key_map = key_map\n end",
"def set_key_map(key_map)\n @key_map = key_map\n end",
"def primary_key=(key)\n @primary_key = key\n end",
"def set_auth_token(token)\n @auth_token = token.to_s\n end",
"def set_user_key\n @user_key = UserKey.find(params[:id])\n end",
"def set_apn_token\n @apn_token = ApnToken.find(params[:id])\n end",
"def set_secret_key\n @secret_key = SecretKey.find(params[:id])\n end",
"def set_ssh_key\n @ssh_key = current_user.ssh_keys.find(params[:id])\n end",
"def api_key=(val)\n @api_key = val\n end"
] | [
"0.57803404",
"0.56525654",
"0.5405496",
"0.5405496",
"0.5405496",
"0.50403214",
"0.5019115",
"0.48666698",
"0.47782272",
"0.4771776",
"0.474613",
"0.4719223",
"0.4628568",
"0.4628568",
"0.46146616",
"0.4559016",
"0.45460495",
"0.45460495",
"0.45437294",
"0.4535135",
"0.4535135",
"0.4460225",
"0.44521597",
"0.43995273",
"0.43856442",
"0.43856442",
"0.43720165",
"0.4368321",
"0.4368321",
"0.43564034",
"0.43335667",
"0.43164256",
"0.4314837",
"0.42979696",
"0.42938614",
"0.42938614",
"0.4288751",
"0.4288683",
"0.4275131",
"0.42644608",
"0.42573944",
"0.4253227",
"0.4247006",
"0.4247006",
"0.4245413",
"0.4245413",
"0.4244931",
"0.42388466",
"0.42356145",
"0.42345008",
"0.42228445",
"0.4206856",
"0.4206856",
"0.42024752",
"0.41802368",
"0.41755733",
"0.4173801",
"0.41359234",
"0.4131599",
"0.41298673",
"0.41175866",
"0.41175866",
"0.41175866",
"0.41173127",
"0.41095537",
"0.41045183",
"0.41029033",
"0.4097333",
"0.40967825",
"0.4096301",
"0.40674487",
"0.40496927",
"0.40459016",
"0.40394816",
"0.4039005",
"0.40324003",
"0.40306914",
"0.40296936",
"0.40293312",
"0.4028904",
"0.40248042",
"0.4017341",
"0.4017341",
"0.40000236",
"0.40000236",
"0.39948612",
"0.39874867",
"0.39706412",
"0.39706412",
"0.3968702",
"0.39671904",
"0.39634368",
"0.39634368",
"0.39556783",
"0.39552084",
"0.39429507",
"0.39398617",
"0.39391145",
"0.39377594",
"0.39309162"
] | 0.7000462 | 0 |
Gets the tokenIssuancePolicies property value. The tokenIssuancePolicies property | def token_issuance_policies
return @token_issuance_policies
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def token_issuance_policies=(value)\n @token_issuance_policies = value\n end",
"def token_lifetime_policies\n return @token_lifetime_policies\n end",
"def applied_policies\n return @applied_policies\n end",
"def list_policies\n nessus_rest_get('policies')['policies']\n end",
"def certificate_policies\n extensions[R509::Cert::Extensions::CertificatePolicies]\n end",
"def managed_app_policies\n return @managed_app_policies\n end",
"def auth_policies\n []\n end",
"def assignment_policies\n return @assignment_policies\n end",
"def intended_policies\n return @intended_policies\n end",
"def policies\n @policies = Policy.all\n end",
"def app_management_policies\n return @app_management_policies\n end",
"def token_lifetime_policies=(value)\n @token_lifetime_policies = value\n end",
"def list_policies\n http_get(:uri=>\"/policies\", :fields=>x_cookie)\n end",
"def applied_policies=(value)\n @applied_policies = value\n end",
"def list_sslpolicies(headers = {})\n get!(\"sslpolicies\", {}, headers)\n end",
"def assignment_policies=(value)\n @assignment_policies = value\n end",
"def policy_tags\n names = @gapi.policy_tags&.names\n names.to_a if names && !names.empty?\n end",
"def policy_role_policies\n @policy_role_policies ||= Array.new.tap do |uris|\n filters = current_ability.agents.map do |agent|\n \"#{Ddr::Index::Fields::POLICY_ROLE}:\\\"#{agent}\\\"\"\n end.join(\" OR \")\n query = \"#{Ddr::Index::Fields::ACTIVE_FEDORA_MODEL}:Collection AND (#{filters})\"\n results = ActiveFedora::SolrService.query(query, rows: Collection.count, fl: Ddr::Index::Fields::INTERNAL_URI)\n results.each_with_object(uris) { |r, memo| memo << r[Ddr::Index::Fields::INTERNAL_URI] }\n end\n end",
"def policy_constraints\n extensions[R509::Cert::Extensions::PolicyConstraints]\n end",
"def secure_score_control_profiles\n return @secure_score_control_profiles\n end",
"def managed_app_policies=(value)\n @managed_app_policies = value\n end",
"def policies()\n return MicrosoftGraph::Policies::PoliciesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def policy_scopes; end",
"def intended_policies=(value)\n @intended_policies = value\n end",
"def app_consent_requests\n return @app_consent_requests\n end",
"def app_management_policies=(value)\n @app_management_policies = value\n end",
"def compliance_policy\n return @compliance_policy\n end",
"def policy_executables\n Array(settings['external_policy_executable'])\n end",
"def check_policies(options = {})\n wss_client = WssAgent::Client.new\n result = wss_client.check_policies(\n WssAgent::Specifications.list(options),\n options\n )\n if result.success?\n WssAgent.logger.debug result.data\n puts result.message\n else\n WssAgent.logger.debug \"check policies errors occur: #{result.status}, message: #{result.message}, data: #{result.data}\"\n ap \"error: #{result.status}/#{result.data}\", color: { string: :red }\n end\n\n result\n end",
"def policies_for_widget widget, options\n widget = widget.is_a?(Widget) ? widget : Widget.find(widget)\n policies = UbiquoDesign::CachePolicies.get(options[:policy_context])[widget.key]\n [widget, policies]\n end",
"def group_policies\r\n GroupPoliciesController.instance\r\n end",
"def threat_assessment_requests\n return @threat_assessment_requests\n end",
"def policy_classes\n fetch_policies! unless @fetched\n @policy_classes\n end",
"def certification_controls\n return @certification_controls\n end",
"def policy_list_uids\n\t\t\tpost= { \"token\" => @token }\n\t\t\tdocxml = nil\n\t\t\tdocxml=nessus_request('policy/list', post)\n\t\t\tif docxml.nil?\n\t\t\t\treturn\n\t\t\tend\n\t\t\tpids=Array.new\n\t\t\tdocxml.root.elements['contents'].elements['policies'].each_element('//policy') { |policy|\n\t\t\t\tpids.push(policy.elements['policyID'].text) }\n\t\t\treturn pids\n\t\tend",
"def windows_information_protection_policies\n return @windows_information_protection_policies\n end",
"def node_policy_tags\n policy_tags = []\n if @policy_tags_enabled\n if @node.respond_to?('policy_group') && [email protected]_group.nil?\n policy_tags << \"#{@scope_prefix}policy_group:#{@node.policy_group}\"\n end\n if @node.respond_to?('policy_name') && [email protected]_name.nil?\n policy_tags << \"#{@scope_prefix}policy_name:#{@node.policy_name}\"\n end\n end\n policy_tags\n end",
"def index\n @bookings = policy_scope(current_user.bookings)\n authorize @bookings\n @experiences = policy_scope(current_user.experiences)\n authorize @experiences\n end",
"def list request_pb, options:, &block\n request_json = JSON.parse ::Google::Cloud::Compute::V1::ListSecurityPoliciesRequest.encode_json(request_pb)\n\n uri = \"/compute/v1/projects/#{request_pb.project}/global/securityPolicies\"\n\n result_json = @client_stub.make_get_request(\n uri: uri,\n options: options,\n &block\n )\n\n ::Google::Cloud::Compute::V1::SecurityPolicyList.decode_json result_json[:body], { ignore_unknown_fields: true }\n end",
"def policy\n self.permissions['policy'].to_sym\n end",
"def home_realm_discovery_policies\n return @home_realm_discovery_policies\n end",
"def hardCodedPolicies()\n\n return [\"Ice time rates are subject to change.\",\n \"Booking total is subject to change depending on activity at the discretion of the \" + long_name + \".\",\n \"Ice schedules are subject to change and Playogo does not guarantee that the timeslot is available until it is confirmed by the \" + long_name + \".\",\n \"Once your booking request has been confirmed by the \" + long_name + \", the price of the booking will be charged to your credit card.\",\n \"Your ice contract will be with the \" + long_name + \".\",\n \"Refer to all terms and conditions of your contract with the \" + long_name + \".\",\n \"Playogo is a non-affiliated third party, who simply makes it easier to find available ice time across a number of markets.\",\n \"There are no additional fees to book ice time through Playogo.\"\n ]\n end",
"def content_security_policy_overrides\n {}\n end",
"def grant_controls\n return @grant_controls\n end",
"def group_policies\n policies = []\n Group.each do |group|\n group.group_memberships.each do |membership|\n if membership.account_id == _id\n policies.push(group.group_policy)\n end\n end\n end\n return policies\n end",
"def policy_list_names\n\t\t\tpost= { \"token\" => @token }\n\t\t\tdocxml = nil\n\t\t\tdocxml=nessus_request('policy/list', post)\n\t\t\tif docxml.nil?\n\t\t\t\treturn\n\t\t\tend\n\t\t\tlist = Array.new\n\t\t\tdocxml.root.elements['contents'].elements['policies'].each_element('//policy') {|policy|\n\t\t\t\tlist.push policy.elements['policyName'].text\n\t\t\t}\n\t\t\treturn list\n\t\tend",
"def security_rules\n return unless exists?\n @security_rules ||= properties.securityRules\n end",
"def policy_list_uids\r\n\t\tpost= { \"token\" => @token } \r\n\t\tdocxml=nessus_request('policy/list', post)\r\n\t\tpids=Array.new\r\n\t\tdocxml.root.elements['contents'].elements['policies'].each_element('//policy') { |policy| \r\n\t\t\tpids.push(policy.elements['policyID'].text) }\r\n\t\treturn pids\r\n\tend",
"def allowed_accounts\n return @allowed_accounts\n end",
"def scaling_policies\n @aws.describe_policies(\n auto_scaling_group_name: @group_name\n ).scaling_policies\n end",
"def custom_security_attribute_definitions\n return @custom_security_attribute_definitions\n end",
"def retrieve_policies( resource_name, access_token, realm_uuid, resource_server )\n if resource_name && access_token\n request_policies(\n resource_name,\n access_token,\n realm_uuid,\n resource_server\n )\n else\n nil\n end\n end",
"def oauth2_permission_scopes\n return @oauth2_permission_scopes\n end",
"def get_kubernetes_sys_config_policy_list(opts = {})\n data, _status_code, _headers = get_kubernetes_sys_config_policy_list_with_http_info(opts)\n data\n end",
"def list_pod_security_policy(opts = {})\n data, _status_code, _headers = list_pod_security_policy_with_http_info(opts)\n return data\n end",
"def list(options = {})\n @raw = send_get_request(@conn_no_err, ['/v1/acl/policies'], options)\n raise Diplomat::AclNotFound if @raw.status == 403\n\n parse_body\n end",
"def index\n @priv_policies = PrivPolicy.all\n end",
"def implicit_grant_settings\n return @implicit_grant_settings\n end",
"def fetch_policies!\n @fetched = true\n @policy_classes = @policies.map do |pol|\n result = case pol\n when String\n Merb::Authorization._policy_from_string(pol)\n when Symbol\n Merb::Authorization._policies_from_scope(pol, scope)\n end\n end\n @policy_classes = @policy_classes.flatten.compact\n end",
"def policy_list_hash\n\t\t\tpost= { \"token\" => @token }\n\t\t\tdocxml = nil\n\t\t\tdocxml=nessus_request('scan/list', post)\n\t\t\tif docxml.nil?\n\t\t\t\treturn\n\t\t\tend\n\t\t\tpolicies=Array.new\n\t\t\tdocxml.elements.each('/reply/contents/policies/policies/policy') { |policy|\n\t\t\t\tentry=Hash.new\n\t\t\t\tentry['id']=policy.elements['policyID'].text if policy.elements['policyID']\n\t\t\t\tentry['name']=policy.elements['policyName'].text if policy.elements['policyName']\n\t\t\t\tentry['comment']=policy.elements['policyComments'].text if policy.elements['policyComments']\n\t\t\t\tpolicies.push(entry)\n\t\t\t}\n\t\t\treturn policies\n\t\tend",
"def automatic_user_consent_settings\n return @automatic_user_consent_settings\n end",
"def ios_managed_app_protections\n return @ios_managed_app_protections\n end",
"def policy_list_names\r\n\t\tpost= { \"token\" => @token } \r\n\t\tdocxml=nessus_request('policy/list', post)\r\n\t\tlist = Array.new\r\n\t\tdocxml.root.elements['contents'].elements['policies'].each_element('//policy') {|policy|\r\n\t\t\t\tlist.push policy.elements['policyName'].text\r\n\t\t}\r\n\t\treturn list\r\n\tend",
"def list_authorization_policies 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_list_authorization_policies_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::NetworkSecurity::V1beta1::ListAuthorizationPoliciesResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def have_policy_for?(app_name)\n @policies ||= Vault.sys.policies\n @policies.include?(app_name)\n end",
"def ios_enrollment_assignments\n return @ios_enrollment_assignments\n end",
"def session_tokens\n @data[:session_tokens]\n end",
"def managed_app_policies()\n return MicrosoftGraph::DeviceAppManagement::ManagedAppPolicies::ManagedAppPoliciesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def vpc_security_groups\n data[:vpc_security_groups]\n end",
"def vpc_security_groups\n data[:vpc_security_groups]\n end",
"def cloud_app_security\n return @cloud_app_security\n end",
"def tokens\n (@token.is_a? OAuth2::AccessToken) ? @token.to_hash : @token\n end",
"def content_security_policy_nonce_directives; end",
"def content_security_policy_nonce_directives; end",
"def vpp_tokens\n return @vpp_tokens\n end",
"def valid_tokens\n clear_expired_tokens\n access_tokens.pluck(:token)\n end",
"def disable_edu_policies\n return @disable_edu_policies\n end",
"def current_access_control\n @access_control\n end",
"def termination_policies\n @group.termination_policies\n end",
"def enforced_settings\n return @enforced_settings\n end",
"def security_groups\n data[:security_groups]\n end",
"def fetch_aud\n Settings.oidc.isolated_audience.claims\n end",
"def fetch_aud\n Settings.oidc.isolated_audience.claims\n end",
"def providers\n authentication_strategies.pluck :provider\n end",
"def token_types\n attributes.fetch(:tokenTypes)\n end",
"def enabled?\n return policy_setting.enabled\n end",
"def ingress_permissions\n @sg.ip_permissions\n end",
"def ingress_permissions\n @sg.ip_permissions\n end",
"def secure_scores\n return @secure_scores\n end",
"def policy\n @policy ||= init_policy\n end",
"def session_controls\n return @session_controls\n end",
"def validators\n parent_validators = self == Tram::Policy ? [] : superclass.validators\n (parent_validators + local_validators).uniq\n end",
"def escalation_approvers\n return @escalation_approvers\n end",
"def index\n @permission_policies = PermissionPolicy.all\n end",
"def policies_with_access\n #### TODO -- Memoize this and put it in the session?\n user_access_filters = []\n user_access_filters += apply_policy_group_permissions(discovery_permissions)\n user_access_filters += apply_policy_user_permissions(discovery_permissions)\n where = user_access_filters.join(' OR ')\n result = policy_class.search_with_conditions(where,\n fl: 'id',\n rows: policy_class.count)\n logger.debug \"get policies: #{result}\\n\\n\"\n result.map { |h| h['id'] }\n end",
"def security\n return @security\n end",
"def get_tokens\n\t\treturn @tokens\n\tend",
"def policies; end",
"def policy_get_first\n\t\t\tpost= { \"token\" => @token }\n\t\t\tdocxml = nil\n\t\t\tdocxml=nessus_request('policy/list', post)\n\t\t\tif docxml.nil?\n\t\t\t\treturn\n\t\t\tend\n\t\t\tdocxml.root.elements['contents'].elements['policies'].each_element('//policy') {|policy|\n\t\t\t\treturn policy.elements['policyID'].text, policy.elements['policyName'].text\n\t\t\t}\n\t\tend",
"def pre_authorized_applications\n return @pre_authorized_applications\n end"
] | [
"0.7457317",
"0.6220168",
"0.61147636",
"0.59649783",
"0.5935576",
"0.5850785",
"0.58183944",
"0.57681656",
"0.57269746",
"0.5700887",
"0.5642988",
"0.56251615",
"0.5601081",
"0.53504634",
"0.52698547",
"0.52008104",
"0.51822466",
"0.51446414",
"0.51336974",
"0.5111897",
"0.5016224",
"0.5002741",
"0.4989363",
"0.49388403",
"0.4893997",
"0.4891243",
"0.48899022",
"0.48769814",
"0.48435047",
"0.48334438",
"0.48266992",
"0.47971305",
"0.47668886",
"0.4758801",
"0.4751128",
"0.4731167",
"0.47212332",
"0.46840414",
"0.46828887",
"0.46693572",
"0.4665032",
"0.46499774",
"0.464607",
"0.4644482",
"0.46361756",
"0.46252945",
"0.46212015",
"0.46091044",
"0.4593616",
"0.45891407",
"0.4585765",
"0.45849466",
"0.45762503",
"0.4564344",
"0.45612997",
"0.45504773",
"0.45440596",
"0.45410764",
"0.45332336",
"0.45324692",
"0.44883406",
"0.44739982",
"0.44706765",
"0.44693643",
"0.4443952",
"0.44434008",
"0.44399956",
"0.44267365",
"0.44195193",
"0.44195193",
"0.44097027",
"0.4407706",
"0.4399856",
"0.4399856",
"0.43997627",
"0.4389446",
"0.4383556",
"0.4383015",
"0.43827307",
"0.4379104",
"0.43732736",
"0.43728605",
"0.43728605",
"0.43593708",
"0.4350688",
"0.43499166",
"0.43498823",
"0.43498823",
"0.4345644",
"0.43438655",
"0.433876",
"0.43344727",
"0.43328494",
"0.4326014",
"0.4324558",
"0.43208528",
"0.43105784",
"0.43085197",
"0.43043816",
"0.43036795"
] | 0.8028733 | 0 |
Sets the tokenIssuancePolicies property value. The tokenIssuancePolicies property | def token_issuance_policies=(value)
@token_issuance_policies = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def token_issuance_policies\n return @token_issuance_policies\n end",
"def applied_policies=(value)\n @applied_policies = value\n end",
"def assignment_policies=(value)\n @assignment_policies = value\n end",
"def intended_policies=(value)\n @intended_policies = value\n end",
"def token_lifetime_policies=(value)\n @token_lifetime_policies = value\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 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 policies\n @policies = Policy.all\n end",
"def put_authcontrols_exemptmids_token(token, opts = {})\n put_authcontrols_exemptmids_token_with_http_info(token, opts)\n nil\n end",
"def tokens(theTokenTypes)\n\t\truleset.token_types = theTokenTypes\n\tend",
"def populate_policies(policies)\n @policies = policies.map do |policy|\n config = PolicyConfig.new()\n config.populate(policy)\n config\n end\n end",
"def compliance_policy=(value)\n @compliance_policy = value\n end",
"def policy=( val )\n val = val.to_s\n raise \"Invalid policy\" unless val == \"allow\" || val == \"deny\"\n\n self.permissions['policy'] = val\n end",
"def set_access_tokens(access_tokens)\n access_tokens.each do |token_name, token_value|\n token_name = token_name.to_sym\n next unless @@access_token_setters.has_key?(token_name)\n\n @@access_token_setters[token_name].each do |token_setter_method|\n token_setter_method.call(token_value)\n end\n end\n end",
"def app_consent_requests=(value)\n @app_consent_requests = value\n end",
"def apply_content_security_policy\n response.headers['Content-Security-Policy'] = build_content_security_policy\n end",
"def allowSecurityManagement()\n banner(\"Allow Security\")\n @run.society.each_enclave() do |enclave|\n securityAgents = getSecurityAgents(enclave)\n securityAgentsName = \"SecurityAgentsIn#{enclave}\"\n declareSet(securityAgentsName, securityAgents)\n permit(enclaveAgentsName(enclave), securityAgentsName,\n \"AllowSecurityManagement-#{enclave}-I\",\n [ enclave ])\n permit(securityAgentsName, enclaveAgentsName(enclave),\n \"AllowSecurityManagement-#{enclave}-II\",\n [ enclave ])\n end\n end",
"def list_sslpolicies(headers = {})\n get!(\"sslpolicies\", {}, headers)\n end",
"def disable_edu_policies=(value)\n @disable_edu_policies = value\n end",
"def grant_controls=(value)\n @grant_controls = value\n end",
"def certificate_policies\n extensions[R509::Cert::Extensions::CertificatePolicies]\n end",
"def implicit_grant_settings=(value)\n @implicit_grant_settings = value\n end",
"def myc_content_security_policy\n url = APP_CONFIG[:multi_year_charts_url]\n\n return unless url\n\n response.set_header('X-Frame-Options', \"allow-from #{url}\")\n response.set_header('Content-Security-Policy', \"frame-ancestors #{url}\")\n end",
"def content_security_policy_overrides\n {}\n end",
"def set_bypass_csp(enabled:)\n {\n method: \"Page.setBypassCSP\",\n params: { enabled: enabled }.compact\n }\n end",
"def threat_assessment_requests=(value)\n @threat_assessment_requests = value\n end",
"def oauth2_permission_scopes=(value)\n @oauth2_permission_scopes = value\n end",
"def auth_policies\n []\n end",
"def related_policy_ids=(policy_ids)\n policy_ids = Array.wrap(policy_ids).reject(&:blank?)\n new_policies = policy_ids.map {|id| Policy.find(id).document }\n other_related_documents = self.related_documents.reject { |document| document.latest_edition.is_a?(Policy) }\n\n self.related_documents = other_related_documents + new_policies\n end",
"def inhibit_any_policy\n extensions[R509::Cert::Extensions::InhibitAnyPolicy]\n end",
"def initialize(path_parameters, request_adapter)\n super(path_parameters, request_adapter, \"{+baseurl}/applications/{application%2Did}/tokenIssuancePolicies/{tokenIssuancePolicy%2Did}\")\n end",
"def list_policies\n nessus_rest_get('policies')['policies']\n end",
"def fetch_policies!\n @fetched = true\n @policy_classes = @policies.map do |pol|\n result = case pol\n when String\n Merb::Authorization._policy_from_string(pol)\n when Symbol\n Merb::Authorization._policies_from_scope(pol, scope)\n end\n end\n @policy_classes = @policy_classes.flatten.compact\n end",
"def allowed_mechs=(mechanisms)\n Cproton.pn_sasl_allowed_mechs(@impl, mechanisms)\n end",
"def policies()\n return MicrosoftGraph::Policies::PoliciesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def use_policies(*policies_or_labels)\n add_policies_to_labels(policies_or_labels, true)\n end",
"def sslpolicies(headers = {})\n list_sslpolicies(headers).resources.map do |sslpolicy|\n Resources::Sslpolicy.new(self, sslpolicy)\n end\n end",
"def certification_controls=(value)\n @certification_controls = value\n end",
"def automatic_user_consent_settings=(value)\n @automatic_user_consent_settings = value\n end",
"def token=(value)\n resources.each do |klass|\n klass.headers['Authorization'] = 'OAuth ' + value.to_s\n end\n @token = value\n end",
"def secure_score_control_profiles=(value)\n @secure_score_control_profiles = value\n end",
"def escalation_approvers=(value)\n @escalation_approvers = value\n end",
"def home_realm_discovery_policies=(value)\n @home_realm_discovery_policies = value\n end",
"def token_lifetime_policies\n return @token_lifetime_policies\n end",
"def assign_policy(*args)\n target.target.send(\"assign_policy\",*args)\n end",
"def set_oauth2_urls(spec, sec_scheme_id, authorization_url, token_url)\n sec_scheme_obj = spec.dig('components', 'securitySchemes', sec_scheme_id)\n if sec_scheme_obj.nil? || sec_scheme_obj['type'] != 'oauth2'\n raise ThreeScaleToolbox::Error, \"Expected security scheme {#{sec_scheme_id}} not found or not oauth2\"\n end\n\n sec_scheme_obj['flows'].each do |flow_key, flow_obj|\n flow_obj['authorizationUrl'] = authorization_url if %w[implicit authorizationCode].include?(flow_key)\n flow_obj['tokenUrl'] = token_url if %w[password clientCredentials authorizationCode].include?(flow_key)\n end\n end",
"def windows_information_protection_policies=(value)\n @windows_information_protection_policies = value\n end",
"def security_require_up_to_date_security_providers=(value)\n @security_require_up_to_date_security_providers = value\n end",
"def declare_access_control_keys( *ack_list )\n self.sg_access_control_keys = ack_list\n end",
"def policy_tags= new_policy_tags\n # If new_policy_tags is nil, send an empty array.\n # Sending a nil value for policy_tags results in no change.\n new_policy_tags = Array(new_policy_tags)\n policy_tag_list = Google::Apis::BigqueryV2::TableFieldSchema::PolicyTags.new names: new_policy_tags\n @gapi.update! policy_tags: policy_tag_list\n end",
"def enforce_configured_scopes\n @config.instance_variable_set(:@enforce_configured_scopes, true)\n end",
"def intended_policies\n return @intended_policies\n end",
"def user_flow_identity_providers=(value)\n @user_flow_identity_providers = value\n end",
"def index\n @bookings = policy_scope(current_user.bookings)\n authorize @bookings\n @experiences = policy_scope(current_user.experiences)\n authorize @experiences\n end",
"def set_skill\n @skill = policy_scope(Skill).find(params[:id])\n authorize(@skill)\n end",
"def list_policies\n http_get(:uri=>\"/policies\", :fields=>x_cookie)\n end",
"def set_security_and_privacy_vulnerability\n @security_and_privacy_vulnerability = SecurityAndPrivacyVulnerability.find(params[:id])\n end",
"def token_types=(theTokenTypes)\n\t\traise LexerSetupError, \"Token types can be specified only once.\" unless token_types.nil?\n\t\t@token_types = theTokenTypes\n\tend",
"def policy_scopes; end",
"def applied_policies\n return @applied_policies\n end",
"def set_csp\n logger.debug \"HELLO I AM A CSP\"\n response.headers['X-Content-Security-Policy'] = \"default-src 'self'; report-uri http://127.0.0.1:3000/csp_report\"\n end",
"def allow_keys(keys)\n @allow_keys = keys\n end",
"def set_privacy_policy\n @privacy_policy = PrivacyPolicy.find(params[:id])\n end",
"def add_policies(*policies_or_labels)\n add_policies_to_labels(policies_or_labels, false)\n end",
"def ios_enrollment_assignments=(value)\n @ios_enrollment_assignments = value\n end",
"def apply_config(config)\n if !config.is_a?(Array)\n config = [config]\n end\n config.each do |entry|\n pub = PubControlClient.new(entry['uri'])\n if entry.key?('iss')\n pub.set_auth_jwt({'iss' => entry['iss']}, entry['key'])\n end\n @clients.push(pub)\n end\n end",
"def pre_authorized_applications=(value)\n @pre_authorized_applications = value\n end",
"def identity_providers=(value)\n @identity_providers = value\n end",
"def identity_providers=(value)\n @identity_providers = value\n end",
"def ios_managed_app_protections=(value)\n @ios_managed_app_protections = value\n end",
"def allowed_accounts=(value)\n @allowed_accounts = value\n end",
"def update!(**args)\n @authorization_policies = args[:authorization_policies] if args.key?(:authorization_policies)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end",
"def issues=(value)\n @issues = value\n end",
"def assignment_policies\n return @assignment_policies\n end",
"def spoken_languages=(spoken_languages_from_response)\n @spoken_languages = Enceladus::SpokenLanguage.build_collection(spoken_languages_from_response)\n end",
"def share_point_ids=(value)\n @share_point_ids = value\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 custom_security_attribute_definitions=(value)\n @custom_security_attribute_definitions = value\n end",
"def enforced_settings=(value)\n @enforced_settings = value\n end",
"def disable_power_policies=(value)\n @disable_power_policies = value\n end",
"def check_policies(options = {})\n wss_client = WssAgent::Client.new\n result = wss_client.check_policies(\n WssAgent::Specifications.list(options),\n options\n )\n if result.success?\n WssAgent.logger.debug result.data\n puts result.message\n else\n WssAgent.logger.debug \"check policies errors occur: #{result.status}, message: #{result.message}, data: #{result.data}\"\n ap \"error: #{result.status}/#{result.data}\", color: { string: :red }\n end\n\n result\n end",
"def set_oauth2_urls(spec, sec_scheme_id, authorization_url, token_url)\n sec_scheme_obj = spec.dig('securityDefinitions', sec_scheme_id)\n if sec_scheme_obj.nil? || sec_scheme_obj['type'] != 'oauth2'\n raise ThreeScaleToolbox::Error, \"Expected security scheme {#{sec_scheme_id}} not found or not oauth2\"\n end\n\n sec_scheme_obj['authorizationUrl'] = authorization_url if %w[implicit accessCode].include?(sec_scheme_obj['flow'])\n sec_scheme_obj['tokenUrl'] = token_url if %w[password application accessCode].include?(sec_scheme_obj['flow'])\n end",
"def set_priv_policy\n @priv_policy = PrivPolicy.find(params[:id])\n end",
"def set *rules\n\n raise ArgumentError, 'expected one or more rules' if rules.empty?\n\n if rules == [[]]\n self.clear\n else\n rules = rule_hashes(rules)\n client.put_bucket_cors(:bucket_name => bucket.name, :rules => rules)\n end\n\n nil\n\n end",
"def account_manager_policy=(value)\n @account_manager_policy = value\n end",
"def content_security_policy_nonce_directives=(_arg0); end",
"def content_security_policy_nonce_directives=(_arg0); end",
"def vpp_tokens=(value)\n @vpp_tokens = value\n end",
"def assign_organization_licenses_seats(options = {})\r\n # Validate required parameters.\r\n validate_parameters(\r\n 'organization_id' => options['organization_id'],\r\n 'assign_organization_licenses_seats' => options['assign_organization_licenses_seats']\r\n )\r\n # Prepare query url.\r\n _path_url = '/organizations/{organizationId}/licenses/assignSeats'\r\n _path_url = APIHelper.append_url_with_template_parameters(\r\n _path_url,\r\n 'organizationId' => options['organization_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.post(\r\n _query_url,\r\n headers: _headers,\r\n parameters: options['assign_organization_licenses_seats'].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 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 content_security_policy_nonce=(_arg0); end",
"def cke_low_policy=(cke_low_policy)\n validator = EnumAttributeValidator.new('String', [\"platform-default\", \"auto\", \"disabled\", \"fast\", \"slow\"])\n unless validator.valid?(cke_low_policy)\n fail ArgumentError, \"invalid value for \\\"cke_low_policy\\\", must be one of #{validator.allowable_values}.\"\n end\n @cke_low_policy = cke_low_policy\n end",
"def azure_rights_management_services_allowed=(value)\n @azure_rights_management_services_allowed = value\n end",
"def call\n resolve_policies\n self\n end",
"def issuer=(value)\n @issuer = value\n end",
"def issuer=(value)\n @issuer = value\n end",
"def implicit_valence=(val)\n @ob.set_implicit_valence(val)\n end",
"def cloud_app_security=(value)\n @cloud_app_security = value\n end",
"def investor_suitabilitytokens(options)\n API::request(:post, 'investorsuitabilitytokens', options)\n end"
] | [
"0.6097537",
"0.56941724",
"0.56843114",
"0.55532855",
"0.5534543",
"0.50635594",
"0.49666488",
"0.46933973",
"0.4623201",
"0.45732978",
"0.45486927",
"0.44743288",
"0.44402224",
"0.44347432",
"0.44234434",
"0.44121087",
"0.43740857",
"0.43623433",
"0.4352911",
"0.43524063",
"0.43445578",
"0.43063465",
"0.43062136",
"0.42854977",
"0.428233",
"0.42788228",
"0.42397925",
"0.42203364",
"0.42161006",
"0.41971996",
"0.4191448",
"0.41849467",
"0.41836777",
"0.417728",
"0.41701218",
"0.41524345",
"0.41500124",
"0.4128605",
"0.41263148",
"0.4099452",
"0.40994352",
"0.40774867",
"0.40700057",
"0.40690422",
"0.406853",
"0.40505105",
"0.40477",
"0.40139595",
"0.40058723",
"0.39904538",
"0.39886698",
"0.39883226",
"0.39881223",
"0.39832044",
"0.39801207",
"0.39797828",
"0.39649123",
"0.39601523",
"0.3951909",
"0.39460084",
"0.39312023",
"0.39234284",
"0.39183387",
"0.39169034",
"0.39161444",
"0.39086288",
"0.39085338",
"0.3900058",
"0.3893224",
"0.3893224",
"0.38861805",
"0.38816744",
"0.38791448",
"0.38767725",
"0.38659397",
"0.38645297",
"0.3857254",
"0.3834326",
"0.38138992",
"0.38103327",
"0.38102767",
"0.38082623",
"0.38059607",
"0.38049904",
"0.3803216",
"0.3792421",
"0.37900224",
"0.37900224",
"0.37899116",
"0.3789528",
"0.37864044",
"0.37847933",
"0.37821224",
"0.3781044",
"0.37809837",
"0.37760025",
"0.37760025",
"0.3762348",
"0.37611157",
"0.37508398"
] | 0.7794396 | 0 |
Gets the tokenLifetimePolicies property value. The tokenLifetimePolicies property | def token_lifetime_policies
return @token_lifetime_policies
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def token_lifetime_policies=(value)\n @token_lifetime_policies = value\n end",
"def token_issuance_policies\n return @token_issuance_policies\n end",
"def get_token_lifetime(key)\n get_option(key, :token_lifetime)\n end",
"def token_issuance_policies=(value)\n @token_issuance_policies = value\n end",
"def session_tokens\n @data[:session_tokens]\n end",
"def auth_policies\n []\n end",
"def token_expiration_window\n # TODO - configurable per tenant\n 72\n end",
"def managed_app_policies\n return @managed_app_policies\n end",
"def list_policies\n http_get(:uri=>\"/policies\", :fields=>x_cookie)\n end",
"def app_management_policies\n return @app_management_policies\n end",
"def certificate_policies\n extensions[R509::Cert::Extensions::CertificatePolicies]\n end",
"def list_policies\n nessus_rest_get('policies')['policies']\n end",
"def applied_policies\n return @applied_policies\n end",
"def get_tokens\n\t\treturn @tokens\n\tend",
"def windows_information_protection_policies\n return @windows_information_protection_policies\n end",
"def termination_policies\n @group.termination_policies\n end",
"def tokens\n @tokens ||= []\n end",
"def node_policy_tags\n policy_tags = []\n if @policy_tags_enabled\n if @node.respond_to?('policy_group') && [email protected]_group.nil?\n policy_tags << \"#{@scope_prefix}policy_group:#{@node.policy_group}\"\n end\n if @node.respond_to?('policy_name') && [email protected]_name.nil?\n policy_tags << \"#{@scope_prefix}policy_name:#{@node.policy_name}\"\n end\n end\n policy_tags\n end",
"def tokens\n return @tokens\n end",
"def vpp_tokens\n return @vpp_tokens\n end",
"def lifetime_in_minutes\n return @lifetime_in_minutes\n end",
"def assignment_policies\n return @assignment_policies\n end",
"def group_lifecycle_policies()\n return MicrosoftGraph::GroupLifecyclePolicies::GroupLifecyclePoliciesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def valid_tokens\n clear_expired_tokens\n access_tokens.pluck(:token)\n end",
"def app_token_ttl\n Rails.application.secrets.app_token_ttl\n end",
"def get_auth_tkt_token_list\n cookie_decoded = Base64.decode64(cookies[:auth_tkt])\n return cookie_decoded.split('!')[1]\n end",
"def inactive_tokens\n client.get('/inactive_tokens')\n end",
"def policy_scopes; end",
"def expiration_behavior\n return @expiration_behavior\n end",
"def get_kubernetes_sys_config_policy_list(opts = {})\n data, _status_code, _headers = get_kubernetes_sys_config_policy_list_with_http_info(opts)\n data\n end",
"def ttl\n config = Pillowfort.config\n\n case self.type\n when 'activation' then config.activation_token_ttl\n when 'password_reset' then config.password_reset_token_ttl\n else config.session_token_ttl\n end\n end",
"def mdm_windows_information_protection_policies\n return @mdm_windows_information_protection_policies\n end",
"def getToken\n @tokens\n end",
"def content_security_policy_nonce_directives; end",
"def content_security_policy_nonce_directives; end",
"def token_modifiers\n attributes.fetch(:tokenModifiers)\n end",
"def tokens\r\n @tokens ||= TokensController.new(configuration: @configuration)\r\n end",
"def scopes\n env['HTTP_X_AUTHENTICATED_SCOPE'].to_s.split(',')\n end",
"def valid_intervals\n VALID[:interval]\n end",
"def policies\n @policies = Policy.all\n end",
"def keyspaces\n @keyspaces.values\n end",
"def tokens\n @tokens ||= Array(grpc.tokens).map { |g| Token.from_grpc g }\n end",
"def policies()\n return MicrosoftGraph::Policies::PoliciesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def policy_role_policies\n @policy_role_policies ||= Array.new.tap do |uris|\n filters = current_ability.agents.map do |agent|\n \"#{Ddr::Index::Fields::POLICY_ROLE}:\\\"#{agent}\\\"\"\n end.join(\" OR \")\n query = \"#{Ddr::Index::Fields::ACTIVE_FEDORA_MODEL}:Collection AND (#{filters})\"\n results = ActiveFedora::SolrService.query(query, rows: Collection.count, fl: Ddr::Index::Fields::INTERNAL_URI)\n results.each_with_object(uris) { |r, memo| memo << r[Ddr::Index::Fields::INTERNAL_URI] }\n end\n end",
"def expire_tokens!\n update_tokens(nil)\n end",
"def get_kubernetes_container_runtime_policy_list(opts = {})\n data, _status_code, _headers = get_kubernetes_container_runtime_policy_list_with_http_info(opts)\n data\n end",
"def list_sslpolicies(headers = {})\n get!(\"sslpolicies\", {}, headers)\n end",
"def home_realm_discovery_policies\n return @home_realm_discovery_policies\n end",
"def group_policies\r\n GroupPoliciesController.instance\r\n end",
"def scopes\n @scopes ||= config[:scopes] || []\n end",
"def apps_permissions_scopes_list\n return {} unless is_app_token?\n semaphore.synchronize {\n @apps_permissions_scopes_list ||= (\n r = get('/api/apps.permissions.scopes.list').parsed\n r['scopes'] || {}\n )\n }\n end",
"def session_controls\n return @session_controls\n end",
"def intended_policies\n return @intended_policies\n end",
"def policy_constraints\n extensions[R509::Cert::Extensions::PolicyConstraints]\n end",
"def tokens\n (@token.is_a? OAuth2::AccessToken) ? @token.to_hash : @token\n end",
"def get_directives ctx\n directives = []\n this_starting_tok = ctx.getSourceInterval.a\n\n i = this_starting_tok - 1\n curr_tok = i > 0 ? @tokens.get(i) : nil\n while curr_tok && curr_tok.channel != 0\n if curr_tok.channel == 2\n directives << curr_tok\n end\n\n i -= 1\n curr_tok = i > 0 ? @tokens.get(i) : nil\n end\n\n return directives\n end",
"def token_types\n @tokens.map(&:type)\n end",
"def token_types\n @tokens.map(&:type)\n end",
"def list_policy_firewall_session_timer_profiles(opts = {})\n data, _status_code, _headers = list_policy_firewall_session_timer_profiles_with_http_info(opts)\n data\n end",
"def tokens\n @tokens.dup\n end",
"def oauth2_permission_scopes\n return @oauth2_permission_scopes\n end",
"def get_token_count_and_deviance\n token_list = []\n get_all_tokens.each do |token|\n\ttoken_list.push([ token, get_token_total( token ), get_token_deviance( token ) ] )\n end\n return token_list\n end",
"def token_types\n attributes.fetch(:tokenTypes)\n end",
"def get_tokenizers_list\n [\n tokenizer_meeting_header_title,\n tokenizer_meeting_footer_city,\n \n tokenizer_meeting_footer_meeting_dates,\n tokenizer_meeting_footer_organization,\n \n tokenizer_event_summary_header_event_type,\n tokenizer_event_summary_header_distance,\n tokenizer_event_summary_header_style,\n \n tokenizer_event_detailed_header_event_type,\n tokenizer_event_detailed_header_distance,\n tokenizer_event_detailed_header_style,\n \n tokenizer_individual_category_header_gender,\n tokenizer_individual_category_header_group,\n tokenizer_individual_category_header_base_time,\n \n tokenizer_relay_category_header_gender,\n tokenizer_relay_category_header_group,\n tokenizer_relay_category_header_base_time,\n \n tokenizer_result_row_result_position,\n tokenizer_result_row_swimmer_name,\n tokenizer_result_row_swimmer_naz,\n tokenizer_result_row_swimmer_year,\n tokenizer_result_row_team_name,\n tokenizer_result_row_result_time,\n tokenizer_result_row_result_score,\n \n tokenizer_relay_row_result_position,\n tokenizer_relay_row_team_name,\n tokenizer_relay_row_result_time,\n tokenizer_relay_row_result_score,\n \n tokenizer_ranking_row_rank_position,\n tokenizer_ranking_row_team_name,\n tokenizer_ranking_row_rank_score\n ]\n end",
"def app_management_policies=(value)\n @app_management_policies = value\n end",
"def plural_policy_store\n @plural_policy_store = {} if @plural_policy_store.nil?\n return @plural_policy_store\n end",
"def group_policies\n policies = []\n Group.each do |group|\n group.group_memberships.each do |membership|\n if membership.account_id == _id\n policies.push(group.group_policy)\n end\n end\n end\n return policies\n end",
"def timers\n @timers\n end",
"def policy_tags\n names = @gapi.policy_tags&.names\n names.to_a if names && !names.empty?\n end",
"def all_tokens\n token_array = []\n self.data.each do |token, count|\n\ttoken_array.push( token )\n end\n return token_array\n end",
"def policy_list_uids\n\t\t\tpost= { \"token\" => @token }\n\t\t\tdocxml = nil\n\t\t\tdocxml=nessus_request('policy/list', post)\n\t\t\tif docxml.nil?\n\t\t\t\treturn\n\t\t\tend\n\t\t\tpids=Array.new\n\t\t\tdocxml.root.elements['contents'].elements['policies'].each_element('//policy') { |policy|\n\t\t\t\tpids.push(policy.elements['policyID'].text) }\n\t\t\treturn pids\n\t\tend",
"def list_pod_security_policy(opts = {})\n data, _status_code, _headers = list_pod_security_policy_with_http_info(opts)\n return data\n end",
"def windows_information_protection_policies=(value)\n @windows_information_protection_policies = value\n end",
"def refresh_tokens\n response = get(path: 'tokens')[\"data\"]\n token_array = response || {}\n tokens = {}\n token_array.each do |t|\n tokens[t.keys.first] = t.values.first\n end\n @tokens = tokens\n return tokens\n end",
"def get_token\n if @token && @valid_until && @valid_until > Time.now + 10\n @token\n else\n renew_token\n end\n end",
"def tokens_rpn\n output = []\n operators = []\n\n @tokens.each do |token|\n case token.type\n when :value\n output.push(token)\n when :operator\n if operators.any? && token.lexeme.precedence >= operators.last.lexeme.precedence\n output.push(operators.pop)\n end\n\n operators.push(token)\n end\n end\n\n output.concat(operators.reverse)\n end",
"def policy_list_names\n\t\t\tpost= { \"token\" => @token }\n\t\t\tdocxml = nil\n\t\t\tdocxml=nessus_request('policy/list', post)\n\t\t\tif docxml.nil?\n\t\t\t\treturn\n\t\t\tend\n\t\t\tlist = Array.new\n\t\t\tdocxml.root.elements['contents'].elements['policies'].each_element('//policy') {|policy|\n\t\t\t\tlist.push policy.elements['policyName'].text\n\t\t\t}\n\t\t\treturn list\n\t\tend",
"def api_tokens\n ApiToken.all(self)\n end",
"def get_tokenizers_list\n [\n tokenizer_meeting_header_title,\n tokenizer_meeting_header_meeting_dates,\n tokenizer_meeting_header_organization,\n tokenizer_category_header_distance,\n tokenizer_category_header_style,\n tokenizer_category_header_gender,\n tokenizer_category_header_group,\n tokenizer_category_header_base_time,\n tokenizer_relay_header_type,\n tokenizer_relay_header_distance,\n tokenizer_relay_header_style,\n tokenizer_relay_header_category_group,\n tokenizer_relay_header_base_time,\n tokenizer_result_row_result_position,\n tokenizer_result_row_team_code,\n tokenizer_result_row_swimmer_name,\n tokenizer_result_row_swimmer_year,\n tokenizer_result_row_team_name,\n tokenizer_result_row_result_time,\n tokenizer_result_row_result_score,\n tokenizer_relay_row_result_position,\n tokenizer_relay_row_team_name,\n tokenizer_relay_row_result_time,\n tokenizer_relay_row_result_score,\n tokenizer_ranking_row_result_position,\n tokenizer_ranking_row_team_code,\n tokenizer_ranking_row_team_name,\n tokenizer_ranking_row_result_score,\n tokenizer_stats_teams_tot,\n tokenizer_stats_teams_presence,\n tokenizer_stats_swimmers_tot,\n tokenizer_stats_swimmers_presence,\n tokenizer_stats_entries_tot,\n tokenizer_stats_entries_presence,\n tokenizer_stats_disqual_tot,\n tokenizer_stats_withdrawals_tot\n ]\n end",
"def expiration\n unless @expiration\n conf = Grape::Jwt::Authentication.configuration\n return conf.rsa_public_key_expiration\n end\n @expiration\n end",
"def strategies\n Warden::Strategies\n end",
"def policies_for_widget widget, options\n widget = widget.is_a?(Widget) ? widget : Widget.find(widget)\n policies = UbiquoDesign::CachePolicies.get(options[:policy_context])[widget.key]\n [widget, policies]\n end",
"def token_validation\n if (!jwt_string.blank? && !(token.all? &:blank?))\n cur_time = Time.now\n iat_time = Time.at(token[0][\"iat\"])\n exp_time = Time.at(token[0][\"exp\"])\n if exp_time < cur_time\n errors.add(:base, I18n.t('token.expired'))\n elsif !(iat_time < cur_time && iat_time < exp_time)\n errors.add(:base, I18n.t('token.invalid'))\n end\n else\n errors.add(:base, I18n.t('token.invalid'))\n end\n rescue JWT::DecodeError\n errors.add(:base, I18n.t('token.invalid'))\n end",
"def managed_app_policies=(value)\n @managed_app_policies = value\n end",
"def secret_strategy\n ::Doorkeeper.config.token_secret_strategy\n end",
"def secret_strategy\n ::Doorkeeper.config.token_secret_strategy\n end",
"def get_kubernetes_trusted_registries_policy_list(opts = {})\n data, _status_code, _headers = get_kubernetes_trusted_registries_policy_list_with_http_info(opts)\n data\n end",
"def keyspaces\n @@connections.keys\n end",
"def keyspaces\n @@connections.keys\n end",
"def assignment_policies=(value)\n @assignment_policies = value\n end",
"def overlapping_token_support\n attributes.fetch(:overlappingTokenSupport)\n end",
"def lifetime_in_minutes=(value)\n @lifetime_in_minutes = value\n end",
"def sessions\n\n key = \"000000:#{TransamController::ACTIVE_SESSION_LIST_CACHE_VAR}\"\n @sessions = Rails.cache.fetch(key)\n @sessions.delete_if { |key, value| value[:expire_time] < Time.now }\n @sessions ||= {}\n\n end",
"def applied_policies=(value)\n @applied_policies = value\n end",
"def scopes\n self.class.scopes\n end",
"def identity_providers\n return @identity_providers\n end",
"def identity_providers\n return @identity_providers\n end",
"def generate_tokens_list\n begin\n edit_time = File.mtime(@config_path)\n\n if edit_time > @last_edit\n @tokens = YAML::load_file(@config_path)\n @last_edit = edit_time\n\n log.info \"Token(s) list updated.\"\n end\n rescue Exception => e\n log.warn \"Could not load configuration. #{e.message}\"\n end\n end",
"def providers\n authentication_strategies.pluck :provider\n end",
"def content_security_policy_nonce_generator; end"
] | [
"0.7786238",
"0.66641134",
"0.5829801",
"0.5734849",
"0.5449247",
"0.5344709",
"0.5301566",
"0.5174814",
"0.5174026",
"0.51546216",
"0.51288104",
"0.5083235",
"0.50620943",
"0.50186986",
"0.4898852",
"0.4886999",
"0.48863584",
"0.48815978",
"0.4868273",
"0.48422164",
"0.48416954",
"0.48342997",
"0.48301932",
"0.48270354",
"0.48017356",
"0.4736721",
"0.47307554",
"0.4676956",
"0.4620764",
"0.46164122",
"0.4609286",
"0.46073616",
"0.45948994",
"0.4560959",
"0.4560959",
"0.45574823",
"0.45541915",
"0.45522398",
"0.45485285",
"0.45430353",
"0.45387125",
"0.45247844",
"0.4520922",
"0.45161223",
"0.44921112",
"0.44734016",
"0.44573516",
"0.445648",
"0.4435733",
"0.443474",
"0.44342184",
"0.44325843",
"0.44307286",
"0.44089022",
"0.44084838",
"0.44057807",
"0.43986213",
"0.43986213",
"0.43949908",
"0.4388896",
"0.4384436",
"0.4381841",
"0.4336707",
"0.4328184",
"0.43117872",
"0.43092206",
"0.42861506",
"0.42858958",
"0.42760152",
"0.42479047",
"0.4243958",
"0.42434508",
"0.42278805",
"0.42222664",
"0.42171463",
"0.42152375",
"0.42072105",
"0.42058122",
"0.42048702",
"0.42037743",
"0.41989025",
"0.4171847",
"0.4162418",
"0.4159803",
"0.4158674",
"0.4158674",
"0.41515175",
"0.41390878",
"0.41390878",
"0.41387174",
"0.41366267",
"0.41195178",
"0.41187623",
"0.41166073",
"0.4114185",
"0.41137505",
"0.41137505",
"0.41128686",
"0.41127804",
"0.40984228"
] | 0.85305226 | 0 |
Sets the tokenLifetimePolicies property value. The tokenLifetimePolicies property | def token_lifetime_policies=(value)
@token_lifetime_policies = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def token_lifetime_policies\n return @token_lifetime_policies\n end",
"def token_issuance_policies=(value)\n @token_issuance_policies = value\n end",
"def expire_tokens!\n update_tokens(nil)\n end",
"def set_token_expires_at\n self.token_expires_at = 3600.seconds.from_now\n end",
"def token_issuance_policies\n return @token_issuance_policies\n end",
"def token_expiration_window\n # TODO - configurable per tenant\n 72\n end",
"def assignment_policies=(value)\n @assignment_policies = value\n end",
"def implicit_grant_id_token_lifespan=(implicit_grant_id_token_lifespan)\n pattern = Regexp.new(/^[0-9]+(ns|us|ms|s|m|h)$/)\n if !implicit_grant_id_token_lifespan.nil? && implicit_grant_id_token_lifespan !~ pattern\n fail ArgumentError, \"invalid value for \\\"implicit_grant_id_token_lifespan\\\", must conform to the pattern #{pattern}.\"\n end\n\n @implicit_grant_id_token_lifespan = implicit_grant_id_token_lifespan\n end",
"def set_auth_token_expiry\n self.auth_token_expires_at = (Time.zone.now + 30.days)\n end",
"def white_list_set_expire(name_of_list, seconds)\n list_set_expire(\"#{WHITE_LIST_NAMED}:#{name_of_list}\", seconds)\n end",
"def vpp_tokens=(value)\n @vpp_tokens = value\n end",
"def tokens(theTokenTypes)\n\t\truleset.token_types = theTokenTypes\n\tend",
"def ttl=(seconds)\n self.shared_max_age = age + seconds\n end",
"def refresh_tokens\n @token = @token.refresh!\n tokens\n end",
"def app_management_policies=(value)\n @app_management_policies = value\n end",
"def applied_policies=(value)\n @applied_policies = value\n end",
"def get_token_lifetime(key)\n get_option(key, :token_lifetime)\n end",
"def session_token=(new_token)\n @session_token = new_token\n @toodle_token_death = Time.now + Babar::Base.toodle_app_token_lifetime\n @session_token\n end",
"def update_token! options = {}\n # Normalize all keys to symbols to allow indifferent access internally\n options = deep_hash_normalize options\n\n self.expires_in = options[:expires] if options.key? :expires\n self.expires_in = options[:expires_in] if options.key? :expires_in\n self.expires_at = options[:expires_at] if options.key? :expires_at\n\n # By default, the token is issued at `Time.now` when `expires_in` is\n # set, but this can be used to supply a more precise time.\n self.issued_at = options[:issued_at] if options.key? :issued_at\n\n # Special case where we want expires_at to be relative to issued_at\n if options.key?(:issued_at) && options.key?(:expires_in)\n set_relative_expires_at options[:issued_at], options[:expires_in]\n end\n\n self.access_token = options[:access_token] if options.key? :access_token\n self.refresh_token = options[:refresh_token] if options.key? :refresh_token\n self.id_token = options[:id_token] if options.key? :id_token\n\n self\n end",
"def implicit_grant_access_token_lifespan=(implicit_grant_access_token_lifespan)\n pattern = Regexp.new(/^[0-9]+(ns|us|ms|s|m|h)$/)\n if !implicit_grant_access_token_lifespan.nil? && implicit_grant_access_token_lifespan !~ pattern\n fail ArgumentError, \"invalid value for \\\"implicit_grant_access_token_lifespan\\\", must conform to the pattern #{pattern}.\"\n end\n\n @implicit_grant_access_token_lifespan = implicit_grant_access_token_lifespan\n end",
"def start_expiry_period!\n self.update_attribute(:access_token_expires_at, Time.now + Devise.timeout_in)\n end",
"def managed_app_policies=(value)\n @managed_app_policies = value\n end",
"def start_expiry_period!\n self.update_attribute(:access_token_expires_at, 2.days.from_now)\n end",
"def expiration_behavior=(value)\n @expiration_behavior = value\n end",
"def put_authcontrols_exemptmids_token(token, opts = {})\n put_authcontrols_exemptmids_token_with_http_info(token, opts)\n nil\n end",
"def group_lifecycle_policies()\n return MicrosoftGraph::GroupLifecyclePolicies::GroupLifecyclePoliciesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def lifetime_in_minutes=(value)\n @lifetime_in_minutes = value\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 black_list_set_expire(name_of_list, seconds)\n list_set_expire(\"#{BLACK_LIST_NAMED}:#{name_of_list}\", seconds)\n end",
"def windows_information_protection_policies=(value)\n @windows_information_protection_policies = value\n end",
"def initialize(path_parameters, request_adapter)\n super(path_parameters, request_adapter, \"{+baseurl}/applications/{application%2Did}/tokenLifetimePolicies/{tokenLifetimePolicy%2Did}\")\n end",
"def populate_policies(policies)\n @policies = policies.map do |policy|\n config = PolicyConfig.new()\n config.populate(policy)\n config\n end\n end",
"def expire_all_namespaces(scope_hash={})\n @_point_keys.keys.each{ |k| expire_namespace(k, scope_hash) }\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 token_types=(theTokenTypes)\n\t\traise LexerSetupError, \"Token types can be specified only once.\" unless token_types.nil?\n\t\t@token_types = theTokenTypes\n\tend",
"def memory_thermal_throttling=(memory_thermal_throttling)\n validator = EnumAttributeValidator.new('String', [\"platform-default\", \"CLTT with PECI\", \"Disabled\"])\n unless validator.valid?(memory_thermal_throttling)\n fail ArgumentError, \"invalid value for \\\"memory_thermal_throttling\\\", must be one of #{validator.allowable_values}.\"\n end\n @memory_thermal_throttling = memory_thermal_throttling\n end",
"def ttl_in_seconds=(value)\n @ttl_in_seconds = value\n refresh_rates_expiration! if ttl_in_seconds\n end",
"def client_ttl=(seconds)\n self.max_age = age + seconds\n end",
"def auth_policies\n []\n end",
"def ttl_in_seconds=(value)\n @ttl_in_seconds = value\n refresh_rates_expiration! if ttl_in_seconds\n end",
"def valid_tokens\n clear_expired_tokens\n access_tokens.pluck(:token)\n end",
"def intended_policies=(value)\n @intended_policies = value\n end",
"def generate_tokens_list\n begin\n edit_time = File.mtime(@config_path)\n\n if edit_time > @last_edit\n @tokens = YAML::load_file(@config_path)\n @last_edit = edit_time\n\n log.info \"Token(s) list updated.\"\n end\n rescue Exception => e\n log.warn \"Could not load configuration. #{e.message}\"\n end\n end",
"def content_security_policy_nonce_directives=(_arg0); end",
"def content_security_policy_nonce_directives=(_arg0); end",
"def refresh_tokens\n response = get(path: 'tokens')[\"data\"]\n token_array = response || {}\n tokens = {}\n token_array.each do |t|\n tokens[t.keys.first] = t.values.first\n end\n @tokens = tokens\n return tokens\n end",
"def jwt_bearer_grant_access_token_lifespan=(jwt_bearer_grant_access_token_lifespan)\n pattern = Regexp.new(/^[0-9]+(ns|us|ms|s|m|h)$/)\n if !jwt_bearer_grant_access_token_lifespan.nil? && jwt_bearer_grant_access_token_lifespan !~ pattern\n fail ArgumentError, \"invalid value for \\\"jwt_bearer_grant_access_token_lifespan\\\", must conform to the pattern #{pattern}.\"\n end\n\n @jwt_bearer_grant_access_token_lifespan = jwt_bearer_grant_access_token_lifespan\n end",
"def ttl_in_seconds=(value)\n @ttl_in_seconds = value\n refresh_rates_expiration! if ttl_in_seconds\n end",
"def ttl_in_seconds=(value)\n @ttl_in_seconds = value\n refresh_rates_expiration! if ttl_in_seconds\n end",
"def ttl_in_seconds=(value)\n @ttl_in_seconds = value\n refresh_rates_expiration! if ttl_in_seconds\n end",
"def add_sec_modes *modes\n modes.flatten.each do |new_mode|\n add_sec_mode new_mode\n end\n end",
"def mdm_windows_information_protection_policies=(value)\n @mdm_windows_information_protection_policies = value\n end",
"def clear_expired_tokens\n access_tokens.where(\"token_expire < ?\", Time.now).destroy_all\n end",
"def clear_expired_tokens\n access_tokens.where(\"token_expire < ?\", Time.now).destroy_all\n end",
"def setup_expiration\n self.expires_at = Time.now.utc + ::Simple::OAuth2.config.authorization_code_lifetime if expires_at.nil?\n end",
"def token=(value)\n @token = value\n resources.each do |klass|\n update_token_header(klass)\n end\n end",
"def del_sec_modes *modes\n modes.flatten.each do |old_mode|\n del_sec_mode old_mode\n end\n end",
"def authorization_code_grant_id_token_lifespan=(authorization_code_grant_id_token_lifespan)\n pattern = Regexp.new(/^[0-9]+(ns|us|ms|s|m|h)$/)\n if !authorization_code_grant_id_token_lifespan.nil? && authorization_code_grant_id_token_lifespan !~ pattern\n fail ArgumentError, \"invalid value for \\\"authorization_code_grant_id_token_lifespan\\\", must conform to the pattern #{pattern}.\"\n end\n\n @authorization_code_grant_id_token_lifespan = authorization_code_grant_id_token_lifespan\n end",
"def expiration=(value)\n @expiration = value\n end",
"def ttl_in_seconds= value\n @ttl_in_seconds = value\n refresh_rates_expiration! if ttl_in_seconds\n end",
"def reset_perishable_token!\n reset_perishable_token\n save_without_session_maintenance(validate: false)\n end",
"def oauth2_permission_scopes=(value)\n @oauth2_permission_scopes = value\n end",
"def tag_tokens=(ids)\n current_ids = []\n ids.split(\",\").each do |id|\n current_ids << OfficialTag.find_or_create_by(tag_text: id).id\n end\n self.official_tag_ids = current_ids\n end",
"def policy_scopes; end",
"def content_security_policy_nonce_directives; end",
"def content_security_policy_nonce_directives; end",
"def purge_old_tokens\n auth_tokens.desc(:last_used_at).offset(20).destroy_all\n end",
"def related_policy_ids=(policy_ids)\n policy_ids = Array.wrap(policy_ids).reject(&:blank?)\n new_policies = policy_ids.map {|id| Policy.find(id).document }\n other_related_documents = self.related_documents.reject { |document| document.latest_edition.is_a?(Policy) }\n\n self.related_documents = other_related_documents + new_policies\n end",
"def ttl_in_seconds=(value)\n @ttl_in_seconds = value\n refresh_rates_expiration if ttl_in_seconds\n ttl_in_seconds\n end",
"def list_set_expire(name_of_list, seconds)\n res = 0\n @redis_pool.with do |redis|\n res = redis.expire \"#{name_of_list}\", seconds\n end\n\n res\n end",
"def policies()\n return MicrosoftGraph::Policies::PoliciesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def terms_expiration=(value)\n @terms_expiration = value\n end",
"def user_tokens=(ids)\n self.user_ids = ids.split(\",\")\n end",
"def refresh_tokens\n\t\tbegin\n\t\t\t\n\t\t\tresp = $c.initiate_auth({\n\t\t\t auth_flow: \"REFRESH_TOKEN\",\n\t\t\t auth_parameters: {\n\t\t\t \"REFRESH_TOKEN\" => self.refresh_token,\n\t\t\t \"SECRET_HASH\" => calculate_cognito_hmac\n\t\t\t },\n\t\t\t client_id: ENV[\"COGNITO_CLIENT_ID\"]\n\t\t\t})\n\t\t\t\n\t\t\tself.access_token = resp[:authentication_result][:access_token]\n\t\t\tself.refresh_token = resp[:authentication_result][:refresh_token]\n\t\t\tself.token_expires_at = Time.now + (resp[:authentication_result][:expires_in]).seconds\n\t\t\tself.save\n\t\t\t#session[:user] = self\n\t\trescue => e\n\t\t\te.to_s\n\t\tend\t\n\tend",
"def expire_multiple\n taxa_ids = params[:taxa_ids]\n if allowed_request && !params[:taxa_ids].nil?\n expire_taxa(taxa_ids.split(','))\n render text: \"Taxa IDs #{taxa_ids} and their ancestors expired.\", layout: false\n else\n redirect_to root_url, status: :moved_permanently\n end\n end",
"def expires=(value)\n @expires = value\n @expires_in = nil\n end",
"def implicit_grant_settings=(value)\n @implicit_grant_settings = value\n end",
"def sslpolicies(headers = {})\n list_sslpolicies(headers).resources.map do |sslpolicy|\n Resources::Sslpolicy.new(self, sslpolicy)\n end\n end",
"def ttl\n config = Pillowfort.config\n\n case self.type\n when 'activation' then config.activation_token_ttl\n when 'password_reset' then config.password_reset_token_ttl\n else config.session_token_ttl\n end\n end",
"def song_tokens=(tokens)\n self.song_ids = Song.ids_from_tokens(tokens)\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.unifiedRoleManagementPolicyExpirationRule\"\n end",
"def grant_controls=(value)\n @grant_controls = value\n end",
"def set_access_tokens(access_tokens)\n access_tokens.each do |token_name, token_value|\n token_name = token_name.to_sym\n next unless @@access_token_setters.has_key?(token_name)\n\n @@access_token_setters[token_name].each do |token_setter_method|\n token_setter_method.call(token_value)\n end\n end\n end",
"def content_security_policy_overrides\n {}\n end",
"def list_policies\n http_get(:uri=>\"/policies\", :fields=>x_cookie)\n end",
"def home_realm_discovery_policies=(value)\n @home_realm_discovery_policies = value\n end",
"def expire!\n token = nil\n save!\n end",
"def certificate_policies\n extensions[R509::Cert::Extensions::CertificatePolicies]\n end",
"def expires_in=(value)\n @expires_in = value\n @expires = nil\n end",
"def app_token_ttl\n Rails.application.secrets.app_token_ttl\n end",
"def shared_token=(ids)\n #self.shared_ids = ids.split(\",\")\n end",
"def tokens\r\n @tokens ||= TokensController.new(configuration: @configuration)\r\n end",
"def add_rules(rules)\n rules.each {|a_rule| @l.addToken(a_rule.tokID,a_rule.re)}\n end",
"def refresh_time\n self.update_column( :expires, Time.zone.now + TOKEN_LIFE )\n end",
"def update_listener_policies(elb_name, port, policy_names)\n # Make sure a policy exists for each policy on the listener\n policy_names.each do |policy_name|\n ensure_policy_exists(elb_name, policy_name)\n end\n\n @elb.set_load_balancer_policies_of_listener({\n load_balancer_name: elb_name,\n load_balancer_port: port,\n policy_names: policy_names\n })\n end",
"def add_policies(*policies_or_labels)\n add_policies_to_labels(policies_or_labels, false)\n end",
"def refresh_token_grant_id_token_lifespan=(refresh_token_grant_id_token_lifespan)\n pattern = Regexp.new(/^[0-9]+(ns|us|ms|s|m|h)$/)\n if !refresh_token_grant_id_token_lifespan.nil? && refresh_token_grant_id_token_lifespan !~ pattern\n fail ArgumentError, \"invalid value for \\\"refresh_token_grant_id_token_lifespan\\\", must conform to the pattern #{pattern}.\"\n end\n\n @refresh_token_grant_id_token_lifespan = refresh_token_grant_id_token_lifespan\n end",
"def set_token_boundaries(t, token_start_index, token_stop_index)\n raise NotImplementedError\n end",
"def enforce_configured_scopes\n @config.instance_variable_set(:@enforce_configured_scopes, true)\n end",
"def add_tokens(tokens)\n @token_stream.concat(tokens)\n end"
] | [
"0.6781242",
"0.61642754",
"0.57528365",
"0.5146086",
"0.50833166",
"0.48748255",
"0.4769637",
"0.4720709",
"0.4641739",
"0.4641101",
"0.46390903",
"0.46234116",
"0.46188337",
"0.46134773",
"0.45927358",
"0.4586908",
"0.45602116",
"0.45430267",
"0.4533689",
"0.4527906",
"0.45221946",
"0.4360972",
"0.43407732",
"0.42590111",
"0.42530122",
"0.42417553",
"0.42396614",
"0.42379695",
"0.42276362",
"0.42224517",
"0.421538",
"0.42137003",
"0.42051214",
"0.41902304",
"0.41770393",
"0.41688827",
"0.41672295",
"0.4162403",
"0.4143065",
"0.413642",
"0.4129363",
"0.41248125",
"0.41222823",
"0.41197008",
"0.41197008",
"0.41027066",
"0.40913534",
"0.40896922",
"0.40896922",
"0.40896922",
"0.40788954",
"0.40785375",
"0.4078029",
"0.4078029",
"0.40554497",
"0.40511474",
"0.40443745",
"0.40363362",
"0.40298682",
"0.40125728",
"0.39978248",
"0.39846426",
"0.39793304",
"0.39742044",
"0.39676818",
"0.39676818",
"0.3960731",
"0.39605248",
"0.39556792",
"0.39511204",
"0.39488947",
"0.3935417",
"0.39324608",
"0.39276877",
"0.39251375",
"0.39200985",
"0.39161244",
"0.39139113",
"0.3912766",
"0.39095956",
"0.39085603",
"0.3907375",
"0.38964137",
"0.3882779",
"0.38794032",
"0.38756758",
"0.38739696",
"0.38702998",
"0.3869044",
"0.3868306",
"0.38624606",
"0.3860978",
"0.38599935",
"0.38533923",
"0.38532272",
"0.38498503",
"0.3845746",
"0.38441116",
"0.38422054",
"0.38303378"
] | 0.79687697 | 0 |
Gets the verifiedPublisher property value. Specifies the verified publisher of the application. For more information about how publisher verification helps support application security, trustworthiness, and compliance, see Publisher verification. | def verified_publisher
return @verified_publisher
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verified_publisher=(value)\n @verified_publisher = value\n end",
"def app_publisher\n return @app_publisher\n end",
"def app_publisher\n return @app_publisher\n end",
"def publisher_domain\n return @publisher_domain\n end",
"def publisher\n return @publisher\n end",
"def publisher\n return @publisher\n end",
"def publisher\n return @publisher\n end",
"def publisher\n return @publisher\n end",
"def app_publisher=(value)\n @app_publisher = value\n end",
"def app_publisher=(value)\n @app_publisher = value\n end",
"def publisher_name\n return @publisher_name\n end",
"def publisher=(value)\n @publisher = value\n end",
"def publisher=(value)\n @publisher = value\n end",
"def publisher=(value)\n @publisher = value\n end",
"def publisher=(value)\n @publisher = value\n end",
"def verified?\n @verified\n end",
"def verified?\n response[\"verified\"]\n end",
"def client_applications_from_verified_publisher_only=(value)\n @client_applications_from_verified_publisher_only = value\n end",
"def publisher_id\n @@publisher_id\n end",
"def client_applications_from_verified_publisher_only\n return @client_applications_from_verified_publisher_only\n end",
"def publisher_domain=(value)\n @publisher_domain = value\n end",
"def is_verified?\n verified\n end",
"def verified?\n\t\t\t@verified\n\t\tend",
"def verified\n object.is_verified?\n end",
"def verifier\n Verifier.new(public_key)\n end",
"def publisher_id=(pub_id)\n @@publisher_id = pub_id\n end",
"def verified?\n verification_code.nil?\n end",
"def publisher_url=(v)\n @publisher_url = v ? URI.parse(v) : nil\n end",
"def verified?\n (status == VERIFIED)\n end",
"def publisher\n @publisher ||= Publisher.new(self)\n end",
"def publisher_name=(value)\n @publisher_name = value\n end",
"def publisher_gln\n if self.publishers.length==1\n self.publisher.gln\n end\n end",
"def publisher_name=(v)\n @publisher_name = v\n end",
"def verified_handler\n @verified_handler\n end",
"def publisher\n if !@publisher\n @sneakers_packer_mutex.synchronize {\n @publisher ||= ::Sneakers::Publisher.new\n }\n end\n @publisher\n end",
"def publisher_name\n if self.publishers.length > 0\n self.publishers.map{|p| p.name}.join(\" / \")\n end\n end",
"def verified?\n (@verified_key ||= verify_api_key) != :false\n end",
"def publisher_class\n Publisher\n end",
"def publisher=(publisher_name)\n record.publisher = Publisher.find_by_name(publisher_name)\n @publisher = record.publisher || publisher_name\n end",
"def verified?\n true\n end",
"def verified?\n outputs_verified?\n end",
"def publisher\n vm.storage_profile.image_reference.publisher\n end",
"def public_key\n @cert.public_key\n end",
"def verified?\n (@verified_key ||= verify_api_key) != :false\n end",
"def public_key\n @pub\n end",
"def publishing_house\n scalar('publisher_tesim') || ''\n end",
"def public_key\n @cert.public_key\n end",
"def verified?\n verification_token.blank? && verified_at.present?\n end",
"def signed_id_verifier=(verifier)\n @signed_id_verifier = verifier\n end",
"def published?\n self.published\n end",
"def set_publisher\n\t\t\t@publisher = Publisher.find(params[:id])\n\t\tend",
"def identity_publisher_hash\n return @identity_publisher_hash\n end",
"def published?\n published.eql?(true)\n end",
"def set_publisher\n @publisher = Publisher.find(params[:id])\n end",
"def set_publisher\n @publisher = Publisher.find(params[:id])\n end",
"def publisher\n if @publisher.nil?\n @publisher = FeedTools::Author.new\n @publisher.raw = FeedTools::HtmlHelper.unescape_entities( \n FeedTools::XmlHelper.try_xpaths(self.channel_node, [\n \"webMaster/text()\",\n \"dc:publisher/text()\"\n ], :select_result_value => true))\n\n unless @publisher.raw.blank?\n raw_scan = @publisher.raw.scan(\n /(.*)\\((\\b[A-Z0-9._%-\\+]+@[A-Z0-9._%-]+\\.[A-Z]{2,4}\\b)\\)/i)\n if raw_scan.nil? || raw_scan.size == 0\n raw_scan = @publisher.raw.scan(\n /(\\b[A-Z0-9._%-\\+]+@[A-Z0-9._%-]+\\.[A-Z]{2,4}\\b)\\s*\\((.*)\\)/i)\n unless raw_scan.size == 0\n publisher_raw_pair = raw_scan.first.reverse\n end\n else\n publisher_raw_pair = raw_scan.first\n end\n if raw_scan.nil? || raw_scan.size == 0\n email_scan = @publisher.raw.scan(\n /\\b[A-Z0-9._%-\\+]+@[A-Z0-9._%-]+\\.[A-Z]{2,4}\\b/i)\n if email_scan != nil && email_scan.size > 0\n @publisher.email = email_scan.first.strip\n end\n end\n unless publisher_raw_pair.nil? || publisher_raw_pair.size == 0\n @publisher.name = publisher_raw_pair.first.strip\n @publisher.email = publisher_raw_pair.last.strip\n else\n unless @publisher.raw.include?(\"@\")\n # We can be reasonably sure we are looking at something\n # that the creator didn't intend to contain an email address if\n # it got through the preceeding regexes and it doesn't\n # contain the tell-tale '@' symbol.\n @publisher.name = @publisher.raw\n end\n end\n end\n\n @publisher.name = nil if @publisher.name.blank?\n @publisher.raw = nil if @publisher.raw.blank?\n @publisher.email = nil if @publisher.email.blank?\n @publisher.url = nil if @publisher.url.blank?\n if @publisher.url != nil\n begin\n if !(@publisher.url =~ /^file:/) &&\n !FeedTools::UriHelper.is_uri?(@publisher.url)\n channel_base_uri = nil\n unless self.channel_node.nil?\n channel_base_uri = self.channel_node.base_uri\n end\n @publisher.url = FeedTools::UriHelper.resolve_relative_uri(\n @publisher.url, [channel_base_uri, self.base_uri])\n end\n rescue\n end\n end \n end\n return @publisher\n end",
"def client_application_publisher_ids\n return @client_application_publisher_ids\n end",
"def verify(signed_message)\n verified(signed_message)\n end",
"def request_signature_verification\n return @request_signature_verification\n end",
"def publisher=(new_publisher)\n if new_publisher.respond_to?(:name) &&\n new_publisher.respond_to?(:email) &&\n new_publisher.respond_to?(:url)\n # It's a complete Author object, just set it.\n @publisher = new_publisher\n else\n # We're not looking at an Author object, this is probably a string,\n # default to setting the publisher's name.\n if @publisher.nil?\n @publisher = FeedTools::Author.new\n end\n @publisher.name = new_publisher\n end\n end",
"def GetSpeakerThatWouldBeApproved()\n\t\t\tspeaker = Speaker.new(\"First\", \"Last\", \"[email protected]\", \"Example Employer\", true, WebBrowser.new(\"test\", 1), 1, Certifications.new(), \"\", Session.new(\"test title\", \"test description\"))\n\t\t\t\n\t\t\treturn speaker\n\t\tend",
"def certification\n return @certification\n end",
"def set_verification\n if provider_class.require_verify?\n self.require_verify = true\n self.verified = false\n end\n end",
"def validate_publisher(item)\n error(msg: 'Publisher may not be blank', item: __method__.to_s) if blank?(item)\n end",
"def verified_count\n @verified_count ||= Vendor.where(:vendor_verified.exists => true).count\n end",
"def get_first_publisher\n self.publishers.all.first.id unless self.publishers.all.first.nil?\n end",
"def getPublisher( publisher_id)\n params = Hash.new\n params['publisher_id'] = publisher_id\n return doCurl(\"get\",\"/publisher\",params)\n end",
"def client_public_key\n return ENV[\"MCOLLECTIVE_SSL_PUBLIC\"] if ENV.include?(\"MCOLLECTIVE_SSL_PUBLIC\")\n\n raise(\"No plugin.ssl_client_public configuration option specified\") unless @config.pluginconf.include?(\"ssl_client_public\")\n\n return @config.pluginconf[\"ssl_client_public\"]\n end",
"def get_public_key\n return @public_key\n end",
"def set_publisher\n @publisher = Publisher.includes(:circulations).where(:id => params[:id], :admin_id => @current_user.id).first\n end",
"def published\n if self.delivery_options.publishable.present?\n meth = \"published_by_#{self.delivery_options.publishable.to_s}\"\n return self.send(meth.to_sym)\n end\n where(:published => true)\n end",
"def set_publisher\n @publisher = Publisher.cached_find(params[:publisher_id])\n end",
"def check_published\n \n if self.publishing_state == PublishingState::PUBLISHED\n self.publishing_date = Time.now\n self.publishing_publisher = connected_user.username\n end\n\n end",
"def checkPublisherID\n begin\n publisher = Publisher.find_by(alpha_id: params[:publisher_alpha_id], verified: true) # grab publisher from clientID\n logger.info \"publisher url: #{params['publisher_url']}\"\n publisher_url = params['publisher_url']\n publisher_domain = URI(publisher_url).host\n @valid = (publisher.present? and publisher.is_valid_domain(publisher_domain))\n logger.info {\"Request has valid client id: #{@valid}\"}\n respond_to do |format|\n format.js do\n render json: @valid, callback: params[:callback]\n end\n end\n rescue => e\n respond_to do |format|\n format.js do\n render json: false, callback: params[:callback]\n end\n end\n end\n end",
"def verified?\n certificate = IdealGateway.certificate_for_fingerprint(fingerprint)\n return false unless certificate\n IdealGateway.ideal_certificate = certificate\n old_verified?\n end",
"def verify\r\n self.verified = true\r\n end",
"def set_verifier\n\t\tself.verified_on = Time.now\n\t\tself.verified_by_uid = current_user.try(:uid)||''\n\tend",
"def set_verifier\n\t\tself.verified_on = Time.now\n\t\tself.verified_by_uid = current_user.try(:uid)||''\n\tend",
"def book_publisher=(book_publisher)\n if !book_publisher.nil? && book_publisher.to_s.length > 50\n fail ArgumentError, 'invalid value for \"book_publisher\", the character length must be smaller than or equal to 50.'\n end\n\n @book_publisher = book_publisher\n end",
"def client_application_publisher_ids=(value)\n @client_application_publisher_ids = value\n end",
"def verify\n\t\tself.verified = true\n\t\tself.save\n\tend",
"def has_verified_akismet_key?()\n return @verifiedKey\n end",
"def is_published?\n self.publishing_state == PublishingState::PUBLISHED\n end",
"def email_verified? # an alias to the field\n email_verified\n end",
"def certified?\n @data['certifiedBot']\n end",
"def is_signed\n return @is_signed\n end",
"def identity_publisher_hash=(value)\n @identity_publisher_hash = value\n end",
"def update\n\t\t@publisher = Publisher.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tif @publisher.update_attributes(params[:publisher])\n\t\t\t\tformat.html { redirect_to(@publisher, :notice => 'Publisher was successfully updated.') }\n\t\t\t\tformat.xml { head :ok }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"edit\" }\n\t\t\t\tformat.xml { render :xml => @publisher.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def verified?\n (verified rescue false) == true\n end",
"def verified\n UserNotifierMailer.verified\n end",
"def full_publisher\n pub = publisher_name\n loc = publication_place\n if pub && loc && !significant(pub).include?(significant(loc))\n sep = (',' unless pub.match?(/[[:punct:]]$/))\n pub = \"#{pub}#{sep} #{loc}\"\n end\n pub || loc\n end",
"def server_public_key\n raise(\"No ssl_server_public configuration option specified\") unless @config.pluginconf.include?(\"ssl_server_public\")\n return @config.pluginconf[\"ssl_server_public\"]\n end",
"def publishing_state\n return @publishing_state\n end",
"def verified?\n paypal_verified? and phone_verified?\n end",
"def publisher\n ::Qup::Publisher.new( self )\n end",
"def trusted_certs\n @trusted_certs ||= trusted_certs_content\n end",
"def publisher_belongs_to_a_group\n unless publisher.publishing_group.present?\n errors.add_to_base(\"publisher must be associated with a publishing group\")\n end\n end",
"def server_verified?\n !!@server_verified\n end",
"def verified?\n status.include?(success)\n end",
"def set_publisher\n @publisher = Publisher.find(params[:id])\n end"
] | [
"0.78886396",
"0.6305936",
"0.6305936",
"0.6283534",
"0.6259229",
"0.6259229",
"0.6259229",
"0.6259229",
"0.5982647",
"0.5982647",
"0.5968375",
"0.586162",
"0.586162",
"0.586162",
"0.586162",
"0.58319914",
"0.580758",
"0.57910645",
"0.5724376",
"0.5703699",
"0.56885004",
"0.5589487",
"0.5519203",
"0.5496922",
"0.54463714",
"0.5404349",
"0.5371425",
"0.5363734",
"0.5348775",
"0.53368783",
"0.53168106",
"0.5307746",
"0.5306473",
"0.52020335",
"0.5194044",
"0.5189257",
"0.5174207",
"0.51592124",
"0.5153882",
"0.50483114",
"0.50255615",
"0.4964162",
"0.49398533",
"0.49141136",
"0.4898927",
"0.4881069",
"0.487808",
"0.4877607",
"0.48725277",
"0.4834763",
"0.4810231",
"0.4799507",
"0.47848257",
"0.47763285",
"0.47763285",
"0.47760144",
"0.47448498",
"0.47291443",
"0.4720219",
"0.47162116",
"0.47144154",
"0.4713359",
"0.4706241",
"0.47012618",
"0.4700296",
"0.46912563",
"0.46900895",
"0.4687573",
"0.46702415",
"0.46541244",
"0.46503195",
"0.46484387",
"0.46367708",
"0.46319655",
"0.46231776",
"0.46227613",
"0.4618657",
"0.4618657",
"0.46161288",
"0.46080542",
"0.45938873",
"0.45739946",
"0.45725784",
"0.45602715",
"0.45498955",
"0.45452246",
"0.45383355",
"0.45361304",
"0.45317334",
"0.45245242",
"0.4519452",
"0.45124558",
"0.45110813",
"0.45097765",
"0.45044163",
"0.45026433",
"0.4499008",
"0.44967178",
"0.4490034",
"0.44604757"
] | 0.81674194 | 0 |
Sets the verifiedPublisher property value. Specifies the verified publisher of the application. For more information about how publisher verification helps support application security, trustworthiness, and compliance, see Publisher verification. | def verified_publisher=(value)
@verified_publisher = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verified_publisher\n return @verified_publisher\n end",
"def client_applications_from_verified_publisher_only=(value)\n @client_applications_from_verified_publisher_only = value\n end",
"def publisher=(value)\n @publisher = value\n end",
"def publisher=(value)\n @publisher = value\n end",
"def publisher=(value)\n @publisher = value\n end",
"def publisher=(value)\n @publisher = value\n end",
"def app_publisher=(value)\n @app_publisher = value\n end",
"def app_publisher=(value)\n @app_publisher = value\n end",
"def set_verification\n if provider_class.require_verify?\n self.require_verify = true\n self.verified = false\n end\n end",
"def publisher_domain=(value)\n @publisher_domain = value\n end",
"def publisher_id=(pub_id)\n @@publisher_id = pub_id\n end",
"def publisher_url=(v)\n @publisher_url = v ? URI.parse(v) : nil\n end",
"def publisher=(publisher_name)\n record.publisher = Publisher.find_by_name(publisher_name)\n @publisher = record.publisher || publisher_name\n end",
"def set_verifier\n\t\tself.verified_on = Time.now\n\t\tself.verified_by_uid = current_user.try(:uid)||''\n\tend",
"def set_verifier\n\t\tself.verified_on = Time.now\n\t\tself.verified_by_uid = current_user.try(:uid)||''\n\tend",
"def publisher=(new_publisher)\n if new_publisher.respond_to?(:name) &&\n new_publisher.respond_to?(:email) &&\n new_publisher.respond_to?(:url)\n # It's a complete Author object, just set it.\n @publisher = new_publisher\n else\n # We're not looking at an Author object, this is probably a string,\n # default to setting the publisher's name.\n if @publisher.nil?\n @publisher = FeedTools::Author.new\n end\n @publisher.name = new_publisher\n end\n end",
"def publisher_name=(v)\n @publisher_name = v\n end",
"def signed_id_verifier=(verifier)\n @signed_id_verifier = verifier\n end",
"def set_publisher\n\t\t\t@publisher = Publisher.find(params[:id])\n\t\tend",
"def verify\n\t\tself.verified = true\n\t\tself.save\n\tend",
"def publisher_name=(value)\n @publisher_name = value\n end",
"def verify\r\n self.verified = true\r\n end",
"def verify!\n self.update_attribute(:verified,\"true\")\n end",
"def book_publisher=(book_publisher)\n if !book_publisher.nil? && book_publisher.to_s.length > 50\n fail ArgumentError, 'invalid value for \"book_publisher\", the character length must be smaller than or equal to 50.'\n end\n\n @book_publisher = book_publisher\n end",
"def set_publisher\n @publisher = Publisher.find(params[:id])\n end",
"def set_publisher\n @publisher = Publisher.find(params[:id])\n end",
"def verified?\n @verified\n end",
"def set_defaults\n self.verified = true\n end",
"def set_publisher\n @publisher = Publisher.cached_find(params[:publisher_id])\n end",
"def setVerifySslCertificates(value)\n @fields['verify_ssl_certificates'] = value\n self\n end",
"def setVerifySslCertificates(value)\n @fields['verify_ssl_certificates'] = value\n self\n end",
"def mark_verified!\n update_column(:is_verified, true)\n UserMailer.user_group_verified(self).deliver_now\n end",
"def published=(new_published)\n @published = new_published\n end",
"def security_require_verify_apps=(value)\n @security_require_verify_apps = value\n end",
"def security_require_verify_apps=(value)\n @security_require_verify_apps = value\n end",
"def security_require_verify_apps=(value)\n @security_require_verify_apps = value\n end",
"def verify_process!\n updated_attribute(:verified, true)\n end",
"def verified?\n\t\t\t@verified\n\t\tend",
"def is_verified?\n verified\n end",
"def publish\n update!(email_status: \"verified\", published_at: Time.now.utc)\n end",
"def client_application_publisher_ids=(value)\n @client_application_publisher_ids = value\n end",
"def enable_ssl_verification=(_value)\n self.properties = properties.except('enable_ssl_verification') # Remove unused key\n end",
"def set_publisher\n @publisher = Publisher.find(params[:id])\n end",
"def verify!\n self.update_attribute(:status, VERIFIED)\n end",
"def verified?\n verification_code.nil?\n end",
"def set_publisher\n @publisher = Publisher.includes(:circulations).where(:id => params[:id], :admin_id => @current_user.id).first\n end",
"def identity_publisher_hash=(value)\n @identity_publisher_hash = value\n end",
"def verifier\n Verifier.new(public_key)\n end",
"def verified?\n (status == VERIFIED)\n end",
"def request_signature_verification=(value)\n @request_signature_verification = value\n end",
"def publisher\n @publisher ||= Publisher.new(self)\n end",
"def verify(signed_message)\n verified(signed_message)\n end",
"def verified?\n response[\"verified\"]\n end",
"def enforce_publishing_validation!\n @enforce_publishing_validation = true\n end",
"def set_publishers_test\n @publishers_test = Test.find_by(id: params[:id])\n @publishers_test.author == @publisher or raise ActiveRecord::RecordNotFound\n end",
"def verified\n update_attributes(:status => STATUS[:verified])\n end",
"def set_publisher\n # something is causing the application to turn :delete /signout requests to :get requests\n # here's minor patch to fix it when that happens\n if params[:id] == \"sign_out\"\n flash[:error] = \"There was a connection error while signing out. Please try again.\"\n redirect_to root_path and return \n end\n @publisher = Publisher.find(params[:id])\n end",
"def verified\n object.is_verified?\n end",
"def client_applications_from_verified_publisher_only\n return @client_applications_from_verified_publisher_only\n end",
"def verified_handler\n @verified_handler\n end",
"def publisher_domain\n return @publisher_domain\n end",
"def verified?\n true\n end",
"def validate_publisher(item)\n error(msg: 'Publisher may not be blank', item: __method__.to_s) if blank?(item)\n end",
"def publish!(user_key)\n self.avalon_publisher = user_key.blank? ? nil : user_key \n self.save(validate: false)\n \n logger.debug \"<< User key is #{user_key} >>\"\n logger.debug \"<< Avalon publisher is now #{avalon_publisher} >>\"\n end",
"def update\n\t\t@publisher = Publisher.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tif @publisher.update_attributes(params[:publisher])\n\t\t\t\tformat.html { redirect_to(@publisher, :notice => 'Publisher was successfully updated.') }\n\t\t\t\tformat.xml { head :ok }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"edit\" }\n\t\t\t\tformat.xml { render :xml => @publisher.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def verified?\n (@verified_key ||= verify_api_key) != :false\n end",
"def publisher_id\n @@publisher_id\n end",
"def verify_peer\n #$log.debug(\"Enabling peer verification\")\n self.verify_mode = OpenSSL::SSL::VERIFY_PEER\n end",
"def publisher\n if !@publisher\n @sneakers_packer_mutex.synchronize {\n @publisher ||= ::Sneakers::Publisher.new\n }\n end\n @publisher\n end",
"def check_published\n \n if self.publishing_state == PublishingState::PUBLISHED\n self.publishing_date = Time.now\n self.publishing_publisher = connected_user.username\n end\n\n end",
"def publishing_state=(value)\n @publishing_state = value\n end",
"def app_publisher\n return @app_publisher\n end",
"def app_publisher\n return @app_publisher\n end",
"def publisher\n return @publisher\n end",
"def publisher\n return @publisher\n end",
"def publisher\n return @publisher\n end",
"def publisher\n return @publisher\n end",
"def attach_to_publishers user\n #self.publisher_id\n return nil unless self.user\n\n if user.personal_publishing_status == \"I have an exclusive publisher\" || \n user.personal_publishing_status == \"I own and control my own publishing\"\n self.publisher_id = user.personal_publisher_id\n self.save(validate: false)\n attach_to_publishing_agreement\n else\n ap 'something fancy here'\n end \n end",
"def initialize\n @verify_certificates = true\n end",
"def verified?\n verification_token.blank? && verified_at.present?\n end",
"def set_ssl_verify(ssl_verify)\n if ssl_verify == false\n @ssl_verify = false\n else\n @ssl_verify = true\n end\n end",
"def publisher_name\n return @publisher_name\n end",
"def create\n\t\t@publisher = Publisher.new(params[:publisher])\n\n\t\trespond_to do |format|\n\t\t\tif @publisher.save\n\t\t\t\tformat.html { redirect_to(@publisher, :notice => 'Publisher was successfully created.') }\n\t\t\t\tformat.xml { render :xml => @publisher, :status => :created, :location => @publisher }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.xml { render :xml => @publisher.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def verified?\n outputs_verified?\n end",
"def publisher_params\n params.require(:publisher).permit(:email, :name, \n :domain, :password, :verified, \n :blog_name, :category_id, :logo,\n :free_demographics, :questions_active)\n end",
"def verified?\n certificate = IdealGateway.certificate_for_fingerprint(fingerprint)\n return false unless certificate\n IdealGateway.ideal_certificate = certificate\n old_verified?\n end",
"def verified\n @user = User.find(params[:id]) \n if current_user.admin? # only admin can mark house as verified\n @user.updated_by = current_user.id\n @user.verified = true\n if @user.save\n flash[:house] = \"User is been successfully verified!\"\n render 'show', :status => :ok\n else\n @errMsg = @user.errors.full_messages[0]\n print @errMsg\n render 'error', :status => :unprocessable_entity\n end\n else\n @errMsg = \"User is not admin.\"\n print @errMsg\n render 'error', :status => :unprocessable_entity\n end\n end",
"def verified\n UserNotifierMailer.verified\n end",
"def save_verified\n user_ids = (params[:verified_users] || [])\n User.where(id: user_ids).update_all(verified: true)\n redirect_to url_for(action: :verified), notice: \"#{user_ids.count} users were verified.\"\n end",
"def publisher_gln\n if self.publishers.length==1\n self.publisher.gln\n end\n end",
"def mark_signed!\n @signed = true\n end",
"def verified_count\n @verified_count ||= Vendor.where(:vendor_verified.exists => true).count\n end",
"def publisher_belongs_to_a_group\n unless publisher.publishing_group.present?\n errors.add_to_base(\"publisher must be associated with a publishing group\")\n end\n end",
"def publisher_class\n Publisher\n end",
"def public_client=(value)\n @public_client = value\n end",
"def nullify_verifier\n\t\tself.verified_on = nil\n\t\tself.verified_by_uid = nil\n\tend",
"def nullify_verifier\n\t\tself.verified_on = nil\n\t\tself.verified_by_uid = nil\n\tend",
"def is_voicemail=(value)\n @is_voicemail = value\n end",
"def set_pub\n @pub = Pub.find(params[:id])\n authorize @pub\n end",
"def verify\n #@blog.verified = 1\n if @blog.verify\n succ\n else\n err\n end\n end"
] | [
"0.6743503",
"0.6213803",
"0.62110054",
"0.62110054",
"0.62110054",
"0.62110054",
"0.61345977",
"0.61345977",
"0.5934758",
"0.5897246",
"0.58186257",
"0.57070094",
"0.5681518",
"0.5576957",
"0.5576957",
"0.5561612",
"0.5517438",
"0.5495859",
"0.53869444",
"0.5337574",
"0.53319395",
"0.53159565",
"0.53008467",
"0.5289376",
"0.5257806",
"0.5257806",
"0.5202148",
"0.52001125",
"0.5187597",
"0.5117228",
"0.5117228",
"0.51062673",
"0.5094715",
"0.49566424",
"0.49566424",
"0.49566424",
"0.49476475",
"0.4929202",
"0.4922501",
"0.4908118",
"0.4898795",
"0.48772666",
"0.4855025",
"0.4853837",
"0.48496032",
"0.48340094",
"0.4833004",
"0.48242384",
"0.4816475",
"0.48065922",
"0.48063436",
"0.47517368",
"0.47406927",
"0.47404337",
"0.4724578",
"0.4709534",
"0.47015482",
"0.46976906",
"0.4695046",
"0.46885774",
"0.46712106",
"0.4664311",
"0.46581927",
"0.4653085",
"0.46527702",
"0.464548",
"0.4608255",
"0.46025968",
"0.45939484",
"0.4579882",
"0.45749742",
"0.4561964",
"0.4561964",
"0.45495966",
"0.45495966",
"0.45495966",
"0.45495966",
"0.45324993",
"0.45128772",
"0.45063242",
"0.44800657",
"0.4474573",
"0.44681233",
"0.44662204",
"0.44634494",
"0.44611254",
"0.44576296",
"0.44373778",
"0.44371235",
"0.44294736",
"0.44192946",
"0.4411507",
"0.440303",
"0.4402886",
"0.43982923",
"0.43950626",
"0.43950626",
"0.4389115",
"0.4372613",
"0.43718922"
] | 0.83826 | 0 |
Gets the web property value. Specifies settings for a web application. | def web
return @web
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def property(name)\n get(\"/session/#{session_id}/element/#{element_id}/property/#{name}\").value\n end",
"def get_settings\n settings.get\n end",
"def setting\n return @setting\n end",
"def current_settings\n Weby::Settings\n end",
"def get_value(property)\n if @env_properties.get_value(property)\n return @env_properties.get_value(property)\n end\n @file_properties.get_value(property)\n end",
"def get_property\n @xml = client.call(url).parsed_response.css('property').first\n @attributes.merge!(parse_xml_to_hash)\n end",
"def settings\n @settings ||= get('/settings')['settings']\n end",
"def setting_value(setting_name)\n if Setting.exists?(name: setting_name)\n setting = Setting.find_by(name: setting_name)\n setting.value.empty? ? default_setting_value(setting_name) : setting.value\n else\n default_setting_value(setting_name)\n end\n end",
"def get_site_setting(site, setting = nil)\n if setting && site_settings(site) && site_settings(site)[setting.to_sym]\n site_settings(site)[setting.to_sym]\n else \n nil\n end\n end",
"def setting_name\n return @setting_name\n end",
"def value\n @property_hash[:value]\n end",
"def get(key)\n settings.find_by_key(key).try(:value)\n end",
"def get_site_property( site_id, property_name )\n client = prepare_request( @service_wsdl )\n\n response = do_request_and_handle_errors do\n client.request :get_site_property do |soap|\n soap.body = {:sessionid => @session, :siteid => site_id, :propname => property_name}\n end\n end\n\n result = response.to_hash[:get_site_property_response][:get_site_property_return]\n\n (result.kind_of? Hash) ? (return false) : (return true)\n end",
"def web_properties\n Management::WebProperty.all(self)\n end",
"def app_settings=(value)\n @children['app-settings'][:value] = value\n end",
"def app_settings=(value)\n @children['app-settings'][:value] = value\n end",
"def appl_settings\n @appl_settings\n end",
"def setting(key)\n @settings[key]\n end",
"def [](key)\n setting_obj = setting(key)\n setting_obj ? setting_obj.value : nil\n end",
"def value\n case ALLOWED_SETTINGS[object['key']]\n when :easy\n ::EasySetting.value(object['key'], object['project'].try(:id))\n when :redmine\n if object['key'] == 'date_format'\n ::Setting.date_format.presence || ::I18n.t('date.formats.default')\n else\n ::Setting.send(object['key'])\n end\n when :time_entry\n ::EasyGlobalTimeEntrySetting.value(object['key'], ::User.current.roles)\n else\n raise GraphQL::ExecutionError, \"Unknow setting '#{object['key']}'\"\n end\n end",
"def property\n @property\n end",
"def get_property _property\n send_cmd(\"get_property #{_property}\")\n end",
"def web_properties\n WebProperty.all(:account => self)\n end",
"def get_settings\n request :get, \"_settings\"\n end",
"def get_settings\n request :get, \"_settings\"\n end",
"def web_browser_cookie_settings\n return @web_browser_cookie_settings\n end",
"def get_property(name)\n Config::Collection.get(name)\n end",
"def web=(value)\n @web = value\n end",
"def settings\n attributes.fetch(:settings)\n end",
"def web_browser_cookie_settings=(value)\n @web_browser_cookie_settings = value\n end",
"def setting\n resource[:name].split('/', 2).last\n end",
"def setting(name)\n @settings[normalize_key(name)]\n end",
"def get(setting, _site_name, _environment_name, default = nil)\n @config.dig(*setting) || default\n end",
"def setting(name)\n config[environment] && config[environment][name]\n end",
"def get_view_setting(setting_name, params = nil)\n view_settings_for_template_language = @view_settings[@template_language.to_sym]\n stringVal = eval(\"view_settings_for_template_language[:\" + setting_name + \"]\")\n if (params)\n return stringVal % params\n else\n return stringVal\n end\n end",
"def [](property_name)\n properties[property_name.to_s].value\n end",
"def teams_app_settings\n return @teams_app_settings\n end",
"def [](key)\n ensure_config_loaded!\n if setting = setting_for(key.to_s)\n setting.value\n end\n end",
"def get_property(*args)\n return unless alive?\n\n command(\"get_property\", *args)[\"data\"]\n end",
"def app_config_key_value\n return @app_config_key_value\n end",
"def setting=(value)\n @setting = value\n end",
"def set_app_setting\n @app_setting = AppSetting.settings\n end",
"def settings\n CucumberSupport.current_page_settings\n end",
"def setting(name)\n roots = []\n if @environment_name\n roots << @config.send(@environment_name)\n end\n roots << @config\n roots.each do |root|\n begin\n setting_value = name.split('.').inject(root) { |node,prop| if node.include?(prop.to_sym) then node.send(prop) else raise \"Undefined property #{prop} for #{node.name}\" end}\n return setting_value\n rescue => e\n # Fall through to next case\n end\n end\n # If we get here the property does not exist\n #XXX - should probably ask for a default, and if one is not provided, raise an error\n nil\n end",
"def project_setting(key)\n data.config[config[:environment]][key]\n end",
"def get_property(property_name)\n value = get() and value[property_name]\n end",
"def load_appl_settings\n Configuration::Application::SETTINGS\n end",
"def get(setting, default = nil)\n prov = backend.provider\n raise Errors::NoProviderSpecifiedError unless prov\n\n prov.get(setting, site_name, environment_name, default)\n end",
"def settings\n self.class.settings\n end",
"def setting_name=(value)\n @setting_name = value\n end",
"def settings\n return @settings\n end",
"def settings\n return @settings\n end",
"def settings\n Thread.current[:shoppe_settings] ||= Shoppe::Settings.new(Shoppe::Setting.to_hash)\n end",
"def get_settings\n get_uri = @data['uri'] + '/settings'\n response = @client.rest_get(get_uri, {}, @api_version)\n @client.response_handler(response)\n end",
"def value\n get_lxd_config_value(resource[:config])\n end",
"def get_property property_name\n\n begin\n\n if property_name == ''\n raise 'Property name not specified.'\n end\n\n str_uri = $product_uri + '/words/' + @filename + '/documentProperties/' + property_name\n signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)\n\n response_stream = RestClient.get(signed_str_uri, {:accept => 'application/json'})\n\n stream_hash = JSON.parse(response_stream)\n stream_hash['Code'] == 200 ? stream_hash['DocumentProperty'] : false\n\n rescue Exception => e\n print e\n end\n\n end",
"def get_settings\n get_uri = @data['uri'] + '/settings'\n response = @client.rest_get(get_uri, {}, @api_version)\n @client.response_handler(response)\n end",
"def extension_setting(name)\n extension_settings.find{ |setting| setting.key == name.to_s }\n end",
"def jira_application_properties()\n \"#{self.build_dir()}/src/edit-webapp/WEB-INF/classes/jira-application.properties\"\n end",
"def get_value(property_path)\n element = @tree.select(property_path)[0]\n element.nil? ? nil : element.value\n end",
"def intersys_get(property)\n intersys_property(property).get\n end",
"def get\n @value\n end",
"def get_settings\n return @client.raw(\"get\", \"/config/settings\")\n end",
"def settings\r\n @@settings\r\n end",
"def get_property property_name\n \n begin\n \n if @filename == ''\n raise 'Base file not specified.'\n end\n \n if property_name == ''\n raise 'Property name not specified.'\n end\n \n str_uri = $product_uri + '/slides/' + @filename + '/documentProperties/' + property_name\n signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)\n \n response_stream = RestClient.get(signed_str_uri,{:accept=>'application/json'})\n \n stream_hash = JSON.parse(response_stream)\n \n if(stream_hash['Code'] == 200)\n return stream_hash['DocumentProperty']\n else\n return false\n end\n \n rescue Exception=>e\n print e\n end\n \n end",
"def settings_version\n settings[:settings_version]\n end",
"def get(value)\n value\n end",
"def package_settings\n properties[:package_settings]\n end",
"def package_settings\n properties[:package_settings]\n end",
"def get_property(property_name)\n command(\"get_property\", property_name)\n end",
"def web_url\n return @web_url\n end",
"def web_url\n return @web_url\n end",
"def web_url\n return @web_url\n end",
"def config_property(name, type, value)\n RubyAem::Resources::ConfigProperty.new(@client, name, type, value)\n end",
"def value(locale=I18n.locale)\n begin\n (self.setting_type =~ /slide/) ? self.slide : eval(\"self.#{self.setting_type}_value\")\n rescue\n nil\n end\n end",
"def get_property!(node, name)\n value = node.xpath(name).text\n raise \"missing property '#{name}' in node: #{node}\" if value.empty?\n value\n end",
"def get(key)\n properties[key]\n end",
"def get_property(name, default= \"\")\n\t\treturn @transport.get_path(\"meta\",\"properties\", name) { default }\n\tend",
"def get_property(name)\n return @properties[name]\n end",
"def setting(name)\n\t\t\tval = config.settings.where(\"name = ?\", name.to_s).first\n\t\t\tif val.nil?\n\t\t\t\tval = config.control_system.zones.joins(:settings).where('settings.name = ?', name.to_s).first\n\t\t\t\tval = val.settings.where(\"name = ?\", name.to_s).first unless val.nil?\n\t\t\t\t\n\t\t\t\tval = config.dependency.settings.where(\"name = ?\", name.to_s).first if val.nil?\n\t\t\tend\n\t\t\t\n\t\t\tif val.present?\n\t\t\t\tcase val.value_type\n\t\t\t\t\twhen 0\n\t\t\t\t\t\treturn val.text_value\n\t\t\t\t\twhen 1\n\t\t\t\t\t\treturn val.integer_value\n\t\t\t\t\twhen 2\n\t\t\t\t\t\treturn val.float_value\n\t\t\t\t\twhen 3\n\t\t\t\t\t\treturn val.datetime_value\n\t\t\t\tend\n\t\t\tend\n\t\t\t\n\t\t\treturn nil\n\t\tend",
"def get_property(element)\n return NotFound if (element[:ns_href] != DAV_NAMESPACE)\n case element[:name]\n when 'resourcetype' then resource_type\n when 'displayname' then display_name\n when 'creationdate' then use_ms_compat_creationdate? ? creation_date.httpdate : creation_date.xmlschema\n when 'getcontentlength' then content_length.to_s\n when 'getcontenttype' then content_type\n when 'getetag' then etag\n when 'getlastmodified' then last_modified.httpdate\n when 'supportedlock' then supported_locks_xml\n when 'lockdiscovery' then lockdiscovery_xml\n else NotImplemented\n end\n end",
"def element_property(element, name)\n execute_script 'return arguments[0][arguments[1]]', element, name\n end",
"def config_setting\n @config_access_name = \"config_setting\"\n @setting ||= Setting.new(ContainerAdapter.new(self))\n end",
"def [](key)\n key = normalize_key(key)\n\n @settings[key] && @settings[key].value\n end",
"def get_property property_name\n \n begin\n \n if @filename == \"\"\n raise \"Base file not specified.\"\n end\n \n if property_name == \"\"\n raise \"Property name not specified.\"\n end\n \n str_uri = $productURI + \"/words/\" + @filename + \"/documentProperties/\" + property_name\n signed_str_uri = Common::Utils.sign(str_uri)\n \n response_stream = RestClient.get(signed_str_uri,{:accept=>\"application/json\"})\n \n stream_hash = JSON.parse(response_stream)\n \n if(stream_hash[\"Code\"] == 200)\n return stream_hash[\"DocumentProperty\"]\n else\n return false\n end\n \n rescue Exception=>e\n print e\n end\n \n end",
"def user_setting_page\n\t\t@notification_settings = current_user.notification_setting\n\n\tend",
"def settings=(value)\n @settings = value\n end",
"def settings=(value)\n @settings = value\n end",
"def properties\n WEBDAV_PROPERTIES\n end",
"def get_setting(key)\n setting = nil\n\n @lock.synchronize do\n setting = @settings\n keys = key.to_s.downcase.split(/\\./)\n\n keys.each do |k|\n item = eval(\"setting.#{k}\") if setting.is_a?(OpenStruct)\n return nil unless item\n setting = item\n end\n end\n\n setting\n end",
"def get_settings\n @bridge.get_settings\n end",
"def get_property(name)\n $NEO_LOGGER.debug{\"get property '#{name}'\"}\n \n return nil if ! property?(name)\n value = @internal_node.get_property(name.to_s)\n if self.class.marshal?(name)\n Marshal.load(String.from_java_bytes(value))\n else\n value\n end\n end",
"def get_setting(field)\n setting = Setting.where(env: Rails.env).first\n raise \"Setting not found for RAILS_ENV=#{Rails.env}\" unless setting\n setting.send(field.to_sym)\n end",
"def get_property(property)\n rows = weather_properties.select do |row|\n row.header.text.downcase == property\n end\n\n return nil if rows.empty?\n\n rows.first.value.text\n end",
"def teams_app_settings=(value)\n @teams_app_settings = value\n end",
"def set_property\n @property = current_client.properties.find(params[:id])\n end",
"def [](key)\n initialize_cache unless @initialized\n return @settings[key]\n end",
"def property_value(property_key, default_value=nil)\n prop=property(property_key)\n if default_value && property_key=='depth'\n # we're in SQALE.... Keep the text_value\n result = (prop ? prop.text_value : nil)||default_value\n else\n result = (prop ? prop.value : nil)\n unless result\n property_definition=java_definition.getWidgetProperty(property_key)\n result = WidgetProperty.text_to_value(property_definition.defaultValue(), property_definition.type().name()) if property_definition\n end\n end\n result\n end",
"def property(name)\n @property_hash[name]\n end",
"def settings\n @settings\n end"
] | [
"0.654594",
"0.65375763",
"0.63873774",
"0.6284174",
"0.6272824",
"0.62316173",
"0.6213888",
"0.60985637",
"0.609377",
"0.6091406",
"0.6022662",
"0.6022621",
"0.60094815",
"0.596386",
"0.5959522",
"0.5959522",
"0.5927171",
"0.5926296",
"0.5871784",
"0.58712274",
"0.5868387",
"0.5843648",
"0.5834969",
"0.58142346",
"0.58142346",
"0.58077097",
"0.5781493",
"0.57772225",
"0.5766575",
"0.57163703",
"0.5694335",
"0.56462413",
"0.56220573",
"0.5616458",
"0.56112856",
"0.5605573",
"0.5595308",
"0.5589186",
"0.5561664",
"0.5560205",
"0.5558109",
"0.5549815",
"0.5545173",
"0.55367535",
"0.5534791",
"0.552835",
"0.5522765",
"0.5516211",
"0.55147564",
"0.5512247",
"0.5509498",
"0.5509498",
"0.55068266",
"0.549994",
"0.5498272",
"0.5494729",
"0.5487551",
"0.5476777",
"0.5467325",
"0.5455164",
"0.54513675",
"0.54396665",
"0.54351074",
"0.5432674",
"0.5427267",
"0.54228765",
"0.54191107",
"0.5418836",
"0.5418836",
"0.5418243",
"0.5409402",
"0.5409402",
"0.5409402",
"0.5393466",
"0.53908104",
"0.5382717",
"0.5380354",
"0.53803426",
"0.5378231",
"0.5368473",
"0.5361627",
"0.5356801",
"0.5352508",
"0.53496456",
"0.5345737",
"0.53433985",
"0.53292954",
"0.53292954",
"0.53265476",
"0.53174436",
"0.53115845",
"0.53064054",
"0.5304122",
"0.52988523",
"0.5298764",
"0.5295198",
"0.52951354",
"0.5289687",
"0.5289014",
"0.52824336"
] | 0.5534486 | 45 |
Sets the web property value. Specifies settings for a web application. | def web=(value)
@web = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def app_settings=(value)\n @children['app-settings'][:value] = value\n end",
"def app_settings=(value)\n @children['app-settings'][:value] = value\n end",
"def set_Property(value)\n set_input(\"Property\", value)\n end",
"def setting=(value)\n @setting = value\n end",
"def web_browser_cookie_settings=(value)\n @web_browser_cookie_settings = value\n end",
"def set_property(property_name, value)\n command(\"set_property\", property_name, value)\n end",
"def set_setting\n end",
"def config_set_app_setting(document, settingName, settingValue)\n\t config_set_attribute(document, '//configuration/appSettings/add', 'key', settingName, 'value', settingValue)\n\tend",
"def e_set_setting(key, value)\n set_option(key, value, '_setting_ecommerce')\n end",
"def setting(property, value)\n\t\tproperty + ':' + value + ';'\n\tend",
"def set_app_setting\n @app_setting = AppSetting.settings\n end",
"def set(property, value)\n self.send(\"#{property}=\".to_sym, value)\n end",
"def set_property(name, value)\n # let Resource handle DAV properties\n if name[:ns_href] == DAV_NAMESPACE\n super\n else\n set_custom_props name, value\n end\n end",
"def set_property(element, value)\n return Forbidden\n end",
"def property(name, value)\n @resource.set_property name, value\n end",
"def set_property(key, value)\n end",
"def intersys_set(property, value)\n intersys_property(property).set(value)\n end",
"def set_property(*args)\n return unless alive?\n\n command \"set_property\", *args\n end",
"def set_property(name, value)\n @properties[name] = value\n end",
"def settings=(value)\n @settings = value\n end",
"def settings=(value)\n @settings = value\n end",
"def set_property(name, value)\n Config::Collection.set(name, value)\n end",
"def set_property(ctx,object,propertyName,value,attributes,exception)\n JS::Lib.JSObjectSetProperty(ctx,object,propertyName,value,attributes,exception)\n end",
"def set(key, value)\n settings.send :\"#{key}=\", value\n end",
"def web_url=(value)\n @web_url = value\n end",
"def web_url=(value)\n @web_url = value\n end",
"def web_url=(value)\n @web_url = value\n end",
"def setting_name=(value)\n @setting_name = value\n end",
"def set_web_id(value) @web_id = value; end",
"def add_property_to_site( site_id, property )\n return true if get_site_property(site_id, property[:propname])\n client = prepare_request( @service_wsdl )\n\n begin\n response = client.request :set_site_property do |soap|\n soap.body = {:sessionid => @session,\n :siteid => site_id,\n :propname => property[:propname],\n :propvalue => property[:propvalue]}\n end\n rescue ArgumentError, \"Wasabi needs a WSDL document\"\n raise StandardError, \"Incorrect login url supplied.\"\n rescue Errno::ECONNREFUSED => error\n raise \"Server doesn't seem to be there: #{error.to_s}\"\n rescue Savon::SOAP::Fault => fault\n raise fault.to_s\n end\n\n (response.to_hash[:set_site_property_response][:set_site_property_return] == \"success\") ? true : false\n end",
"def set_property\n @property = current_client.properties.find(params[:id])\n end",
"def value=(new_value)\n if @value.nil?\n @value = new_value\n else\n api.put_config_vars app.name, key => new_value\n @value = new_value\n end\n end",
"def set(setting, value)\n setting = setting.to_sym\n if setting == :estream\n self.estream = value\n elsif setting == :ostream\n self.ostream = value\n else\n @settings[setting.to_sym] = value\n end\n end",
"def teams_app_settings=(value)\n @teams_app_settings = value\n end",
"def web_dir=(dir)\n @@web_dir = dir\n end",
"def set_property( propname, value )\n params = { 'value' => value }\n resp = conn.put('/users/'+name+'/props/'+propname+'/', params)\n \n case resp.code.to_i\n when 200\n return JSON.parse( resp.body )\n when 201\n return\n when 404\n raise RestAuthResourceNotFound.new( resp )\n else\n raise RestAuthUnknownStatus.new( resp )\n end\n end",
"def set_property(name, value)\n $NEO_LOGGER.debug{\"set property '#{name}'='#{value}'\"} \n old_value = get_property(name)\n\n if value.nil?\n remove_property(name)\n elsif self.class.marshal?(name)\n @internal_node.set_property(name, Marshal.dump(value).to_java_bytes)\n else\n @internal_node.set_property(name, value)\n end\n\n if (name != 'classname') # do not want events on internal properties\n event = PropertyChangedEvent.new(self, name.to_sym, old_value, value)\n self.class.fire_event(event)\n end\n end",
"def set_property(element, value)\n raise NotImplemented if (element[:ns_href] != 'DAV:')\n case element[:name]\n when 'resourcetype' then self.resource_type = value\n when 'getcontenttype' then self.content_type = value\n when 'getetag' then self.etag = value\n when 'getlastmodified' then self.last_modified = Time.httpdate(value)\n else raise NotImplemented\n end\n end",
"def []=(property, value)\n root[property] = value\n end",
"def update!(**args)\n @web_property_ref = args[:web_property_ref] if args.key?(:web_property_ref)\n end",
"def set_Website(value)\n set_input(\"Website\", value)\n end",
"def set_property( name, value )\n ( @properties ||= Hash.new )[ name ] = value\n end",
"def set_property property_name, property_value\n\n begin\n\n raise 'Property name not specified.' if property_name.empty?\n raise 'Property value not specified.' if property_value.empty?\n\n post_hash = {'Value' => property_value}\n json_data = post_hash.to_json\n\n str_uri = $product_uri + '/words/' + @filename + '/documentProperties/' + property_name\n signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)\n\n response_stream = RestClient.put(signed_str_uri, json_data, {:content_type => :json})\n\n xmldoc = REXML::Document.new(response_stream)\n\n if xmldoc.elements.to_a('SaaSposeResponse/Status').first.text == 'OK'\n return xmldoc.elements.to_a('SaaSposeResponse/DocumentProperty')\n end\n\n false\n\n rescue Exception => e\n print e\n end\n\n end",
"def set_property(property_name, value)\n object = get()\n object[property_name] = value\n set(object)\n end",
"def []=(property_name, value)\n properties[property_name.to_s].value = value\n end",
"def set_property property_name, property_value\n \n begin\n \n if @filename == \"\"\n raise \"Base file not specified.\"\n end\n \n if property_name == \"\"\n raise \"Property name not specified.\"\n end\n \n if property_value == \"\"\n raise \"Property value not specified.\"\n end\n \n post_hash = { \"Value\" => property_value}\n json_data = post_hash.to_json \n \n str_uri = $productURI + \"/words/\" + @filename + \"/documentProperties/\" + property_name\n signed_str_uri = Common::Utils.sign(str_uri)\n \n response_stream = RestClient.put(signed_str_uri,json_data,{:accept=>\"application/json\"})\n \n stream_hash = JSON.parse(response_stream)\n \n if(stream_hash[\"Code\"] == 200)\n return stream_hash[\"DocumentProperty\"]\n else\n return false\n end\n \n rescue Exception=>e\n print e\n end\n \n end",
"def set_system_setting\n @system_setting = System.settings\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 change_plugin_prop(prop, value)\n cmd = <<-END\nobj = AdminConfig.list(\"WebserverPluginSettings\", AdminConfig.getid(\"/Node:#{resource[:nodename]}/Server:#{resource[:name]}/\"))\nAdminConfig.modify(obj, '[[ #{prop} \"#{value}\" ]]')\n END\n cmd\n end",
"def set!(path, value)\n setProperty path, value\n save if respond_to? :save # Only Configuration can save\n value\n end",
"def set_web()\n self.is_web = 1\n self.save()\n end",
"def set_preference(prefs_section, pref, value)\n driver.setPref(prefs_section, pref, value.to_s)\n end",
"def setter(section, setting, value)\n method = \"#{setting}=\"\n section.send(method, value) if section.respond_to?(method)\n end",
"def set_property property_name, property_value\n \n begin\n \n if @filename == ''\n raise 'Base file not specified.'\n end\n \n if property_name == ''\n raise 'Property name not specified.'\n end\n \n if property_value == ''\n raise 'Property value not specified.'\n end\n \n post_hash = { 'Value' => property_value}\n json_data = post_hash.to_json \n \n str_uri = $product_uri + '/slides/' + @filename + '/documentProperties/' + property_name\n signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)\n \n response_stream = RestClient.put(signed_str_uri,json_data,{:accept=>'application/json'})\n \n stream_hash = JSON.parse(response_stream)\n \n if(stream_hash['Code'] == 200)\n return stream_hash['DocumentProperty']\n else\n return false\n end\n \n rescue Exception=>e\n print e\n end\n \n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find_by(id: 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 []=(name, value) \n @server.setAttribute @object_name, javax.management.Attribute.new(name.to_s, value)\n end",
"def set_property!(property_name, value)\n set_property(property_name, value).data!\n end",
"def login_web_url=(value)\n @login_web_url = value\n end",
"def []=(prop)\n set_property(prop)\n end",
"def set_param(name, property, value)\n raise('wrong type: String required') unless name.is_a?(String)\n raise('wrong value: name must be valid') unless !name.nil? && !name.empty?\n raise('wrong type: String required for property') unless property.is_a?(String)\n raise('wrong value: property must be valid') unless !property.nil? && !property.empty?\n raise('wrong value: value be valid') if value.nil?\n\n @client.post({\n 'action' => 'setparam',\n 'object' => 'htpl',\n 'values' => '%s;%s;%s' % [name, property, value.to_s],\n }.to_json)\n end",
"def set(setting, value = nil)\n if value\n command \"set #{setting}=#{value}\"\n else\n command \"set #{setting}\"\n end\n self\n end",
"def set_value(value)\n @value = value\n end",
"def set_setting\n ap @setting = Setting.first\n end",
"def set_webpage!\n self.webpage = 'http://www.' unless self.webpage\n end",
"def setting(nested_key, value)\n settings.set(nested_key, value)\n save_settings!\n end",
"def set_user_page_setting\n @user_page_setting = UserPageSetting.find(params[:id])\n end",
"def set_setting\n @setting = Setting.first\n end",
"def config=(value); end",
"def config=(value)\n Thread.current[:rails_amp_config] = value\n end",
"def set_property(property_name, property_value, secret)\n if !valid_secret?(secret)\n return BAD_SECRET_MSG\n end\n\n Djinn.log_info(\"Attempting to set @#{property_name} to #{property_value}\")\n\n name_with_at_sign = \"@#{property_name}\"\n begin\n instance_variable_set(name_with_at_sign, property_value)\n rescue NameError\n Djinn.log_info(\"Failed to set @#{property_name}\")\n return KEY_NOT_FOUND\n end\n\n Djinn.log_info(\"Successfully set @#{property_name} to #{property_value}\")\n return 'OK'\n end",
"def set(value)\n value\n end",
"def set_user_setting\n @current_user.create_default_user_setting unless @current_user.user_setting\n @user_setting = @current_user.user_setting\n end",
"def set_property\n @property = Property.friendly.find(params[:id])\n end",
"def set_application_setting\n @application_setting = ApplicationSetting.find(params[:id])\n end"
] | [
"0.7056061",
"0.7056061",
"0.6827579",
"0.6724153",
"0.6559661",
"0.64866793",
"0.64851004",
"0.6483225",
"0.6390282",
"0.6371379",
"0.6351027",
"0.6241218",
"0.61706096",
"0.6168252",
"0.6139298",
"0.61245406",
"0.60986036",
"0.60932636",
"0.60518104",
"0.60501003",
"0.60501003",
"0.603782",
"0.6027433",
"0.6021048",
"0.6010479",
"0.6010479",
"0.6010479",
"0.5996022",
"0.59900665",
"0.5984807",
"0.598448",
"0.5981006",
"0.5944126",
"0.59333235",
"0.5887749",
"0.5882455",
"0.586811",
"0.5865013",
"0.58485997",
"0.5842119",
"0.5803559",
"0.57964414",
"0.5777319",
"0.57771564",
"0.57630265",
"0.57556236",
"0.5740549",
"0.5723548",
"0.57192135",
"0.5690322",
"0.56851286",
"0.5681852",
"0.56777054",
"0.56613165",
"0.5660307",
"0.5660307",
"0.5660307",
"0.5660307",
"0.5660307",
"0.5660307",
"0.5660307",
"0.5660307",
"0.5660307",
"0.5660307",
"0.5660307",
"0.5660307",
"0.5660307",
"0.5660307",
"0.5660307",
"0.5660307",
"0.5660307",
"0.5660307",
"0.5660307",
"0.5660307",
"0.5660307",
"0.5660307",
"0.5660307",
"0.5660307",
"0.5660307",
"0.5626926",
"0.56089723",
"0.5582066",
"0.55806434",
"0.5575032",
"0.55678576",
"0.55668604",
"0.555124",
"0.5547604",
"0.5539686",
"0.5512992",
"0.5499123",
"0.5498499",
"0.5496125",
"0.5491766",
"0.54886377",
"0.54759693",
"0.547515",
"0.54734135",
"0.5456843",
"0.54488236"
] | 0.6653502 | 4 |
Calculate tax for a given price tag | def apply_tax(price, tax)
return (price * tax / BigDecimal.new(5)).ceil / BigDecimal.new(20) #rounding up to nearest 0.05
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calcuate_tax\n @price * 0.12\n end",
"def tax_calc\n tax = @quantity * @price * @taxe\n end",
"def compute_tax(item_price, tax_rate)\n item_price * tax_rate\n end",
"def tax\n price.to_f * 0.09\n end",
"def tax\n price_as_price.tax\n end",
"def tax\n rate = 0.09\n tax_amount = (price.to_f * rate)\n return tax_amount\n end",
"def taxify price\n (price * Store::tax_rate) + price\n end",
"def calcTaxes price\r\n taxrate = 0.95\r\n return taxrate * price\r\nend",
"def tax\n \"#{price}\".to_i * 0.09 \n end",
"def price_with_tax\n price_as_price.with_tax\n end",
"def get_tax(price, quantity, tax_rate)\n\t\ttax = (price * quantity) * tax_rate\n\t\tround_tax(tax)\n\tend",
"def calc_t1(price, tip, tax)\n tax_amount = price * tax\n tip_amount = price * tip\n price + tip_amount + tax_amount\nend",
"def calculate_tax(item, price)\n tax = 0.0\n \n # if no words in the item match the exempt list\n if (Exempt - item.split(\" \")).length == Exempt.length\n tax += 0.10\n end\n\n # if imported, add 5% tax\n if item.split(\" \").include? 'imported'\n tax += 0.05\n end\n\n # round up to nearest .05 calculation\n item_tax = price.to_f * tax\n @tax_hash[item] = (item_tax * 20).ceil / 20.0\n end",
"def get_tax(item_price, tax_rate)\n amt = compute_tax(item_price, tax_rate)\n round_tax(amt)\n end",
"def basic_tax(item_name, price_of_item)\n\t\[email protected]_tax_calc(item_name, price_of_item)\n\t\tadd_item\n\tend",
"def tax_share(tax)\n tax.to_f / price\n end",
"def tax\n\t\t@value * 0.16\n\tend",
"def tax_amount\n rounded(tax.percent_of(price))\n end",
"def paypal_variant_tax(sale_price, variant) \n 0.0\n end",
"def estimated_tax_amount\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.find.span.id(\"/_lblTax$/\"),\n format_method(__method__))\n end",
"def taxes\n calculation = BigDecimal.new(\"0\")\n absolutely_priced? ? base_price = sales_price : base_price = gross_price\n calculation = ( (base_price - rebate) / BigDecimal.new(\"100.0\")) * tax_class.percentage\n end",
"def calculate_sales_tax\n @sales_tax = 0\n @sales_tax = (price * 0.1) unless %i[book food medical].include?(category)\n end",
"def product_selling_price_after_tax\n product_markup_price * (1 - county.tax_factor) \n end",
"def tax\n if defined?(tax_rate)\n calculated = subtotal * tax_rate\n return 0 if calculated < 0\n calculated\n else\n 0\n end\n end",
"def calculate_tax\n if self.vendor.net_prices\n # this is for the US tax system. At this point, total is still net.\n self.tax_amount = self.total * self.tax / 100.0\n # here, total becomes gross\n self.total += tax_amount\n else\n # this is for the Europe tax system. self.total is already gross, so we don't have to modify it here.\n self.tax_amount = self.total * ( 1 - 1 / ( 1 + self.tax / 100.0 ) )\n end\n end",
"def full_price\n price + tax_evaluation\n end",
"def total_price(tax_rate)\n ((1 + tax_percentage(tax_rate)) * price)\n end",
"def tax25_sum\n tax_sum(tax25, 0.25)\n end",
"def calculate_tax_for(total)\n if self.vat_rate.present? && self.vat_rate != 0.0\n ((self.vat_rate / 100) * total)\n else\n 0\n end\n end",
"def tax\n 0.0\n end",
"def estimated_tax_amount\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.find.span.id(\"/_EstimatedTaxLabel$/\"),\n format_method(__method__))\n end",
"def tax_money_owed\n if update_taxable <= 43953 && update_taxable >= 0\n update_taxable * 0.15\n elsif update_taxable >= 43954 && update_taxable <=87907\n (43953*0.15) + ((update_taxable-43953) * 0.22)\n elsif update_taxable >= 87908 && update_taxable <=136270\n (43953*0.15)+ (48363*0.22) + (update_taxable * 0.26)\n elsif update_taxable >= 136270\n (43953*0.15)+ (48363*0.22)+ (43954*0.26) + (update_taxable * 0.29)\n else\n update_taxable \n end\n end",
"def tax_evaluation\n percent_of(price, tax)\n end",
"def payment_price_tax\n\t\t\t\t\treturn nil\n\t\t\t\tend",
"def tax(amount)\n if amount <= 240\n 0\n elsif amount <= 480\n amount * 0.15\n else\n amount * 0.28\n end\nend",
"def calc_spec_tax(_amount)\n _amountret = _amount.to_f * @_taxpr\n return _amountret\n end",
"def tax_amount(amount)\n return ((amount * 8.9)/100).round(2)\nend",
"def calculate\n product.taxes&.map { |tax| tax_portion(tax) }.sum.to_f || 0\n end",
"def calculate_price_with_vat\n if @tax and self.price\n if User.current and User.current.currency\n converted_price = (self.price.to_d / User.current.currency.exchange_rate.to_d).to_d\n else\n converted_price = self.price\n end\n price_with_vat = @tax.apply_tax(converted_price)\n return price_with_vat\n else\n nil\n end\n end",
"def tax(income)\n if income > 180000\n return 54232 + 0.45*(income-180000)\n elsif income > 87000\n return 19822 + 0.37*(income-87000)\n elsif income > 37000\n return 3572 + 0.325*(income-37000)\n elsif income > 18200\n return 0.19*(income-18200)\n else\n return 0\n end\nend",
"def price_sans_tax\n price_as_price.sans_tax\n end",
"def tax_rate\n self[:tax_rate] ||= Float(line_items.inject(0) {|sum, l| sum + l.tax_rate}) / line_items.size\n end",
"def compute(order)\n rate = self.calculable\n tax = 0\n\n if rate.tax_category.is_default\n order.adjustments.each do | adjust |\n next if adjust.originator_type == \"TaxRate\"\n next if adjust.originator_type == \"ShippingMethod\" and not Spree::Config[:shipment_inc_vat]\n\n tax += (adjust.amount * rate.amount).round(2, BigDecimal::ROUND_HALF_UP)\n end\n end\n\n order.line_items.each do | line_item|\n if line_item.product.tax_category #only apply this calculator to products assigned this rates category\n next unless line_item.product.tax_category == rate.tax_category\n else\n next unless rate.tax_category.is_default # and apply to products with no category, if this is the default rate\n end\n tax += (line_item.price * rate.amount).round(2, BigDecimal::ROUND_HALF_UP) * line_item.quantity\n end\n\n tax\n end",
"def tax_rate\n write_attribute( :tax_rate, Float(line_items.inject(0) {|sum, l| sum + l.tax_rate}) / line_items.size)\n end",
"def tax\n order.delivery_tax_amount +\n order_items.inject(BigDecimal(0)) { |t, i| t + i.tax_amount }\n end",
"def rounded_tax(raw_tax)\n (raw_tax * 20).ceil.round / 20.0\n end",
"def import_tax(item_name, price_of_item)\n\t\[email protected]_tax_calc(item_name, price_of_item)\n\t\tadd_item\n\tend",
"def calc_high_tax(_amount)\n _amountret = _amount.to_f * 0.3\n return _amountret\n end",
"def tax_amount\n self.quantity * single_item_tax\n end",
"def tax_sum(tax, tax_percent)\n (tax - (tax / (1 + tax_percent))).round(2)\n end",
"def full_price\n\t\t\t\t@aftertax = @baseprice * @taxrate\n\t\tend",
"def calculate_price\n result = 0.0\n @items.each do |item|\n name = item.name\n price = item.price\n final_taxed_price = price # Begin with price and add tax as necessary\n tax = 0.0\n\n # Is the item subject to sales tax (ie. not exempt)?\n if !is_exempt(name)\n # Not exempt, apply sales tax\n tax += price * @@sales_tax\n else\n # Exempt, don't apply sales tax\n end\n\n # Is the item subject to import tax (ie. is it imported)?\n if is_imported(name)\n # Is imported, apply import sales tax\n tax += price * @@imported_goods_sales_tax\n else\n # Is not imported, don't apply import sales tax\n end\n\n final_taxed_price += round_point05(tax)\n\n puts final_taxed_price\n\n result += final_taxed_price # Add the final price to the running total\n end\n result\n end",
"def price_inc_vat(q = 1)\n Taxer.new(price_at_quantity(q), tax_type).inc_vat\n end",
"def sales_tax_amount\n $tracer.trace(__method__)\n\t\treturn ToolTag.new(td.className(create_ats_regex_string(\"ats-wis-tax\")), __method__)\n end",
"def compute(order)\n rate = self.calculable\n tax = 0\n return 0 unless order.ship_address.nil? || order.ship_address.country.nil? || rate.zone.country_list.include?(order.ship_address.country)\n\n if rate.tax_category.is_default and !Spree::Config[ :show_price_inc_vat]\n order.adjustments.each do | adjust |\n next if adjust.originator_type == \"TaxRate\"\n add = adjust.amount * rate.amount\n puts \"Applying default rate to adjustment #{adjust.label} (#{adjust.originator_type} ), sum = #{add}\"\n tax += add\n end\n end\n order.line_items.each do | line_item|\n # do not apply tax_rate if product has no tax_category\n next unless line_item.product.tax_category_id?\n next unless line_item.product.tax_category == rate.tax_category\n next unless line_item.product.tax_category.tax_rates.include? rate\n tax += BigDecimal((line_item.price * rate.amount).to_s).round(2, BigDecimal::ROUND_HALF_UP) * line_item.quantity\n end\n tax\n end",
"def apply_tax(amount, options = {})\n opts = {}.merge(options)\n amount = amount.to_d\n if self.compound_tax.to_i == 1\n if opts[:precision]\n amount += format(\"%.#{opts[:precision].to_i}f\", (amount* tax1_value/100.0)).to_d if tax1_enabled.to_i == 1\n amount += format(\"%.#{opts[:precision].to_i}f\", (amount* tax2_value/100.0)).to_d if tax2_enabled.to_i == 1\n amount += format(\"%.#{opts[:precision].to_i}f\", (amount* tax3_value/100.0)).to_d if tax3_enabled.to_i == 1\n amount += format(\"%.#{opts[:precision].to_i}f\", (amount* tax4_value/100.0)).to_d if tax4_enabled.to_i == 1\n else\n amount += (amount* tax1_value/100.0) if tax1_enabled.to_i == 1\n amount += (amount* tax2_value/100.0) if tax2_enabled.to_i == 1\n amount += (amount* tax3_value/100.0) if tax3_enabled.to_i == 1\n amount += (amount* tax4_value/100.0) if tax4_enabled.to_i == 1\n end\n else\n tax = 0\n if opts[:precision]\n tax += format(\"%.#{opts[:precision].to_i}f\", (amount* tax1_value/100.0)).to_d if tax1_enabled.to_i == 1\n tax += format(\"%.#{opts[:precision].to_i}f\", (amount* tax2_value/100.0)).to_d if tax2_enabled.to_i == 1\n tax += format(\"%.#{opts[:precision].to_i}f\", (amount* tax3_value/100.0)).to_d if tax3_enabled.to_i == 1\n tax += format(\"%.#{opts[:precision].to_i}f\", (amount* tax4_value/100.0)).to_d if tax4_enabled.to_i == 1\n else\n tax += (amount* tax1_value/100.0) if tax1_enabled.to_i == 1\n tax += (amount* tax2_value/100.0) if tax2_enabled.to_i == 1\n tax += (amount* tax3_value/100.0) if tax3_enabled.to_i == 1\n tax += (amount* tax4_value/100.0) if tax4_enabled.to_i == 1\n end\n amount += tax\n end\n amount\n end",
"def calc_top_tax(_amount)\n _amountret = _amount.to_f * 0.33\n return _amountret\n end",
"def tax_coefficient(model)\n 1 + model.tax / 100.0\n end",
"def count_tax_amount(amount, options = {})\n opts = {}.merge(options)\n amount = amount.to_d\n tax = amount\n if self.compound_tax.to_i == 1\n if opts[:precision]\n tax += format(\"%.#{opts[:precision].to_i}f\", (tax* tax1_value/100.0)).to_d if tax1_enabled.to_i == 1\n tax += format(\"%.#{opts[:precision].to_i}f\", (tax* tax2_value/100.0)).to_d if tax2_enabled.to_i == 1\n tax += format(\"%.#{opts[:precision].to_i}f\", (tax* tax3_value/100.0)).to_d if tax3_enabled.to_i == 1\n tax += format(\"%.#{opts[:precision].to_i}f\", (tax* tax4_value/100.0)).to_d if tax4_enabled.to_i == 1\n else\n tax += (tax* tax1_value/100.0) if tax1_enabled.to_i == 1\n tax += (tax* tax2_value/100.0) if tax2_enabled.to_i == 1\n tax += (tax* tax3_value/100.0) if tax3_enabled.to_i == 1\n tax += (tax* tax4_value/100.0) if tax4_enabled.to_i == 1\n end\n return tax - amount\n else\n if opts[:precision]\n tax = format(\"%.#{opts[:precision].to_i}f\", (amount* tax1_value/100.0)).to_d\n tax += format(\"%.#{opts[:precision].to_i}f\", (amount* tax2_value/100.0)).to_d if tax2_enabled.to_i == 1\n tax += format(\"%.#{opts[:precision].to_i}f\", (amount* tax3_value/100.0)).to_d if tax3_enabled.to_i == 1\n tax += format(\"%.#{opts[:precision].to_i}f\", (amount* tax4_value/100.0)).to_d if tax4_enabled.to_i == 1\n else\n tax = amount* tax1_value/100.0\n tax += (amount* tax2_value/100.0) if tax2_enabled.to_i == 1\n tax += (amount* tax3_value/100.0) if tax3_enabled.to_i == 1\n tax += (amount* tax4_value/100.0) if tax4_enabled.to_i == 1\n end\n return tax\n end\n\n end",
"def tax_amount\n self[:tax_amount] || (application_fee * tax_rate / 100)\n end",
"def calculate_taxes\n\t\ttax = 0\n\t\t\n\t\tif self.sku.contains_merch?\n\t\t\t# because paypal orders will not have billing addresses, just set \n\t\t\t# billing == to shipping if billing_address is nil\n\t\t\tself.billing_address ||= self.shipping_address \n\t\t\t\n\t\t\ttax = (self.sku.price * self.tax_rate * self.sku_quantity).round if self.billing_address.state == self.nexus\n\t\tend\n\t\t\n\t\tself.tax_amount = tax\n\t\t\n\tend",
"def add_tax(tax)\n tax_breakdown(tax)[0]\n end",
"def calculateTax(income)\n\t\n\t\ttax = 0\n\t\t\n\t\tleftOver = income - 18201\n\t\t\n\t\tif leftOver <= 0\n\t\t\treturn tax;\n\t\tend\n\t\t\n\t\tleftOver -= 18799\n\t\t\n\t\tif leftOver < 0\n\t\t\tleftOver += 18799\n\t\t\ttax += calculateTaxBracket(0 ,0.19, leftOver)\n\t\t\treturn tax\n\t\tend\n\t\t\t\n\t\ttax += calculateTaxBracket(0 ,0.19, leftOver)\n\t\t\n\t\tleftOver -= 49999\n\t\t\n\t\tif leftOver < 0\n\t\t\tleftOver += 49999\n\t\t\ttax += calculateTaxBracket(3572 ,0.32, leftOver)\n\t\t\treturn tax\n\t\tend\n\t\t\n\t\tleftOver -= 92999\n\t\t\n\t\tif leftOver < 0\n\t\t\tleftOver += 92999\n\t\t\ttax += calculateTaxBracket(19822 ,0.32, leftOver)\n\t\t\treturn tax\n\t\tend\n\t\t\n\t\ttax += calculateTaxBracket(54232,0.45, leftOver)\n\t\t\t\n\t\treturn tax.round(2)\n\t\n\tend",
"def tax\n self.delivery_tax_amount +\n order_items.inject(BigDecimal(0)) { |t, i| t + i.tax_amount }\n end",
"def income_tax(income=0,inc_tax_rate=0.1)\n income*inc_tax_rate\nend",
"def income_tax(income=0,inc_tax_rate=0.1)\n income*inc_tax_rate\nend",
"def product_tax(product)\n tax = 0\n tax += IMPORT_TAX if product =~ Regexp.new(IMPORTED_PRODUCTS)\n tax += SALES_TAX unless EXEMPT_PRODUCTS.any? { |p| product.downcase.include?(p) }\n tax\n end",
"def sales_tax\n return (@listOfItem.inject(0){|sum,e| sum += \n e.product != nil ? e.product.sales_tax + e.product.import_tax : 0 }).round_to(2)\n end",
"def apply_tax(amount, options = {})\n opts = {}.merge(options)\n amount = amount.to_d\n if self.compound_tax.to_i == 1\n if opts[:precision]\n amount += format(\"%.#{opts[:precision].to_i}f\", (amount* tax1_value/100.0)).to_d if tax1_enabled.to_i == 1\n amount += format(\"%.#{opts[:precision].to_i}f\", (amount* tax2_value/100.0)).to_d if tax2_enabled.to_i == 1\n amount += format(\"%.#{opts[:precision].to_i}f\", (amount* tax3_value/100.0)).to_d if tax3_enabled.to_i == 1\n amount += format(\"%.#{opts[:precision].to_i}f\", (amount* tax4_value/100.0)).to_d if tax4_enabled.to_i == 1\n else\n amount += (amount* tax1_value/100.0) if tax1_enabled.to_i == 1\n amount += (amount* tax2_value/100.0) if tax2_enabled.to_i == 1\n amount += (amount* tax3_value/100.0) if tax3_enabled.to_i == 1\n amount += (amount* tax4_value/100.0) if tax4_enabled.to_i == 1\n end\n else\n tax = 0\n if opts[:precision]\n tax += format(\"%.#{opts[:precision].to_i}f\", (amount* tax1_value/100.0)).to_d if tax1_enabled.to_i == 1\n tax += format(\"%.#{opts[:precision].to_i}f\", (amount* tax2_value/100.0)).to_d if tax2_enabled.to_i == 1\n tax += format(\"%.#{opts[:precision].to_i}f\", (amount* tax3_value/100.0)).to_d if tax3_enabled.to_i == 1\n tax += format(\"%.#{opts[:precision].to_i}f\", (amount* tax4_value/100.0)).to_d if tax4_enabled.to_i == 1\n else\n tax += (amount* tax1_value/100.0) if tax1_enabled.to_i == 1\n tax += (amount* tax2_value/100.0) if tax2_enabled.to_i == 1\n tax += (amount* tax3_value/100.0) if tax3_enabled.to_i == 1\n tax += (amount* tax4_value/100.0) if tax4_enabled.to_i == 1\n end\n amount += tax\n end\n amount\n end",
"def tax income\r\n income = fix_income income\r\n\r\n total_tax = 0\r\n working_income = income\r\n @taxes.reverse.each do |tax|\r\n if working_income >= tax[:min_income]\r\n diff = working_income - tax[:min_income]\r\n total_tax += diff*tax[:rate]\r\n working_income -= diff\r\n end\r\n end\r\n\r\n return total_tax\r\n end",
"def calculate_total_price_and_taxes\n # find the tax rate\n tax_rate_percent = 0\n\n unless is_exempt_from_regular_tax?\n tax_rate_percent += REGULAR_TAX_PERCENT\n end\n\n unless self.is_exempt_from_import_tax?\n tax_rate_percent += IMPORT_TAX_PERCENT\n end\n\n # np/100\n # total tax needs to be a float rounded to nearest .05\n @total_tax = SalesTaxes::Item.round_properly((self.price * tax_rate_percent)/100)\n\n @total_price = (@price + @total_tax)\n end",
"def get_tax_rate(item)\n\t\ttax_rate = 0.0\n\t\ttax_rate = @goods_tax_rate unless item[:exempt]\n\t\ttax_rate = tax_rate + @imported_tax_rate if item[:import]\n\t\treturn tax_rate\n\tend",
"def total_before_tax\n order.delivery_price + items_sub_total\n end",
"def round_tax(tax)\n\t\t(tax * 20.0).ceil / 20.0\n\tend",
"def add_taxes(amt, good_tax, import_tax)\n amt += good_tax + import_tax\n amt.round(2)\n end",
"def original_price\n order.total_price_with_taxes\n end",
"def effective_tax_rate income\r\n income = fix_income income\r\n\r\n return marginal_tax_rate income if income == 0 #avoid our later divide by zero\r\n\r\n (tax income) / income \r\n end",
"def ticket_tax(accounting_element)\n\t \taccounting_element[:taxes][:tax][:@amount]\n\t end",
"def tax_rate\n Store.settings.tax_rate/100\n end",
"def tax_rate\n self[:tax_rate] || 19.0\n end",
"def calc_low_tax(_amount)\n _amountret = _amount.to_f * 0.105\n return _amountret\n end",
"def calc_total\n (@total_after_tax * @gratuity) + @total_after_tax\n end",
"def get_medicare_tax(income)\n tax_rate = 0.124\n if status = \"married\" && income > 250000\n tax_rate += 0.009\n elsif status = (\"single\" || \"head_of_household\") && income > 200000\n tax_rate += 0.009\n end\n if income >= 127200\n return tax_rate * 127200\n else\n return tax_rate * income\n end\n end",
"def tax\n unescape params['x_tax']\n end",
"def calc_tax_rate(item)\n tax_rate = 0\n tax_rate += @@import_duty if item.imported\n tax_rate += @@sales_tax unless (item.is_a? Book) || (item.is_a? Food) || (item.is_a? Medicine)\n \n return tax_rate\n end",
"def tax_total\n self.tax_amount = line_items.inject(0.to_money) {|sum,l| sum + l.tax_amount }\n self.tax_rate # calculates average rate, leave for compatibility reasons\n self.tax_amount\n end",
"def product_tax_rate(state_id, tax_time = Time.now)\n product.tax_rate(state_id, tax_time)\n end",
"def find_other_taxes\n @service_tax = @seats_price * SERVICE_TAX\n @swach_bharath_cess = @seats_price * SWACH_BHARATH_CESS\n @krishi_kalyan_cess = @seats_price * KRISHI_KALYAN_CESS\n end",
"def tax_total\n self.tax_amount = line_items.inject(Money.new(0, self.currency || Money.default_currency)) {|sum,l| sum + l.tax_amount }\n self.tax_rate # calculates average rate, leave for compatibility reasons\n self.tax_amount\n end",
"def total_tax\n unit_tax * quantity\n end",
"def total_before_tax\n self.delivery_price + self.items_sub_total\n end",
"def calc_middle_tax(_amount)\n _amountret = _amount.to_f * 0.175\n return _amountret\n end",
"def unit_amount_inc_tax\n unit_amount + unit_tax\n end",
"def unit_price_without_tax\n unit_price - tax_amount\n end",
"def total_before_tax\n total = 0\n @cart_items.each do |item|\n total += item.price\n end\n return total\n end",
"def conv_tax\n ((self.respond_to?(:tax) && tax) || 0).to_r\n end",
"def total_amount_inc_tax\n unit_amount_inc_tax * quantity\n end",
"def tax\n unescape params['x_tax']\n end",
"def tax_rate\n self[:tax_rate] || TAX_RATE || product.try(:tax_rate).try(:rate_for, order) || BigDecimal(0)\n end",
"def taxable_amount()\n (self.amount - vat_amount())\n end"
] | [
"0.7979767",
"0.7882686",
"0.78707516",
"0.7869687",
"0.77694654",
"0.7633737",
"0.7632139",
"0.75849223",
"0.7516382",
"0.7507391",
"0.73583174",
"0.7323329",
"0.7312023",
"0.72739744",
"0.7180627",
"0.71625704",
"0.71436626",
"0.7033889",
"0.7027502",
"0.7022732",
"0.6989246",
"0.69829845",
"0.69699246",
"0.69649214",
"0.6957142",
"0.689676",
"0.6884644",
"0.6882959",
"0.68789476",
"0.68742555",
"0.6834145",
"0.6816587",
"0.6787854",
"0.67765933",
"0.67413443",
"0.6724204",
"0.67094535",
"0.66635644",
"0.6606887",
"0.6573331",
"0.65690666",
"0.65555114",
"0.6531262",
"0.65296155",
"0.6521468",
"0.6518903",
"0.6515689",
"0.651434",
"0.650943",
"0.65092456",
"0.650175",
"0.6498113",
"0.64952636",
"0.6491392",
"0.64814484",
"0.64770216",
"0.6466048",
"0.6458401",
"0.6456805",
"0.6452655",
"0.64521104",
"0.6450113",
"0.64306545",
"0.6424262",
"0.64185",
"0.64185",
"0.6402722",
"0.63992584",
"0.63948166",
"0.6384882",
"0.63799036",
"0.6370065",
"0.6368107",
"0.6361078",
"0.6360172",
"0.6355185",
"0.63467956",
"0.63418126",
"0.6310779",
"0.63016605",
"0.6292719",
"0.62772906",
"0.62620157",
"0.6254277",
"0.62506455",
"0.6242782",
"0.62370425",
"0.62360334",
"0.62317973",
"0.6226618",
"0.6216353",
"0.6205307",
"0.6200622",
"0.61994976",
"0.61977226",
"0.61888844",
"0.61875033",
"0.618659",
"0.6182661",
"0.61617255"
] | 0.74593616 | 10 |
Describes current tax rates and gives a list of exempt products | def to_s
"Tax authority: #{@authority}\n" +
"-Sales Taxes: #{@sales_tax.to_i}% rate on all goods except #{exempt_basic}.\n" +
"-Import Duty: #{@import_duty.to_i}% rate on all imported goods."
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def supplies_with_default_tax\n self.supplies_including_tax + self.supplies_excluding_tax.select{|s| [\"CAD\",\"USD\"].include?(s[:currency])}\n end",
"def supplies_including_tax\n self.supplies.select{|p| p[:including_tax]}\n end",
"def tr_pq_taxes(pq)\n\t \tresponse = \"\"\n\t \titf = pq[:priced_itinerary][:air_itinerary_pricing_info][:itin_total_fare]\n\t \ttaxes = itf[:taxes][:tax_breakdown_code]\n\t \tcode_tax = itf[:taxes][:tax][:@tax_code]\n\t \tdiv_taxes = taxes.each_slice(4).to_a\n\t \tdiv_taxes.each {\n\t \t\t|ts|\n\t \t\tresponse += \"<tr>\"\n\t \t\tresponse += \"<td>#{code_tax}</td>\"\n\t \t\tts.each { |t| response += \"<td>#{t}</td>\" }\n\t \t\tresponse += \"</tr>\"\n\t \t\tcode_tax = \"\" #el codigo del impuesto solo va en la primer fila\n\t \t}\n\t \treturn response\n\t end",
"def get_all_taxes\n self.class.get(\"/aldebaran-taxes/v2/taxes\", :basic_auth => @auth)\n end",
"def product_tax(product)\n tax = 0\n tax += IMPORT_TAX if product =~ Regexp.new(IMPORTED_PRODUCTS)\n tax += SALES_TAX unless EXEMPT_PRODUCTS.any? { |p| product.downcase.include?(p) }\n tax\n end",
"def applied_tax_list(amount, options = {})\n opts = {}.merge(options)\n amount = amount.to_d\n list = []\n if self.compound_tax.to_i == 1\n if opts[:precision]\n list << {:name => tax1_name.to_s, :value => tax1_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax1_value).to_d/100.0), :amount => amount += format(\"%.#{opts[:precision].to_i}f\", (amount*tax1_value).to_d/100.0).to_d} if tax1_enabled.to_i == 1\n list << {:name => tax2_name.to_s, :value => tax2_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax2_value).to_d/100.0), :amount => amount += format(\"%.#{opts[:precision].to_i}f\", (amount*tax2_value).to_d/100.0).to_d} if tax2_enabled.to_i == 1\n list << {:name => tax3_name.to_s, :value => tax3_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax3_value).to_d/100.0), :amount => amount += format(\"%.#{opts[:precision].to_i}f\", (amount*tax3_value).to_d/100.0).to_d} if tax3_enabled.to_i == 1\n list << {:name => tax4_name.to_s, :value => tax4_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax4_value).to_d/100.0), :amount => amount += format(\"%.#{opts[:precision].to_i}f\", (amount*tax4_value).to_d/100.0).to_d} if tax4_enabled.to_i == 1\n else\n list << {:name => tax1_name.to_s, :value => tax1_value.to_d, :tax => amount*tax1_value/100.0, :amount => amount += amount*tax1_value/100.0} if tax1_enabled.to_i == 1\n list << {:name => tax2_name.to_s, :value => tax2_value.to_d, :tax => amount*tax2_value/100.0, :amount => amount += amount*tax2_value/100.0} if tax2_enabled.to_i == 1\n list << {:name => tax3_name.to_s, :value => tax3_value.to_d, :tax => amount*tax3_value/100.0, :amount => amount += amount*tax3_value/100.0} if tax3_enabled.to_i == 1\n list << {:name => tax4_name.to_s, :value => tax4_value.to_d, :tax => amount*tax4_value/100.0, :amount => amount += amount*tax4_value/100.0} if tax4_enabled.to_i == 1\n end\n else\n if opts[:precision]\n list << {:name => tax1_name.to_s, :value => tax1_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax1_value).to_d/100.0), :amount => format(\"%.#{opts[:precision].to_i}f\", (amount*tax1_value).to_d/100.0).to_d} if tax1_enabled.to_i == 1\n list << {:name => tax2_name.to_s, :value => tax2_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax2_value).to_d/100.0), :amount => format(\"%.#{opts[:precision].to_i}f\", (amount*tax2_value).to_d/100.0).to_d} if tax2_enabled.to_i == 1\n list << {:name => tax3_name.to_s, :value => tax3_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax3_value).to_d/100.0), :amount => format(\"%.#{opts[:precision].to_i}f\", (amount*tax3_value).to_d/100.0).to_d} if tax3_enabled.to_i == 1\n list << {:name => tax4_name.to_s, :value => tax4_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax4_value).to_d/100.0), :amount => format(\"%.#{opts[:precision].to_i}f\", (amount*tax4_value).to_d/100.0).to_d} if tax4_enabled.to_i == 1\n else\n list << {:name => tax1_name.to_s, :value => tax1_value.to_d, :tax => amount*tax1_value/100.0, :amount => amount*tax1_value/100.0} if tax1_enabled.to_i == 1\n list << {:name => tax2_name.to_s, :value => tax2_value.to_d, :tax => amount*tax2_value/100.0, :amount => amount*tax2_value/100.0} if tax2_enabled.to_i == 1\n list << {:name => tax3_name.to_s, :value => tax3_value.to_d, :tax => amount*tax3_value/100.0, :amount => amount*tax3_value/100.0} if tax3_enabled.to_i == 1\n list << {:name => tax4_name.to_s, :value => tax4_value.to_d, :tax => amount*tax4_value/100.0, :amount => amount*tax4_value/100.0} if tax4_enabled.to_i == 1\n end\n end\n list\n end",
"def applied_tax_list(amount, options = {})\n opts = {}.merge(options)\n amount = amount.to_d\n list = []\n if self.compound_tax.to_i == 1\n if opts[:precision]\n list << {:name => tax1_name.to_s, :value => tax1_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax1_value).to_d/100.0), :amount => amount += format(\"%.#{opts[:precision].to_i}f\", (amount*tax1_value).to_d/100.0).to_d} if tax1_enabled.to_i == 1\n list << {:name => tax2_name.to_s, :value => tax2_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax2_value).to_d/100.0), :amount => amount += format(\"%.#{opts[:precision].to_i}f\", (amount*tax2_value).to_d/100.0).to_d} if tax2_enabled.to_i == 1\n list << {:name => tax3_name.to_s, :value => tax3_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax3_value).to_d/100.0), :amount => amount += format(\"%.#{opts[:precision].to_i}f\", (amount*tax3_value).to_d/100.0).to_d} if tax3_enabled.to_i == 1\n list << {:name => tax4_name.to_s, :value => tax4_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax4_value).to_d/100.0), :amount => amount += format(\"%.#{opts[:precision].to_i}f\", (amount*tax4_value).to_d/100.0).to_d} if tax4_enabled.to_i == 1\n else\n list << {:name => tax1_name.to_s, :value => tax1_value.to_d, :tax => amount*tax1_value/100.0, :amount => amount += amount*tax1_value/100.0} if tax1_enabled.to_i == 1\n list << {:name => tax2_name.to_s, :value => tax2_value.to_d, :tax => amount*tax2_value/100.0, :amount => amount += amount*tax2_value/100.0} if tax2_enabled.to_i == 1\n list << {:name => tax3_name.to_s, :value => tax3_value.to_d, :tax => amount*tax3_value/100.0, :amount => amount += amount*tax3_value/100.0} if tax3_enabled.to_i == 1\n list << {:name => tax4_name.to_s, :value => tax4_value.to_d, :tax => amount*tax4_value/100.0, :amount => amount += amount*tax4_value/100.0} if tax4_enabled.to_i == 1\n end\n else\n if opts[:precision]\n list << {:name => tax1_name.to_s, :value => tax1_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax1_value).to_d/100.0), :amount => format(\"%.#{opts[:precision].to_i}f\", (amount*tax1_value).to_d/100.0).to_d} if tax1_enabled.to_i == 1\n list << {:name => tax2_name.to_s, :value => tax2_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax2_value).to_d/100.0), :amount => format(\"%.#{opts[:precision].to_i}f\", (amount*tax2_value).to_d/100.0).to_d} if tax2_enabled.to_i == 1\n list << {:name => tax3_name.to_s, :value => tax3_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax3_value).to_d/100.0), :amount => format(\"%.#{opts[:precision].to_i}f\", (amount*tax3_value).to_d/100.0).to_d} if tax3_enabled.to_i == 1\n list << {:name => tax4_name.to_s, :value => tax4_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax4_value).to_d/100.0), :amount => format(\"%.#{opts[:precision].to_i}f\", (amount*tax4_value).to_d/100.0).to_d} if tax4_enabled.to_i == 1\n else\n list << {:name => tax1_name.to_s, :value => tax1_value.to_d, :tax => amount*tax1_value/100.0, :amount => amount*tax1_value/100.0} if tax1_enabled.to_i == 1\n list << {:name => tax2_name.to_s, :value => tax2_value.to_d, :tax => amount*tax2_value/100.0, :amount => amount*tax2_value/100.0} if tax2_enabled.to_i == 1\n list << {:name => tax3_name.to_s, :value => tax3_value.to_d, :tax => amount*tax3_value/100.0, :amount => amount*tax3_value/100.0} if tax3_enabled.to_i == 1\n list << {:name => tax4_name.to_s, :value => tax4_value.to_d, :tax => amount*tax4_value/100.0, :amount => amount*tax4_value/100.0} if tax4_enabled.to_i == 1\n end\n end\n list\n end",
"def taxes\n wizard_step(STEPS)\n end",
"def index\n @form_excise_taxes = FormExciseTax.all\n end",
"def tax_rates\n @tax_rates ||= @api.get('TaxRates')['TaxRates'] || []\n end",
"def after_taxes\n printed_list = \"\"\n @total = 0\n @list.each do |item, quantity|\n item_total = quantity * item.price\n @total += item_total\n printed_list += \"#{quantity} #{item.name}: #{MONEY_FORMAT % item.price}\\n\"\n end\n return printed_list\n end",
"def taxes\n calculation = BigDecimal.new(\"0\")\n absolutely_priced? ? base_price = sales_price : base_price = gross_price\n calculation = ( (base_price - rebate) / BigDecimal.new(\"100.0\")) * tax_class.percentage\n end",
"def tax\n 0.0\n end",
"def find_other_taxes\n @service_tax = @seats_price * SERVICE_TAX\n @swach_bharath_cess = @seats_price * SWACH_BHARATH_CESS\n @krishi_kalyan_cess = @seats_price * KRISHI_KALYAN_CESS\n end",
"def taxon_preview(taxon)\n products = taxon.products[0..4]\n return products unless products.size < 5\n if Spree::Config[:show_descendents]\n taxon.descendents.each do |taxon|\n products += taxon.products[0..4]\n break if products.size >= 5\n end\n end\n products[0..4]\n end",
"def index\n @taxes = Tax.all\n end",
"def all_products_before_tax\n collection_of_products_total = 0\n @collection_of_products.each do |current_product|\n collection_of_products_total += current_product.base_price\n end\n end",
"def product_selling_price_after_tax\n product_markup_price * (1 - county.tax_factor) \n end",
"def supplies_excluding_tax\n self.supplies.select{|p| not p[:including_tax]}\n end",
"def tax\n\t\t@value * 0.16\n\tend",
"def tax_breakdown\n global_tax_breakdown(purchase_order_items, true)\n end",
"def taxes_amounts\n total_prices_te_by_taxes_rates.map do |taxes_rate, price_without_taxes|\n tax_amount = price_without_taxes.to_f * (taxes_rate / 100)\n\n {formatted_taxes_rate(taxes_rate) => formatted_price(tax_amount)}\n end.reduce({}, :merge)\n end",
"def text_pq_taxes(pq)\n\t \titf = pq[:priced_itinerary][:air_itinerary_pricing_info][:itin_total_fare]\n\t \ttaxes = itf[:taxes][:tax_breakdown_code]\n\t \treturn \"#{itf[:taxes][:tax][:@tax_code]} #{taxes.join(\" \")}\"\n\t end",
"def price_sans_tax\n price_as_price.sans_tax\n end",
"def tax_rate\n Store.settings.tax_rate/100\n end",
"def tax_rate\n self[:tax_rate] || TAX_RATE || product.try(:tax_rate).try(:rate_for, order) || BigDecimal(0)\n end",
"def sales_tax\n return (@listOfItem.inject(0){|sum,e| sum += \n e.product != nil ? e.product.sales_tax + e.product.import_tax : 0 }).round_to(2)\n end",
"def tax\n price_as_price.tax\n end",
"def list_products\n @products.map { |p| \"#{p.name} costs £#{p.price / 100.round(2)}\" }\n end",
"def get_cost_without_tax\n total_costs = 0.0\n @products.each_value { |cost| total_costs += cost if is_valid_cost?(cost) }\n return total_costs\n end",
"def total_prices_te_by_taxes_rates\n order_items.reduce({}) do |total_prices, order_item|\n taxes_rate = order_item.product_taxes_rate.to_f\n\n total_prices[taxes_rate] ||= 0\n total_prices[taxes_rate] += order_item.product_price_te.to_f\n total_prices\n end\n end",
"def payment_price_tax\n\t\t\t\t\treturn nil\n\t\t\t\tend",
"def calcuate_tax\n @price * 0.12\n end",
"def all_products_after_tax\n ccollection_of_products_total = 0\n @collection_of_products.each do |current_product|\n ccollection_of_products_total += current_product.total_price\n end\n end",
"def product_tax_rate(state_id, tax_time = Time.now)\n product.tax_rate(state_id, tax_time)\n end",
"def get_tax_rates\n response_xml = http_get(@client, \"#{xero_url}/TaxRates\")\n parse_response(response_xml, {}, {:request_signature => 'GET/tax_rates'})\n end",
"def calc_all_tax(items)\n items_tax = items.collect { |item| calc_tax(item) }\n end",
"def index\n @quarter_income_taxes = QuarterIncomeTax.all\n end",
"def display_price\n price = if respond_to?(:display_amount)\n display_amount\n else\n display_base_price\n end.to_s\n\n return price if Spree::Avatax::Config.tax_calculation\n return price if taxes.empty? || amount == 0\n\n tax_explanations = taxes.map(&:label).join(tax_label_separator)\n\n Spree.t :display_price_with_explanations,\n scope: 'shipping_rate.display_price',\n price: price,\n explanations: tax_explanations\n end",
"def total_taxes\n @total_taxes = 0\n @list.each do |item, quantity|\n @total_taxes += quantity * item.taxes\n end\n puts \"Sales Taxes: #{MONEY_FORMAT % @total_taxes}\"\n end",
"def gst_tax_rate\n if !self.tax_accounts.blank?\n self.tax_accounts.first.accountable.tax_rate\n end\n end",
"def included_taxes(amount)\r\n tax_rate = BigDecimal.new('0')\r\n # perform approximate base amount calculation\r\n included = @taxes.find_all {|tax| tax.included}\r\n included.each do |tax|\r\n tax_rate += tax.effective_rate\r\n end\r\n approx_base = amount / (BigDecimal.new('1.0') + tax_rate)\r\n\r\n #use approximate base to calculate included taxes.\r\n included.each do |tax|\r\n tax.amount = approx_base * tax.effective_rate\r\n end\r\n included\r\n end",
"def find_products_by_taxons(taxons)\n Spree::Product.joins(:taxons).includes(:taxons).where(spree_taxons: { name: taxons }).where('available_on <= ?', DateTime.now)\n end",
"def price_with_tax\n price_as_price.with_tax\n end",
"def tax_rate\n self[:tax_rate] ||= Float(line_items.inject(0) {|sum, l| sum + l.tax_rate}) / line_items.size\n end",
"def tax_index\n\n end",
"def ticket_tax(accounting_element)\n\t \taccounting_element[:taxes][:tax][:@amount]\n\t end",
"def tax_exempt\n params['x_tax_exempt']\n end",
"def tax_rate\n self[:tax_rate] || 19.0\n end",
"def calcTaxes price\r\n taxrate = 0.95\r\n return taxrate * price\r\nend",
"def selected\n @taxons = @product.taxons\n set_available\n end",
"def pricing_types\n self.pricing_expressions.map(&:pricing_type).select{|x| x.ineffective_on.nil?}\n end",
"def tax_exempt\n params['x_tax_exempt']\n end",
"def index\n @transaction_goods_taxes = Transaction::Goods::Taxe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @transaction_goods_taxes }\n end\n end",
"def preview_order_items\n [\n {title: 'Item One', quantity: 2, price: 999, tax_exempt: false},\n {title: 'Item Two', quantity: 1, price: 25000, tax_exempt: false},\n {title: 'Item Three', quantity: 1, price: 8999, tax_exempt: false},\n {title: 'Item Four', quantity: 1, price: 100000, tax_exempt: false}\n ]\n end",
"def create_tax_charge!\n #puts \"Adjustments #{adjustments} TAX #{tax_total}\"\n #puts \"CREATE TAX for #{ship_address} \"\n all_rates = Spree::TaxRate.all\n matching_rates = all_rates.select { |rate| rate.zone.include?(ship_address) }\n if matching_rates.empty?\n matching_rates = all_rates.select{|rate| # get all rates that apply to default country \n rate.zone.country_list.collect{|c| c.id}.include?(Spree::Config[:default_country_id])\n }\n end\n adjustments.where(:originator_type => \"TaxRate\").each do |old_charge|\n old_charge.destroy\n end\n matching_rates.each do |rate|\n #puts \"Creating rate #{rate.amount}\" \n rate.create_adjustment( rate.tax_category.description , self, self, true)\n end\n end",
"def order_items_by_article_categories_and_taxes\n object.order_items.includes(:product).where(product_type: 'Article').reduce({}) do |hash, order_item|\n hash[\"#{order_item.product_category_name}_#{order_item.product_taxes_rate}\"] ||= []\n hash[\"#{order_item.product_category_name}_#{order_item.product_taxes_rate}\"].push(order_item)\n hash\n end\n end",
"def get_ex_taxes_price(ex_gst_price, wet_percentage)\n\t\treturn ex_gst_price/(1 + (wet_percentage/100))\n\tend",
"def special_prices\n prices\n end",
"def calculate\n product.taxes&.map { |tax| tax_portion(tax) }.sum.to_f || 0\n end",
"def price_ex_vat(q = 1)\n Taxer.new(price_at_quantity(q), tax_type).ex_vat\n end",
"def sales_tax_amount\n $tracer.trace(__method__)\n\t\treturn ToolTag.new(td.className(create_ats_regex_string(\"ats-wis-tax\")), __method__)\n end",
"def query_tax_rates(options={})\n path = \"/api/v2/compliance/taxrates\"\n get(path, options)\n end",
"def index\n @taxfrees = Taxfree.all\n end",
"def exempted(item_name, price_of_item)\n\t\[email protected]_tax(item_name, price_of_item)\n\t\tadd_item\n\tend",
"def index\n @taxes = params['item_id'] ? Item.find(params['item_id']).taxes : Tax.all\n render json: @taxes\n end",
"def tax_calc\n tax = @quantity * @price * @taxe\n end",
"def tax\n price.to_f * 0.09\n end",
"def paypal_variant_tax(sale_price, variant) \n 0.0\n end",
"def tax\n rate = 0.09\n tax_amount = (price.to_f * rate)\n return tax_amount\n end",
"def tax_rate\n write_attribute( :tax_rate, Float(line_items.inject(0) {|sum, l| sum + l.tax_rate}) / line_items.size)\n end",
"def taxons(product_id:)\n version_ids = taxons_version_ids(product_id: product_id)\n\n versions = PaperTrail::Version.where(id: version_ids)\n versions.map(&:reify)\n end",
"def display_price\n price = if respond_to?(:display_amount)\n display_amount\n else\n display_base_price\n end.to_s\n\n return price if ::Spree::Avatax::Config.tax_calculation\n return price if taxes.empty? || amount == 0\n\n tax_explanations = taxes.map(&:label).join(tax_label_separator)\n\n I18n.t :display_price_with_explanations,\n scope: 'spree.shipping_rate.display_price',\n price: price,\n explanations: tax_explanations\n end",
"def profit\n total_before_tax - total_cost\n end",
"def profit\n total_before_tax - total_cost\n end",
"def tax_amount\n self.quantity * single_item_tax\n end",
"def index\n @tax_informations = TaxInformation.all\n end",
"def tax\n self.delivery_tax_amount +\n order_items.inject(BigDecimal(0)) { |t, i| t + i.tax_amount }\n end",
"def get_tax(price, quantity, tax_rate)\n\t\ttax = (price * quantity) * tax_rate\n\t\tround_tax(tax)\n\tend",
"def tax_total\n adjustments.where(:originator_type => \"TaxRate\").map(&:amount).sum\n end",
"def pricing\n request('pricing', :get)\n end",
"def index\n @taxons = Taxon.all\n end",
"def compute(order)\n rate = self.calculable\n tax = 0\n\n if rate.tax_category.is_default\n order.adjustments.each do | adjust |\n next if adjust.originator_type == \"TaxRate\"\n next if adjust.originator_type == \"ShippingMethod\" and not Spree::Config[:shipment_inc_vat]\n\n tax += (adjust.amount * rate.amount).round(2, BigDecimal::ROUND_HALF_UP)\n end\n end\n\n order.line_items.each do | line_item|\n if line_item.product.tax_category #only apply this calculator to products assigned this rates category\n next unless line_item.product.tax_category == rate.tax_category\n else\n next unless rate.tax_category.is_default # and apply to products with no category, if this is the default rate\n end\n tax += (line_item.price * rate.amount).round(2, BigDecimal::ROUND_HALF_UP) * line_item.quantity\n end\n\n tax\n end",
"def productrevenue\n vat_rate = TaxRate.find_by_name(\"VAT\")\n shipping_rate = TaxRate.find_by_name(\"Shipping Reverse for PPO\")\n \n totalrevenue = 0\n totalrevenue += (self.subtotal * (self.pieces ||= 1) * vat_rate.reverse_rate.to_f) || 0\n totalrevenue += (self.shipping * (self.pieces ||= 1) * shipping_rate.reverse_rate.to_f) || 0\n return totalrevenue\nend",
"def index\n @taxes = Tax.all\n\n render json: @taxes\n end",
"def compute_tax(item_price, tax_rate)\n item_price * tax_rate\n end",
"def applicable_filters\n fs = []\n # fs << ProductFilters.taxons_below(self)\n ## unless it's a root taxon? left open for demo purposes\n\n fs << Spree::Core::ProductFilters.price_filter if Spree::Core::ProductFilters.respond_to?(:price_filter)\n fs << Spree::Core::ProductFilters.brand_filter if Spree::Core::ProductFilters.respond_to?(:brand_filter)\n fs\n end",
"def taxpayers_object(number_of_buyers)\n @taxpayers = Array.new(number_of_buyers) do\n Returns::Lbtt::Party.new(party_type: claim_public? ? 'UNAUTH_CLAIMANT' : 'CLAIMANT')\n end\n end",
"def receipt_items\n returning = []\n sales_tax = 0.0\n total = 0.0\n @shopping_cart.each do |line_item|\n sales_tax = sales_tax + line_item.tax\n total = total + line_item.price_with_tax\n returning << \"#{line_item.count} #{line_item.description}: %.2f\" % line_item.price_with_tax\n end\n returning << \"Sales Taxes: %.2f\" % sales_tax\n returning << \"Total: %.2f\" % total\n end",
"def tax\n unescape params['x_tax']\n end",
"def create_tax_charge!\n unless self.account.try(:is_tax_exempt?)\n Spree::TaxRate.adjust(self, line_items)\n Spree::TaxRate.adjust(self, shipments) if shipments.any?\n end\n end",
"def tax\n order.delivery_tax_amount +\n order_items.inject(BigDecimal(0)) { |t, i| t + i.tax_amount }\n end",
"def country_isos_requiring_price\n return [nil] unless variant.tax_category\n [nil] + variant_vat_rates.map(&:zone).flat_map(&:countries).flat_map(&:iso)\n end",
"def tax\n unescape params['x_tax']\n end",
"def line_items_pre_tax_price\n @pre_tax ||= LineItem.total_price(unpaid_line_items)\n end",
"def apply_taxes(taxman)\n @taxes = BigDecimal.new(0)\n if @is_imported\n @taxes += taxman.apply_tax(@price, taxman.import_duty)\n end\n unless taxman.exempt_basic.include?(@type)\n @taxes += taxman.apply_tax(@price, taxman.sales_tax)\n end\n @price += @taxes\n end",
"def basic_tax(item_name, price_of_item)\n\t\[email protected]_tax_calc(item_name, price_of_item)\n\t\tadd_item\n\tend",
"def applicable_filters\n fs = []\n fs << Spree::ProductFilters.taxons_below(self)\n ## unless it's a root taxon? left open for demo purposes\n\n fs << Spree::ProductFilters.price_filter if Spree::ProductFilters.respond_to?(:price_filter)\n fs << Spree::ProductFilters.brand_filter if Spree::ProductFilters.respond_to?(:brand_filter)\n #fs << Spree::ProductFilters.occasion_filter if Spree::ProductFilters.respond_to?(:occasion_filter)\n #fs << Spree::ProductFilters.holiday_filter if Spree::ProductFilters.respond_to?(:holiday_filter)\n fs << Spree::ProductFilters.selective_occasion_filter(self) if Spree::ProductFilters.respond_to?(:selective_occasion_filter)\n fs << Spree::ProductFilters.selective_holiday_filter(self) if Spree::ProductFilters.respond_to?(:selective_holiday_filter)\n fs\n end",
"def applicable_filters\n fs = []\n fs << Spree::ProductFilters.taxons_below(self)\n ## unless it's a root taxon? left open for demo purposes\n\n fs << Spree::ProductFilters.price_filter if Spree::ProductFilters.respond_to?(:price_filter)\n fs << Spree::ProductFilters.brand_filter if Spree::ProductFilters.respond_to?(:brand_filter)\n #fs << Spree::ProductFilters.occasion_filter if Spree::ProductFilters.respond_to?(:occasion_filter)\n #fs << Spree::ProductFilters.holiday_filter if Spree::ProductFilters.respond_to?(:holiday_filter)\n fs << Spree::ProductFilters.selective_occasion_filter(self) if Spree::ProductFilters.respond_to?(:selective_occasion_filter)\n fs << Spree::ProductFilters.selective_holiday_filter(self) if Spree::ProductFilters.respond_to?(:selective_holiday_filter)\n fs\n end",
"def order_taxons(order)\n taxon_ids = Spree::Classification.where(product_id: order.product_ids).pluck(:taxon_id).uniq\n\n order.store.taxons.where(id: taxon_ids)\n end"
] | [
"0.6339077",
"0.6321726",
"0.6303712",
"0.62579215",
"0.6252233",
"0.6224047",
"0.61949295",
"0.6156388",
"0.6155132",
"0.613356",
"0.611691",
"0.60694623",
"0.6038363",
"0.59926057",
"0.5949335",
"0.5947632",
"0.5922911",
"0.59226996",
"0.59218806",
"0.5885946",
"0.58793813",
"0.5861698",
"0.585403",
"0.58298194",
"0.5816307",
"0.5812524",
"0.58088565",
"0.5796556",
"0.5783626",
"0.5767776",
"0.57658935",
"0.576336",
"0.5749064",
"0.5742947",
"0.57394475",
"0.57155114",
"0.57141715",
"0.5700947",
"0.56986916",
"0.56959146",
"0.5694576",
"0.567971",
"0.56657183",
"0.56636614",
"0.56513155",
"0.56508905",
"0.5632087",
"0.5623541",
"0.56150335",
"0.5611637",
"0.56100166",
"0.5605031",
"0.55934095",
"0.5591908",
"0.5590686",
"0.55855846",
"0.55812824",
"0.55776584",
"0.5575039",
"0.55665493",
"0.55615085",
"0.55577636",
"0.55573225",
"0.5548603",
"0.5545692",
"0.5543024",
"0.5539779",
"0.55394965",
"0.5536022",
"0.55303144",
"0.55291796",
"0.55264294",
"0.5520174",
"0.5514113",
"0.5514113",
"0.5511699",
"0.5510225",
"0.5507673",
"0.54877865",
"0.5480566",
"0.54756534",
"0.5474646",
"0.5474299",
"0.5465169",
"0.5454243",
"0.54253733",
"0.54115623",
"0.54018974",
"0.5395088",
"0.5394597",
"0.5389224",
"0.5383103",
"0.53773373",
"0.53714406",
"0.53626364",
"0.5352874",
"0.53490716",
"0.5346012",
"0.5346012",
"0.53426206"
] | 0.57465607 | 33 |
Calculates corresponding tax total depending on properties and current rates set by tax authority | def apply_taxes(taxman)
@taxes = BigDecimal.new(0)
if @is_imported
@taxes += taxman.apply_tax(@price, taxman.import_duty)
end
unless taxman.exempt_basic.include?(@type)
@taxes += taxman.apply_tax(@price, taxman.sales_tax)
end
@price += @taxes
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tax_total\n self.tax_amount = line_items.inject(0.to_money) {|sum,l| sum + l.tax_amount }\n self.tax_rate # calculates average rate, leave for compatibility reasons\n self.tax_amount\n end",
"def tax_total\n self.tax_amount = line_items.inject(Money.new(0, self.currency || Money.default_currency)) {|sum,l| sum + l.tax_amount }\n self.tax_rate # calculates average rate, leave for compatibility reasons\n self.tax_amount\n end",
"def calc_total\n (@total_after_tax * @gratuity) + @total_after_tax\n end",
"def calculate_tax\n if self.vendor.net_prices\n # this is for the US tax system. At this point, total is still net.\n self.tax_amount = self.total * self.tax / 100.0\n # here, total becomes gross\n self.total += tax_amount\n else\n # this is for the Europe tax system. self.total is already gross, so we don't have to modify it here.\n self.tax_amount = self.total * ( 1 - 1 / ( 1 + self.tax / 100.0 ) )\n end\n end",
"def calculate_tax_for(total)\n if self.vat_rate.present? && self.vat_rate != 0.0\n ((self.vat_rate / 100) * total)\n else\n 0\n end\n end",
"def tax_calc\n tax = @quantity * @price * @taxe\n end",
"def tax_total\n self.tax_amount = line_items.inject(0.to_money) {|sum,l| sum + l.tax_amount }\n self.tax_amount\n end",
"def calculate_total_price_and_taxes\n # find the tax rate\n tax_rate_percent = 0\n\n unless is_exempt_from_regular_tax?\n tax_rate_percent += REGULAR_TAX_PERCENT\n end\n\n unless self.is_exempt_from_import_tax?\n tax_rate_percent += IMPORT_TAX_PERCENT\n end\n\n # np/100\n # total tax needs to be a float rounded to nearest .05\n @total_tax = SalesTaxes::Item.round_properly((self.price * tax_rate_percent)/100)\n\n @total_price = (@price + @total_tax)\n end",
"def tax_rate\n self[:tax_rate] ||= Float(line_items.inject(0) {|sum, l| sum + l.tax_rate}) / line_items.size\n end",
"def calculate current_tax_rate, delivery_price=nil\n delivery = delivery_price.nil? ? (delivery.try(:price) || 0) : delivery_price\n subtotal = (total_price + delivery)\n tax = subtotal * current_tax_rate\n return {\n subtotal: subtotal,\n tax: tax,\n delivery: delivery,\n total: subtotal + tax\n }\n end",
"def total_tax\n line_items.reduce(Money.zero) { |a, e| a + e.total_tax }\n end",
"def taxes\n calculation = BigDecimal.new(\"0\")\n absolutely_priced? ? base_price = sales_price : base_price = gross_price\n calculation = ( (base_price - rebate) / BigDecimal.new(\"100.0\")) * tax_class.percentage\n end",
"def tax\n if defined?(tax_rate)\n calculated = subtotal * tax_rate\n return 0 if calculated < 0\n calculated\n else\n 0\n end\n end",
"def tax_total\n adjustments.where(:originator_type => \"TaxRate\").map(&:amount).sum\n end",
"def tax_total\n self.tax_amount = line_items.inject(::Money.new(0, self.currency || ::Money.default_currency.iso_code)) {|sum,line| sum + line.tax_amount}\n self.tax_amount\n end",
"def calculate_taxes\n\t\ttax = 0\n\t\t\n\t\tif self.sku.contains_merch?\n\t\t\t# because paypal orders will not have billing addresses, just set \n\t\t\t# billing == to shipping if billing_address is nil\n\t\t\tself.billing_address ||= self.shipping_address \n\t\t\t\n\t\t\ttax = (self.sku.price * self.tax_rate * self.sku_quantity).round if self.billing_address.state == self.nexus\n\t\tend\n\t\t\n\t\tself.tax_amount = tax\n\t\t\n\tend",
"def total_tax\n total_cache(:total_tax) || sum_line_items(line_items, :tax_amount)\n end",
"def total_tax\n unit_tax * quantity\n end",
"def calculate\n product.taxes&.map { |tax| tax_portion(tax) }.sum.to_f || 0\n end",
"def calculate_total_for_tax(invoice, tax_rate)\n total_amount = total_tax_amount = 0\n\n components = invoice.\n all_items.\n flatten.\n select { |component| component.tax_rate == tax_rate }\n\n components.each do |component|\n total_amount += component.price\n total_tax_amount += component.calculate_tax\n end\n\n [total_amount, total_tax_amount]\n end",
"def calcuate_tax\n @price * 0.12\n end",
"def set_tax(status, base_total, tax_rate)\n if status == true\n amt = compute_tax(base_total, tax_rate)\n round_tax(amt)\n else\n 0.0\n end\n end",
"def total\n cost_without_tax = get_cost_without_tax\n return cost_without_tax + get_sales_tax(cost_without_tax)\n end",
"def total\n subtotal\n # + tax\n end",
"def sales_tax\n total_tax_percent = 0\n if Tax.sales_tax_applicable?(@item)\n total_tax_percent += Tax.sales_tax_amount\n end\n if Tax.import_duty_applicable?(@item)\n total_tax_percent += Tax.import_tax_amount\n end\n total_tax_percent.round(2)\n end",
"def tax_amount\n self[:tax_amount] || (application_fee * tax_rate / 100)\n end",
"def tax\n self.delivery_tax_amount +\n order_items.inject(BigDecimal(0)) { |t, i| t + i.tax_amount }\n end",
"def tax_amount\n self.quantity * single_item_tax\n end",
"def gross_total_base\n net_total_base + tax_total_base\n end",
"def tax\n order.delivery_tax_amount +\n order_items.inject(BigDecimal(0)) { |t, i| t + i.tax_amount }\n end",
"def amount\n estimate_total = self.estimate_line_items.sum(:amount)\n if self.tax_inclusive? \n tax_total = 0 \n else\n tax_total = 0 \n tax_line_items.each do |line_item|\n tax_account = line_item.account\n next if (tax_account.accountable_type=='DutiesAndTaxesAccounts' && tax_account.accountable.calculation_method==4 && tax_account.accountable.split_tax == 0) \n tax_total += line_item.amount\n end\n end\n ship_charge = self.shipping_line_items.sum(:amount)\n estimate_total + tax_total + ship_charge\n end",
"def tax_rate\n write_attribute( :tax_rate, Float(line_items.inject(0) {|sum, l| sum + l.tax_rate}) / line_items.size)\n end",
"def total_price(tax_rate)\n ((1 + tax_percentage(tax_rate)) * price)\n end",
"def tax_rate\n Store.settings.tax_rate/100\n end",
"def compute(order)\n rate = self.calculable\n tax = 0\n\n if rate.tax_category.is_default\n order.adjustments.each do | adjust |\n next if adjust.originator_type == \"TaxRate\"\n next if adjust.originator_type == \"ShippingMethod\" and not Spree::Config[:shipment_inc_vat]\n\n tax += (adjust.amount * rate.amount).round(2, BigDecimal::ROUND_HALF_UP)\n end\n end\n\n order.line_items.each do | line_item|\n if line_item.product.tax_category #only apply this calculator to products assigned this rates category\n next unless line_item.product.tax_category == rate.tax_category\n else\n next unless rate.tax_category.is_default # and apply to products with no category, if this is the default rate\n end\n tax += (line_item.price * rate.amount).round(2, BigDecimal::ROUND_HALF_UP) * line_item.quantity\n end\n\n tax\n end",
"def total_amount_inc_tax\n unit_amount_inc_tax * quantity\n end",
"def total_before_tax\n self.delivery_price + self.items_sub_total\n end",
"def calc_tax_rate(item)\n tax_rate = 0\n tax_rate += @@import_duty if item.imported\n tax_rate += @@sales_tax unless (item.is_a? Book) || (item.is_a? Food) || (item.is_a? Medicine)\n \n return tax_rate\n end",
"def compute_tax(item_price, tax_rate)\n item_price * tax_rate\n end",
"def tax\n rate = 0.09\n tax_amount = (price.to_f * rate)\n return tax_amount\n end",
"def tax_total\n send(:tax_amount) if respond_to?(:tax_amount)\n end",
"def calc_spec_tax(_amount)\n _amountret = _amount.to_f * @_taxpr\n return _amountret\n end",
"def calculate_totals\n subtotal_collector = 0\n active_contracts.each do |active_contract|\n subtotal_collector += active_contract.subtotal\n end\n\n self.subtotal = subtotal_collector\n self.tax = subtotal * 0.09\n self.total = subtotal + tax\n save\n end",
"def total_before_tax\n order.delivery_price + items_sub_total\n end",
"def tax\n 0.0\n end",
"def tax_rate\n self[:tax_rate] || TAX_RATE || product.try(:tax_rate).try(:rate_for, order) || BigDecimal(0)\n end",
"def total\n # extracts all of the values from the hash and sums them up\n cost = @products.values.sum\n # add 7.5% tax and round to two decimal places\n return (cost * 1.075).round(2)\n end",
"def line_item_sales_tax_total\n\n ((pre_tax_total * 20).ceil.to_f / 20.0).round(2)\n end",
"def tax_rate\n self[:tax_rate] || 19.0\n end",
"def compute(order)\n rate = self.calculable\n tax = 0\n return 0 unless order.ship_address.nil? || order.ship_address.country.nil? || rate.zone.country_list.include?(order.ship_address.country)\n\n if rate.tax_category.is_default and !Spree::Config[ :show_price_inc_vat]\n order.adjustments.each do | adjust |\n next if adjust.originator_type == \"TaxRate\"\n add = adjust.amount * rate.amount\n puts \"Applying default rate to adjustment #{adjust.label} (#{adjust.originator_type} ), sum = #{add}\"\n tax += add\n end\n end\n order.line_items.each do | line_item|\n # do not apply tax_rate if product has no tax_category\n next unless line_item.product.tax_category_id?\n next unless line_item.product.tax_category == rate.tax_category\n next unless line_item.product.tax_category.tax_rates.include? rate\n tax += BigDecimal((line_item.price * rate.amount).to_s).round(2, BigDecimal::ROUND_HALF_UP) * line_item.quantity\n end\n tax\n end",
"def calculate\n @item_list.each { |item|\n tax_rate = (item.exempt? ? 0.00 : Constants::NON_IMPORT_TAX_RATE) + (item.imported? ? Constants::IMPORT_TAX_RATE : 0.00)\n total_before_tax = item.qty * item.price\n tax = (total_before_tax * tax_rate).round_to_05\n\n @receipt_tax += tax\n @receipt_total += item.total = total_before_tax + tax\n }\n\n # do final rounding - needed due to Float quirks\n @receipt_tax = @receipt_tax.round(2)\n @receipt_total = @receipt_total.round(2)\n return self\n end",
"def grand_total_sans_tax\n (subtotal_sans_tax || 0.to_money) + adjustments_sans_tax\n end",
"def tax\n\t\t@value * 0.16\n\tend",
"def total_with_tax\n total = 0\n @cart_items.each do |item|\n total += item.total_price\n end\n return total\n end",
"def add_taxes(amt, good_tax, import_tax)\n amt += good_tax + import_tax\n amt.round(2)\n end",
"def sales_tax\n return (@listOfItem.inject(0){|sum,e| sum += \n e.product != nil ? e.product.sales_tax + e.product.import_tax : 0 }).round_to(2)\n end",
"def apply_tax(amount, options = {})\n opts = {}.merge(options)\n amount = amount.to_d\n if self.compound_tax.to_i == 1\n if opts[:precision]\n amount += format(\"%.#{opts[:precision].to_i}f\", (amount* tax1_value/100.0)).to_d if tax1_enabled.to_i == 1\n amount += format(\"%.#{opts[:precision].to_i}f\", (amount* tax2_value/100.0)).to_d if tax2_enabled.to_i == 1\n amount += format(\"%.#{opts[:precision].to_i}f\", (amount* tax3_value/100.0)).to_d if tax3_enabled.to_i == 1\n amount += format(\"%.#{opts[:precision].to_i}f\", (amount* tax4_value/100.0)).to_d if tax4_enabled.to_i == 1\n else\n amount += (amount* tax1_value/100.0) if tax1_enabled.to_i == 1\n amount += (amount* tax2_value/100.0) if tax2_enabled.to_i == 1\n amount += (amount* tax3_value/100.0) if tax3_enabled.to_i == 1\n amount += (amount* tax4_value/100.0) if tax4_enabled.to_i == 1\n end\n else\n tax = 0\n if opts[:precision]\n tax += format(\"%.#{opts[:precision].to_i}f\", (amount* tax1_value/100.0)).to_d if tax1_enabled.to_i == 1\n tax += format(\"%.#{opts[:precision].to_i}f\", (amount* tax2_value/100.0)).to_d if tax2_enabled.to_i == 1\n tax += format(\"%.#{opts[:precision].to_i}f\", (amount* tax3_value/100.0)).to_d if tax3_enabled.to_i == 1\n tax += format(\"%.#{opts[:precision].to_i}f\", (amount* tax4_value/100.0)).to_d if tax4_enabled.to_i == 1\n else\n tax += (amount* tax1_value/100.0) if tax1_enabled.to_i == 1\n tax += (amount* tax2_value/100.0) if tax2_enabled.to_i == 1\n tax += (amount* tax3_value/100.0) if tax3_enabled.to_i == 1\n tax += (amount* tax4_value/100.0) if tax4_enabled.to_i == 1\n end\n amount += tax\n end\n amount\n end",
"def total\n subtotal + tax + shipping\n end",
"def calculate_totals\n subtotal = 0\n\n carted_products.each do |carted_product|\n subtotal += carted_product.subtotal\n end\n\n tax = subtotal * 0.09\n total = subtotal + tax\n update(subtotal: subtotal, tax: tax, total: total)\n end",
"def taxes_amounts\n total_prices_te_by_taxes_rates.map do |taxes_rate, price_without_taxes|\n tax_amount = price_without_taxes.to_f * (taxes_rate / 100)\n\n {formatted_taxes_rate(taxes_rate) => formatted_price(tax_amount)}\n end.reduce({}, :merge)\n end",
"def calc_all_tax(items)\n items_tax = items.collect { |item| calc_tax(item) }\n end",
"def unit_amount_inc_tax\n unit_amount + unit_tax\n end",
"def tax_reduction\n if has_rebate?\n previous_taxes = taxes\n previous_gross_price = gross_price + rebate\n rebate_in_percent_of_gross = (BigDecimal.new(\"100.0\") / previous_gross_price) * rebate\n tax_reduction = (previous_taxes / BigDecimal.new(\"100.0\")) * rebate_in_percent_of_gross\n else\n tax_reduction = BigDecimal.new(\"0.0\")\n end\n return tax_reduction\n end",
"def final_bill\n total + tax + @tip_amount\n end",
"def tax_profile_amount\n return self.tax_profile.value\n end",
"def apply_tax(amount, options = {})\n opts = {}.merge(options)\n amount = amount.to_d\n if self.compound_tax.to_i == 1\n if opts[:precision]\n amount += format(\"%.#{opts[:precision].to_i}f\", (amount* tax1_value/100.0)).to_d if tax1_enabled.to_i == 1\n amount += format(\"%.#{opts[:precision].to_i}f\", (amount* tax2_value/100.0)).to_d if tax2_enabled.to_i == 1\n amount += format(\"%.#{opts[:precision].to_i}f\", (amount* tax3_value/100.0)).to_d if tax3_enabled.to_i == 1\n amount += format(\"%.#{opts[:precision].to_i}f\", (amount* tax4_value/100.0)).to_d if tax4_enabled.to_i == 1\n else\n amount += (amount* tax1_value/100.0) if tax1_enabled.to_i == 1\n amount += (amount* tax2_value/100.0) if tax2_enabled.to_i == 1\n amount += (amount* tax3_value/100.0) if tax3_enabled.to_i == 1\n amount += (amount* tax4_value/100.0) if tax4_enabled.to_i == 1\n end\n else\n tax = 0\n if opts[:precision]\n tax += format(\"%.#{opts[:precision].to_i}f\", (amount* tax1_value/100.0)).to_d if tax1_enabled.to_i == 1\n tax += format(\"%.#{opts[:precision].to_i}f\", (amount* tax2_value/100.0)).to_d if tax2_enabled.to_i == 1\n tax += format(\"%.#{opts[:precision].to_i}f\", (amount* tax3_value/100.0)).to_d if tax3_enabled.to_i == 1\n tax += format(\"%.#{opts[:precision].to_i}f\", (amount* tax4_value/100.0)).to_d if tax4_enabled.to_i == 1\n else\n tax += (amount* tax1_value/100.0) if tax1_enabled.to_i == 1\n tax += (amount* tax2_value/100.0) if tax2_enabled.to_i == 1\n tax += (amount* tax3_value/100.0) if tax3_enabled.to_i == 1\n tax += (amount* tax4_value/100.0) if tax4_enabled.to_i == 1\n end\n amount += tax\n end\n amount\n end",
"def gross_total\n self.gross_amount = self.net_total + self.tax_total\n end",
"def tax_sum(tax, tax_percent)\n (tax - (tax / (1 + tax_percent))).round(2)\n end",
"def delivery_tax_amount\n read_attribute(:delivery_tax_amount) ||\n delivery_price / BigDecimal(100) * delivery_tax_rate\n end",
"def calculate cart, current_tax_rate\n net_amount = cart.total_price + (delivery.try(:price) || 0)\n tax_amount = net_amount * current_tax_rate\n self.attributes = { cart_id: cart.id, net_amount: net_amount, tax_amount: tax_amount, gross_amount: net_amount + tax_amount }\n self.save(validate: false)\n \tend",
"def count_tax_amount(amount, options = {})\n opts = {}.merge(options)\n amount = amount.to_d\n tax = amount\n if self.compound_tax.to_i == 1\n if opts[:precision]\n tax += format(\"%.#{opts[:precision].to_i}f\", (tax* tax1_value/100.0)).to_d if tax1_enabled.to_i == 1\n tax += format(\"%.#{opts[:precision].to_i}f\", (tax* tax2_value/100.0)).to_d if tax2_enabled.to_i == 1\n tax += format(\"%.#{opts[:precision].to_i}f\", (tax* tax3_value/100.0)).to_d if tax3_enabled.to_i == 1\n tax += format(\"%.#{opts[:precision].to_i}f\", (tax* tax4_value/100.0)).to_d if tax4_enabled.to_i == 1\n else\n tax += (tax* tax1_value/100.0) if tax1_enabled.to_i == 1\n tax += (tax* tax2_value/100.0) if tax2_enabled.to_i == 1\n tax += (tax* tax3_value/100.0) if tax3_enabled.to_i == 1\n tax += (tax* tax4_value/100.0) if tax4_enabled.to_i == 1\n end\n return tax - amount\n else\n if opts[:precision]\n tax = format(\"%.#{opts[:precision].to_i}f\", (amount* tax1_value/100.0)).to_d\n tax += format(\"%.#{opts[:precision].to_i}f\", (amount* tax2_value/100.0)).to_d if tax2_enabled.to_i == 1\n tax += format(\"%.#{opts[:precision].to_i}f\", (amount* tax3_value/100.0)).to_d if tax3_enabled.to_i == 1\n tax += format(\"%.#{opts[:precision].to_i}f\", (amount* tax4_value/100.0)).to_d if tax4_enabled.to_i == 1\n else\n tax = amount* tax1_value/100.0\n tax += (amount* tax2_value/100.0) if tax2_enabled.to_i == 1\n tax += (amount* tax3_value/100.0) if tax3_enabled.to_i == 1\n tax += (amount* tax4_value/100.0) if tax4_enabled.to_i == 1\n end\n return tax\n end\n\n end",
"def calcTaxes price\r\n taxrate = 0.95\r\n return taxrate * price\r\nend",
"def calculate_sales_tax\n @sales_tax = 0\n @sales_tax = (price * 0.1) unless %i[book food medical].include?(category)\n end",
"def calculate_total_2(info) # info is a hash with expected arguments\n taxAmt = info[:price] * info[:tax]\n tipAmt = info[:price] * info[:tip]\n info[:price] + tipAmt + taxAmt\nend",
"def recalculate_totals\n # Line's total prices (qty * amount)\n single_untaxed_price_after_rebate = BigDecimal.new( (self.single_untaxed_price - self.single_rebate).to_s )\n self.gross_price = BigDecimal.new( (self.quantity * single_untaxed_price_after_rebate).to_s )\n self.gross_price = self.gross_price\n self.taxes = (self.gross_price / BigDecimal.new(\"100.0\")) * self.tax_percentage\n self.taxed_price = (BigDecimal.new( (self.gross_price + self.taxes).to_s )).rounded # Rounded like in document_line.rb\n\n # Line's single prices (for qty 1 * amount)\n single_taxes = ((single_untaxed_price_after_rebate / BigDecimal.new(\"100.0\")) * self.tax_percentage) # like in product.rb\n self.single_price = (single_untaxed_price_after_rebate + single_taxes).rounded # Like in document_line.rb\n\n end",
"def unit_tax\n tax = Money.new(0)\n tax_classes.each do |tax_class|\n class_tax = @rounding_strategy.round(tax_class.rate * unit_amount)\n tax += class_tax\n end\n tax\n end",
"def total_price\n (@base_price * @tax_rate + @base_price) * @quantity\n end",
"def tax25_sum\n tax_sum(tax25, 0.25)\n end",
"def tax_money_owed\n if update_taxable <= 43953 && update_taxable >= 0\n update_taxable * 0.15\n elsif update_taxable >= 43954 && update_taxable <=87907\n (43953*0.15) + ((update_taxable-43953) * 0.22)\n elsif update_taxable >= 87908 && update_taxable <=136270\n (43953*0.15)+ (48363*0.22) + (update_taxable * 0.26)\n elsif update_taxable >= 136270\n (43953*0.15)+ (48363*0.22)+ (43954*0.26) + (update_taxable * 0.29)\n else\n update_taxable \n end\n end",
"def calc_t1(price, tip, tax)\n tax_amount = price * tax\n tip_amount = price * tip\n price + tip_amount + tax_amount\nend",
"def total\n total_cost = 0\n \n # Summing up the product cost\n @products.each do |item, cost|\n total_cost += cost\n end\n \n # Calculate a 7.5% tax\n total_order_cost = total_cost * 1.075\n \n # Rounding the result to two decimal places\n return total_order_cost.round(2)\n end",
"def gross_total\n self.gross_amount = self.net_total + self.tax_total\n end",
"def total\n total_cache(:total) || (sub_total + total_tax)\n end",
"def sum_of_tax_rates line_item\n line_item.adjustments.tax.\n joins(\"INNER JOIN spree_tax_rates ON spree_tax_rates.id = spree_adjustments.source_id\").\n where(spree_tax_rates: { included_in_price: true }).\n map(&:source).\n sum(&:amount)\n end",
"def calculate\n=begin\n self.net_amount = nil\n self.tax_amount = nil\n self.gross_amount = nil\n=end\n self.total\n end",
"def get_total(item_name)\n return (@item_hash[item_name].to_f + @tax_hash[item_name].to_f).round(2)\n end",
"def total_taxes\n @total_taxes = 0\n @list.each do |item, quantity|\n @total_taxes += quantity * item.taxes\n end\n puts \"Sales Taxes: #{MONEY_FORMAT % @total_taxes}\"\n end",
"def calculate(items)\n\n\t\titems.each do |item|\n\t\t\ttax_rate = get_tax_rate(item)\n\t\t\ttax = get_tax(item[:price], item[:quantity], tax_rate)\n\t\t\t@total_tax += tax\n\n\t\t\titem[:sales_price] = (item[:price] * item[:quantity] + tax).round(2)\n\t\t\t@total_price += item[:sales_price]\n\t\tend\n\n\t\treturn @total_tax, @total_price\n\tend",
"def gst_tax_rate\n if !self.tax_accounts.blank?\n self.tax_accounts.first.accountable.tax_rate\n end\n end",
"def tax\n price.to_f * 0.09\n end",
"def calculate_price\n result = 0.0\n @items.each do |item|\n name = item.name\n price = item.price\n final_taxed_price = price # Begin with price and add tax as necessary\n tax = 0.0\n\n # Is the item subject to sales tax (ie. not exempt)?\n if !is_exempt(name)\n # Not exempt, apply sales tax\n tax += price * @@sales_tax\n else\n # Exempt, don't apply sales tax\n end\n\n # Is the item subject to import tax (ie. is it imported)?\n if is_imported(name)\n # Is imported, apply import sales tax\n tax += price * @@imported_goods_sales_tax\n else\n # Is not imported, don't apply import sales tax\n end\n\n final_taxed_price += round_point05(tax)\n\n puts final_taxed_price\n\n result += final_taxed_price # Add the final price to the running total\n end\n result\n end",
"def get_medicare_tax(income)\n tax_rate = 0.124\n if status = \"married\" && income > 250000\n tax_rate += 0.009\n elsif status = (\"single\" || \"head_of_household\") && income > 200000\n tax_rate += 0.009\n end\n if income >= 127200\n return tax_rate * 127200\n else\n return tax_rate * income\n end\n end",
"def recalc_price(subscription_config)\n total_tax = subscription_config.all_taxes[self.taxes_id][\"taxes\"].inject(0){|sum,item| sum + item[\"rate\"]} # sum all applicable taxes\n self.net_amount = self.quantity * subscription_config.all_tariff_plans[self.tariff_plan_id][\"price\"]\n self.taxes_amount = self.net_amount * total_tax\n end",
"def get_tax_rate(item)\n\t\ttax_rate = 0.0\n\t\ttax_rate = @goods_tax_rate unless item[:exempt]\n\t\ttax_rate = tax_rate + @imported_tax_rate if item[:import]\n\t\treturn tax_rate\n\tend",
"def total_before_tax\n total = 0\n @cart_items.each do |item|\n total += item.price\n end\n return total\n end",
"def tax\n price_as_price.tax\n end",
"def calculate_total_2(info)\n tip_amt = info[:price] * info[:tip]\n tax_amt = info[:price] * info[:tax]\n info[:price] + tip_amt + tax_amt\nend",
"def billing_amount\n self.net_amount + self.taxes_amount\n end",
"def billing_amount\n self.net_amount + self.taxes_amount\n end",
"def gross_total\n self.gross_amount ||= self.net_total + self.tax_total\n end"
] | [
"0.7897647",
"0.7840126",
"0.7765914",
"0.77385294",
"0.7629178",
"0.76075035",
"0.7587397",
"0.75153357",
"0.74809885",
"0.743706",
"0.7417386",
"0.74173814",
"0.73976254",
"0.73828447",
"0.7366826",
"0.73634917",
"0.7355434",
"0.73467314",
"0.73312217",
"0.73048484",
"0.72854227",
"0.7235063",
"0.7190846",
"0.7153166",
"0.7119347",
"0.7109858",
"0.71004164",
"0.7057713",
"0.70501876",
"0.7045169",
"0.7043157",
"0.703893",
"0.7029393",
"0.7019476",
"0.7015379",
"0.70145935",
"0.701284",
"0.7003671",
"0.69960433",
"0.69603455",
"0.69588625",
"0.69584",
"0.6935721",
"0.69320637",
"0.6909966",
"0.6906768",
"0.68989223",
"0.6891893",
"0.68832463",
"0.68808454",
"0.68794453",
"0.687261",
"0.68683815",
"0.6864829",
"0.684247",
"0.6815504",
"0.6806341",
"0.6787513",
"0.67807937",
"0.67708695",
"0.67666537",
"0.6750144",
"0.6749355",
"0.67455643",
"0.6740726",
"0.67336154",
"0.6732694",
"0.6732133",
"0.67299306",
"0.672177",
"0.6717254",
"0.67081964",
"0.66909623",
"0.6688943",
"0.66761696",
"0.667538",
"0.66744286",
"0.6656391",
"0.66509897",
"0.6646704",
"0.6640315",
"0.6635976",
"0.6631477",
"0.6629881",
"0.6621151",
"0.66142786",
"0.6608306",
"0.6606666",
"0.6603546",
"0.6597121",
"0.6591268",
"0.65889454",
"0.6572476",
"0.65628296",
"0.65583247",
"0.6554154",
"0.6552446",
"0.65509516",
"0.65509516",
"0.6529966"
] | 0.6993848 | 39 |
Full description of the item's state, with price including taxes | def to_s
"#{@name} at #{MONEY_FORMAT % @price}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state_description(item)\n s = state_value(item) or return\n state_table.dig(s, :note) || s.to_s.humanize(capitalize: false)\n end",
"def description\n @state.description\n end",
"def state_description(item = nil)\n super(item || self[state_column])\n end",
"def description\n pricing_db_hp_short_description.description\n end",
"def state_rate\n rate = @tax_rates.state_rate\n rate_item = RateItem.new\n rate_item.zip = '*'\n rate_item.state = 'NE'\n rate_item.rate = rate.general_tax_rate_intrastate\n rate_item\n end",
"def describe_price\r\n\t\ta = []\r\n\t\ta << sprintf('$%.2f per item', per_item) unless per_item.zero?\r\n\t\ta << sprintf('$%.2f per kg', per_kg) unless per_kg.zero?\r\n\t\ta << sprintf('$%.2f', flat_rate) unless flat_rate.zero?\r\n\t\tif formula and !formula.empty?\r\n\t\t\tif formula_description and !formula_description.empty?\r\n\t\t\t\ta << formula_description\r\n\t\t\telse\r\n\t\t\t\ta << formula.gsub('I', \"'number of items'\").gsub('W', \"'total weight'\").gsub('V', \"'total value'\")\r\n\t\t\tend\r\n\t\tend\r\n\r\n\t\ta.empty? ? ((name == '[ to be advised ]') ? nil : 'no charge') : a.join(' + ')\r\n\tend",
"def details\r\n return @description + \"; \" + @firm + \": \" + \"#{@cost}\"\r\n end",
"def describe\n physical_quantity or get_description\n end",
"def details\n return @description + \" Extra cost: \" + \"#{@extra_cost}\" + \". \" + @basic_booking.details\n end",
"def details\n return \"#{@description} : #{@extra_cost}, #{@basic_booking.details}\"\n end",
"def show_state\n return \"#{@name} a #{life_points} points de vie et une amre de niveau #{weapon_level}\"\n end",
"def details\n return @description + \" extra cost: \" + \"#{@extra_cost}\" + \". \" + @basic_booking.details\n end",
"def line_description\n \"#{@quantity} #{@item}: #{format_as_currency(line_total)}\"\n end",
"def details\n return @description + \"; \" + @firm + \"; \" + @age + \": \" + \"#{@cost}\"\n end",
"def details\n return @description + \"; \" + @manufacturer + \"; \" + @color + \": \" + \"#{@cost}\"\n end",
"def descriptions\n return @detail + \"; \" + @firm + \"; \" + @age + \": \" + \"#{@cost}\"\n end",
"def description\n @beverage.description + \", Milk\"\n end",
"def description\n super + \", Milk\"\n end",
"def show\n \"$#{total} #{@state[0]} #{@state[1]} #{@state[2]} #{@state[3]} #{@state[4]}\"\n end",
"def getDescriptionOfState ( state )\n case state \n when CHECKBOX_CHECKED\n s = \" Checked \"\n when CHECKBOX_UNCHECKED\n s = \" Unchecked \"\n when CHECKBOX_TOGGLE\n s = \" Toggle \"\n else\n s = \" Unknown Checkbox State!! \"\n end\n return s \n end",
"def product_price_details\n {:currency => 'EUR', :price => price}\n end",
"def display_description\n @name.capitalize + \" stands here\" + ((item_for :weapon) ? (\", wielding \" + item_for(:weapon).short_display_string) : \"\") + \".\"\n end",
"def description\n @beverage.description + \", Soy\"\n end",
"def descriptions\n \n return @detail + \": \" + \"#{@extra_cost}\" + \". \" + @basic_transfer.descriptions\n end",
"def item_details\n font \"Helvetica\"\n fill_color \"555555\"\n text \"Item Details\", align: :center, size: 10, style: :bold\n fill_color \"000000\"\n table([\n [\"Status\", @status[@item.status]],\n [\"Condition\", @conditions[@item.condition]],\n [\"Date Purchased\", @item.date_received.try(:strftime,\"%d %b %Y\")],\n [\"Price\", @item.price],\n [\"Asset ID\", @item.asset_id],\n [\"Serial Number\", @item.serial_number],\n [\"Contract Expiration\", @item.contract_expire.try(:strftime,\"%d %b %Y\")],\n [\"Warranty Expiration\", @item.warranty_expire.try(:strftime,\"%d %b %Y\")],\n [\"Warranty Notes\", @item.warranty_notes],\n [\"Misc. Notes\", @item.notes]\n ], :position => :center,\n :column_widths => [150, 380],\n :cell_style => {:font => \"Helvetica\", :size => 10}\n )\n end",
"def item_description\n \"Donation: #{account_code.name_or_code}\"\n end",
"def quantity_description\n data[:quantity_description]\n end",
"def describe_state(state)\n $states[state.to_sym].last.join(' ,')\nend",
"def details\n return @description + \": \" + \"#{@extra_cost}\" + \". \" + @basic_drug.details\n end",
"def product_description\n data.product_description\n end",
"def description\n purchase.store.present? ? \"Bought from #{purchase.store.name}\" : ''\n end",
"def description\n @beverage.description + \", Whip\"\n end",
"def descriptive_text\n description.blank? && taxon ? taxon.descriptive_text : description\n end",
"def details\n return @description + \": \" + \"#{@extra_cost}\" + \". \" + @basic_inst.details\n end",
"def info\n return \"#{self.name} $#{self.price}\"\n end",
"def description\n description = super\n if description.blank?\n if quantity.blank? || measure.blank?\n description\n else\n measure = self.measure.dup\n if quantity == '1'\n measure.slice!(measure.index('(')..-1)\n else\n measure.gsub!(/[()]/, '')\n end\n \"#{quantity} #{measure} #{variety}\".strip\n end\n else\n description\n end\n end",
"def show_state\n return \"#{@name} a #{@life_points} points de vie\"\n end",
"def description\n @beverage.description\n end",
"def details\n return @description + \": \" + \"#{@extra_cost}\" + \". \" + @basic_tran.details\n end",
"def inspect\n \"#{'%.2f' % self.amount} #{self.currency}\"\n end",
"def description\n return summary\n end",
"def show_state\n\t\tputs \"#{@name} a #{life_points} de points de vie et une arme de niveau #{weapon_level}\"\n\tend",
"def summary(include_item_specifics = false)\n string = []\n string << title.ljust(80)\n string << \"[#{status.to_s}]\".capitalize.rjust(15)\n\n if has_variations?\n string << \"\\n #{variations.count} Variations:\"\n variations.each do |variation|\n string << \"\\n #{variation[:sku]}: \"\n string << \"#{variation[:quantity_available].to_s.rjust(3)} @ #{(variation[:current_price].symbol + variation[:current_price].to_s).rjust(6)}\"\n string << \" #{variation[:quantity_listed].to_s.rjust(2)} listed, #{variation[:quantity_sold].to_s.rjust(2)} sold\"\n end\n else\n string << \"\\n \"\n string << \"#{quantity_available.to_s} @ \"\n string << \"#{current_price.symbol}#{current_price.to_s}\"\n if best_offer? # Cannot have best offer on variations\n string << ' with Best Offer'\n string << \" #{best_offer_auto_accept_price.symbol}#{best_offer_auto_accept_price}\" if best_offer_auto_accept_price\n string << \" | #{best_offer_minimum_accept_price.symbol}#{best_offer_minimum_accept_price}\" if best_offer_minimum_accept_price\n end\n end\n\n if promotional_sale?\n details = promotional_sale\n starts = details[:start_time]\n ends = details[:end_time]\n original_price = promotional_sale[:original_price]\n string << \"\\n \"\n string << 'ON SALE NOW!' if on_sale_now?\n string << 'was on sale' if Time.now.utc > ends\n string << 'sale scheduled' if Time.now.utc < starts\n string << \" original price #{original_price.symbol}#{original_price.to_s}\"\n string << \" #{starts.strftime('%H:%M %A')}\"\n string << \" until #{ends.strftime('%H:%M %A')}\"\n end\n string << \"\\n\"\n\n string << \"#{quantity_sold.to_s.rjust(4)} sold\"\n if quantity_sold > 0 && status == :completed\n days = (end_time - start_time).round.to_i\n if days > 1\n string << \" in #{days} days\"\n else\n hours = ((end_time.to_time - start_time.to_time) / 1.hour).round\n string << \" in #{hours} hours\"\n end\n end\n\n string << \", #{watch_count} watchers, #{hit_count} page views.\"\n string << \"\\n\"\n\n string << \" SKU: #{sku} Photos: #{photo_urls.count} eBay ID: \"\n string << \"#{relist_parent_id} <= \" unless relist_parent_id.nil?\n string << \"#{ebay_item_id}\"\n string << \" => #{relist_child_id}\" unless relist_child_id.nil?\n\n string << \"\\n \"\n if gtc?\n date_time = (Time.now.utc < end_time) ? Time.now.utc : end_time\n days = (date_time - start_time).round.to_i\n if days > 1\n string << \"GTC [#{days} days]\"\n else\n hours = ((date_time.to_time - start_time.to_time) / 1.hour).round\n string << \"GTC [#{hours} hours]\"\n end\n\n else\n string << \"#{duration} Day\"\n end\n string << \" #{category_1_path.join(' -> ')}\"\n\n string << \"\\n \"\n string << \"#{start_time.strftime('%l:%H%P %A %-d %b').strip} until #{end_time.strftime('%l:%H%P %A %-d %b').strip}\"\n\n if include_item_specifics\n item_specifics.each_pair do |key, value|\n string << \"\\n#{key.rjust(30)} : #{value}\"\n end\n end\n\n string.join\n end",
"def details\n return @description + \": \" +\n @duration.to_s + \" hour for \" +\n @cost.to_s + \" euros.\"\n end",
"def show_state\n puts \"#{@name} a #{@life_points} points de vie et une arme de niveau #{@weapon_level}\"\n end",
"def show_state\n\t\treturn \"#{self.name} a #{self.life_points} points de vie.\"\n\tend",
"def show_state\r\n puts \"#{@name} à #{@life_points} points de vie et une arme de niveau #{@weapon_level}\"\r\n end",
"def description\n \"#{sku.product.name} (#{sku.short_desc})\"\n end",
"def details\n return @description + \": \" + \"#{@extra_cost}\" + \". \" + @basic_prescription.details\n end",
"def show_state\n\t\tputs \"#{self.name} a #{self.life_points} points de vie et une arme de niveau #{self.weapon_level}.\"\n\tend",
"def show_state \n puts \"#{@name} a #{@life_points} points de vie et une arme au niveau #{@weapon_level}.\"\n end",
"def description()\n Receipt.get_default_receipt_description( self )\n end",
"def price_name_and_description\n desc = ' ('+ description + ')' unless description.blank?\n \"#{name}#{desc}\"\n end",
"def long_desc\n return @inv.item_list\n end",
"def details\r\n return @description + \": \" + \"#{@extra_cost}\" + \". \" + @basic_shifted.details\r\n end",
"def details\n return @description + \": \" + \"#{@extra_cost}\" + \". \" + @basic_cycle.details\n end",
"def display_price\n price = if respond_to?(:display_amount)\n display_amount\n else\n display_base_price\n end.to_s\n\n return price if Spree::Avatax::Config.tax_calculation\n return price if taxes.empty? || amount == 0\n\n tax_explanations = taxes.map(&:label).join(tax_label_separator)\n\n Spree.t :display_price_with_explanations,\n scope: 'shipping_rate.display_price',\n price: price,\n explanations: tax_explanations\n end",
"def state_short(s, opts={tag: 'li'})\n if s\n \"<#{opts[:tag]} class=\\\"state #{s.state}\\\" style=\\\"opacity: #{age_fraction s.time}\\\" title=\\\"#{h s.description}\\\">#{h s.host} #{h s.service}</#{opts[:tag]}>\"\n else\n \"<#{opts[:tag]} class=\\\"service\\\"></#{opts[:tag]}>\"\n end\n end",
"def long_desc\n return @name << \", \" << @desc << \", has the following inventory: \" << @inv.item_list\n end",
"def product_description\n return product_presentation.description if product_presentation\n return \"\"\n end",
"def display_price\n price = if respond_to?(:display_amount)\n display_amount\n else\n display_base_price\n end.to_s\n\n return price if ::Spree::Avatax::Config.tax_calculation\n return price if taxes.empty? || amount == 0\n\n tax_explanations = taxes.map(&:label).join(tax_label_separator)\n\n I18n.t :display_price_with_explanations,\n scope: 'spree.shipping_rate.display_price',\n price: price,\n explanations: tax_explanations\n end",
"def description\n name + ': ' + resource_type.to_s + ' | Sueldo: ' + salary.to_s +\n ' | Experiencia: ' + experience.to_s + ' años'\n end",
"def show_state\n puts \"#{@names} a #{@life_points} points de vie et une arme de niveau #{@weapon_level}\"\n end",
"def show_state\n puts \"#{self.name} a #{self.life_points} points de vie et son arme est de niveau #{self.weapon_level}.\"\n end",
"def to_s\n item_text = \"=== Your Receipt ===#{Constants::CR_LF}\"\n @item_list.each { |item| item_text += item.to_s }\n item_text += \"Sales taxes: #{(\"%.02f\" % @receipt_tax).to_s}#{Constants::CR_LF}\"\n item_text += \"Total: #{(\"%.02f\" % @receipt_total).to_s}\"\n end",
"def description\n fetch('restaurant.description')\n end",
"def product_selling_price_after_tax\n product_markup_price * (1 - county.tax_factor) \n end",
"def description_bonita\n \t\"#{description} #{product.name}\"\n end",
"def state\n object.human_state_name\n end",
"def description\n @attributes[:description]\n end",
"def sales_price\n Dowstore.priceMarkup(commodity.price,0,2)\n end",
"def state_abbr; end",
"def preview_order_items\n [\n {title: 'Item One', quantity: 2, price: 999, tax_exempt: false},\n {title: 'Item Two', quantity: 1, price: 25000, tax_exempt: false},\n {title: 'Item Three', quantity: 1, price: 8999, tax_exempt: false},\n {title: 'Item Four', quantity: 1, price: 100000, tax_exempt: false}\n ]\n end",
"def price_display\n lookup = {\n 'cheap' => '$',\n 'affordable' => '$$',\n 'pricey' => '$$$',\n 'expensive' => '$$$$'\n }\n lookup[price] # return the dollar signs corresponding to this price enum value\n end",
"def mark_up()\n return @retail_price-@buying_cost\n end",
"def show_state\n puts \"#{@name} a #{@life_points} de PV\"\n end",
"def get_state\n \"Treasury state: #{@resources}\"\n end",
"def brief_description\n call_proc_or_return_value(self::BRIEF_DESCRIPTION)\n end",
"def description\n return $BlizzABS.util.add_item_text(@description, @id, 2)\n end",
"def state_text\n EasyLoan::LoanBill::STATE_TEXT.fetch(bill_state.to_sym, \"无状态\")\n end",
"def details\n return @description + \"; is set to: \" + \"#{@duration}\" + \"hour - at a cost of: \" + \"#{@cost}\"\n end",
"def base_description(_); end",
"def to_pretty_s\n \"#{type}:#{name} is #{state}\"\n end",
"def to_s\n str = \"\"\n str << \"Item\\t\\t\\t\\tPrice\\n\"\n str << \"----\\t\\t\\t\\t-----\\n\"\n @transactions.each do |t|\n price = Market::Transaction::transaction_list[t][:price]\n type = Market::Transaction::transaction_list[t][:type]\n if type == :discount\n str << \"\\t\\t#{t}\\t\\t#{price}\\n\"\n else\n str << \"#{t}\\t\\t\\t\\t#{price}\\n\"\n end\n end\n str << \"-------------------------------------\\n\"\n str << \"\\t\\t\\t\\t#{@total}\\n\"\n end",
"def transaction_summary()\n 'Adjustment ' + adjustment_type\n end",
"def print_item\n return \"Title: #{@title}; Description: #{@description}; Is Done: #{@is_done}; Due Date: #{@due_date}\"\n end",
"def description\n attributes.fetch(:description)\n end",
"def info_for(item)\n # Create quantity & trucks hash for this item\n {\n quantity: quantity_for(item),\n food_trucks: food_trucks_that_sell(item.name)\n }\n end",
"def price\n price_tier ? price_tier : 'Unknown'\n end",
"def show_state\n puts \"#{name} à #{life_points} points de vie\"\n end",
"def description\n return @description if @description\n \n parts = []\n \n tp = trial_period(false)\n parts << \"#{tp}-day trial\" if tp && tp > 0\n \n sa = setup_amount(false)\n parts << \"#{number_to_currency(sa)} setup fee\" if sa && sa > 0\n \n am = amount(false)\n parts << \"#{number_to_currency(am)}/mo\"\n \n if prepaid_message_count >= UNLIMITED\n texts = \"unlimited\"\n else\n texts = \"#{prepaid_message_count}/mo prepaid\"\n end\n \n @description = parts.join(', ') + \" and #{texts} texts after that.\"\n\n return @description\n end",
"def state_note(item)\n s = state_value(item) or return\n state_table.dig(s, :note)\n end",
"def description\n @description = \"House Blend Coffee\"\n end",
"def display\n total_tax, total = 0.0, 0.0\n @item_hash.each do |key|\n item_tax, item_price = @tax_hash[key[0].to_s].to_f, @item_hash[key[0].to_s].to_f\n puts \"#{key[0].to_s}: %.2f\" % (item_tax + item_price).round(2)\n total_tax += item_tax\n total += (item_price + item_tax).round(2)\n end\n\n puts \"Sales Tax: %.2f\" % total_tax.round(2)\n puts \"Total: %.2f\" % total.round(2)\n end",
"def summary\n @items.map { |i| \"* #{i.title}\" }.join(\"\\n\")\n end",
"def product_price_long variant\n prices = variant.flow_prices @flow_session.experience\n return variant.flow_spree_price unless prices.try(:first).present?\n\n prices.map do |price|\n label = price['label']\n\n case price['key']\n when 'localized_item_vat'\n '%s: %s' % [price['name'], label]\n when 'localized_item_duty'\n 'duty: %s' % label\n else\n if price['includes']\n '%s (%s)' % [label, price['includes']['label']]\n else\n label\n end\n end\n end.join(', ')\n end",
"def basic_tax(item_name, price_of_item)\n\t\[email protected]_tax_calc(item_name, price_of_item)\n\t\tadd_item\n\tend",
"def product_summary\n cell(CardProduct::Cell::Summary, card_product)\n end",
"def bde_description\n read_attribute(:description)\n end",
"def info\n return \"#{self.name} $#{self.price} (#{self.calorie}kcal)\"\n end",
"def display_price\n Spree::Money.new(new_amount, currency: currency)\n end"
] | [
"0.7411758",
"0.7154255",
"0.7126411",
"0.6540064",
"0.6465481",
"0.6421843",
"0.63522565",
"0.6299356",
"0.61912405",
"0.6186888",
"0.61864567",
"0.6184706",
"0.61353666",
"0.60822356",
"0.6080343",
"0.60749125",
"0.6052838",
"0.6028925",
"0.6015556",
"0.6014408",
"0.60077965",
"0.6006392",
"0.6001996",
"0.599121",
"0.5975847",
"0.5969832",
"0.5967988",
"0.5933346",
"0.59278625",
"0.5924526",
"0.5923315",
"0.5912336",
"0.59118104",
"0.5892528",
"0.5876458",
"0.5875158",
"0.587019",
"0.58609897",
"0.585363",
"0.5851752",
"0.5850482",
"0.5844004",
"0.5836393",
"0.58329177",
"0.5826038",
"0.582562",
"0.5817112",
"0.58061475",
"0.58031946",
"0.5791251",
"0.57861865",
"0.57783854",
"0.5772119",
"0.57669526",
"0.57646996",
"0.575441",
"0.5748125",
"0.5743545",
"0.57293534",
"0.5716924",
"0.5706573",
"0.5700198",
"0.568845",
"0.56873447",
"0.5679436",
"0.5679298",
"0.56739944",
"0.5672351",
"0.56713015",
"0.566778",
"0.56637263",
"0.5655907",
"0.56387895",
"0.5629342",
"0.5627491",
"0.56262064",
"0.56259567",
"0.5614368",
"0.56078726",
"0.5590747",
"0.5590133",
"0.5582154",
"0.557785",
"0.5575648",
"0.5572285",
"0.55658543",
"0.55543655",
"0.55535567",
"0.5553454",
"0.55525905",
"0.55499643",
"0.55456626",
"0.5545069",
"0.5542474",
"0.55368936",
"0.5535097",
"0.55329895",
"0.5532944",
"0.55291414",
"0.5528941",
"0.55202305"
] | 0.0 | -1 |
Total price of purchased items (with/out taxes) | def initialize
@list = {}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_with_tax\n total = 0\n @cart_items.each do |item|\n total += item.total_price\n end\n return total\n end",
"def total_before_tax\n total = 0\n @cart_items.each do |item|\n total += item.price\n end\n return total\n end",
"def calculate_price\n result = 0.0\n @items.each do |item|\n name = item.name\n price = item.price\n final_taxed_price = price # Begin with price and add tax as necessary\n tax = 0.0\n\n # Is the item subject to sales tax (ie. not exempt)?\n if !is_exempt(name)\n # Not exempt, apply sales tax\n tax += price * @@sales_tax\n else\n # Exempt, don't apply sales tax\n end\n\n # Is the item subject to import tax (ie. is it imported)?\n if is_imported(name)\n # Is imported, apply import sales tax\n tax += price * @@imported_goods_sales_tax\n else\n # Is not imported, don't apply import sales tax\n end\n\n final_taxed_price += round_point05(tax)\n\n puts final_taxed_price\n\n result += final_taxed_price # Add the final price to the running total\n end\n result\n end",
"def total_before_tax\n self.delivery_price + self.items_sub_total\n end",
"def total\n total_price = 0.0\n cart.line_items.each do |line_item|\n if !line_item.unit_price.blank?\n total_price += line_item.unit_price.to_f\n if line_item.line_item_options\n line_item.line_item_options.each do |line_item_option|\n total_price += line_item_option.price.to_f\n end\n end\n elsif line_item.menu_section_item\n total_price += line_item.menu_section_item.price.to_f\n if line_item.menu_item_options\n line_item.menu_item_options.each do |menu_item_option|\n total_price += menu_item_option.price.to_f\n end\n end\n else\n total_price += 0\n end\n end\n tax = total_price.to_f * 0.0825\n total_price = total_price + tax\n if tip\n total_price = total_price.to_f + tip.to_f\n end\n return total_price\n end",
"def total_before_tax\n order.delivery_price + items_sub_total\n end",
"def total_price\r\n\t\[email protected](0.0) { |sum, i| sum + i.total_unit_price * i.quantity }\r\n\tend",
"def total\n total_cost = 0\n \n # Summing up the product cost\n @products.each do |item, cost|\n total_cost += cost\n end\n \n # Calculate a 7.5% tax\n total_order_cost = total_cost * 1.075\n \n # Rounding the result to two decimal places\n return total_order_cost.round(2)\n end",
"def total_price\n (@base_price * @tax_rate + @base_price) * @quantity\n end",
"def total_price\n \t\tsale_items.sum { |item| (item.product.price * item.quantity) }\n\tend",
"def total\n product_total = 0\n tax = 1.075\n @products.each do |product, price|\n product_total += price\n end\n order_total = (product_total * tax).round(2)\n return order_total\n end",
"def calculate_total_price_and_taxes\n # find the tax rate\n tax_rate_percent = 0\n\n unless is_exempt_from_regular_tax?\n tax_rate_percent += REGULAR_TAX_PERCENT\n end\n\n unless self.is_exempt_from_import_tax?\n tax_rate_percent += IMPORT_TAX_PERCENT\n end\n\n # np/100\n # total tax needs to be a float rounded to nearest .05\n @total_tax = SalesTaxes::Item.round_properly((self.price * tax_rate_percent)/100)\n\n @total_price = (@price + @total_tax)\n end",
"def total\n # extracts all of the values from the hash and sums them up\n cost = @products.values.sum\n # add 7.5% tax and round to two decimal places\n return (cost * 1.075).round(2)\n end",
"def total\n total_invoice_items_price(invoice_items)\n end",
"def calculate_product_total(items_bought)\n result = items_bought * @price\n if @discount\n result -= @discount.apply(self, items_bought)\n end\n result \n end",
"def total_price\n \tresult = 0;\n \titems = self.order_items\n\n \titems.each do |item|\n \t\tresult += item.price\n \tend\n \treturn result\n end",
"def total_price\r\n total = 0\r\n\r\n #Adds the prices of the orders up\r\n order_items.each do |order_item|\r\n total += order_item.item.price*order_item.quantity\r\n end\r\n\r\n #Applies any discounts\r\n if(campaign)\r\n discount = campaign.campaign_type.percentage_reduced\r\n if discount != 100\r\n total -= (total * discount / 100)\r\n elsif discount == 100\r\n i = []\r\n order_items.each do |order_item|\r\n i.push(order_item.item.price)\r\n end\r\n total -= i.min\r\n end\r\n end\r\n return total\r\n end",
"def get_total_price\n self.line_items.sum { |item| item.get_subtotal }\n end",
"def total_price\n\t\tline_items.to_a.sum { |item| item.total_price }\n\tend",
"def total_unit_price\r\n\t\ttotal = self.unit_price\r\n\r\n\t\ttotal = Product.discount_price(total, discount, discount_is_abs)\r\n\r\n\t\tliovs = self.line_item_option_values\r\n\t\tliovs.each do |cur_liov|\r\n\t\t\ttotal += cur_liov.extra_cost\r\n\t\tend\r\n\r\n\t\ttotal\r\n#\t\tmultiplier = order.priced ? 1.0 : 1.1\r\n\r\n#\t\ttotal * multiplier\r\n\tend",
"def total_price\n\t\tline_items.to_a.sum{|item| item.total_price}\n\tend",
"def total_price\n mrg = margin(pricing_policy)\n calculate(pricing_policy, mrg).round\n end",
"def total_price(tax_rate)\n ((1 + tax_percentage(tax_rate)) * price)\n end",
"def purchase_price(item)\n item.price / 2\n end",
"def total_price\n \tresult = 0;\n \titems = self.temp_order_items\n\n \titems.each do |item|\n \t\tresult += item.price\n \tend\n \treturn result\n end",
"def get_total(item_name)\n return (@item_hash[item_name].to_f + @tax_hash[item_name].to_f).round(2)\n end",
"def purchase(item_price)\n @total += item_price\n total\n end",
"def total_price\n line_items.map { |line_item| line_item.item.price * line_item.quantity }.sum\n end",
"def total_price\n line_items.to_a.sum { |item| item.total_price}\n end",
"def total\n if @products.length == 0\n return 0\n else\n total = @products.values.reduce(:+)\n total*= 1.075 #Tax\n total = total.round(2)\n return total\n end\n end",
"def sub_total_price\n line_items.inject(0) {|sum, item| sum += item.price * item.qty }\n end",
"def cart_price_total_wtax\n price = 0\n tax = 2.99\n CartProduct.all.each do |cart_product|\n if cart_product.user_id == logged_in\n if product = get_product_by_id(cart_product.product_id)\n price += (product.price * cart_product.quantity) \n end\n end\n end\n return price + tax\n end",
"def total_price\n line_items.to_a.sum { |item| item.total_price }\n end",
"def total_price\n line_items.to_a.sum { |item| item.total_price }\n end",
"def total_price\n line_items.to_a.sum { |item| item.total_price }\n end",
"def total_price\n line_items.to_a.sum { |item| item.total_price }\n end",
"def cumulative_total_before_tax\n amount = 0.0\n @products_in_cart.each do |product|\n amount += product.price\n end#each\n return amount\nend",
"def total\n self.delivery_price +\n self.delivery_tax_amount +\n order_items.inject(BigDecimal(0)) { |t, i| t + i.total }\n end",
"def total_item\n @items.reject {|item| item.quantity == 0}\n invoice_total = @items.sum {|item| item.sale_price * item.quantity}\n\n end",
"def total\n order_total + delivery_price + (prices_include_tax ? 0 : tax_amount)\n end",
"def cumulative_total_after_tax\n amount = 0.0\n @products_in_cart.each do |product|\n amount += product.total\n end#each\n return amount\nend",
"def total_price\n total = 0\n self.carts.each do |item|\n total += item.quantity * item.product.price\n end\n return total\n end",
"def total_price\n line_items.to_a.sum {|item| item.total_price}\n end",
"def total_price\n items.map(&:price).sum\n end",
"def total_price\n total = total_price_without_installments\n if promotions.any?\n adjustment = adjustments.eligible.map(&:amount).sum\n\n (total += adjustment).to_f\n end\n if line_items.any? { |li| li.request_installments == true }\n total = total / 5\n end\n total\n end",
"def total\n order.delivery_price +\n order.delivery_tax_amount +\n order_items.inject(BigDecimal(0)) { |t, i| t + i.total }\n end",
"def total\r\n\t\tthe_cost = product[:wholesale_base_price] + option_value[:wholesale_extra_cost]\r\n\t\tthe_discount = product[:discount]\r\n\t\tabs_discount = product[:discount_is_abs]\r\n\r\n\t\tmultiplier = draft.priced ? 1.0 : 1.1\r\n\r\n\t\tProduct.discount_price(the_cost, the_discount, abs_discount) * quantity * multiplier\r\n\tend",
"def total_tax\n line_items.reduce(Money.zero) { |a, e| a + e.total_tax }\n end",
"def calculate(items)\n\n\t\titems.each do |item|\n\t\t\ttax_rate = get_tax_rate(item)\n\t\t\ttax = get_tax(item[:price], item[:quantity], tax_rate)\n\t\t\t@total_tax += tax\n\n\t\t\titem[:sales_price] = (item[:price] * item[:quantity] + tax).round(2)\n\t\t\t@total_price += item[:sales_price]\n\t\tend\n\n\t\treturn @total_tax, @total_price\n\tend",
"def total\n product_total = 0\n subtotal = 0\n @products.each_value do |prices|\n subtotal += prices\n end\n product_total = (subtotal * 0.075).round(2)+ subtotal\n return product_total\n\n end",
"def tax_total\n self.tax_amount = line_items.inject(Money.new(0, self.currency || Money.default_currency)) {|sum,l| sum + l.tax_amount }\n self.tax_rate # calculates average rate, leave for compatibility reasons\n self.tax_amount\n end",
"def total\n total = 0\n @products.values.each do |price|\n total += price\n end\n total += (0.075 * total).round(2)\n end",
"def total_price\n total = 0\n if self.nil? || self.order_items.empty?\n else\n items = Order.find(self.id).order_items\n if items.length > 0\n items.each do |item|\n total += Product.find(item.product_id).price * item.quantity\n end\n end\n end\n\n\n return total\n end",
"def total_cost\n order_items.map { |order_item| order_item.subtotal }.sum.round(2)\n end",
"def calculate_tax(item, price)\n tax = 0.0\n \n # if no words in the item match the exempt list\n if (Exempt - item.split(\" \")).length == Exempt.length\n tax += 0.10\n end\n\n # if imported, add 5% tax\n if item.split(\" \").include? 'imported'\n tax += 0.05\n end\n\n # round up to nearest .05 calculation\n item_tax = price.to_f * tax\n @tax_hash[item] = (item_tax * 20).ceil / 20.0\n end",
"def line_items_pre_tax_price\n @pre_tax ||= LineItem.total_price(unpaid_line_items)\n end",
"def tax_total\n self.tax_amount = line_items.inject(0.to_money) {|sum,l| sum + l.tax_amount }\n self.tax_rate # calculates average rate, leave for compatibility reasons\n self.tax_amount\n end",
"def total_unit_price\r\n\t\ttotal = self.unit_price\r\n\r\n\t\tliovs = self.line_item_option_values\r\n\t\tliovs.each do |cur_liov|\r\n\t\t\ttotal += cur_liov.extra_cost\r\n\t\tend\r\n\r\n\t\ttotal\r\n\tend",
"def total\n sum = self.line_items.inject(BigDecimal('0.0')) { |sum, li| sum + li.price } +\n self.price_modifiers.inject(BigDecimal('0.0')) { |sum, pm| sum + pm.amount }\n return ApplicationHelper.round_currency(sum)\n end",
"def total_price\n self.line_items.each.sum {|li| li.total_price}\n end",
"def price\n\t\tvalue = 0\n\t\tself.items.each do |item|\n\t\t\tvalue += item.product.price * item.amount\n\t\tend\n\t\tvalue\n\tend",
"def total_price\n cart_items.to_a.sum { |item| item.total_price }\n end",
"def total_price\n puts \"O PRECO TOTAL DE ORDER FOI CHAMADO\"\n self.line_items.to_a.sum{ |item| item.total_price}\n end",
"def discountable_item_total\n tot = 0\n self.line_items.each do |li|\n tot += li.total if li.product.taxons.any? {|t| t.name == \"Discountable\"}\n end\n self.item_total = tot\n end",
"def total_price\n # convert to array so it doesn't try to do sum on database directly\n @total = 0\n line_items.each do |item|\n @total = item.price\n end\n line_items.to_a.sum {|item| (item.quantity * item.price) }\n end",
"def product_selling_price_after_tax\n product_markup_price * (1 - county.tax_factor) \n end",
"def tax_total\n self.tax_amount = line_items.inject(0.to_money) {|sum,l| sum + l.tax_amount }\n self.tax_amount\n end",
"def line_item_sales_tax_total\n\n ((pre_tax_total * 20).ceil.to_f / 20.0).round(2)\n end",
"def total\n subtotal\n # + tax\n end",
"def total_price\n total = 0\n cart_items.collect do |item|\n total += item.total_price\n end\n\n total\n end",
"def calculate\n @item_list.each { |item|\n tax_rate = (item.exempt? ? 0.00 : Constants::NON_IMPORT_TAX_RATE) + (item.imported? ? Constants::IMPORT_TAX_RATE : 0.00)\n total_before_tax = item.qty * item.price\n tax = (total_before_tax * tax_rate).round_to_05\n\n @receipt_tax += tax\n @receipt_total += item.total = total_before_tax + tax\n }\n\n # do final rounding - needed due to Float quirks\n @receipt_tax = @receipt_tax.round(2)\n @receipt_total = @receipt_total.round(2)\n return self\n end",
"def total_tax\n total_cache(:total_tax) || sum_line_items(line_items, :tax_amount)\n end",
"def total_tax\n unit_tax * quantity\n end",
"def tax_amount\n self.quantity * single_item_tax\n end",
"def total\n\t\tprices = line_items.map {|li| li.price}\n\t\tprices.reduce(0) {|it0, it1| it0+it1}\n\tend",
"def total_pay\n total = 0\n @serie_items.each do |item|\n # next if item.quantity.nil?\n total += item.quantity * item.creation.price\n end\n return total\n end",
"def total_price\n\t\tproduct.price * quantity\n\tend",
"def product_total\n\t\ttotal = 0\n\t\tself.items.each do |item|\n\t\t\ttotal += item.amount\n\t\tend\n\t\ttotal\n\tend",
"def total_price(cart)\n cart.sum {|item| item.price} \n end",
"def full_price\n price + tax_evaluation\n end",
"def tax\n self.delivery_tax_amount +\n order_items.inject(BigDecimal(0)) { |t, i| t + i.tax_amount }\n end",
"def total_price\n self.unit_price * (self.quantity || 1)\n end",
"def total_price \n \tcart_items.to_a.sum { |item| item.total_price }\n end",
"def cart_total_price\n total = 0\n self.cart_items.each do |cart_item|\n total += cart_item.sub_total\n end\n total\n end",
"def total_price\n res = product.price * count\n if product_options.any?\n res = res + product_options.map { |po| po.price }.sum * count\n end\n res\n end",
"def subtotal\r\n\t\[email protected](0.0) { |sum, i| sum + i.total_unit_price * i.quantity }\r\n\tend",
"def summ\n result = 0.0\n self.propose_items.each do |item|\n result += item.price\n end\n return result\n end",
"def total_price\n total = 0\n self.transactions.each do |t|\n total += t.price\n end\n total\n end",
"def all_products_after_tax\n ccollection_of_products_total = 0\n @collection_of_products.each do |current_product|\n ccollection_of_products_total += current_product.total_price\n end\n end",
"def calcuate_tax\n @price * 0.12\n end",
"def line_total\n (@quantity * @price + line_item_sales_tax_total).round(2)\n end",
"def total_amount\n line_items.reduce(Money.zero) { |a, e| a + e.total_amount_inc_tax }\n end",
"def total\n return 0 if @products.empty?\n total = (@products.sum { |name, price| price } * 1.075).round(2)\n return total\n end",
"def total_prices_te_by_taxes_rates\n order_items.reduce({}) do |total_prices, order_item|\n taxes_rate = order_item.product_taxes_rate.to_f\n\n total_prices[taxes_rate] ||= 0\n total_prices[taxes_rate] += order_item.product_price_te.to_f\n total_prices\n end\n end",
"def total_cost_of_sales\n costs = self.purchases.map(&:cost)\n self.total_costs = costs.inject{|sum, cost| sum + cost}.to_f\n end",
"def total\n total = 0.00\n #accesses the subtotal of each of the order items\n order_items.each do |item|\n total += item.subtotal\n end\n return total.round(2)\n end",
"def total\n self.inject(0) { |t, calculator| t + (calculator.active? ? calculator.price(@cart) : 0) }\n end",
"def compute_tax(item_price, tax_rate)\n item_price * tax_rate\n end",
"def subtotal\n order_items.collect { |oi| oi.valid? ? (oi.quantity * oi.unit_price) : 0 }.sum\n end",
"def total_price\n Money.new(quantity * price_per_serving)\n end",
"def subtotal\n items.map(&:price).reduce(&:+)\n end"
] | [
"0.83898705",
"0.82394105",
"0.8155155",
"0.8119738",
"0.8112963",
"0.81068397",
"0.8088625",
"0.80422086",
"0.8034937",
"0.79057133",
"0.789007",
"0.78630185",
"0.7830885",
"0.78215414",
"0.7713045",
"0.7699325",
"0.7692754",
"0.7665392",
"0.7642579",
"0.76247543",
"0.76057625",
"0.75953",
"0.7591733",
"0.7576934",
"0.7572236",
"0.7567325",
"0.75668377",
"0.7566178",
"0.75592816",
"0.7530954",
"0.7522778",
"0.75072426",
"0.750426",
"0.750426",
"0.750426",
"0.750426",
"0.7498372",
"0.7484195",
"0.7481341",
"0.7467177",
"0.7465123",
"0.7454659",
"0.7439469",
"0.74370867",
"0.7428643",
"0.7420205",
"0.7402988",
"0.7401635",
"0.73945874",
"0.73941636",
"0.739169",
"0.7389452",
"0.7389142",
"0.73850805",
"0.73828655",
"0.7379069",
"0.73712873",
"0.7367337",
"0.73619187",
"0.7359549",
"0.7359542",
"0.7355648",
"0.7348347",
"0.73414224",
"0.73411703",
"0.7340361",
"0.7339974",
"0.73316026",
"0.73238045",
"0.73153234",
"0.7309278",
"0.7305479",
"0.7293443",
"0.72886956",
"0.7282684",
"0.7280861",
"0.72779006",
"0.7275289",
"0.7272058",
"0.72670496",
"0.72609437",
"0.72587097",
"0.72561157",
"0.72413516",
"0.7240429",
"0.72364384",
"0.7222504",
"0.72179556",
"0.72076845",
"0.7206649",
"0.72065693",
"0.7202162",
"0.72014594",
"0.72000706",
"0.71977454",
"0.71897197",
"0.7185955",
"0.7184907",
"0.71848226",
"0.7182924",
"0.71770823"
] | 0.0 | -1 |
Lists the cart's items with their respective prices before taxes | def to_s
printed_list = ""
@list.each do |item, quantity|
printed_list += "#{quantity} #{item}\n"
end
return printed_list
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_taxes\n printed_list = \"\"\n @total = 0\n @list.each do |item, quantity|\n item_total = quantity * item.price\n @total += item_total\n printed_list += \"#{quantity} #{item.name}: #{MONEY_FORMAT % item.price}\\n\"\n end\n return printed_list\n end",
"def total_before_tax\n total = 0\n @cart_items.each do |item|\n total += item.price\n end\n return total\n end",
"def total_with_tax\n total = 0\n @cart_items.each do |item|\n total += item.total_price\n end\n return total\n end",
"def receipt_items\n returning = []\n sales_tax = 0.0\n total = 0.0\n @shopping_cart.each do |line_item|\n sales_tax = sales_tax + line_item.tax\n total = total + line_item.price_with_tax\n returning << \"#{line_item.count} #{line_item.description}: %.2f\" % line_item.price_with_tax\n end\n returning << \"Sales Taxes: %.2f\" % sales_tax\n returning << \"Total: %.2f\" % total\n end",
"def show\n @cart = Cart.find_by(buyer_id:current_buyer.id)\n @entries = CartCarry.where(cart_id:@cart.id)\n @TotalPrice = 0\n @entries.each do |item|\n @TotalPrice += Product.find_by(id:item.product_id).currentPrice * item.quantity\n end\n end",
"def all_products_before_tax\n collection_of_products_total = 0\n @collection_of_products.each do |current_product|\n collection_of_products_total += current_product.base_price\n end\n end",
"def cart_before_tax\n#go into our array\n#get product price before tx\n#sum the array\nsum_base_price = []\n\n @@shopping_cart.each do |product|\n sum_base_price << product.base_price\n end\n\nreturn sum_base_price.sum\n\n\nend",
"def all_products_after_tax\n ccollection_of_products_total = 0\n @collection_of_products.each do |current_product|\n ccollection_of_products_total += current_product.total_price\n end\n end",
"def cumulative_total_before_tax\n amount = 0.0\n @products_in_cart.each do |product|\n amount += product.price\n end#each\n return amount\nend",
"def cart_price_sans_tax\n return nil if part_of_package?\n return price_with_subitems(:price_sans_tax) if package?\n price_sans_tax\n end",
"def calculate_price\n result = 0.0\n @items.each do |item|\n name = item.name\n price = item.price\n final_taxed_price = price # Begin with price and add tax as necessary\n tax = 0.0\n\n # Is the item subject to sales tax (ie. not exempt)?\n if !is_exempt(name)\n # Not exempt, apply sales tax\n tax += price * @@sales_tax\n else\n # Exempt, don't apply sales tax\n end\n\n # Is the item subject to import tax (ie. is it imported)?\n if is_imported(name)\n # Is imported, apply import sales tax\n tax += price * @@imported_goods_sales_tax\n else\n # Is not imported, don't apply import sales tax\n end\n\n final_taxed_price += round_point05(tax)\n\n puts final_taxed_price\n\n result += final_taxed_price # Add the final price to the running total\n end\n result\n end",
"def total_taxes\n @total_taxes = 0\n @list.each do |item, quantity|\n @total_taxes += quantity * item.taxes\n end\n puts \"Sales Taxes: #{MONEY_FORMAT % @total_taxes}\"\n end",
"def preview_order_items\n [\n {title: 'Item One', quantity: 2, price: 999, tax_exempt: false},\n {title: 'Item Two', quantity: 1, price: 25000, tax_exempt: false},\n {title: 'Item Three', quantity: 1, price: 8999, tax_exempt: false},\n {title: 'Item Four', quantity: 1, price: 100000, tax_exempt: false}\n ]\n end",
"def cumulative_total_after_tax\n amount = 0.0\n @products_in_cart.each do |product|\n amount += product.total\n end#each\n return amount\nend",
"def calc_all_tax(items)\n items_tax = items.collect { |item| calc_tax(item) }\n end",
"def list_products\n @products.map { |p| \"#{p.name} costs £#{p.price / 100.round(2)}\" }\n end",
"def checkout_shopping_cart\n\tputs \"------------------------------------ ITEMS PURCHASED ------------------------------------\"\n\n\t# Displays all the items\n\t@shopping_cart.items.each_with_index do |item, index|\n\t\t# Displays the item\n\t\tputs \"(#{index+1}) Name: #{item.name} \\n\"\n\t\tputs \"Price: $#{item.price}\\n\"\n\t\tputs \"Shipping Cost: $#{item.shipping_cost}\\n \\n\"\n\tend\n\tputs \"-----------------------------------------------------------------------------------------\"\n\tputs \"TOTAL Price: $#{@shopping_cart.total_price}\"\n\tputs \"TOTAL Shipping Cost: $#{@shopping_cart.total_shipping_cost}\"\n\tputs \"-----------------------------------------------------------------------------------------\"\n\tputs \"GRAND TOTAL: $#{@shopping_cart.total_cost}\"\n\tputs \"-----------------------------------------------------------------------------------------\\n\"\nend",
"def total\n total_price = 0.0\n cart.line_items.each do |line_item|\n if !line_item.unit_price.blank?\n total_price += line_item.unit_price.to_f\n if line_item.line_item_options\n line_item.line_item_options.each do |line_item_option|\n total_price += line_item_option.price.to_f\n end\n end\n elsif line_item.menu_section_item\n total_price += line_item.menu_section_item.price.to_f\n if line_item.menu_item_options\n line_item.menu_item_options.each do |menu_item_option|\n total_price += menu_item_option.price.to_f\n end\n end\n else\n total_price += 0\n end\n end\n tax = total_price.to_f * 0.0825\n total_price = total_price + tax\n if tip\n total_price = total_price.to_f + tip.to_f\n end\n return total_price\n end",
"def get_items_info_in_cart\n return [] unless page.has_css?('.no-style.cart__list', wait: TimeOut::WAIT_BIG_CONST)\n\n items_arr = []\n str = page.evaluate_script(\"$('.no-style.cart__list').html();\")\n html_doc = Nokogiri::HTML(str)\n\n # get all information of product\n html_doc.css('.cart__item.ng-scope').each do |el|\n prod_id = el.css('div.media >a.pull-left> @href').to_s.split('/')[-1].gsub('A-', '')\n title = el.css('div.media>div>div.row>div>h3.title>a.ng-binding').text\n strike = el.css('div.media>div>div.row>div.span3>div.qty-price>span.single.price.strike.ng-binding').text\n sale = el.css('div.media>div>div.row>div.span3>div.qty-price>span.single.price.ng-binding.sale').text\n price = el.css('div.media>div>div.row>div.span3>div.qty-price>span.single.price').text if strike == ''\n\n # Put all info into array\n items_arr.push(prod_id: prod_id, title: title, price: price, strike: strike, sale: sale)\n end\n\n items_arr\n end",
"def checkout \n number_items = 0\n total = 0\n puts \"ITEMS PRECIO\"\n puts \"\"\n\n get_list.each {\n \t|a| total += a.price \t\n number_items += 1\n puts \"#{a.name} $#{a.price}\"\n\n }\n\n if number_items > 5\n \ttotal_sin_redondeo = 0.9 * total\n \ttotal = total_sin_redondeo.redondear(2)\n end\n\n puts \"You are taking #{number_items} items\"\n puts \"Your total today is $#{total}. Have a nice day!\"\n\n end",
"def cart_price_total_wtax\n price = 0\n tax = 2.99\n CartProduct.all.each do |cart_product|\n if cart_product.user_id == logged_in\n if product = get_product_by_id(cart_product.product_id)\n price += (product.price * cart_product.quantity) \n end\n end\n end\n return price + tax\n end",
"def calculate_totals\n subtotal = 0\n\n carted_products.each do |carted_product|\n subtotal += carted_product.subtotal\n end\n\n tax = subtotal * 0.09\n total = subtotal + tax\n update(subtotal: subtotal, tax: tax, total: total)\n end",
"def flow_cart_breakdown\n prices = []\n\n price_model = Struct.new(:name, :label)\n\n if flow_order\n # duty, vat, ...\n unless flow_order.prices\n message = Flow::Error.format_order_message flow_order\n raise Flow::Error.new(message)\n end\n\n flow_order.prices.each do |price|\n prices.push price_model.new(price['name'], price['label'])\n end\n else\n price_elements = [:item_total, :adjustment_total, :included_tax_total, :additional_tax_total, :tax_total, :shipment_total, :promo_total]\n price_elements.each do |el|\n price = send(el)\n if price > 0\n label = Flow.format_default_price price\n prices.push price_model.new(el.to_s.humanize.capitalize, label)\n end\n end\n\n # discount is applied and we allways show it in default currency\n if adjustment_total != 0\n formated_discounted_price = Flow.format_default_price adjustment_total\n prices.push price_model.new('Discount', formated_discounted_price)\n end\n end\n\n # total\n prices.push price_model.new(Spree.t(:total), flow_total)\n\n prices\n end",
"def total_before_tax\n order.delivery_price + items_sub_total\n end",
"def index\n # @carts = Cart.all\n # @cart = Cart.where(user_id: session[:user_id]).first\n # byebug\n\n\n @cart = Cart.where(user_id: session[:user_id]).first\n\n\n\n @amount = @cart.calculate_price_based_on_qty\n\n @fabric_type_options = [['Basic Cotton Ultra', 30], ['Satin', 40], ['Kona® Cotton', 44],\n ['Performance Piqué', 33], ['Cotton Poplin', 59], ['Poly Crepe de Chine', 39],\n ['Cotton Lawn Ultra', 47], ['Silky Faille', 23], ['Performance Knit', 21], ['Modern Jersey', 31],\n ['Cotton Spandex Jersey', 55], ['Fleece', 56], ['Minky', 46],\n ['Linen-Cotton Canvas', 52], ['Organic Cotton Knit', 5], ['Organic Cotton Sateen', 36],\n ['Sport Lycra', 50], ['Heavy Cotton Twill', 7], ['Eco Canvas', 34],\n ['Faux Suede', 32], ['Silk Crepe de Chine', 10]]\n\n end",
"def calculate\n @item_list.each { |item|\n tax_rate = (item.exempt? ? 0.00 : Constants::NON_IMPORT_TAX_RATE) + (item.imported? ? Constants::IMPORT_TAX_RATE : 0.00)\n total_before_tax = item.qty * item.price\n tax = (total_before_tax * tax_rate).round_to_05\n\n @receipt_tax += tax\n @receipt_total += item.total = total_before_tax + tax\n }\n\n # do final rounding - needed due to Float quirks\n @receipt_tax = @receipt_tax.round(2)\n @receipt_total = @receipt_total.round(2)\n return self\n end",
"def total_before_tax\n self.delivery_price + self.items_sub_total\n end",
"def index\n add_breadcrumb 'shopping cart'\n @grand_sub_total = 0\n @grand_tax_total = 0\n @grand_total = 0\n @total_qty = 0\n\n case params[:view]\n when 'paid'\n add_breadcrumb '[Paid]'\n @carts = Cart.where('user_id =? AND paid =?', current_user.id, true)\n when 'notpaid'\n add_breadcrumb '[Not Paid]'\n @carts = Cart.where('user_id =? AND paid =?', current_user.id, false)\n else\n @carts = Cart.where('user_id =?', current_user.id)\n end\n\n @pagy, @carts = pagy(@carts)\n end",
"def display\n total_tax, total = 0.0, 0.0\n @item_hash.each do |key|\n item_tax, item_price = @tax_hash[key[0].to_s].to_f, @item_hash[key[0].to_s].to_f\n puts \"#{key[0].to_s}: %.2f\" % (item_tax + item_price).round(2)\n total_tax += item_tax\n total += (item_price + item_tax).round(2)\n end\n\n puts \"Sales Tax: %.2f\" % total_tax.round(2)\n puts \"Total: %.2f\" % total.round(2)\n end",
"def show\n @shopping_cart = ShoppingCart.find(params[:id])\n if(@shopping_cart.user == current_user)\n @shopping_cart_hash = eval(@shopping_cart.item_list)\n @shopping_item_list = Array.new\n @total_price = 0\n @shopping_cart_hash.each do |item_id, quantity|\n @item = Item.find(Integer(item_id))\n @shopping_item_list += [{:item => @item, :quantity => quantity, :price => (quantity * @item.price)}]\n @total_price += (quantity * @item.price)\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shopping_cart }\n end\n else\n redirect_to root_path\n end\n end",
"def run(cart)\n # Each line_item has a quantity, which usually makes the total...\n # ...quantity of items higher than the length of cart.line_items\n total_item_count = 0\n applicable_line_items = cart.line_items.select do |line_item|\n is_shirt = line_item.variant.product.tags.include? 'shirts'\n is_bundle = line_item.variant.product.tags.include? 'bundle'\n if is_shirt and is_bundle\n total_item_count += line_item.quantity\n line_item\n end\n end\n\n # The remaining amount of items that can be discounted in each category\n items_in_bundles_of_3 = (total_item_count / 3).floor * 3\n items_in_bundles_of_2 = ((total_item_count % 3) / 2).floor * 2\n \n # Change the price of applicable items\n applicable_line_items.each do |line_item|\n unexamined_item_count = line_item.quantity\n if items_in_bundles_of_3 >= unexamined_item_count\n discount = unexamined_item_count * @discount_per_item_in_bundle_of_three\n line_item.change_line_price(line_item.line_price - discount, message: \"\")\n items_in_bundles_of_3 -= unexamined_item_count\n next\n end\n if items_in_bundles_of_3 > 0 and items_in_bundles_of_3 < unexamined_item_count\n discount = items_in_bundles_of_3 * @discount_per_item_in_bundle_of_three\n line_item.change_line_price(line_item.line_price - discount, message: \"\")\n unexamined_item_count -= items_in_bundles_of_3\n items_in_bundles_of_3 = 0\n end\n if items_in_bundles_of_2 >= unexamined_item_count\n discount = unexamined_item_count * @discount_per_item_in_bundle_of_two\n line_item.change_line_price(line_item.line_price - discount, message: \"\")\n items_in_bundles_of_2 -= unexamined_item_count\n end\n end\n end",
"def checkout(cart, coupons)\n \n #binding.pry\n \n #use same cart to apply all the different discounts onto otherwise it wont be totaled\n \n \n cart_output = consolidate_cart(cart)\n apply_coupons(cart_output, coupons)\n apply_clearance(cart_output)\n \n grand_total = 0\n\n #binding.pry\n cart_output.each do |item_name, item_details|\n \n #have to get price AND count otherwise items aren't charged repeatedly\n grand_total += item_details[:price] * item_details[:count]\n \n end\n \n #binding.pry\n \n if grand_total > 100.00\n grand_total = ( grand_total * (0.90) ).round(2)\n end \n #binding.pry\n \n grand_total\nend",
"def total\n @items_total = []\n self.line_items.each do |item|\n @item = Item.find_by_id(item.item_id)\n @items_total << @item.price.to_f\n end\n cart_total = @items_total.inject(0){|sum, x| sum + x }\n @cart_total = cart_total.round(2)\n @cart_total\n end",
"def calculate_billing_price\n show_items\n self.discount.get_discount(self)\n print_billing_details\n self\n end",
"def cart\n # Calculate price\n # Warn: Need to update cart price every time items changed in cart for the safe side\n update_total_price_and_quantity_in_cart\n @cart = get_current_cart\n \n # prepare coupons\n @available_coupons = get_available_coupons(@cart) \n end",
"def garage_with_prices\n garage_inventory = []\n garage_inventory << {name: 'computer', price: '100.00', quantity: 1}\n garage_inventory << {name: 'book', price: '3.50', quantity: 5}\n\n garage_inventory.each do |item|\n puts \"Items for sale: #{item[:quantity]} #{item[:name].capitalize}(s) at $#{item[:price]} each\"\n end\n puts\n puts \"Inventory:\"\n puts \"----------\"\n puts \"#{garage_inventory.count} types of items\"\n total_value = 0\n print \"Total value: \"\n garage_inventory.map do |item|\n total_value += item[:quantity].to_f * item[:price].to_f\n end\n puts format(\"$%.2f\",total_value.round(2)) #This formats the output to show the '$' sign and 2 decimal places\nend",
"def show_items\n puts \"-------------------------------------------------\"\n puts \"Category | Item | Price \"\n puts \"-------------------------------------------------\"\n billing_items.each do |billing_item_category, billing_items_with_price|\n billing_items_with_price.each do |billing_item, price|\n puts \"#{billing_item_category} | #{billing_item} | $ #{price}\"\n end\n end\n puts \"-------------------------------------------------\"\n end",
"def line_items_pre_tax_price\n @pre_tax ||= LineItem.total_price(unpaid_line_items)\n end",
"def avail_products\n @products.each_with_index do |product, index|\n print \"#{index + 1}. #{product[:product]} - \"\n puts \"$#{product[:price]}\"\n end\n puts \"----------------\"\n add_to_cart\nend",
"def avail_products\n @products.each_with_index do |product, index|\n print \"#{index + 1}. #{product[:product]} - \"\n puts \"$#{product[:price]}\"\n end\n puts \"----------------\"\n add_to_cart\nend",
"def total_price\n total = 0\n cart_items.collect do |item|\n total += item.total_price\n end\n\n total\n end",
"def add_items_from_cart(cart)\n cart.line_items.each do |item|\n self.line_items << item if item.sufficient_stock?\n end\n end",
"def cart_total_price\n total = 0\n self.cart_items.each do |cart_item|\n total += cart_item.sub_total\n end\n total\n end",
"def cart_subtotal\n order = current_order ? current_order : new_order_from_cookies\n order.order_items.each { |item| item.send(:update_price)}\n order.send(:update_subtotal)\n end",
"def show\n @total = 0\n @cart.lineitems.each{|line|\n @total = AddService.call(@total.to_i, line.product.price * line.quantity)\n }\n #Use of logger class to log messages into the log file\n Logger.instance.log(Time.now.to_s + \": Cart viewed by user \\n\")\n end",
"def use_cart(cart)\n cart.cart_items.each do |cart_item|\n order_items.build(item_id: cart_item.item.id, price: cart_item.item.send(item_price_method_name), quantity: cart_item.quantity) if cart_item.quantity.to_i > 0\n end\n end",
"def calc_cart_total\n @cart_total = 0\n #This will determine the cart total\n @user_cart.each do |product|\n @cart_total = @cart_total + product[:price]\n end\n puts \"Your cart will cost you $#{@cart_total.round(2)} currently.\"\nend",
"def display_price\n Spree::Money.new(new_amount, {currency: currency})\n end",
"def print_total_cost\n order_desc = []\n order_desc << \"----------------------------\"\n order_desc << \"Item Quantity Price\"\n order_desc << \"----------------------------\"\n \n total_price = 0\n saved_cost = 0\n purchased_items.each do |item, count|\n unit_price = PRICE_MAP[item][:unit_price].to_f\n\n if PRICE_MAP[item][:sale_price]\n qty = PRICE_MAP[item][:sale_price][:qty]\n unit_qty = qty.to_i.zero? ? 1 : qty\n if count < unit_qty\n unit_price *= count\n else\n sale_price = PRICE_MAP[item][:sale_price][:price].to_f\n offer_price = (unit_price * (count % unit_qty)) + (sale_price * (count / unit_qty))\n saved_cost += (unit_price * count) - offer_price\n unit_price = offer_price\n end\n else\n unit_price *= count\n end\n unit_price = ('%.2f' % unit_price).to_f\n order_desc << \"#{item} #{count} $#{unit_price}\"\n total_price += unit_price\n end\n order_desc << \"\"\n order_desc << \"Total price : $#{'%.2f' % total_price}\"\n order_desc << \"You saved $#{'%.2f' % saved_cost} today.\" unless saved_cost.zero?\n order_desc << \"\"\n order_desc.map {|d| puts d }\n end",
"def on_change_funct(idx, price, cart)\n @all_items_price = total_price(cart)\n \"total_price(#{idx}, #{price}, #{@all_items_price})\"\n end",
"def basic_tax(item_name, price_of_item)\n\t\[email protected]_tax_calc(item_name, price_of_item)\n\t\tadd_item\n\tend",
"def products_in_cart (complete)\n cart = []\n @total = 0\n Cart.all.each do |item|\n product_total = item.quantity * item.price\n @total += product_total\n cart.append('Name': item.name,\n 'Description': item.description,\n 'Item ID': item.item_id,\n 'Price': item.price,\n 'Quantity': item.quantity,\n 'Subtotal': \"$#{product_total.round(2)}\")\n if complete\n product = Product.find_by(name: item.name)\n product.update_columns(quantity: product.quantity - item.quantity)\n end\n end\n cart.append('Total': \"$#{@total.round(2)}\")\n return cart\n end",
"def display_price\n Spree::Money.new(new_amount, currency: currency)\n end",
"def cart_with_price(price)\n Cart.new(cart_items: [\n CartItem.new(product: Product.new(price: price))\n ])\n end",
"def list_price\n self.phone_price ||= BigDecimal.new('0.0')\n self.update_price ||= BigDecimal.new('0.0')\n @list_price ||= phone_price + update_price\n end",
"def price( items )\n self.parser.price(items)\n end",
"def line_items_price_calculations(line_items)\n total_price = 0.0\n line_items.each do |li|\n total_price += (li.quantity * li.price.to_f)\n end\n return total_price\n end",
"def index\n\t\t@products = Product.all\n\t\t@cart_line_item = CartLineItem.new\n\tend",
"def print_items\n @items.each do |item|\n puts item.name + \" (#{item.price} gold)\"\n end\n print \"\\n\"\n end",
"def view_cart\n cart_total = 0.00\n puts \"--------CART------------\"\n @cart.each_with_index do |product, index|\n print \"#{index + 1}. #{product[:product]} - \"\n puts \"$#{product[:price]}\"\n cart_total += product[:price]\n end\n puts \"------------------------\"\n puts \"Cart Subtotal: $#{cart_total.round(2)}\"\n tax = cart_total * 0.068\n puts \"Tax: $#{tax.round(2)}\"\n puts \"Cart Total: $#{(cart_total + tax).round(2)}\"\n puts \"___________________________________________________________________________________\"\n puts \"To remove a product, enter the item number. Or, enter M to return to the Main Menu.\"\n user_input = gets.strip\n if user_input == \"M\"\n menu\n else\n user_input = user_input.to_i\n remove_product(user_input - 1)\n end\nend",
"def show\n\t\t\n\t\t#Show total items and prices\n\t\tputs \"\\nShopping list: \"\n @list_products.each {|key, val| print val, \" \", key, \" \",productsMarket[key], \"$\\n\"} \n\tend",
"def total_price\n cart_items.to_a.sum { |item| item.total_price }\n end",
"def total_price \n \tcart_items.to_a.sum { |item| item.total_price }\n end",
"def total\n product_total = 0\n tax = 1.075\n @products.each do |product, price|\n product_total += price\n end\n order_total = (product_total * tax).round(2)\n return order_total\n end",
"def add_line_items_from_cart(cart)\n cart.items.each do |item|\n li = LineItem.from_cart_item(item)# \"from_cart_item(item)\" is a method? to get the item from cart, store in li #\n line_items << li # appends the li stuff to line_items?\n end\n\n\n end",
"def checkout(cart, coupons)\n cart = consolidate_cart(cart)\n cart = apply_coupons(cart, coupons)\n cart = apply_clearance(cart)\n total = 0\n cart.each do |item|\n total += item[:price] * item[:count]\n end\n if total > 100\n total = (total * 0.90).round(2)\n end \n total\nend",
"def ticket_price\n\t\t#There is no base cost\n\t\tticket_price = @price\n\t\[email protected] do |item|\n\t\tif @items.count > 5\n\t\t\tticket_price += item.price * 0.9\n\t\telse\n\t\t\tticket_price += item.price\n\t\tend\n\t\tend\n\t\tticket_price.round(2)\n\tend",
"def display_cart(cart)\n cart.each do |item, quantity|\n puts item.to_s + ' (' + quantity.to_s + ')'\n end\nend",
"def checkout(cart, coupons)\n new_cart = consolidate_cart(cart)\n new_cart = apply_coupons(new_cart, coupons)\n new_cart = apply_clearance(new_cart)\n\n total = 0\n new_cart.each do |item|\n total += item[:price] * item[:count]\n end\n\n if total >= 100\n total = total - total*0.10\n end\n\n total\nend",
"def test_return_tax_cost\n # Create a cart and add some products.\n a_cart = Order.new\n a_cart.add_product(items(:red_lightsaber), 2)\n a_cart.add_product(items(:blue_lightsaber), 4)\n \n # By default tax is zero.\n assert_equal a_cart.tax_cost, a_cart.total * a_cart.tax\n end",
"def product_price_list\n $tracer.trace(__method__)\n #unit_test_no_generate: product_price_list, section.with.className(\"product_buy\").find.tr; GameStopMobileProductDetailPriceList\n return GameStopMobileProductDetailPriceList.new(\n ToolTag.new(section.with.className(\"product_buy\").find.tr, __method__, self), self)\n end",
"def tax_amount\n self.quantity * single_item_tax\n end",
"def product_selling_price_after_tax\n product_markup_price * (1 - county.tax_factor) \n end",
"def calculate(items)\n\n\t\titems.each do |item|\n\t\t\ttax_rate = get_tax_rate(item)\n\t\t\ttax = get_tax(item[:price], item[:quantity], tax_rate)\n\t\t\t@total_tax += tax\n\n\t\t\titem[:sales_price] = (item[:price] * item[:quantity] + tax).round(2)\n\t\t\t@total_price += item[:sales_price]\n\t\tend\n\n\t\treturn @total_tax, @total_price\n\tend",
"def index\n @cart_items = current_customer.cart_items\n @cart_item = CartItem.new\n end",
"def sub_total_price\n line_items.inject(0) {|sum, item| sum += item.price * item.qty }\n end",
"def total_price\n puts \"O PRECO TOTAL DE ORDER FOI CHAMADO\"\n self.line_items.to_a.sum{ |item| item.total_price}\n end",
"def compute_tax(item_price, tax_rate)\n item_price * tax_rate\n end",
"def order_total(items)\r\n order_total = 0\r\n for item in items\r\n order_total += item.total_cost\r\n end\r\n puts \"Order Total: $#{'%.2f' % order_total}\"\r\n end",
"def add_items_to_cart(cart)\n cart.cart_items.each do |item|\n @command.shopping_cart.create_item do |i|\n i.name = item.name\n i.description = \"\"\n i.unit_price = Money.new(item.product_price * 100, \"USD\")\n i.quantity = item.quantity\n end\n end\n end",
"def purchase_price(item)\n item.price / 2\n end",
"def total_price\n total = 0\n self.carts.each do |item|\n total += item.quantity * item.product.price\n end\n return total\n end",
"def compute_total_and_print()\n @total_price=0\n $final_price_list.each do |element| \n @total_price = @total_price + element\n end\n @total_sales_tax=0\n $sales_tax_list.each do |element|\n @total_sales_tax = @total_sales_tax + element\n end\n puts \"Sales Tax : #{@total_sales_tax.round(2)}\"\n puts \"Total : #{@total_price.round(2)}\"\nend",
"def sales_tax\n return (@listOfItem.inject(0){|sum,e| sum += \n e.product != nil ? e.product.sales_tax + e.product.import_tax : 0 }).round_to(2)\n end",
"def checkout\n\ttotal = shopping_cart.inject {|sum, item| sum + item.price}\n\n\t...\nend\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>END>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>",
"def update_prices( card )\n #更新 order 价格做为新的支付价格\n order.line_items.each{|item|\n discount = card.get_discount_percent( item.product )\n item.update_discount_percent( discount )\n }\n update_totals\n persist_totals\n end",
"def load_item_list\n @item_quantity = []\n get_list_item\n get_definitive_list_price\n check_if_shop_empty\n @index = 0\n @last_index = @list_item.size - 1\n end",
"def total\n total_cost = 0\n \n # Summing up the product cost\n @products.each do |item, cost|\n total_cost += cost\n end\n \n # Calculate a 7.5% tax\n total_order_cost = total_cost * 1.075\n \n # Rounding the result to two decimal places\n return total_order_cost.round(2)\n end",
"def total_price\n self.line_items.each.sum {|li| li.total_price}\n end",
"def show\n @cart = current_user.cart\n @all_items = @cart.items\n end",
"def full_price_items(cart, cost)\n#defines a new method for full price items where we'll be working with the cost and the cart\n cart.each do |item|\n #for each item in the cart do something to it. It will be referred to as item.\n item.each do |name,attribute|\n #for each item do something with the key/value pair, now referred to as name and attribute\n cost += (attribute[:price] * attribute[:count])\n #add it to or equal it to the attribute price key times the attribute count key\n end\n end\n cost\n #again, why put this here?\nend",
"def total_price\r\n\t\[email protected](0.0) { |sum, i| sum + i.total_unit_price * i.quantity }\r\n\tend",
"def checkout(cart, coupons)\n total = 0\n base_cart = consolidate_cart(cart)\n cart_with_coupons = apply_coupons(base_cart, coupons)\n final_cart = apply_clearance(cart_with_coupons)\n final_cart.each do |item, attribute_hash|\n total += attribute_hash[:price] * attribute_hash[:count]\n end\n if total > 100\n total *= 0.90\n end\n total\nend",
"def total_price\n line_items.map { |line_item| line_item.item.price * line_item.quantity }.sum\n end",
"def print_receipt (result)\n taxes, total = 0, 0\n puts \"-\" * 50\n result.each do |each|\n quantity, name, tax, tprice = each[:quantity], each[:name], each[:tax] , each[:tprice]\n puts \"#{quantity}, #{name}, #{'%.2f' % tprice.to_f}\"\n taxes += tax\n total += tprice\n end\n puts \"\\nSales Taxes: #{'%.2f' % taxes.to_f}\"\n puts \"Total: #{'%.2f' % total.to_f}\"\n puts \"-\" * 50\n return taxes, total\n end",
"def recalculate_totals\n # Line's total prices (qty * amount)\n single_untaxed_price_after_rebate = BigDecimal.new( (self.single_untaxed_price - self.single_rebate).to_s )\n self.gross_price = BigDecimal.new( (self.quantity * single_untaxed_price_after_rebate).to_s )\n self.gross_price = self.gross_price\n self.taxes = (self.gross_price / BigDecimal.new(\"100.0\")) * self.tax_percentage\n self.taxed_price = (BigDecimal.new( (self.gross_price + self.taxes).to_s )).rounded # Rounded like in document_line.rb\n\n # Line's single prices (for qty 1 * amount)\n single_taxes = ((single_untaxed_price_after_rebate / BigDecimal.new(\"100.0\")) * self.tax_percentage) # like in product.rb\n self.single_price = (single_untaxed_price_after_rebate + single_taxes).rounded # Like in document_line.rb\n\n end",
"def index\n @shopping_cart_items = current_user.shopping_cart_items\n \n puts \"@shopping_cart_items\"\n puts @shopping_cart_items.inspect\n \n puts \"current_user\"\n puts current_user.inspect\n \n @total_amount = 0\n @shopping_cart_items.each do |shopping_cart_item| \n puts \"total for loop\"\n puts shopping_cart_item.quantity * shopping_cart_item.card.price\n @total_amount += shopping_cart_item.quantity * shopping_cart_item.card.price\n end\n end",
"def cart_tmpl\n # items = [{id: 1, name: 'somename1'}, {id: 2, name: 'somename2'}, {id: 3, name: 'somename3'}]\n # @cart_totals = {'num_items' => 3,'price' => 99.76, 'tax' => 3.26, 'items' => items }\n @user = current_user\n @cart = @user.cart || Cart.new\n unless @cart.id?\n @cart.user = @user \n @cart.save\n end\n @items = @cart.items\n p '5'*50\n p @items\n render 'partials/_cart', layout: false, locals: {user: @user, cart: @cart, items: @items} \n end",
"def coupDiscounts\n\t\t@new_cart.each do |item, details|\n\t\t\tcase\n\t\t\t\twhen item == \"CHEESE\" && details[:coups] == 1 && details[:count] > 2\n\t\t\t\t\tdetails[:cost] = (((details[:count] / 3) * 15) + ((details[:count] % 3) * details[:price]))\n\t\t\t\twhen item == \"AVOCADO\" && details[:coups] == 1 && details[:count] > 1\n\t\t\t\t\tdetails[:cost] = (((details[:count] / 2) * 5) + ((details[:count] % 2) * details[:price]))\n\t\t\t\twhen item == \"BEER\" && details[:coups] == 1 && details[:count] > 1\n\t\t\t\t\tdetails[:cost] = (((details[:count] / 2) * 20) + ((details[:count] % 2) * details[:price]))\n\t\t\t\tend\t\t\t\t\n\t\tend\n\tend",
"def total_prices_te_by_taxes_rates\n order_items.reduce({}) do |total_prices, order_item|\n taxes_rate = order_item.product_taxes_rate.to_f\n\n total_prices[taxes_rate] ||= 0\n total_prices[taxes_rate] += order_item.product_price_te.to_f\n total_prices\n end\n end",
"def index\n @cart_items = CartItem.all\n end"
] | [
"0.7231672",
"0.7039515",
"0.68051445",
"0.6766033",
"0.66715413",
"0.66485214",
"0.6602778",
"0.6597087",
"0.65553457",
"0.64899325",
"0.6434836",
"0.64116",
"0.6406786",
"0.6368743",
"0.6363944",
"0.6359519",
"0.6356791",
"0.6349201",
"0.6346062",
"0.63459617",
"0.6334564",
"0.6286785",
"0.6266196",
"0.62577504",
"0.6256814",
"0.6247303",
"0.6208249",
"0.62073034",
"0.6169363",
"0.6138553",
"0.6128709",
"0.61204815",
"0.61068135",
"0.6094303",
"0.6089696",
"0.608354",
"0.6076448",
"0.60721487",
"0.6048779",
"0.6048779",
"0.60331744",
"0.6015132",
"0.60102266",
"0.59666055",
"0.59471726",
"0.59465754",
"0.59427935",
"0.59341735",
"0.59306335",
"0.59227115",
"0.5919761",
"0.59115946",
"0.5900355",
"0.5889887",
"0.5886854",
"0.58819133",
"0.587832",
"0.5878223",
"0.58765036",
"0.58753675",
"0.58726186",
"0.5861944",
"0.5852428",
"0.58421284",
"0.58397037",
"0.5831491",
"0.5824415",
"0.58242494",
"0.58241224",
"0.5821948",
"0.58157974",
"0.5800166",
"0.5799415",
"0.5794188",
"0.579345",
"0.5778333",
"0.57777506",
"0.57759345",
"0.57733023",
"0.57703",
"0.5769786",
"0.57656807",
"0.5765541",
"0.57601905",
"0.5758308",
"0.5753473",
"0.575044",
"0.57463664",
"0.5742395",
"0.5742053",
"0.573714",
"0.5734757",
"0.57269996",
"0.5726665",
"0.57251966",
"0.57126504",
"0.5711406",
"0.57017076",
"0.5698651",
"0.569621",
"0.5696128"
] | 0.0 | -1 |
Prints out the list of purchased items along with their price including taxes | def after_taxes
printed_list = ""
@total = 0
@list.each do |item, quantity|
item_total = quantity * item.price
@total += item_total
printed_list += "#{quantity} #{item.name}: #{MONEY_FORMAT % item.price}\n"
end
return printed_list
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_items\n @items.each do |item|\n puts item.name + \" (#{item.price} gold)\"\n end\n print \"\\n\"\n end",
"def print\n puts <<~RECEIPT\n #{parsed_items.join(\"\\n\")}\n\n Sales Taxes: #{total_sales_tax}\n Total: #{total_price}\n RECEIPT\n end",
"def print_items\n if @items.empty?\n print NO_ITEMS_MESSAGE\n else\n print WARES_MESSAGE\n @items.each { |item| puts \"#{item.name} (#{item.price} gold)\" }\n print \"\\n\"\n end\n end",
"def show_items\n puts \"-------------------------------------------------\"\n puts \"Category | Item | Price \"\n puts \"-------------------------------------------------\"\n billing_items.each do |billing_item_category, billing_items_with_price|\n billing_items_with_price.each do |billing_item, price|\n puts \"#{billing_item_category} | #{billing_item} | $ #{price}\"\n end\n end\n puts \"-------------------------------------------------\"\n end",
"def display\n total_tax, total = 0.0, 0.0\n @item_hash.each do |key|\n item_tax, item_price = @tax_hash[key[0].to_s].to_f, @item_hash[key[0].to_s].to_f\n puts \"#{key[0].to_s}: %.2f\" % (item_tax + item_price).round(2)\n total_tax += item_tax\n total += (item_price + item_tax).round(2)\n end\n\n puts \"Sales Tax: %.2f\" % total_tax.round(2)\n puts \"Total: %.2f\" % total.round(2)\n end",
"def receipt_items\n returning = []\n sales_tax = 0.0\n total = 0.0\n @shopping_cart.each do |line_item|\n sales_tax = sales_tax + line_item.tax\n total = total + line_item.price_with_tax\n returning << \"#{line_item.count} #{line_item.description}: %.2f\" % line_item.price_with_tax\n end\n returning << \"Sales Taxes: %.2f\" % sales_tax\n returning << \"Total: %.2f\" % total\n end",
"def print_receipt (result)\n taxes, total = 0, 0\n puts \"-\" * 50\n result.each do |each|\n quantity, name, tax, tprice = each[:quantity], each[:name], each[:tax] , each[:tprice]\n puts \"#{quantity}, #{name}, #{'%.2f' % tprice.to_f}\"\n taxes += tax\n total += tprice\n end\n puts \"\\nSales Taxes: #{'%.2f' % taxes.to_f}\"\n puts \"Total: #{'%.2f' % total.to_f}\"\n puts \"-\" * 50\n return taxes, total\n end",
"def print_total_cost\n order_desc = []\n order_desc << \"----------------------------\"\n order_desc << \"Item Quantity Price\"\n order_desc << \"----------------------------\"\n \n total_price = 0\n saved_cost = 0\n purchased_items.each do |item, count|\n unit_price = PRICE_MAP[item][:unit_price].to_f\n\n if PRICE_MAP[item][:sale_price]\n qty = PRICE_MAP[item][:sale_price][:qty]\n unit_qty = qty.to_i.zero? ? 1 : qty\n if count < unit_qty\n unit_price *= count\n else\n sale_price = PRICE_MAP[item][:sale_price][:price].to_f\n offer_price = (unit_price * (count % unit_qty)) + (sale_price * (count / unit_qty))\n saved_cost += (unit_price * count) - offer_price\n unit_price = offer_price\n end\n else\n unit_price *= count\n end\n unit_price = ('%.2f' % unit_price).to_f\n order_desc << \"#{item} #{count} $#{unit_price}\"\n total_price += unit_price\n end\n order_desc << \"\"\n order_desc << \"Total price : $#{'%.2f' % total_price}\"\n order_desc << \"You saved $#{'%.2f' % saved_cost} today.\" unless saved_cost.zero?\n order_desc << \"\"\n order_desc.map {|d| puts d }\n end",
"def print_billing_details\n puts \"--------------Final Bill-------------------------\"\n puts \"User type: #{self.user.class}\"\n puts \"-------------------------------------------------\"\n puts \"Category | Item | Price \"\n puts \"-------------------------------------------------\"\n billing_items.each do |billing_item_category, billing_items_with_price|\n billing_items_with_price.each do |billing_item, price|\n puts \"#{billing_item_category} | #{billing_item} | $ #{price}\"\n end\n end\n puts \"-------------------------------------------------\"\n puts \"Total payable amount: $ #{total_price}\"\n puts \"Total percentage discount: $ #{discount.percentage_discounted_price}\"\n puts \"Total every hundred discount: $ #{discount.every_hundred_discount_price}\"\n puts \"Total Saving: $ #{discount.total_net_discount_price}\"\n puts \"Total net price after discount: $ #{net_payable_price}\"\n end",
"def print_item(item, spent)\n\tputs \"You added #{item.item} to your order.\"\n\tputs \"You've spent $#{(spent).round(2)}\\n\\n\"\nend",
"def garage_with_prices\n garage_inventory = []\n garage_inventory << {name: 'computer', price: '100.00', quantity: 1}\n garage_inventory << {name: 'book', price: '3.50', quantity: 5}\n\n garage_inventory.each do |item|\n puts \"Items for sale: #{item[:quantity]} #{item[:name].capitalize}(s) at $#{item[:price]} each\"\n end\n puts\n puts \"Inventory:\"\n puts \"----------\"\n puts \"#{garage_inventory.count} types of items\"\n total_value = 0\n print \"Total value: \"\n garage_inventory.map do |item|\n total_value += item[:quantity].to_f * item[:price].to_f\n end\n puts format(\"$%.2f\",total_value.round(2)) #This formats the output to show the '$' sign and 2 decimal places\nend",
"def print_list(grocery_list)\n line_width = 30\n puts\n puts ('Grocery List'.center(line_width))\n puts\n puts (\"ITEMS\".ljust(line_width/2)) + \"QTY\".rjust(line_width/2)\n puts (\"------------------------------\").center(line_width)\n grocery_list.each { |item, quantity| \n puts (item.ljust(line_width/2)) + quantity.to_s.rjust(line_width/2)\n puts (\"------------------------------\") }\nend",
"def show\n\t\t\n\t\t#Show total items and prices\n\t\tputs \"\\nShopping list: \"\n @list_products.each {|key, val| print val, \" \", key, \" \",productsMarket[key], \"$\\n\"} \n\tend",
"def checkout \n number_items = 0\n total = 0\n puts \"ITEMS PRECIO\"\n puts \"\"\n\n get_list.each {\n \t|a| total += a.price \t\n number_items += 1\n puts \"#{a.name} $#{a.price}\"\n\n }\n\n if number_items > 5\n \ttotal_sin_redondeo = 0.9 * total\n \ttotal = total_sin_redondeo.redondear(2)\n end\n\n puts \"You are taking #{number_items} items\"\n puts \"Your total today is $#{total}. Have a nice day!\"\n\n end",
"def print_list(grocery_list)\n grocery_list.each do |item,quantity|\n puts \"Buy: #{quantity} #{item}\"\n end\nend",
"def print_pretty(new_list)\n puts \"Grocery List:\"\n new_list.each do |item, amount|\n \n puts \"#{item}: #{amount}\"\n end\nend",
"def print_pretty(grocery_list)\r\n\tgrocery_list.each do |item, quantity| \r\n\t\tputs \"you bought #{quantity} #{item}\"\r\n\tend\r\nend",
"def print_list(grocery_list)\n grocery_list.each do |item, quantity|\n puts \"Buy: #{quantity} #{item}\"\n end\nend",
"def pretty_list(list)\n\tlist.each { |item_name, item_quantity|\n\t\tputs \"You will need to purchase #{item_quantity} of #{item_name}.\"\n\t}\nend",
"def print_list(item_list)\r\n\t# steps: iterate through each of hash element\r\n\t# print the header\r\n puts \"=========================\"\r\n\tputs \"== Grocery List So Far ==\"\r\n\tputs \"=========================\"\r\n\titem_list.each do |item,quantity|\r\n\t\t# display each element key and the value to make it look pretty\r\n\r\n\t\tputs item.ljust(20)+quantity.to_s\r\n\tend\r\nend",
"def print_list(grocery_list)\n grocery_list.each do |item,quantity|\n puts \" #{item} #{quantity}\"\n end\n end",
"def print_list(list)\n puts \"Grocery List\"\n list.each { |item, qty| puts \"#{item}: #{qty}\" }\nend",
"def print_list(grocery_list)\n grocery_list.each do |item, qty|\n p \"#{item}: #{qty}\"\n end\nend",
"def checkout_shopping_cart\n\tputs \"------------------------------------ ITEMS PURCHASED ------------------------------------\"\n\n\t# Displays all the items\n\t@shopping_cart.items.each_with_index do |item, index|\n\t\t# Displays the item\n\t\tputs \"(#{index+1}) Name: #{item.name} \\n\"\n\t\tputs \"Price: $#{item.price}\\n\"\n\t\tputs \"Shipping Cost: $#{item.shipping_cost}\\n \\n\"\n\tend\n\tputs \"-----------------------------------------------------------------------------------------\"\n\tputs \"TOTAL Price: $#{@shopping_cart.total_price}\"\n\tputs \"TOTAL Shipping Cost: $#{@shopping_cart.total_shipping_cost}\"\n\tputs \"-----------------------------------------------------------------------------------------\"\n\tputs \"GRAND TOTAL: $#{@shopping_cart.total_cost}\"\n\tputs \"-----------------------------------------------------------------------------------------\\n\"\nend",
"def print_list(list)\n\tputs \"Grocery List\"\n\tlist.each{|item, quantity|\n\t\tputs \"#{item} : #{quantity}\"\n\t}\nend",
"def print_list(list)\r\n puts \"Your current grocery list\"\r\n puts \"---------------------------\"\r\n list.each do |item, quantity|\r\n puts \"#{item}: #{quantity}\"\r\n end \r\nend",
"def print_list(grocery_list)\n grocery_list.each do |item, quantity|\n puts \"#{item}, qty: #{quantity}\"\n end\nend",
"def print(list)\n list.each do |item, number|\n puts \"Need to purchase: #{item} -- #{number}\"\n end\nend",
"def print(list)\n puts \"***This is your grocery list:***\"\n list.each do |item,quantity|\n puts \"-#{quantity} #{item}\"\n end\nend",
"def printItem\n print @category,\", \"\n print @batteryLife,\", \"\n print @modelNum,\", \"\n print @color,\", \"\n print @manufacturer,\", \"\n print @status,\", \"\n print @yearBuilt,\", \"\n print @price,\", \"\n print @features\n end",
"def print_list\n @list.each { |item, qty| puts \"#{qty} #{item}\" }\n end",
"def print_list\n @list.each { |item, qty| puts \"#{qty} #{item}\" }\n end",
"def order_print_out\n puts \"Your order is #{@the_order[0][:item_name]} with a side of #{@the_order[1][:item_name]} and #{@the_order[2][:item_name]}.\"\n puts \"Your total is $#{@the_order[0][:price] + @the_order[1][:price] + @the_order[2][:price]}.\"\n puts \"Thank you for your order.\"\n exit\nend",
"def listing_items\n @products.each do |item|\n puts \"item: #{item[:name]} \\n reference_number: #{item[:reference_number]} \\n price: #{item[:price]}\"\nend\nend",
"def print_list(shopping_list)\n puts \"SHOPPING LIST:\"\n shopping_list.each do |item, qty|\n puts \"-#{item} ---> #{qty}\"\n end\n\nend",
"def print_items\n @items.each { |item| print \"#{item} \"}\n puts \"\\n\"\n end",
"def print_list(grocery_list)\n puts \" GROCERY LIST \".center(50, \"=\")\n puts\n grocery_list.each { |item,qty| puts \"#{item} qty: #{qty}\" }\n puts\n puts \"=\".center(50, \"=\")\nend",
"def print_list(grocery_list)\n\tgrocery_list.each do |item_name, quantity|\n\t\tputs \"#{item_name} => #{quantity}\"\n\tend\nend",
"def print_list(list)\n\t# input: list\n\t# output: none\n\n\t# print header\n\tputs \"Grocery List\\n------------\"\n\t# iterate over list\n\tfor item, qty in list do\n\t\t# print each item to screen ex: \" - Lemonade, 2 liters\"\n\t\tputs \" - #{item}, #{qty}\"\n\tend\n\nend",
"def print_list(list)\n puts \"Here's your grocery list:\"\n list.each { |item, quantity| puts \"#{item}: #{quantity}\" }\nend",
"def print_list(my_groceries)\n puts \"----------\"\n puts \"Our grocery list contains:\" \n my_groceries.each { |item, quantity| puts \"#{item}: #{quantity}\"}\n puts \"----------\"\nend",
"def total_taxes\n @total_taxes = 0\n @list.each do |item, quantity|\n @total_taxes += quantity * item.taxes\n end\n puts \"Sales Taxes: #{MONEY_FORMAT % @total_taxes}\"\n end",
"def receipt\r\n if self.qty >= 1\r\n puts \"#{self.drink} x#{self.qty} @ $#{'%.2f' % self.price} each: $#{'%.2f' % self.total_cost}\"\r\n end\r\n end",
"def printed_list(grocery_list)\n grocery_list.each {|item, quantity|\n puts \"#{item}: #{quantity}\" }\nend",
"def print_item_list(item_list)\r\n item_list.each { |item, qty| puts \"- #{item} : #{qty}\" }\r\nend",
"def preview_order_items\n [\n {title: 'Item One', quantity: 2, price: 999, tax_exempt: false},\n {title: 'Item Two', quantity: 1, price: 25000, tax_exempt: false},\n {title: 'Item Three', quantity: 1, price: 8999, tax_exempt: false},\n {title: 'Item Four', quantity: 1, price: 100000, tax_exempt: false}\n ]\n end",
"def print_pretty (list)\n puts \"Grocery list\".upcase.center(50)\n puts \"-----------------\".center(50)\n list.each do |item,quantity|\n puts item.rjust(25) + \":\" + quantity.to_s.ljust(25) \n end\nend",
"def print_list(grocery_list)\n puts \"*\" * 40 + \"Grocery List\" + \"*\" * 40 \n grocery_list.each do |item, quantity|\n puts \"#{item.capitalize}\".ljust(30) + \"#{quantity}\".rjust(10)\n\n end\n end",
"def final(list)\n\tputs \"Grocery List\"\n\tputs \"*\"*12\n\tlist.each {|item_name, quantity| puts \"#{item_name}: #{quantity}\"}\nend",
"def print_items\n puts print_line\n puts print_date\n puts print_title\n puts print_line\n puts print_header\n puts print_line\n items.each_with_index do |item, index_no|\n puts item.print_item_details(index_no)\n end\n puts print_line\n end",
"def pretty_in_print(list)\n puts \"---------------------------------------\"\n puts \"These are the items we are gonna buy\"\n list.each {|item, qty| puts \"#{qty} pieces of #{item}\" }\nend",
"def print_list(shopping_list)\n puts \"This is your shopping list\"\n shopping_list.each{|k,v| puts \"Item: #{k} Quantity: #{v}\" }\nend",
"def print_list(list)\n\tputs \"This is what you need to buy:\"\n\tputs \"--------------------\"\n\tlist.each do |item, quantity|\n\t\tputs \" #{item} : #{quantity}\"\n\tend\n\tputs \"--------------------\"\nend",
"def print_list(list)\n list.each do |item, quantity| \n puts \"The amount of #{item} you need to buy is #{quantity}.\" \n end\nend",
"def print_list(grocery_list)\n grocery_list.each do |item, quantity|\n puts \"#{item}: #{quantity}\"\n end\nend",
"def print_list(grocery_list)\n grocery_list.each do |item, quantity|\n puts \"#{item}: #{quantity}\"\n end\nend",
"def print_list(list)\r\n puts \"_-\" *25 + \"\\n\\n\"\r\n puts \"Here is your Grocery List: \\n\\n\"\r\n list.each do |item, quantity|\r\n puts \"\\tItem: #{item} \\tAmount: #{quantity}\"\r\n end\r\n puts \"_-\" *25\r\nend",
"def print_inovice\n\tputs \"\\n----------------------------------\"\n\tputs \"| Item | Quantity | Total Price |\"\n\tputs \"----------------------------------\"\n\tsingletn_example.items_per_invoice.each do |item, quantity|\n\t\tputs \"| #{item} | #{quantity} | #{singletn_example.calculate_total_price(item, quantity)} |\"\n\t\tend\n\tputs \"----------------------------------\"\n\tputs \"\\nYou bought #{singletn_example.items_to_buy} items, and the total price is #{singletn_example.total_price}\"\nend",
"def print_list(list)\n\tlist.each do |item, quantity|\n\t\tputs \"#{item}, amount: #{quantity}\"\n\tend\nend",
"def print_list(list)\n grocery_list = \"Grocery List\" + \"\\n\"\n\n list.each do |item, qty|\n grocery_list += \"#{item} : #{qty}\" + \"\\n\"\n end\n\n puts grocery_list\nend",
"def print_list(shopping_list)\n puts shopping_list.each {|item, quantity| puts \"#{item}: #{quantity}\"}\nend",
"def print_list(grocery_list)\r\n grocery_list.each do |item, quantity|\r\n puts \"#{item}: #{quantity}\"\r\n end\r\nend",
"def print_order(order)\n\tputs \"Here are the items you've ordered:\"\n\torder.each {|food| puts \"#{food.item}: $#{food.price}\\n\\tcalories: #{food.calories}\\tfat: #{food.fat} g\\tcarbs: #{food.carbs} g\"}\nend",
"def print_grocery_list(grocery_list) \n\t# create title and line break\n\tputs \"Current grocery list:\"\n\tputs \"----------\"\n\t# iterate through hash\n\tgrocery_list.each do |item, quantity|\n\t\t# print each item with its quantity\n\t\tputs \"#{item}: #{quantity}\"\n\tend\n\t# create line break for readability\n\tputs \"----------\"\nend",
"def print_list(list)\n puts \"This week's grocery list:\"\n list.each do |item, quantity|\n puts \"#{item}: #{quantity}\"\n end\nend",
"def list_items_to_sell\r\n list = \"\"\r\n items.each{ |item|\r\n if item.active == true\r\n list = list + item.name + \"\\n\"\r\n end}\r\n list\r\n end",
"def print_list(grocery_list)\n grocery_list.each { |grocery_item, quantity| puts \"#{grocery_item} : #{quantity}\"}\nend",
"def display_list(list_items)\n title = \"Shopping List:\"\n puts title\n puts \"-\" * title.length\n list_items.each do |item_name, item_qty|\n puts \"#{item_qty}x - #{item_name}\"\n end\n\nend",
"def print_list\n \t\tputs \"\\n----------------------------\"\n \t\tputs \"#{@date_created.month}/#{@date_created.day}/#{date_created.year}\"\n \t\tputs \"Your Grocery List:\\n\\n\" \t\t\n \t\tif @list.empty?\n \t\t\tputs \"The List Is Empty!\"\n \t\telse\n\n \[email protected]_with_index { |item, index| puts \"#{index+1}. #{item.qty} #{item.name}\" }\n end\n puts \"\\n----------------------------\"\n end",
"def print_list(list, item_name, quantity)\n list.each do |item|\n puts \"We need #{quantity} #{item_name}\"\n end\nend",
"def print_list(list)\n list.each do |item, quant| \n puts \"Item: #{item}, Quantity: #{quant}\"\n end\nend",
"def order_total(items)\r\n order_total = 0\r\n for item in items\r\n order_total += item.total_cost\r\n end\r\n puts \"Order Total: $#{'%.2f' % order_total}\"\r\n end",
"def pretty_list(grocery_list)\n grocery_list.each do |item, quantity|\n puts \"#{quantity} #{item}\"\n end\nend",
"def pretty_list(grocery_list)\n grocery_list.each do |item, quantity|\n puts \"#{quantity} #{item}\"\n end\nend",
"def pretty_list(grocery_list)\n puts \"Shopping List\"\n grocery_list.each do |item, quantity|\n puts \"#{item}: #{quantity}\"\n end\n puts \"Happy Shopping!\"\nend",
"def pretty_list(hash)\r\n puts \"Grocery List:\"\r\n puts \" \"\r\n hash.each do |item_name, quantity|\r\n puts \"#{item_name}: #{quantity}\"\r\n end\r\nend",
"def pretty_list(list)\n list.each do |grocery_item, qty|\n puts \"#{grocery_item}, quantity: #{qty}\"\n end\nend",
"def print_list(list)\n\tlist.each do |item, quantity|\n\t\tputs \"There are #{quantity} #{item} on the grocery list!!\"\n\tend\nend",
"def print_list\n $list.each {|list_item| puts \"#{list_item[:quantity]} #{list_item[:item]}\"}\nend",
"def printlist(list)\r\n# input: shopping list\r\n# steps:\r\nlist.each {|item, quantity| puts \"Please buy #{quantity} #{item}\"}\r\n # Print each item on the shopping list in a readable fashion\r\nend",
"def look_pretty(list)\n puts \"Here is your grocery list:\"\n list.each { |item, quantity| puts \"#{item}: #{quantity}\" }\nend",
"def order_profit(items)\r\n order_profit = 0\r\n for item in items\r\n order_profit += item.profit\r\n end\r\n puts \"Order Profit: $#{'%.2f' % order_profit}\"\r\n end",
"def list_products\n @products.map { |p| \"#{p.name} costs £#{p.price / 100.round(2)}\" }\n end",
"def print_list(list)\n puts \"Shopping List\"\n list.each { |item, quantity| puts \"You need #{quantity} #{item}(s).\" }\nend",
"def pretty_list(grocery_list)\r\n puts \"Your Grocery List for next week!\"\r\n grocery_list.each do |item, num|\r\n puts \"#{item} qty #{num}\"\r\n end\r\n \r\nend",
"def print_out(list)\n\tlist.each {|item, qty| puts \"#{item}; #{qty}\"}\nend",
"def print_receipt(barcodes)\n display = \"\"\n total = 0\n barcodes.each do |barcode|\n index = @barcodes.index(barcode)\n name = @names[index]\n price = @prices[index]\n display = display + \"#{name} $#{price}\\n\"\n total = total + price\n end\n display = display + \"total $#{total}\"\n display\n end",
"def print_list(grocery_list)\n grocery_list.each { |item, quantity| puts \"You need #{quantity} #{item}\"}\nend",
"def print_grocery_list(grocery_list)\n # steps: print \"Grocery List\"\n puts \"Grocery List:\"\n # for each item, print \"item name: quantity\"\n grocery_list.each do |item_name, quantity|\n puts \"#{item_name.to_s}: #{quantity}\"\n # output:\n end\nend",
"def print_list(list)\n puts \"List: #{list['name']}\"\n print_separator\n\n list[\"items\"].each do |item|\n puts \"\\tItem: \" + item['name'] + \"\\t\\t\\t\" +\n \"quantity: \" + item['quantity'].to_s\n end\n\n print_separator\nend",
"def cost_cal(items)\r\n price = 0\r\n items.item.each do |h|\r\n price += h[:num] * h[:price]\r\n end\r\n #profit = '%.2f' % profit\r\n puts \"Order total: $#{'%.2f' % price}\"\r\n return nil\r\nend",
"def print_list(list)\n\tputs \"----- Shopping List -----\"\n\tlist.each do |item, quantity|\n\t\tputs \"#{item}: #{quantity}\"\n\tend\n\treturn list\nend",
"def print(groceries_list)\n\tputs \"---------------------------------------------\"\n\tgroceries_list.each do |item, quantity|\n\t\tputs \"#{item}: #{quantity}\"\n\tend\n\tputs \"---------------------------------------------\"\nend",
"def print_list(hash)\n puts \"Grocery list:\"\n hash.each {|item, quantity| puts \"#{item} - #{quantity}\"}\nend",
"def print_list\r\n puts \"Here is your current grocery list:\"\r\n $grocery_list.each do |item, quantity|\r\n puts \"There are #{quantity} items of type #{item}\" if quantity > 1\r\n puts \"There is #{quantity} item of type #{item}\" if quantity == 1\r\n puts \"There is no #{item}\" if quantity == 0\r\n end\r\nend",
"def print_list(list)\n\tlist.each do |item,quantity|\n\t\tp \"#{quantity} #{item}\"\n\tend\nend",
"def display_cart(cart)\n cart.each do |item, quantity|\n puts item.to_s + ' (' + quantity.to_s + ')'\n end\nend",
"def make_products_section\n\t$products_hash[\"items\"].each do |toy|\n\t\ttoy_name toy\n print_toy_name\n\t\ttoy_full_price toy\n\t print_toy_full_price\n \ttotal_purchases toy\n\t\tprint_total_purchases\n\t total_sales toy\n\t\tprint_total_sales\n \taverage_price toy\n\t\tprint_average_price\n \taverage_discount toy\n\t\tprint_average_discount\n\tend\nend",
"def print_list(list)\r\n\r\n\tputs 'Shopping List'\r\n\r\n\tlist.each {|item, quantity| puts \"#{item}: #{quantity}\"}\r\n\t\r\n\tputs \"\"\r\n\r\nend",
"def print_list(food_list)\n food_list.each do |item_name, quantity|\n puts \"You have the following item #{item_name}, qty: #{quantity}.\"\n end\nend"
] | [
"0.77486473",
"0.76579475",
"0.74715567",
"0.7458602",
"0.7426162",
"0.72966766",
"0.72756946",
"0.71756107",
"0.70203245",
"0.7012923",
"0.7011954",
"0.69782466",
"0.69232494",
"0.69022673",
"0.68728924",
"0.6852633",
"0.6845356",
"0.68431",
"0.68340164",
"0.6808747",
"0.6794436",
"0.6760117",
"0.6749065",
"0.6748332",
"0.67393714",
"0.6735711",
"0.6709939",
"0.67090744",
"0.6697953",
"0.6688407",
"0.66826206",
"0.66826206",
"0.66752946",
"0.6670649",
"0.66654485",
"0.66597337",
"0.66529423",
"0.66497725",
"0.66178715",
"0.6615855",
"0.6614095",
"0.6601487",
"0.659327",
"0.6581741",
"0.65781623",
"0.6563799",
"0.6563245",
"0.6562675",
"0.6557086",
"0.65564096",
"0.6556255",
"0.6548713",
"0.6545422",
"0.65453005",
"0.65406865",
"0.65406865",
"0.6540126",
"0.6534132",
"0.6528755",
"0.6524621",
"0.6522809",
"0.6521333",
"0.6515571",
"0.6509816",
"0.6509545",
"0.65070045",
"0.65040636",
"0.65018773",
"0.6500629",
"0.64830893",
"0.64728594",
"0.64679474",
"0.64636403",
"0.64636403",
"0.6456292",
"0.64543784",
"0.6452891",
"0.64388347",
"0.6438198",
"0.6425832",
"0.64191675",
"0.64120555",
"0.63971716",
"0.6395653",
"0.6391899",
"0.6384312",
"0.63756204",
"0.6375231",
"0.63718563",
"0.6362972",
"0.6362371",
"0.6356926",
"0.6351213",
"0.6348446",
"0.63463336",
"0.6340296",
"0.633926",
"0.6334486",
"0.63278943",
"0.6327133"
] | 0.7491478 | 2 |
Calculates and prints out total amount of taxes for all listed items | def total_taxes
@total_taxes = 0
@list.each do |item, quantity|
@total_taxes += quantity * item.taxes
end
puts "Sales Taxes: #{MONEY_FORMAT % @total_taxes}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_all_tax(items)\n items_tax = items.collect { |item| calc_tax(item) }\n end",
"def total_tax\n line_items.reduce(Money.zero) { |a, e| a + e.total_tax }\n end",
"def after_taxes\n printed_list = \"\"\n @total = 0\n @list.each do |item, quantity|\n item_total = quantity * item.price\n @total += item_total\n printed_list += \"#{quantity} #{item.name}: #{MONEY_FORMAT % item.price}\\n\"\n end\n return printed_list\n end",
"def tax_total\n self.tax_amount = line_items.inject(0.to_money) {|sum,l| sum + l.tax_amount }\n self.tax_amount\n end",
"def total_with_tax\n total = 0\n @cart_items.each do |item|\n total += item.total_price\n end\n return total\n end",
"def tax_total\n self.tax_amount = line_items.inject(Money.new(0, self.currency || Money.default_currency)) {|sum,l| sum + l.tax_amount }\n self.tax_rate # calculates average rate, leave for compatibility reasons\n self.tax_amount\n end",
"def tax_total\n self.tax_amount = line_items.inject(0.to_money) {|sum,l| sum + l.tax_amount }\n self.tax_rate # calculates average rate, leave for compatibility reasons\n self.tax_amount\n end",
"def tax_total\n self.tax_amount = line_items.inject(::Money.new(0, self.currency || ::Money.default_currency.iso_code)) {|sum,line| sum + line.tax_amount}\n self.tax_amount\n end",
"def calculate_price\n result = 0.0\n @items.each do |item|\n name = item.name\n price = item.price\n final_taxed_price = price # Begin with price and add tax as necessary\n tax = 0.0\n\n # Is the item subject to sales tax (ie. not exempt)?\n if !is_exempt(name)\n # Not exempt, apply sales tax\n tax += price * @@sales_tax\n else\n # Exempt, don't apply sales tax\n end\n\n # Is the item subject to import tax (ie. is it imported)?\n if is_imported(name)\n # Is imported, apply import sales tax\n tax += price * @@imported_goods_sales_tax\n else\n # Is not imported, don't apply import sales tax\n end\n\n final_taxed_price += round_point05(tax)\n\n puts final_taxed_price\n\n result += final_taxed_price # Add the final price to the running total\n end\n result\n end",
"def total_before_tax\n total = 0\n @cart_items.each do |item|\n total += item.price\n end\n return total\n end",
"def total_tax\n total_cache(:total_tax) || sum_line_items(line_items, :tax_amount)\n end",
"def display\n total_tax, total = 0.0, 0.0\n @item_hash.each do |key|\n item_tax, item_price = @tax_hash[key[0].to_s].to_f, @item_hash[key[0].to_s].to_f\n puts \"#{key[0].to_s}: %.2f\" % (item_tax + item_price).round(2)\n total_tax += item_tax\n total += (item_price + item_tax).round(2)\n end\n\n puts \"Sales Tax: %.2f\" % total_tax.round(2)\n puts \"Total: %.2f\" % total.round(2)\n end",
"def sales_tax\n return (@listOfItem.inject(0){|sum,e| sum += \n e.product != nil ? e.product.sales_tax + e.product.import_tax : 0 }).round_to(2)\n end",
"def calculate\n @item_list.each { |item|\n tax_rate = (item.exempt? ? 0.00 : Constants::NON_IMPORT_TAX_RATE) + (item.imported? ? Constants::IMPORT_TAX_RATE : 0.00)\n total_before_tax = item.qty * item.price\n tax = (total_before_tax * tax_rate).round_to_05\n\n @receipt_tax += tax\n @receipt_total += item.total = total_before_tax + tax\n }\n\n # do final rounding - needed due to Float quirks\n @receipt_tax = @receipt_tax.round(2)\n @receipt_total = @receipt_total.round(2)\n return self\n end",
"def total_tax\n unit_tax * quantity\n end",
"def tax_amount\n self.quantity * single_item_tax\n end",
"def tax\n self.delivery_tax_amount +\n order_items.inject(BigDecimal(0)) { |t, i| t + i.tax_amount }\n end",
"def calculate(items)\n\n\t\titems.each do |item|\n\t\t\ttax_rate = get_tax_rate(item)\n\t\t\ttax = get_tax(item[:price], item[:quantity], tax_rate)\n\t\t\t@total_tax += tax\n\n\t\t\titem[:sales_price] = (item[:price] * item[:quantity] + tax).round(2)\n\t\t\t@total_price += item[:sales_price]\n\t\tend\n\n\t\treturn @total_tax, @total_price\n\tend",
"def total\n total_cost = 0\n \n # Summing up the product cost\n @products.each do |item, cost|\n total_cost += cost\n end\n \n # Calculate a 7.5% tax\n total_order_cost = total_cost * 1.075\n \n # Rounding the result to two decimal places\n return total_order_cost.round(2)\n end",
"def total\n subtotal\n # + tax\n end",
"def compute_total_and_print()\n @total_price=0\n $final_price_list.each do |element| \n @total_price = @total_price + element\n end\n @total_sales_tax=0\n $sales_tax_list.each do |element|\n @total_sales_tax = @total_sales_tax + element\n end\n puts \"Sales Tax : #{@total_sales_tax.round(2)}\"\n puts \"Total : #{@total_price.round(2)}\"\nend",
"def get_total(item_name)\n return (@item_hash[item_name].to_f + @tax_hash[item_name].to_f).round(2)\n end",
"def tax\n order.delivery_tax_amount +\n order_items.inject(BigDecimal(0)) { |t, i| t + i.tax_amount }\n end",
"def total_before_tax\n order.delivery_price + items_sub_total\n end",
"def total_before_tax\n self.delivery_price + self.items_sub_total\n end",
"def line_item_sales_tax_total\n\n ((pre_tax_total * 20).ceil.to_f / 20.0).round(2)\n end",
"def total_amount\n line_items.reduce(Money.zero) { |a, e| a + e.total_amount_inc_tax }\n end",
"def order_total(items)\r\n order_total = 0\r\n for item in items\r\n order_total += item.total_cost\r\n end\r\n puts \"Order Total: $#{'%.2f' % order_total}\"\r\n end",
"def calculate_tax(item, price)\n tax = 0.0\n \n # if no words in the item match the exempt list\n if (Exempt - item.split(\" \")).length == Exempt.length\n tax += 0.10\n end\n\n # if imported, add 5% tax\n if item.split(\" \").include? 'imported'\n tax += 0.05\n end\n\n # round up to nearest .05 calculation\n item_tax = price.to_f * tax\n @tax_hash[item] = (item_tax * 20).ceil / 20.0\n end",
"def total_amount_inc_tax\n unit_amount_inc_tax * quantity\n end",
"def calculate_total_price_and_taxes\n # find the tax rate\n tax_rate_percent = 0\n\n unless is_exempt_from_regular_tax?\n tax_rate_percent += REGULAR_TAX_PERCENT\n end\n\n unless self.is_exempt_from_import_tax?\n tax_rate_percent += IMPORT_TAX_PERCENT\n end\n\n # np/100\n # total tax needs to be a float rounded to nearest .05\n @total_tax = SalesTaxes::Item.round_properly((self.price * tax_rate_percent)/100)\n\n @total_price = (@price + @total_tax)\n end",
"def calculate_total_for_tax(invoice, tax_rate)\n total_amount = total_tax_amount = 0\n\n components = invoice.\n all_items.\n flatten.\n select { |component| component.tax_rate == tax_rate }\n\n components.each do |component|\n total_amount += component.price\n total_tax_amount += component.calculate_tax\n end\n\n [total_amount, total_tax_amount]\n end",
"def basic_tax(item_name, price_of_item)\n\t\[email protected]_tax_calc(item_name, price_of_item)\n\t\tadd_item\n\tend",
"def tax_rate\n self[:tax_rate] ||= Float(line_items.inject(0) {|sum, l| sum + l.tax_rate}) / line_items.size\n end",
"def cumulative_total_after_tax\n amount = 0.0\n @products_in_cart.each do |product|\n amount += product.total\n end#each\n return amount\nend",
"def total\n # extracts all of the values from the hash and sums them up\n cost = @products.values.sum\n # add 7.5% tax and round to two decimal places\n return (cost * 1.075).round(2)\n end",
"def tax_rate\n write_attribute( :tax_rate, Float(line_items.inject(0) {|sum, l| sum + l.tax_rate}) / line_items.size)\n end",
"def amount\n estimate_total = self.estimate_line_items.sum(:amount)\n if self.tax_inclusive? \n tax_total = 0 \n else\n tax_total = 0 \n tax_line_items.each do |line_item|\n tax_account = line_item.account\n next if (tax_account.accountable_type=='DutiesAndTaxesAccounts' && tax_account.accountable.calculation_method==4 && tax_account.accountable.split_tax == 0) \n tax_total += line_item.amount\n end\n end\n ship_charge = self.shipping_line_items.sum(:amount)\n estimate_total + tax_total + ship_charge\n end",
"def total\n total_price = 0.0\n cart.line_items.each do |line_item|\n if !line_item.unit_price.blank?\n total_price += line_item.unit_price.to_f\n if line_item.line_item_options\n line_item.line_item_options.each do |line_item_option|\n total_price += line_item_option.price.to_f\n end\n end\n elsif line_item.menu_section_item\n total_price += line_item.menu_section_item.price.to_f\n if line_item.menu_item_options\n line_item.menu_item_options.each do |menu_item_option|\n total_price += menu_item_option.price.to_f\n end\n end\n else\n total_price += 0\n end\n end\n tax = total_price.to_f * 0.0825\n total_price = total_price + tax\n if tip\n total_price = total_price.to_f + tip.to_f\n end\n return total_price\n end",
"def tax_calc\n tax = @quantity * @price * @taxe\n end",
"def all_products_after_tax\n ccollection_of_products_total = 0\n @collection_of_products.each do |current_product|\n ccollection_of_products_total += current_product.total_price\n end\n end",
"def tax25_sum\n tax_sum(tax25, 0.25)\n end",
"def calculate_totals\n subtotal = 0\n\n carted_products.each do |carted_product|\n subtotal += carted_product.subtotal\n end\n\n tax = subtotal * 0.09\n total = subtotal + tax\n update(subtotal: subtotal, tax: tax, total: total)\n end",
"def calc_total\n (@total_after_tax * @gratuity) + @total_after_tax\n end",
"def total\n cost_without_tax = get_cost_without_tax\n return cost_without_tax + get_sales_tax(cost_without_tax)\n end",
"def calc_tax_rate(item)\n tax_rate = 0\n tax_rate += @@import_duty if item.imported\n tax_rate += @@sales_tax unless (item.is_a? Book) || (item.is_a? Food) || (item.is_a? Medicine)\n \n return tax_rate\n end",
"def update_amounts\n @items = @items.each do |item|\n item[:good_tax] = set_tax(item[:good], item[:total], @good_tax_rate)\n item[:import_tax] = set_tax(item[:import], item[:total], @import_tax_rate)\n item[:sales_tax] = add_taxes(item[:sales_tax], item[:good_tax], item[:import_tax])\n item[:total] = add_taxes(item[:total], item[:good_tax], item[:import_tax])\n end\n end",
"def calculate_totals\n subtotal_collector = 0\n active_contracts.each do |active_contract|\n subtotal_collector += active_contract.subtotal\n end\n\n self.subtotal = subtotal_collector\n self.tax = subtotal * 0.09\n self.total = subtotal + tax\n save\n end",
"def calcuate_tax\n @price * 0.12\n end",
"def tax_total\n adjustments.where(:originator_type => \"TaxRate\").map(&:amount).sum\n end",
"def add_taxes(amt, good_tax, import_tax)\n amt += good_tax + import_tax\n amt.round(2)\n end",
"def total\n product_total = 0\n tax = 1.075\n @products.each do |product, price|\n product_total += price\n end\n order_total = (product_total * tax).round(2)\n return order_total\n end",
"def taxes\n calculation = BigDecimal.new(\"0\")\n absolutely_priced? ? base_price = sales_price : base_price = gross_price\n calculation = ( (base_price - rebate) / BigDecimal.new(\"100.0\")) * tax_class.percentage\n end",
"def cumulative_total_before_tax\n amount = 0.0\n @products_in_cart.each do |product|\n amount += product.price\n end#each\n return amount\nend",
"def sales_tax\n total_tax_percent = 0\n if Tax.sales_tax_applicable?(@item)\n total_tax_percent += Tax.sales_tax_amount\n end\n if Tax.import_duty_applicable?(@item)\n total_tax_percent += Tax.import_tax_amount\n end\n total_tax_percent.round(2)\n end",
"def calculate_tax_for(total)\n if self.vat_rate.present? && self.vat_rate != 0.0\n ((self.vat_rate / 100) * total)\n else\n 0\n end\n end",
"def discountable_item_total\n tot = 0\n self.line_items.each do |li|\n tot += li.total if li.product.taxons.any? {|t| t.name == \"Discountable\"}\n end\n self.item_total = tot\n end",
"def calculate\n product.taxes&.map { |tax| tax_portion(tax) }.sum.to_f || 0\n end",
"def get_total\n counts = convert_to_hash(@item_list)\n uniq_items = @item_list.uniq\n\n final = (@total - @sale.apply(uniq_items, counts)).round(2) # Used round for precision\n puts get_invoice + final.to_s\n final\n end",
"def calculate_taxes\n\t\ttax = 0\n\t\t\n\t\tif self.sku.contains_merch?\n\t\t\t# because paypal orders will not have billing addresses, just set \n\t\t\t# billing == to shipping if billing_address is nil\n\t\t\tself.billing_address ||= self.shipping_address \n\t\t\t\n\t\t\ttax = (self.sku.price * self.tax_rate * self.sku_quantity).round if self.billing_address.state == self.nexus\n\t\tend\n\t\t\n\t\tself.tax_amount = tax\n\t\t\n\tend",
"def compute_tax(item_price, tax_rate)\n item_price * tax_rate\n end",
"def calculate_tax\n if self.vendor.net_prices\n # this is for the US tax system. At this point, total is still net.\n self.tax_amount = self.total * self.tax / 100.0\n # here, total becomes gross\n self.total += tax_amount\n else\n # this is for the Europe tax system. self.total is already gross, so we don't have to modify it here.\n self.tax_amount = self.total * ( 1 - 1 / ( 1 + self.tax / 100.0 ) )\n end\n end",
"def all_products_before_tax\n collection_of_products_total = 0\n @collection_of_products.each do |current_product|\n collection_of_products_total += current_product.base_price\n end\n end",
"def receipt_items\n returning = []\n sales_tax = 0.0\n total = 0.0\n @shopping_cart.each do |line_item|\n sales_tax = sales_tax + line_item.tax\n total = total + line_item.price_with_tax\n returning << \"#{line_item.count} #{line_item.description}: %.2f\" % line_item.price_with_tax\n end\n returning << \"Sales Taxes: %.2f\" % sales_tax\n returning << \"Total: %.2f\" % total\n end",
"def add_tax_as_line_item\n raise unless @fields['x_tax']\n add_line_item :name => 'Total Tax', :quantity => 1, :unit_price => @fields['x_tax'], :tax => 0, :line_title => 'Tax'\n end",
"def print_receipt (result)\n taxes, total = 0, 0\n puts \"-\" * 50\n result.each do |each|\n quantity, name, tax, tprice = each[:quantity], each[:name], each[:tax] , each[:tprice]\n puts \"#{quantity}, #{name}, #{'%.2f' % tprice.to_f}\"\n taxes += tax\n total += tprice\n end\n puts \"\\nSales Taxes: #{'%.2f' % taxes.to_f}\"\n puts \"Total: #{'%.2f' % total.to_f}\"\n puts \"-\" * 50\n return taxes, total\n end",
"def so_item_totals\n qty = params[:qty].to_f / 10000\n amount = params[:amount].to_f / 10000\n tax = params[:tax].to_f / 10000\n discount_p = params[:discount_p].to_f / 100\n # Bonus\n discount = discount_p != 0 ? amount * (discount_p / 100) : 0\n # Taxable\n taxable = amount - discount\n # Taxes\n tax = tax - (tax * (discount_p / 100)) if discount_p != 0\n # Total\n total = taxable + tax\n # Format output values\n qty = number_with_precision(qty.round(4), precision: 4)\n amount = number_with_precision(amount.round(4), precision: 4)\n tax = number_with_precision(tax.round(4), precision: 4)\n discount = number_with_precision(discount.round(4), precision: 4)\n taxable = number_with_precision(taxable.round(4), precision: 4)\n total = number_with_precision(total.round(4), precision: 4)\n # Setup JSON hash\n @json_data = { \"qty\" => qty.to_s, \"amount\" => amount.to_s, \"tax\" => tax.to_s,\n \"discount\" => discount.to_s, \"taxable\" => taxable.to_s, \"total\" => total.to_s }\n render json: @json_data\n end",
"def taxes_amounts\n total_prices_te_by_taxes_rates.map do |taxes_rate, price_without_taxes|\n tax_amount = price_without_taxes.to_f * (taxes_rate / 100)\n\n {formatted_taxes_rate(taxes_rate) => formatted_price(tax_amount)}\n end.reduce({}, :merge)\n end",
"def total\n total_invoice_items_price(invoice_items)\n end",
"def unit_amount_inc_tax\n unit_amount + unit_tax\n end",
"def final_bill\n total + tax + @tip_amount\n end",
"def get_tax_rate(item)\n\t\ttax_rate = 0.0\n\t\ttax_rate = @goods_tax_rate unless item[:exempt]\n\t\ttax_rate = tax_rate + @imported_tax_rate if item[:import]\n\t\treturn tax_rate\n\tend",
"def total\n total = 0\n self.menu_items.each do |item|\n total += item.price\n end\n \"$#{total}\"\n end",
"def total\n subtotal + tax + shipping\n end",
"def amount_after_tax\n if waitlist_deduct_amount.present?\n amount_after_discounted + amount_of_tax - waitlist_deduct_amount\n else\n amount_after_discounted + amount_of_tax\n end\n end",
"def applied_tax_list(amount, options = {})\n opts = {}.merge(options)\n amount = amount.to_d\n list = []\n if self.compound_tax.to_i == 1\n if opts[:precision]\n list << {:name => tax1_name.to_s, :value => tax1_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax1_value).to_d/100.0), :amount => amount += format(\"%.#{opts[:precision].to_i}f\", (amount*tax1_value).to_d/100.0).to_d} if tax1_enabled.to_i == 1\n list << {:name => tax2_name.to_s, :value => tax2_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax2_value).to_d/100.0), :amount => amount += format(\"%.#{opts[:precision].to_i}f\", (amount*tax2_value).to_d/100.0).to_d} if tax2_enabled.to_i == 1\n list << {:name => tax3_name.to_s, :value => tax3_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax3_value).to_d/100.0), :amount => amount += format(\"%.#{opts[:precision].to_i}f\", (amount*tax3_value).to_d/100.0).to_d} if tax3_enabled.to_i == 1\n list << {:name => tax4_name.to_s, :value => tax4_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax4_value).to_d/100.0), :amount => amount += format(\"%.#{opts[:precision].to_i}f\", (amount*tax4_value).to_d/100.0).to_d} if tax4_enabled.to_i == 1\n else\n list << {:name => tax1_name.to_s, :value => tax1_value.to_d, :tax => amount*tax1_value/100.0, :amount => amount += amount*tax1_value/100.0} if tax1_enabled.to_i == 1\n list << {:name => tax2_name.to_s, :value => tax2_value.to_d, :tax => amount*tax2_value/100.0, :amount => amount += amount*tax2_value/100.0} if tax2_enabled.to_i == 1\n list << {:name => tax3_name.to_s, :value => tax3_value.to_d, :tax => amount*tax3_value/100.0, :amount => amount += amount*tax3_value/100.0} if tax3_enabled.to_i == 1\n list << {:name => tax4_name.to_s, :value => tax4_value.to_d, :tax => amount*tax4_value/100.0, :amount => amount += amount*tax4_value/100.0} if tax4_enabled.to_i == 1\n end\n else\n if opts[:precision]\n list << {:name => tax1_name.to_s, :value => tax1_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax1_value).to_d/100.0), :amount => format(\"%.#{opts[:precision].to_i}f\", (amount*tax1_value).to_d/100.0).to_d} if tax1_enabled.to_i == 1\n list << {:name => tax2_name.to_s, :value => tax2_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax2_value).to_d/100.0), :amount => format(\"%.#{opts[:precision].to_i}f\", (amount*tax2_value).to_d/100.0).to_d} if tax2_enabled.to_i == 1\n list << {:name => tax3_name.to_s, :value => tax3_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax3_value).to_d/100.0), :amount => format(\"%.#{opts[:precision].to_i}f\", (amount*tax3_value).to_d/100.0).to_d} if tax3_enabled.to_i == 1\n list << {:name => tax4_name.to_s, :value => tax4_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax4_value).to_d/100.0), :amount => format(\"%.#{opts[:precision].to_i}f\", (amount*tax4_value).to_d/100.0).to_d} if tax4_enabled.to_i == 1\n else\n list << {:name => tax1_name.to_s, :value => tax1_value.to_d, :tax => amount*tax1_value/100.0, :amount => amount*tax1_value/100.0} if tax1_enabled.to_i == 1\n list << {:name => tax2_name.to_s, :value => tax2_value.to_d, :tax => amount*tax2_value/100.0, :amount => amount*tax2_value/100.0} if tax2_enabled.to_i == 1\n list << {:name => tax3_name.to_s, :value => tax3_value.to_d, :tax => amount*tax3_value/100.0, :amount => amount*tax3_value/100.0} if tax3_enabled.to_i == 1\n list << {:name => tax4_name.to_s, :value => tax4_value.to_d, :tax => amount*tax4_value/100.0, :amount => amount*tax4_value/100.0} if tax4_enabled.to_i == 1\n end\n end\n list\n end",
"def order_profit(items)\r\n order_profit = 0\r\n for item in items\r\n order_profit += item.profit\r\n end\r\n puts \"Order Profit: $#{'%.2f' % order_profit}\"\r\n end",
"def total_tax_amount_validation\n @items.each do |i|\n next if i[:total_tax_amount].to_i * 100 / (i[:total_amount].to_i - i[:total_tax_amount].to_i) == i[:tax_rate].to_i / 100\n\n raise Klarna::Checkout::Errors::OrderValidationError.new(\n 'inconsistent_order_line_total_tax', 'line_total_tax_amount_not_matching_tax_rate'\n )\n end\n end",
"def tax_total\n send(:tax_amount) if respond_to?(:tax_amount)\n end",
"def applied_tax_list(amount, options = {})\n opts = {}.merge(options)\n amount = amount.to_d\n list = []\n if self.compound_tax.to_i == 1\n if opts[:precision]\n list << {:name => tax1_name.to_s, :value => tax1_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax1_value).to_d/100.0), :amount => amount += format(\"%.#{opts[:precision].to_i}f\", (amount*tax1_value).to_d/100.0).to_d} if tax1_enabled.to_i == 1\n list << {:name => tax2_name.to_s, :value => tax2_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax2_value).to_d/100.0), :amount => amount += format(\"%.#{opts[:precision].to_i}f\", (amount*tax2_value).to_d/100.0).to_d} if tax2_enabled.to_i == 1\n list << {:name => tax3_name.to_s, :value => tax3_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax3_value).to_d/100.0), :amount => amount += format(\"%.#{opts[:precision].to_i}f\", (amount*tax3_value).to_d/100.0).to_d} if tax3_enabled.to_i == 1\n list << {:name => tax4_name.to_s, :value => tax4_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax4_value).to_d/100.0), :amount => amount += format(\"%.#{opts[:precision].to_i}f\", (amount*tax4_value).to_d/100.0).to_d} if tax4_enabled.to_i == 1\n else\n list << {:name => tax1_name.to_s, :value => tax1_value.to_d, :tax => amount*tax1_value/100.0, :amount => amount += amount*tax1_value/100.0} if tax1_enabled.to_i == 1\n list << {:name => tax2_name.to_s, :value => tax2_value.to_d, :tax => amount*tax2_value/100.0, :amount => amount += amount*tax2_value/100.0} if tax2_enabled.to_i == 1\n list << {:name => tax3_name.to_s, :value => tax3_value.to_d, :tax => amount*tax3_value/100.0, :amount => amount += amount*tax3_value/100.0} if tax3_enabled.to_i == 1\n list << {:name => tax4_name.to_s, :value => tax4_value.to_d, :tax => amount*tax4_value/100.0, :amount => amount += amount*tax4_value/100.0} if tax4_enabled.to_i == 1\n end\n else\n if opts[:precision]\n list << {:name => tax1_name.to_s, :value => tax1_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax1_value).to_d/100.0), :amount => format(\"%.#{opts[:precision].to_i}f\", (amount*tax1_value).to_d/100.0).to_d} if tax1_enabled.to_i == 1\n list << {:name => tax2_name.to_s, :value => tax2_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax2_value).to_d/100.0), :amount => format(\"%.#{opts[:precision].to_i}f\", (amount*tax2_value).to_d/100.0).to_d} if tax2_enabled.to_i == 1\n list << {:name => tax3_name.to_s, :value => tax3_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax3_value).to_d/100.0), :amount => format(\"%.#{opts[:precision].to_i}f\", (amount*tax3_value).to_d/100.0).to_d} if tax3_enabled.to_i == 1\n list << {:name => tax4_name.to_s, :value => tax4_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax4_value).to_d/100.0), :amount => format(\"%.#{opts[:precision].to_i}f\", (amount*tax4_value).to_d/100.0).to_d} if tax4_enabled.to_i == 1\n else\n list << {:name => tax1_name.to_s, :value => tax1_value.to_d, :tax => amount*tax1_value/100.0, :amount => amount*tax1_value/100.0} if tax1_enabled.to_i == 1\n list << {:name => tax2_name.to_s, :value => tax2_value.to_d, :tax => amount*tax2_value/100.0, :amount => amount*tax2_value/100.0} if tax2_enabled.to_i == 1\n list << {:name => tax3_name.to_s, :value => tax3_value.to_d, :tax => amount*tax3_value/100.0, :amount => amount*tax3_value/100.0} if tax3_enabled.to_i == 1\n list << {:name => tax4_name.to_s, :value => tax4_value.to_d, :tax => amount*tax4_value/100.0, :amount => amount*tax4_value/100.0} if tax4_enabled.to_i == 1\n end\n end\n list\n end",
"def unit_tax\n tax = Money.new(0)\n tax_classes.each do |tax_class|\n class_tax = @rounding_strategy.round(tax_class.rate * unit_amount)\n tax += class_tax\n end\n tax\n end",
"def total\n @total = items.inject(0.0) { |sum, order_line_item| sum + order_line_item.subtotal }\n end",
"def cart_price_total_wtax\n price = 0\n tax = 2.99\n CartProduct.all.each do |cart_product|\n if cart_product.user_id == logged_in\n if product = get_product_by_id(cart_product.product_id)\n price += (product.price * cart_product.quantity) \n end\n end\n end\n return price + tax\n end",
"def total\n if @products.length == 0\n return 0\n else\n total = @products.values.reduce(:+)\n total*= 1.075 #Tax\n total = total.round(2)\n return total\n end\n end",
"def apply_taxes(taxman)\n @taxes = BigDecimal.new(0)\n if @is_imported\n @taxes += taxman.apply_tax(@price, taxman.import_duty)\n end\n unless taxman.exempt_basic.include?(@type)\n @taxes += taxman.apply_tax(@price, taxman.sales_tax)\n end\n @price += @taxes\n end",
"def sum_of_tax_rates line_item\n line_item.adjustments.tax.\n joins(\"INNER JOIN spree_tax_rates ON spree_tax_rates.id = spree_adjustments.source_id\").\n where(spree_tax_rates: { included_in_price: true }).\n map(&:source).\n sum(&:amount)\n end",
"def total\n total = 0.00\n #accesses the subtotal of each of the order items\n order_items.each do |item|\n total += item.subtotal\n end\n return total.round(2)\n end",
"def grand_total_sans_tax\n (subtotal_sans_tax || 0.to_money) + adjustments_sans_tax\n end",
"def total\n total = 0\n line_items.each do |line_item|\n total += line_item.item.price * line_item.quantity\n end\n total\n end",
"def tax\n rate = 0.09\n tax_amount = (price.to_f * rate)\n return tax_amount\n end",
"def total\n self.delivery_price +\n self.delivery_tax_amount +\n order_items.inject(BigDecimal(0)) { |t, i| t + i.total }\n end",
"def total\n return (@listOfItem.inject(0){|sum,e| sum += e.total}).round_to(2)\n end",
"def checkout \n number_items = 0\n total = 0\n puts \"ITEMS PRECIO\"\n puts \"\"\n\n get_list.each {\n \t|a| total += a.price \t\n number_items += 1\n puts \"#{a.name} $#{a.price}\"\n\n }\n\n if number_items > 5\n \ttotal_sin_redondeo = 0.9 * total\n \ttotal = total_sin_redondeo.redondear(2)\n end\n\n puts \"You are taking #{number_items} items\"\n puts \"Your total today is $#{total}. Have a nice day!\"\n\n end",
"def calcTaxes price\r\n taxrate = 0.95\r\n return taxrate * price\r\nend",
"def total_prices_te_by_taxes_rates\n order_items.reduce({}) do |total_prices, order_item|\n taxes_rate = order_item.product_taxes_rate.to_f\n\n total_prices[taxes_rate] ||= 0\n total_prices[taxes_rate] += order_item.product_price_te.to_f\n total_prices\n end\n end",
"def tax\n 0.0\n end",
"def item_total\n tot = 0\n self.line_items.each do |li|\n tot += li.total\n end\n self.item_total = tot\n end",
"def total_price(tax_rate)\n ((1 + tax_percentage(tax_rate)) * price)\n end",
"def tax\n price.to_f * 0.09\n end",
"def tax_sum(tax, tax_percent)\n (tax - (tax / (1 + tax_percent))).round(2)\n end"
] | [
"0.8032528",
"0.7993072",
"0.7990664",
"0.78866035",
"0.7871526",
"0.7848681",
"0.78205323",
"0.76909906",
"0.76633155",
"0.76433283",
"0.7558471",
"0.75224084",
"0.7467282",
"0.7399366",
"0.7339651",
"0.7320659",
"0.7289374",
"0.7239031",
"0.72362095",
"0.72107303",
"0.7208427",
"0.72031623",
"0.71993446",
"0.7198437",
"0.7195943",
"0.7169359",
"0.71043587",
"0.7095693",
"0.7085937",
"0.7037705",
"0.7033122",
"0.7016709",
"0.70164967",
"0.69906515",
"0.6989802",
"0.69682795",
"0.69496703",
"0.6940121",
"0.69238347",
"0.6896299",
"0.68916065",
"0.68852735",
"0.68751854",
"0.68555635",
"0.68483853",
"0.6840608",
"0.6833172",
"0.68288356",
"0.6822501",
"0.6797397",
"0.6796879",
"0.67835003",
"0.67832613",
"0.67831963",
"0.6777261",
"0.677239",
"0.67586166",
"0.67516106",
"0.6738247",
"0.6725971",
"0.670457",
"0.6699531",
"0.6688788",
"0.66805166",
"0.6655531",
"0.6630301",
"0.6628838",
"0.6616538",
"0.66052",
"0.658472",
"0.658457",
"0.6583645",
"0.6573635",
"0.65712386",
"0.6565345",
"0.65451586",
"0.6541533",
"0.65397024",
"0.65349686",
"0.6526813",
"0.65010303",
"0.6500229",
"0.6487892",
"0.648701",
"0.6482677",
"0.647541",
"0.6473265",
"0.6470955",
"0.6469221",
"0.6466009",
"0.6459982",
"0.6427585",
"0.6422132",
"0.6417364",
"0.640661",
"0.6403036",
"0.6402311",
"0.6393459",
"0.63913375",
"0.63901675"
] | 0.8499987 | 0 |
Convenience method that prints out standard receipt, including subtotal of taxes | def checkout(receipt_name)
puts receipt_name
puts after_taxes
total_taxes
puts "Total: #{MONEY_FORMAT % @total}\n"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print\n puts <<~RECEIPT\n #{parsed_items.join(\"\\n\")}\n\n Sales Taxes: #{total_sales_tax}\n Total: #{total_price}\n RECEIPT\n end",
"def printTotal()\n\tdiscount = ($total * ($discountPercentage / 100.0)).round(2)\n\ttax = (TAX_PERCENTAGE * ($total - discount)).round(2)\n\tgrandTotal = ($labor + $total + tax - discount).round(2)\n\tbalance = (grandTotal - $giftCardAmount).abs().round(2)\n\t\n\tputs\t\"Receipt\\n\"\\\n\t\t\t\"Description\\tQuantity\\tAmount\\n\"\\\n\t\t\t\"----------\\t--------\\t------\\n\"\\\n\t\t\t\"Items\\t\\t#{$numCharges}\\t\\t$#{format(\"%.2f\" % $total)}\\n\"\\\n\t\t\t\"Discount\\t#{$discountPercentage}%\\t\\t-$#{format(\"%.2f\" % discount)}\\n\"\\\n\t\t\t\"Tax\\t\\t6.5%\\t\\t$#{format(\"%.2f\" % tax)}\\n\"\\\n\t\t\t\"Labor\\t\\t#{$labor == 0 ? 0 : 1}\\t\\t$#{format(\"%.2f\" % $labor)}\\n\"\\\n\t\t\t\"Grand Total:\\t\\t\\t$#{format(\"%.2f\" % grandTotal)}\\n\\n\"\\\n\t\t\t\"Gift Cards\\t#{$numGiftCards}\\t\\t-$#{format(\"%.2f\" % $giftCardAmount)}\\n\\n\\n\"\n\t\t\t\n\t\t\tprint ((grandTotal - $giftCardAmount) > 0)? \"Please Pay Amount:\" : \"Remaining balance:\"\t\t\t\n\t\t\tprint \"\\t\\t$#{format(\"%.2f\" % balance)}\\n\\n\"\nend",
"def print_receipt (result)\n taxes, total = 0, 0\n puts \"-\" * 50\n result.each do |each|\n quantity, name, tax, tprice = each[:quantity], each[:name], each[:tax] , each[:tprice]\n puts \"#{quantity}, #{name}, #{'%.2f' % tprice.to_f}\"\n taxes += tax\n total += tprice\n end\n puts \"\\nSales Taxes: #{'%.2f' % taxes.to_f}\"\n puts \"Total: #{'%.2f' % total.to_f}\"\n puts \"-\" * 50\n return taxes, total\n end",
"def format_receipt\n receipt = ''\n\n @items.each do |item|\n receipt += item.generate_receipt_string\n receipt += \"\\n\"\n end\n\n sales_taxes = 0.00\n @items.each do |item|\n sales_taxes += item.total_tax\n end\n\n total = 0.00\n @items.each do |item|\n total += item.total_price\n end\n\n receipt += \"Sales Taxes: \" + sprintf(\"%.2f\",sales_taxes)\n receipt += \"\\n\"\n receipt += \"Total: \" + sprintf(\"%.2f\",total)\n receipt\n end",
"def receipt\r\n if self.qty >= 1\r\n puts \"#{self.drink} x#{self.qty} @ $#{'%.2f' % self.price} each: $#{'%.2f' % self.total_cost}\"\r\n end\r\n end",
"def print_sales_receipt\n puts \"Successfully Booked - Show #{@show_no}\"\n puts \"Subtotal: Rs. #{@seats_price}\"\n puts \"Service Tax @14%: RS. #{@service_tax}\"\n puts \"Swachh Bharat Cess @0.5%: RS. #{@swach_bharath_cess}\"\n puts \"Krishi Kalyan Cess @0.5%: RS. #{@krishi_kalyan_cess}\"\n puts \"Total: Rs. #{$TOTAL_SALES.last.sum}\"\n end",
"def receipt_items\n returning = []\n sales_tax = 0.0\n total = 0.0\n @shopping_cart.each do |line_item|\n sales_tax = sales_tax + line_item.tax\n total = total + line_item.price_with_tax\n returning << \"#{line_item.count} #{line_item.description}: %.2f\" % line_item.price_with_tax\n end\n returning << \"Sales Taxes: %.2f\" % sales_tax\n returning << \"Total: %.2f\" % total\n end",
"def print_receipt(barcodes)\n display = \"\"\n total = 0\n barcodes.each do |barcode|\n index = @barcodes.index(barcode)\n name = @names[index]\n price = @prices[index]\n display = display + \"#{name} $#{price}\\n\"\n total = total + price\n end\n display = display + \"total $#{total}\"\n display\n end",
"def to_s\n item_text = \"=== Your Receipt ===#{Constants::CR_LF}\"\n @item_list.each { |item| item_text += item.to_s }\n item_text += \"Sales taxes: #{(\"%.02f\" % @receipt_tax).to_s}#{Constants::CR_LF}\"\n item_text += \"Total: #{(\"%.02f\" % @receipt_total).to_s}\"\n end",
"def display\n total_tax, total = 0.0, 0.0\n @item_hash.each do |key|\n item_tax, item_price = @tax_hash[key[0].to_s].to_f, @item_hash[key[0].to_s].to_f\n puts \"#{key[0].to_s}: %.2f\" % (item_tax + item_price).round(2)\n total_tax += item_tax\n total += (item_price + item_tax).round(2)\n end\n\n puts \"Sales Tax: %.2f\" % total_tax.round(2)\n puts \"Total: %.2f\" % total.round(2)\n end",
"def generate_receipt_string\n \"#{@quantity} #{type}: #{sprintf(\"%.2f\",total_price)}\"\n end",
"def print_total_cost\n order_desc = []\n order_desc << \"----------------------------\"\n order_desc << \"Item Quantity Price\"\n order_desc << \"----------------------------\"\n \n total_price = 0\n saved_cost = 0\n purchased_items.each do |item, count|\n unit_price = PRICE_MAP[item][:unit_price].to_f\n\n if PRICE_MAP[item][:sale_price]\n qty = PRICE_MAP[item][:sale_price][:qty]\n unit_qty = qty.to_i.zero? ? 1 : qty\n if count < unit_qty\n unit_price *= count\n else\n sale_price = PRICE_MAP[item][:sale_price][:price].to_f\n offer_price = (unit_price * (count % unit_qty)) + (sale_price * (count / unit_qty))\n saved_cost += (unit_price * count) - offer_price\n unit_price = offer_price\n end\n else\n unit_price *= count\n end\n unit_price = ('%.2f' % unit_price).to_f\n order_desc << \"#{item} #{count} $#{unit_price}\"\n total_price += unit_price\n end\n order_desc << \"\"\n order_desc << \"Total price : $#{'%.2f' % total_price}\"\n order_desc << \"You saved $#{'%.2f' % saved_cost} today.\" unless saved_cost.zero?\n order_desc << \"\"\n order_desc.map {|d| puts d }\n end",
"def total\n subtotal\n # + tax\n end",
"def after_taxes\n printed_list = \"\"\n @total = 0\n @list.each do |item, quantity|\n item_total = quantity * item.price\n @total += item_total\n printed_list += \"#{quantity} #{item.name}: #{MONEY_FORMAT % item.price}\\n\"\n end\n return printed_list\n end",
"def puts_grandtotal(sumtotal)\n 2.times { puts }\n puts \"Grand total AUD#{sumtotal}\"\n 2.times { puts }\n end",
"def print_billing_details\n puts \"--------------Final Bill-------------------------\"\n puts \"User type: #{self.user.class}\"\n puts \"-------------------------------------------------\"\n puts \"Category | Item | Price \"\n puts \"-------------------------------------------------\"\n billing_items.each do |billing_item_category, billing_items_with_price|\n billing_items_with_price.each do |billing_item, price|\n puts \"#{billing_item_category} | #{billing_item} | $ #{price}\"\n end\n end\n puts \"-------------------------------------------------\"\n puts \"Total payable amount: $ #{total_price}\"\n puts \"Total percentage discount: $ #{discount.percentage_discounted_price}\"\n puts \"Total every hundred discount: $ #{discount.every_hundred_discount_price}\"\n puts \"Total Saving: $ #{discount.total_net_discount_price}\"\n puts \"Total net price after discount: $ #{net_payable_price}\"\n end",
"def print_receipt_for(payment)\n @data.payment = payment\n @data.invoice = Invoice.create_for_payment(payment, Invoice::RECEIPT_TYPE)\n print_common\n end",
"def print_inovice\n\tputs \"\\n----------------------------------\"\n\tputs \"| Item | Quantity | Total Price |\"\n\tputs \"----------------------------------\"\n\tsingletn_example.items_per_invoice.each do |item, quantity|\n\t\tputs \"| #{item} | #{quantity} | #{singletn_example.calculate_total_price(item, quantity)} |\"\n\t\tend\n\tputs \"----------------------------------\"\n\tputs \"\\nYou bought #{singletn_example.items_to_buy} items, and the total price is #{singletn_example.total_price}\"\nend",
"def final_bill\n total + tax + @tip_amount\n end",
"def order_print_out\n puts \"Your order is #{@the_order[0][:item_name]} with a side of #{@the_order[1][:item_name]} and #{@the_order[2][:item_name]}.\"\n puts \"Your total is $#{@the_order[0][:price] + @the_order[1][:price] + @the_order[2][:price]}.\"\n puts \"Thank you for your order.\"\n exit\nend",
"def print_receipt(user_loc, dest_loc, driver_loc, driver_name)\n receipt = \"RECEIPT GO-RIDE\\n Thank you for using Go-Ride\\n From #{user_loc} to #{dest_loc}\\n Driver name #{driver_name} from location #{driver_loc}\\n \"\n receipt += route_go_ride(user_loc,dest_loc)\n receipt += \"\\n \"\n receipt += estimate_price(user_loc,dest_loc)\n receipt\n end",
"def receipt_builder\n header = \"Item Price\\n\"\n divider = \"---- -----\\n\"\n line_items = \"\"\n @basket.keys.each do |key|\n line_items += line_item_builder(key)\n end\n end_divider = \"-----------------------------------\\n\"\n total = line_item_builder(:TOTAL)\n\n return header += divider += line_items += end_divider += total\n end",
"def total_taxes\n @total_taxes = 0\n @list.each do |item, quantity|\n @total_taxes += quantity * item.taxes\n end\n puts \"Sales Taxes: #{MONEY_FORMAT % @total_taxes}\"\n end",
"def print_products_report(toy_name,full_price,product_purchase_cnt,sales_sum,avg_price,avg_discount)\n $report_file.puts toy_name\n $report_file.puts \"*********************************\"\n $report_file.puts \"Retail price : #{full_price}\"\n $report_file.puts \"Product purchases: #{product_purchase_cnt}\"\n $report_file.puts \"Product Sales : #{sales_sum}\"\n $report_file.puts \"Average price : #{avg_price.round(2)}\"\n $report_file.puts \"Average Discount : $#{avg_discount.round(2)} \\n\\n\" \nend",
"def to_s\n \"#{@qty.to_s} #{@description}: #{(\"%.02f\" % @total).to_s}#{Constants::CR_LF}\"\n end",
"def wrt_retail_prc(price, options = {})\n format = options[:format] || 6\n $report_file.puts(\"Retail Price:\" + \"%#{format}s\" % \"$\" + price.to_s)\nend",
"def total\n subtotal + tax + shipping\n end",
"def tax_total\n self.tax_amount = line_items.inject(0.to_money) {|sum,l| sum + l.tax_amount }\n self.tax_amount\n end",
"def print_sales_rpt\n\treturn \"\n ____ _ ____ _ \n / ___| __ _| | ___ ___ | _ \\\\ ___ _ __ ___ _ __| |_ \n \\\\___ \\\\ / _` | |/ _ / __| | |_) / _ | '_ \\\\ / _ \\\\| '__| __|\n ___) | (_| | | __\\\\__ \\\\ | _ | __| |_) | (_) | | | |_ \n |____/ \\\\__,_|_|\\\\___|___/ |_| \\\\_\\\\___| .__/ \\\\___/|_| \\\\__|\n |_| \n===============================================================\\n\"\nend",
"def total_before_tax\n order.delivery_price + items_sub_total\n end",
"def total_before_tax\n self.delivery_price + self.items_sub_total\n end",
"def compute_total_and_print()\n @total_price=0\n $final_price_list.each do |element| \n @total_price = @total_price + element\n end\n @total_sales_tax=0\n $sales_tax_list.each do |element|\n @total_sales_tax = @total_sales_tax + element\n end\n puts \"Sales Tax : #{@total_sales_tax.round(2)}\"\n puts \"Total : #{@total_price.round(2)}\"\nend",
"def tax_total\n self.tax_amount = line_items.inject(::Money.new(0, self.currency || ::Money.default_currency.iso_code)) {|sum,line| sum + line.tax_amount}\n self.tax_amount\n end",
"def line_total\n (@quantity * @price + line_item_sales_tax_total).round(2)\n end",
"def get_total\n counts = convert_to_hash(@item_list)\n uniq_items = @item_list.uniq\n\n final = (@total - @sale.apply(uniq_items, counts)).round(2) # Used round for precision\n puts get_invoice + final.to_s\n final\n end",
"def subtotal\n self.cost_per_pound * self.order_quantity\n end",
"def tax_total\n self.tax_amount = line_items.inject(0.to_money) {|sum,l| sum + l.tax_amount }\n self.tax_rate # calculates average rate, leave for compatibility reasons\n self.tax_amount\n end",
"def wrt_total_sales(purchases, options = {})\n format = options[:format] || 6\n total_sales = 0.0\n purchases.each do |sale|\n total_sales += sale[\"price\"]\n end\n $report_file.puts(\"Total Sales:\" + \"%#{format}s\" % \"$\" + total_sales.to_s)\n total_sales\nend",
"def tax_total\n self.tax_amount = line_items.inject(Money.new(0, self.currency || Money.default_currency)) {|sum,l| sum + l.tax_amount }\n self.tax_rate # calculates average rate, leave for compatibility reasons\n self.tax_amount\n end",
"def total_tax\n unit_tax * quantity\n end",
"def print_register\n puts \"#{name}'s' Bank Account\"\n puts \"/\" * 40\n\n puts \"Description\".ljust(30) + \"Amount\".rjust(10)\n puts \"/\" * 40\n @transactions.each do |transaction|\n puts transaction[:description].ljust(30) + sprintf(\"%0.2f\", transaction[:amount]).rjust(10)\n end\n\n puts \"-\" * 40\n\n puts \"Ending Balance:\".ljust(30) + sprintf(\"%0.2f\", balance).rjust(10)\n puts \"-\" * 40\n end",
"def total \n\t\t@Total_bill = @bill_amount + @tip_rate_calc\t\n\t \tputs \"The total bill is £#{@Total_bill}\"\n\tend",
"def total_tax\n line_items.reduce(Money.zero) { |a, e| a + e.total_tax }\n end",
"def total\n total_price = 0.0\n cart.line_items.each do |line_item|\n if !line_item.unit_price.blank?\n total_price += line_item.unit_price.to_f\n if line_item.line_item_options\n line_item.line_item_options.each do |line_item_option|\n total_price += line_item_option.price.to_f\n end\n end\n elsif line_item.menu_section_item\n total_price += line_item.menu_section_item.price.to_f\n if line_item.menu_item_options\n line_item.menu_item_options.each do |menu_item_option|\n total_price += menu_item_option.price.to_f\n end\n end\n else\n total_price += 0\n end\n end\n tax = total_price.to_f * 0.0825\n total_price = total_price + tax\n if tip\n total_price = total_price.to_f + tip.to_f\n end\n return total_price\n end",
"def to_s\n \"Tax authority: #{@authority}\\n\" +\n \"-Sales Taxes: #{@sales_tax.to_i}% rate on all goods except #{exempt_basic}.\\n\" + \n \"-Import Duty: #{@import_duty.to_i}% rate on all imported goods.\"\n end",
"def print_item(item, spent)\n\tputs \"You added #{item.item} to your order.\"\n\tputs \"You've spent $#{(spent).round(2)}\\n\\n\"\nend",
"def basic_tax(item_name, price_of_item)\n\t\[email protected]_tax_calc(item_name, price_of_item)\n\t\tadd_item\n\tend",
"def tax\n self.delivery_tax_amount +\n order_items.inject(BigDecimal(0)) { |t, i| t + i.tax_amount }\n end",
"def add_tax_as_line_item\n raise unless @fields['x_tax']\n add_line_item :name => 'Total Tax', :quantity => 1, :unit_price => @fields['x_tax'], :tax => 0, :line_title => 'Tax'\n end",
"def sub_total\n # quantity * unit_price\n unit_price\n end",
"def show_total_cash\n \"Total: #{total_cash}\"\n end",
"def subtotal\n subtotal = purse.price * quantity\n end",
"def tax_breakdown\n global_tax_breakdown(purchase_order_items, true)\n end",
"def print\n Prawn::Document.generate(@request[:user][:name] + ' invoice.pdf') do |pdf| \n pdf.text(\"Congratulations on your purchase!\" + \"\\n\" + \"Your price was \" + @request[:po][:price].to_s) \nend\n end",
"def print_investment\n puts \"\"\n puts \"Your Investment on #{@name} (#{@short_code})\"\n puts \"-------------------------------\"\n \n puts \"Total number of shares: #{total_number_of_shares}\"\n puts \"Value: #{total_value_of_shares.round(2)}\"\n puts \"Return: $#{return_sum.round(2)} / #{increment_status} #{percentage_change.round(2)}% \"\n puts \"\"\n\n puts \"Your Transactions\"\n puts \"-------------------------------\"\n\n @transactions.each do |t|\n t.print_transaction\n puts \"\"\n end\n\n puts \"\"\n end",
"def sub_total\n (self.subtotal + self.taxes + self.shipping_cost)\n end",
"def build_total\n @pdf.move_down(25)\n\n items = []\n\n items << [\n { content: \"#{@labels[:subtotal]}:#{build_sublabel_for_total_table(:subtotal)}\", align: :left },\n { content: @document.subtotal, align: :right }\n ] unless @document.subtotal.empty?\n\n items << [\n { content: \"#{@labels[:tax]}:#{build_sublabel_for_total_table(:tax)}\", align: :left },\n { content: @document.tax, align: :right }\n ] unless @document.tax.empty?\n\n items << [\n { content: \"#{@labels[:tax2]}:#{build_sublabel_for_total_table(:tax2)}\", align: :left },\n { content: @document.tax2, align: :right }\n ] unless @document.tax2.empty?\n\n items << [\n { content: \"#{@labels[:tax3]}:#{build_sublabel_for_total_table(:tax3)}\", align: :left },\n { content: @document.tax3, align: :right }\n ] unless @document.tax3.empty?\n\n items << [\n { content: \"\\n#{@labels[:total]}:#{build_sublabel_for_total_table(:total)}\", align: :left, font_style: :bold, size: 16 },\n { content: \"\\n#{@document.total}\", align: :right, font_style: :bold, size: 16 }\n ] unless @document.total.empty?\n\n options = {\n cell_style: {\n borders: []\n },\n position: :right\n }\n\n @pdf.table(items, options) unless items.empty?\n end",
"def print_wallet\n\t\tputs \"\\n\\n\\n\"\n\t\tputs \"Your balance: #{@balance.round(2)}\"\n\tend",
"def total_without_tax\n sub_total - tax_amount\n end",
"def invoice_tax(taxable_sub_total)\n ZipCodeTax.invoice_tax(zip_code_5_digit, taxable_sub_total)\n end",
"def grand_total_sans_tax\n (subtotal_sans_tax || 0.to_money) + adjustments_sans_tax\n end",
"def tax\n order.delivery_tax_amount +\n order_items.inject(BigDecimal(0)) { |t, i| t + i.tax_amount }\n end",
"def print_balance\n # $50.00\n # \"$\" + balance.to_s + \".00\"\n \"$#{balance}.00\"\n end",
"def total_with_tax\n total = 0\n @cart_items.each do |item|\n total += item.total_price\n end\n return total\n end",
"def print_order\n p \"@@@@@@@@@ Order id: ##{order.attrs['id']}\"\n p \"Name: #{order.attrs['name']} Email: #{order.attrs['email']}\"\n p \"Status: #{order.attrs['status']}\"\n\n conn = DatabaseConnector.new.connect\n rs = conn.exec \"select li.*, products.name from line_items as li INNER JOIN products on li.product_id = products.id where li.order_id = '#{order.attrs['id']}'\"\n\n char_len = 30\n rs.each do |row|\n prod_name = \"#{row['id']} : #{row['name']}\"\n\n p \"#{prod_name} #{'-'*(char_len - prod_name.length)}---> #{row['amount']} X #{row['quantity']} = #{row['amount'].to_f * row['quantity'].to_i}\"\n end\n p '-'*55\n if order.attrs['discont_desc'] != ''\n p \"Sub Total #{'-'*25} -> #{order.attrs['sub_total']}\"\n p \"Coupon #{'-'*25} -> #{order.attrs['discont_desc']}\"\n p \"You Saved #{'-'*25} -> #{order.attrs['amount'].to_i - order.attrs['sub_total'].to_i}\"\n p '-'*55\n end\n p \"Total #{'-'*25} -> #{order.attrs['amount']}\"\n end",
"def receipt\n receipt_pdf.render\n end",
"def wrt_brand_tot_sales(brand_tot_sales, format = 6)\n $report_file.puts(\"Total Sales:\" + \"%#{format}s\" % \"$\" + brand_tot_sales.to_s)\nend",
"def total\n total = with_product_discounts\n total = with_basket_discounts(total)\n return \"£#{total}\"\n end",
"def show_contents_of_the_cart\n puts \"You currently have the following items:\n\n #{@inventory}\n\n Total cart value: €#{@total_cart_value}\n \"\nend",
"def print_list(grocery_list)\n line_width = 30\n puts\n puts ('Grocery List'.center(line_width))\n puts\n puts (\"ITEMS\".ljust(line_width/2)) + \"QTY\".rjust(line_width/2)\n puts (\"------------------------------\").center(line_width)\n grocery_list.each { |item, quantity| \n puts (item.ljust(line_width/2)) + quantity.to_s.rjust(line_width/2)\n puts (\"------------------------------\") }\nend",
"def print_pretty (list)\n puts \"Grocery list\".upcase.center(50)\n puts \"-----------------\".center(50)\n list.each do |item,quantity|\n puts item.rjust(25) + \":\" + quantity.to_s.ljust(25) \n end\nend",
"def total\n total_cost = 0\n \n # Summing up the product cost\n @products.each do |item, cost|\n total_cost += cost\n end\n \n # Calculate a 7.5% tax\n total_order_cost = total_cost * 1.075\n \n # Rounding the result to two decimal places\n return total_order_cost.round(2)\n end",
"def sub_total_price\n line_items.inject(0) {|sum, item| sum += item.price * item.qty }\n end",
"def print_pretty(new_list)\n puts \"Grocery List:\"\n new_list.each do |item, amount|\n \n puts \"#{item}: #{amount}\"\n end\nend",
"def get_subtotal\n if is_a_review?\n user_visibility = :peer_visible\n else\n user_visibility = :ta_visible\n end\n Result.get_subtotals([self.id], user_visibility: user_visibility)[self.id]\n end",
"def totals_table\n strings = []\n strings << \"#{@labels[:subtotal]}:\"\n strings << @document.subtotal\n strings << \"#{@labels[:tax]}:\"\n strings << @document.tax\n strings << \"#{@labels[:tax2]}:\"\n strings << @document.tax2\n strings << \"#{@labels[:tax3]}:\"\n strings << @document.tax3\n strings << \"#{@labels[:total]}:\"\n strings << @document.total\n strings\n end",
"def print_details\n puts \"#{self.reader.name} subscribed to #{self.magazine.title} for $#{self.price}\"\n end",
"def sub_total\n sum = 0\n line_items.each do |line_item|\n sum += line_item.total_price\n end\n sum\n end",
"def print_pay_stub\n print_name\n pay_for_period = (@salary / 365.0) * 14\n formatted_pay = format(\"%.2f\", pay_for_period)\n puts \"Pay for this period: $#{formatted_pay}\"\n end",
"def print_products\n$report_file.puts \"\n\n | | | |\n _ __ _ __ ___ __| |_ _ ___| |_ ___\n| '_ \\\\| '__/ _ \\\\ / _` | | | |/ __| __/ __|\n| |_) | | | (_) | (_| | |_| | (__| |_\\\\__ \\\\\n| .__/|_| \\\\___/ \\\\__,_|\\\\__,_|\\\\___|\\\\__|___/\n| |\n|_|\n\t \t\t\t\t\t\t\t\t\t\"\nend",
"def subtotal\n line_items.reduce(BigDecimal(\"0\")) { |result, item| result += item.amount }\n end",
"def print_brands_report(sub_array)\n $report_file.puts sub_array[0]\n $report_file.puts \"*********************************\"\n $report_file.puts \"Toys in Stock: #{sub_array[1]}\"\n $report_file.puts \"Average price: #{sub_array[2].round(2)}\"\n $report_file.puts \"Total Revenue: #{sub_array[3].round(2)} \\n\\n\"\nend",
"def print_register\n\t\tputs \"#{name}'s Bank Account\"\n\t\tputs \"-\" * 40\n\n\t\t#prints the description and amount of each transaction in the transaction hash.\n\t\t#applies left formatting and right formatting (ljust(x)/rjust(x))\n\t\tputs \"Description\".ljust(30) + \"Amount\".rjust(10)\n\t\[email protected] do |transaction|\n\t\t\tputs transaction[:description].ljust(30) + sprintf(\"%0.2f\", transaction[:amount]).rjust(10)\n\t\tend\n\n\t\t#prints ending balance after all transactions calculated\n\t\tputs \"-\" * 40\n\t\tputs \"Balance:\".ljust(30) + sprintf(\"%0.2f\", balance).rjust(10)\n\t\tputs \"-\" * 40\n\tend",
"def dump\n info \"販売価格:#{@sell_price},買取価格:#{@purchase_price},利益:#{@yield}\\n\"\n #ap \"販売価格:#{@sell_price}\\n買取価格:#{@purchase_price}\\n利益:#{@yield}\\n\"\n end",
"def test_credit_note_sub_total_calculation2\n credit_note = create_test_credit_note\n line_item = credit_note.line_items.first\n\n # Make sure that everything adds up to begin with.\n expected_total_tax = credit_note.line_items.inject(BigDecimal('0')) { | sum, l | l.tax_amount }\n assert_equal(expected_total_tax, credit_note.total_tax)\n\n # Change the tax_amount of the first line item and make sure that\n # everything still continues to add up.\n line_item.tax_amount = line_item.tax_amount + 10\n assert_not_equal(expected_total_tax, credit_note.total_tax)\n expected_total_tax = credit_note.line_items.inject(BigDecimal('0')) { | sum, l | l.tax_amount }\n assert_equal(expected_total_tax, credit_note.total_tax)\n end",
"def view_cart\n cart_total = 0.00\n puts \"--------CART------------\"\n @cart.each_with_index do |product, index|\n print \"#{index + 1}. #{product[:product]} - \"\n puts \"$#{product[:price]}\"\n cart_total += product[:price]\n end\n puts \"------------------------\"\n puts \"Cart Subtotal: $#{cart_total.round(2)}\"\n tax = cart_total * 0.068\n puts \"Tax: $#{tax.round(2)}\"\n puts \"Cart Total: $#{(cart_total + tax).round(2)}\"\n puts \"___________________________________________________________________________________\"\n puts \"To remove a product, enter the item number. Or, enter M to return to the Main Menu.\"\n user_input = gets.strip\n if user_input == \"M\"\n menu\n else\n user_input = user_input.to_i\n remove_product(user_input - 1)\n end\nend",
"def text_pq_taxes(pq)\n\t \titf = pq[:priced_itinerary][:air_itinerary_pricing_info][:itin_total_fare]\n\t \ttaxes = itf[:taxes][:tax_breakdown_code]\n\t \treturn \"#{itf[:taxes][:tax][:@tax_code]} #{taxes.join(\" \")}\"\n\t end",
"def show_item_receipt(*items)\n item_data = []\n # Extract first and last element if meant to be label and balance\n label = items[0].is_a?(String) ? items.shift : $game_map.marw_label_default\n balance = items[-1].is_a?(Integer) ? items.pop : 0\n # Cycle through items and properly format them\n for item in items do item_data << marw_format_item_array(item) end\n $game_map.show_receipt_window(label, item_data, balance)\n end",
"def sub_total\n return ApplicationHelper.round_currency(self.line_items.inject(BigDecimal('0.0')) { |sum, li| sum + li.price })\n end",
"def obvious_total(subtotal:, tax:, discount:)\r\n subtotal + tax - discount\r\nend",
"def subtotal\r\n\t\[email protected](0.0) { |sum, i| sum + i.total_unit_price * i.quantity }\r\n\tend",
"def order_total(items)\r\n order_total = 0\r\n for item in items\r\n order_total += item.total_cost\r\n end\r\n puts \"Order Total: $#{'%.2f' % order_total}\"\r\n end",
"def print_details\n puts \"#{self.reader.name} subscribed to #{self.magazine.title} for $#{self.price}\"\n end",
"def wrt_total_purchs(count, options = {})\n format = options[:format] || 6\n $report_file.puts(\"Total Purchases:\" + \"%#{format}s\" % count.to_s)\nend",
"def grand_total\n order_lines.inject(Money.new(0)) { |grand_total, line| grand_total + line.total_price }\n end",
"def make_and_print_receipt(printer,file)\n OpenReceiptPdf.new(@bill)\n PaperPrinter.print(printer, file)\n end",
"def subtotal\n subtotal = (self.quantity) * (self.product.price)\n return subtotal.round(2)\n end",
"def print_order(order)\n\tputs \"Here are the items you've ordered:\"\n\torder.each {|food| puts \"#{food.item}: $#{food.price}\\n\\tcalories: #{food.calories}\\tfat: #{food.fat} g\\tcarbs: #{food.carbs} g\"}\nend",
"def subtotal1\n @subtotal1 = @uomd + @clean\n end",
"def total\n order_total + delivery_price + (prices_include_tax ? 0 : tax_amount)\n end"
] | [
"0.7870939",
"0.7563667",
"0.74841064",
"0.7356885",
"0.7351116",
"0.7048002",
"0.6943587",
"0.67912364",
"0.6623164",
"0.65846133",
"0.6542026",
"0.649616",
"0.6488499",
"0.64805835",
"0.64302003",
"0.63383734",
"0.6276925",
"0.6274041",
"0.6178592",
"0.61612684",
"0.6101983",
"0.60938686",
"0.6069557",
"0.6026327",
"0.60252774",
"0.60079247",
"0.5989713",
"0.59824073",
"0.5974529",
"0.5969859",
"0.5963611",
"0.5956141",
"0.59476775",
"0.593187",
"0.5908099",
"0.59029603",
"0.5897767",
"0.5891487",
"0.5886286",
"0.58476436",
"0.58251196",
"0.58234644",
"0.5820445",
"0.5817669",
"0.5815345",
"0.58102524",
"0.580441",
"0.5800326",
"0.5788909",
"0.5786771",
"0.57819027",
"0.57817096",
"0.57807106",
"0.57728827",
"0.57671887",
"0.5760833",
"0.5754376",
"0.5744178",
"0.5740189",
"0.5714291",
"0.57121253",
"0.57110995",
"0.5710852",
"0.5710017",
"0.5707284",
"0.5677873",
"0.56603223",
"0.56587535",
"0.5658312",
"0.56500345",
"0.56467843",
"0.56418175",
"0.56398803",
"0.5636093",
"0.56230754",
"0.56221884",
"0.561859",
"0.56167865",
"0.56158423",
"0.5607499",
"0.5605302",
"0.55887586",
"0.55795985",
"0.5559222",
"0.5558751",
"0.55539477",
"0.5552806",
"0.5547133",
"0.5544895",
"0.5541684",
"0.55382746",
"0.5535822",
"0.55349594",
"0.55316275",
"0.5530812",
"0.5530026",
"0.5525168",
"0.55249083",
"0.5524313",
"0.55218995"
] | 0.7065686 | 5 |
this method is invoked, when `all_link` fields is being resolved | def all_links
Link.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_all_links_attributes\n # Interface method\n end",
"def resolve_all_links()\n @links.each_value { |lnk|\n set_link_target(lnk) if lnk.target.nil?\n }\n end",
"def resolve_all_links()\n @flows.each_value { |f|\n f.resolve_all_links()\n }\n end",
"def resolve_all_links()\n @tasks.each_value { |t|\n t.resolve_all_links()\n }\n @prepared = true\n end",
"def link_fields\n self.class._module.link_fields\n end",
"def fetch_links!\n return if content_id.blank?\n\n links = Services.publishing_api.get_links(content_id)[\"links\"]\n\n self.lead_organisation_content_ids = links[\"lead_organisations\"] || []\n self.organisation_content_ids = links[\"organisations\"] || []\n self.people_content_ids = links[\"people\"] || []\n self.working_group_content_ids = links[\"working_groups\"] || []\n end",
"def links; end",
"def links; end",
"def show_all_link?\n @show_all_link\n end",
"def processLinks\n if params[:plant][:links_attributes]\n for i in 0..2\n @curLink = @plant.links[i]\n\n if !params[:plant][:links_attributes][i.to_s][:name].empty?\n @curLink.name = params[:plant][:links_attributes][i.to_s][:name]\n end\n if !params[:plant][:links_attributes][i.to_s][:link].empty?\n @curLink.link = params[:plant][:links_attributes][i.to_s][:link]\n end\n end\n end\n end",
"def links\n each_link.to_set\n end",
"def prepare_links!\n links_def = find_links_definition or return\n \n links_def.rel2block.each do |link|\n links.update_link(Feature::Hypermedia::Hyperlink.new.tap do |hyperlink| # create Hyperlink representer.\n hyperlink.rel = link[:rel]\n hyperlink.href = run_link_block(link[:block])\n end)\n end\n end",
"def links_feed\n end",
"def link_address_props\n if link\n link.address_props\n end\n end",
"def update_table_links\n if !self.insurance_billing_id.blank?\n self.provider_id = self.insurance_billing.provider_id\n self.group_id = self.insurance_billing.group_id\n self.patient_id = self.insurance_billing.patient_id\n self.subscriber_id = self.insurance_billing.subscriber_id\n self.insurance_company_id = self.insurance_billing.insurance_company_id\n end\n end",
"def normalize_fields!\n # TODO: normalize Array of Symbol, String or DM::Property\n\n # TODO: loop over fields, and if the resource doesn't match\n # self.resource, append the property's resource to @links\n # eg:\n #if property.resource != self.resource\n # @links << discover_path_for_property(property)\n #end\n end",
"def update_link_definitions(link_defs); end",
"def links\n @links = super || []\n end",
"def display_link_attributes(link)\n # Interface method\n end",
"def parse_links_hash(link_hash_arrays)\n link_hash_arrays.each do |link_array|\n \n unless (link_array.has_key?(\"Link\"))\n next\n end\n \n # Loop thru each link pulled from XML\n (link_array[\"Link\"]).each do |link_hash|\n \n # Select or Insect Link\n puts \"Searching for link #{link_hash['title']}, entity_a: #{link_hash['entity_a']}, entity_b: #{link_hash['entity_b']}\"\n result = Link.select_or_insert(@project_id, @section_id, link_hash['entity_a'], link_hash['entity_b'], link_hash['title'])\n result.save\n puts \"Result: #{result.inspect}\"\n \n # Select or Insert LinkType\n if (link_hash.has_key?(\"type\"))\n puts \"Searching for link type #{link_hash['type']}\"\n type_result = LinkType.select_or_insert(link_hash['type'])\n type_result.save\n puts \"Result: #{type_result.inspect}\"\n \n puts \"Setting entity type for link\"\n result.link_type_id = type_result.id\n result.save\n puts \"Done.\" \n end\n \n ## Other fields???\n ## Description\n if (link_hash.has_key?(\"description\")) \n ## TODO: if / when needed \n end\n ## Title\n if (link_hash.has_key?(\"title\"))\n ## TODO: if/when needed\n end\n \n ## Logic for attributes\n if (link_hash.has_key?(\"AdditionalField\"))\n (link_hash[\"AdditionalField\"]).each do |add_field|\n field_name = add_field['name']\n field_value = add_field['value']\n puts \"[DEBUG] name: #{field_name} value: #{field_value}\"\n \n ## Insert attribute field if not exists\n link_field = PoortegoLinkField.select_or_insert(result.id, field_name)\n link_field.save\n \n ## Set attribute field\n link_field.update_attributes('value' => field_value)\n link_field.save\n end \n end\n end\n end\n end",
"def render_link\n values.map { |v| link(link_field, v) }\n end",
"def links=(value)\n @links = value\n end",
"def links=(value)\n @links = value\n end",
"def links=(value)\n @links = value\n end",
"def all_links\n self.fulltext_links + self.non_fulltext_links\n end",
"def linkPages\n @all_pages.each_value do |one_page|\n one_page.addPageLinks\n end\n @all_pages.each_value do |one_page|\n one_page.addMissingLinkNames\n end\n end",
"def activate_links(fields, types)\n fields.each do |field|\n field[:type] = activate_field_links(field[:type], types, auto_link: true) if field[:type]\n field[:note] = activate_field_links(field[:note], types) if field[:note]\n field[:description] = activate_field_links(field[:description], types) if field[:description]\n end\n end",
"def meta_links\n @meta_links ||= @internal_struct[:meta_links]\n end",
"def links\n links = []\n result = self.perform\n links = result.ft_links\n end",
"def all\n @all ||= raw.map { |link| URL.absolutify(link, base_url) }.compact.uniq\n end",
"def filter_link_helper_all(text, filter_params={}, other_params={}, opts={})\n filter_link_helper(text, filter_params.merge(ErrataFilter::FILTER_DEFAULTS_ALL), other_params, opts)\n end",
"def my_links\n end",
"def links\n @links ||= lambda do \n raw_links.map do |link|\n hash = {}\n link.keys.each do |key|\n hash[key] = link[key]\n end\n hash\n end\n end.call\n end",
"def links\n return nil unless @item and self.type == :query and @item['entry']['link']\n @item['entry']['link']\n end",
"def links\n valid_link_keys = %w(mandate new_customer_bank_account organisation parent_event payment payout previous_customer_bank_account refund subscription )\n valid_links = (@links || {}).select { |key, _| valid_link_keys.include?(key) }\n\n links_class = Struct.new(\n *{\n\n mandate: '',\n\n new_customer_bank_account: '',\n\n organisation: '',\n\n parent_event: '',\n\n payment: '',\n\n payout: '',\n\n previous_customer_bank_account: '',\n\n refund: '',\n\n subscription: ''\n\n }.keys\n ) do\n def initialize(hash)\n hash.each do |key, val|\n send(\"#{key}=\", val)\n end\n end\n end\n links_class.new(valid_links)\n end",
"def parse_link_definition; end",
"def links(type = :local)\n @links = type == :all ? @all_links : @local_links\n end",
"def lists\n @links = Link.all\n @short_link = ActionMailer::Base.default_url_options[:host]\n end",
"def links\n\t\t( 0...self.link_count ).collect do |i|\n\t\t\tself.link( i )\n\t\tend\n\tend",
"def update_page_links(links) # :nodoc:\n ATTRIBUTES.each do |attr|\n self.send(:\"#{attr}_page_uri=\", links.send(:\"#{attr}\"))\n self.send(:\"#{attr}_page=\", links.send(:\"#{attr}\"))\n end\n end",
"def links\n @mandate_import_entry_links ||= Links.new(@links)\n end",
"def all_links\n Link.all.order(id: :desc)\n end",
"def show_links\n source_archives = []\n source_surveys = []\n source_scripts = []\n target_archives = []\n target_surveys = []\n target_scripts = []\n #publications link to something, not from\n @publications = []\n case params[:link_state]\n when \"mine\"\n links = Link.find(:all, :conditions => { :subject_type => \"Csvarchive\", :subject_id => params[:extract_id], :predicate => \"link\", :user_id => current_user.id })\n links.each do |link|\n case link.object.class.name\n when \"Csvarchive\"\n source_archives.push(link.object)\n when \"Script\"\n source_scripts.push(link.object)\n when \"Survey\"\n source_surveys.push(link.object)\n when \"Publication\"\n @publications.push(link.object)\n end\n \n target_links = Link.find(:all, :conditions => { :object_type => \"Csvarchive\", :object_id => params[:extract_id], :predicate => \"link\", :user_id => current_user.id })\n target_links.each do |link|\n case link.subject.class.name\n when \"Csvarchive\"\n target_archives.push(link.subject)\n when \"Script\"\n target_scripts.push(link.subject)\n when \"Survey\"\n target_surveys.push(link.subject)\n end\n end\n end\n @archives = source_archives | target_archives\n @scripts = source_scripts | target_scripts\n @surveys = source_surveys | target_surveys\n when \"all\"\n links = Link.find(:all, :conditions => { :subject_type => \"Csvarchive\", :subject_id => params[:extract_id], :predicate => \"link\"})\n links.each do |link|\n case link.object.class.name\n when \"Csvarchive\"\n source_archives.push(link.object)\n when \"Script\"\n source_scripts.push(link.object)\n when \"Survey\"\n source_surveys.push(link.object)\n when \"Publication\"\n @publications.push(link.object)\n end\n \n target_links = Link.find(:all, :conditions => { :object_type => \"Csvarchive\", :object_id => params[:extract_id], :predicate => \"link\"})\n target_links.each do |link|\n case link.subject.class.name\n when \"Csvarchive\"\n target_archives.push(link.subject)\n when \"Script\"\n target_scripts.push(link.subject)\n when \"Survey\"\n target_surveys.push(link.subject)\n end\n end\n end\n @archives = source_archives | target_archives\n @scripts = source_scripts | target_scripts\n @surveys = source_surveys | target_surveys\n end\n \n render :update do |page|\n page.replace_html \"links\",:partial=>\"assets/link_view\",:locals=>{:archives=>@archives, :scripts=>@scripts,:surveys=>@surveys,:publications=>@publications}\n end\n end",
"def check_resolvers\n done = @resolver_manager.done\n done.each do |entry, resolver|\n if resolver.successful?\n @link_table.remove(entry)\n\n resolver.result.each do |resolvable|\n entry = LinkTable::Entry.new(resolvable.link)\n entry.status = resolvable.status\n entry.name = resolvable.name\n entry.hoster = resolvable.hoster\n entry.size = resolvable.size\n @link_table.add(entry)\n end\n else\n entry.status.error!(resolver.message)\n @link_table.update(entry)\n end\n end\n end",
"def link_fieldlet\n\t\t\t@fieldlets[self.class::LINK_FIELDLET]\n\t\tend",
"def create_links\n end",
"def create_links\n end",
"def links\n metadata[:links] || Set.new\n end",
"def visit_links\n @link_rules.accept\n end",
"def links\n valid_link_keys = %w(creditor creditor_bank_account )\n valid_links = (@links || {}).select { |key, _| valid_link_keys.include?(key) }\n\n links_class = Struct.new(\n *{\n\n creditor: '',\n\n creditor_bank_account: ''\n\n }.keys\n ) do\n def initialize(hash)\n hash.each do |key, val|\n send(\"#{key}=\", val)\n end\n end\n end\n links_class.new(valid_links)\n end",
"def provided_service_links\n links.joins(:service).merge(provided_services)\n end",
"def provided_service_links\n links.joins(:service).merge(provided_services)\n end",
"def prepare_links!(*args)\n # TODO: move this method to _links or something so it doesn't need to be called in #serialize.\n compile_links_for(link_configs, *args).each do |lnk|\n links.add(lnk) # TODO: move to LinkCollection.new.\n end\n end",
"def links\n @data[\"_links\"]\n end",
"def each(&block)\n @lock.synchronize do\n @links.each(&block)\n end\n end",
"def links(options={})\n options = {:get_dataset => false, :type => Ecore::Link, :reload => false, :preconditions => {:hidden => false}}.merge(options)\n return @links_chache if @links_chache and !options[:get_dataset] and !options[:reload]\n query = Ecore::db[options[:type].table_name].store_preconditions((@group_ids || @user_id),self.class.get_type_if_has_superclass,self,nil,(options[:preconditions] || {:hidden => false}))\n query = query.where(:orig_document_id => id)\n return query if options[:get_dataset]\n @links_chache = query.order(:name,:created_at).receive(:all)\n end",
"def refresh_from_freshbooks\n fb_invoice = self.freshbooks_invoice\n self.public_link = fb_invoice['links']['client_view']\n self.internal_link = fb_invoice['links']['view']\n end",
"def links\n @links ||= []\n @links\n end",
"def links\n return @links\n end",
"def links\n return @links\n end",
"def links\n return @links\n end",
"def links\n typed_set(entities, Occi::Core::Link)\n end",
"def update_page_links(links) # :nodoc:\n ATTRIBUTES.each do |attr|\n send(:\"#{attr}_page_uri=\", links.send(:\"#{attr}\"))\n send(:\"#{attr}_page=\", parse_page_number(links.send(:\"#{attr}\")))\n end\n end",
"def rebuild_and_save_links\n fail NoAliasWithHostPresentError if alias_with_host.blank?\n\n conference_id = alias_with_host[/BVA(\\d+)@/, 1]\n link_service = VirtualHearings::LinkService.new(conference_id)\n\n # confirm that we extracted the conference ID correctly,\n # and that the original link was generated with the link service\n if link_service.alias_with_host != alias_with_host ||\n link_service.host_pin != host_pin_long ||\n link_service.guest_pin != guest_pin_long\n fail LinkMismatchError\n end\n\n update!(host_hearing_link: link_service.host_link, guest_hearing_link: link_service.guest_link)\n end",
"def links\n @event_links ||= Links.new(@links)\n end",
"def links=(new_links)\n @links = new_links\n end",
"def links\n data['links']\n end",
"def links\n @links.values\n end",
"def parameters\n resolve_parameters(link_schema['href'].scan(PARAMETER_REGEX))\n end",
"def update_link_definitions(link_defs)\n link_defs.each {|k, v| @link_defs[normalize_link_id(k)] = v }\n end",
"def parse_link; end",
"def links\n valid_link_keys = %w(mandate )\n valid_links = (@links || {}).select { |key, _| valid_link_keys.include?(key) }\n\n links_class = Struct.new(\n *{\n\n mandate: ''\n\n }.keys\n ) do\n def initialize(hash)\n hash.each do |key, val|\n send(\"#{key}=\", val)\n end\n end\n end\n links_class.new(valid_links)\n end",
"def normalize_links!\n # TODO: normalize Array of Symbol, String, DM::Property 1-jump-away or DM::Query::Path\n end",
"def link\n @link\n end",
"def send_early_hints(links); end",
"def adopt_dependencies\n super if defined? super\n # Get the available attributes from the PageRef\n # Translate what the PageRef is offering into our attributes\n accept_attribute :picurl, page_ref.picurl if page_ref.picurl_ready?\n accept_attribute :title, page_ref.title if page_ref.title_ready?\n accept_attribute :description, page_ref.description if page_ref.description_ready?\n end",
"def links()\n return @links\n end",
"def update_links\n return if self.suppress_recreate_trigger == true\n \n marc_foreign_objects = Hash.new\n \n # All the allowed relation types *must* be in this array or they will be dropped\n allowed_relations = [\"people\", \"standard_titles\", \"standard_terms\", \"institutions\", \"catalogues\", \"liturgical_feasts\", \"places\"]\n \n # Group all the foreign associations by class, get_all_foreign_associations will just return\n # a flat list of objects\n marc.get_all_foreign_associations.each do |object_id, object|\n next if object.is_a? Source\n \n foreign_class = object.class.name.pluralize.underscore\n marc_foreign_objects[foreign_class] = [] if !marc_foreign_objects.include? (foreign_class)\n \n marc_foreign_objects[foreign_class] << object\n \n end\n \n # allowed_relations explicitly needs to contain the classes we will repond to\n # Log if in the Marc there are \"unknown\" classes, should never happen\n unknown_classes = marc_foreign_objects.keys - allowed_relations\n # If there are unknown classes purge them\n related_classes = marc_foreign_objects.keys - unknown_classes\n \n if !unknown_classes.empty?\n puts \"Tried to relate with the following unknown classes: #{unknown_classes.join(',')}\"\n end\n \n related_classes.each do |foreign_class|\n relation = self.send(foreign_class)\n \n # The foreign class array holds the correct number of object\n # We want to delete or add only the difference betweend\n # what is in marc and what is in the DB relations\n new_items = marc_foreign_objects[foreign_class] - relation.to_a\n remove_items = relation.to_a - marc_foreign_objects[foreign_class]\n \n # Delete or add to the DB relation\n relation.delete(remove_items)\n relation << new_items\n\n # If this item was manipulated, update also the src count\n # Unless the suppress_update_count is set\n if !self.suppress_update_count_trigger\n (new_items + remove_items).each do |o|\n o.update_attribute( :src_count, o.sources.count )\n end\n end\n \n end\n \n # update the parent manuscript when having 773/772 relationships\n update_77x unless self.suppress_update_77x_trigger == true \n end",
"def attachment_links()\n @attachment_links ||= AttachmentLink.where(\"master_id = ? AND master_type = ?\", id, class_name).limit(attachments_count)\n end",
"def handle_association_links\n @type = @normalized_type = @subtype\n obj = model.with_pk(@type, request, request.id)\n association_links(obj)\n end",
"def check_only_links\n end",
"def initialize\n super\n select @all\n end",
"def external_link_inventory # make this an object attribute for every page object, along with base url, and other helpful state info\n []\n end",
"def all\n \n end",
"def _all; end",
"def each_defaultable_reference\n # visit ReceivedEventParameters first\n rep = received_event_parameters\n yield rep if rep\n # add other dependent defaults\n super { |dep| yield dep unless ReceivedEventParameters === dep }\n end",
"def non_fulltext_links\n links = []\n other_customlinks = @record.fetch('CustomLinks',{})\n if other_customlinks.count > 0\n other_customlinks.each do |other_customlink|\n link_url = other_customlink['Url']\n link_label = other_customlink['Text']\n link_icon = other_customlink['Icon']\n links.push({url: link_url, label: link_label, icon: link_icon, type: 'customlink-other'})\n end\n end\n\n links\n end",
"def links\n json_hyperschema[\"links\"] || []\n end",
"def links\n @mandate_links ||= Links.new(@links)\n end",
"def relationship_links(source)\n {}\n end",
"def prepare_links!(*args)\n compile_links_for(_link_configs, *args).each do |link| \n rel = link.delete :rel\n links[rel] = link\n end\n end",
"def include_links!\n return if options[:links] == false\n key = configuration_for(:links).fetch :key, :_links\n prepare_links!\n @node.merge!(key => links) if links.any?\n end",
"def save_results\n unless self.options[:disable_save] == true\n self.final_path.inject(nil) do |previous, link|\n unless previous.nil? || previous.element.bacon_link.present?\n previous.element.update_attribute(:bacon_link_id, link.element.id)\n end\n link\n end\n end\n\n self.final_path\n end",
"def related_fields(method)\n \n end",
"def create_attribute_links__clone_if_needed\n return if self.port_links.empty?\n sp_hash = {\n cols: [:id, :display_name, :group_id, :input_id, :output_id],\n filter: [:oneof, :id, self.port_links.map(&:id)]\n }\n port_link_mh = self.port_links.first.id_handle.createMH\n Model.get_objs(port_link_mh, sp_hash).each do |port_link|\n port_link.create_attribute_links__clone_if_needed(self.target.id_handle, set_port_link_temporal_order: true)\n end\n end",
"def initialize(link_options={})\n @id = link_options[\"id\"]\n @assignment_id = link_options[\"assignment_id\"] \n @link = link_options[\"link\"]\n @type = link_options[\"type\"]\n end",
"def links\n if @links.blank?\n @links = []\n link_nodes =\n FeedTools::XmlHelper.combine_xpaths_all(self.channel_node, [\n \"atom10:link\",\n \"atom03:link\",\n \"atom:link\",\n \"link\",\n \"channelLink\",\n \"a\",\n \"url\",\n \"href\"\n ])\n for link_node in link_nodes\n link_object = FeedTools::Link.new\n link_object.href = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@atom10:href\",\n \"@atom03:href\",\n \"@atom:href\",\n \"@href\",\n \"text()\"\n ], :select_result_value => true)\n if link_object.href == \"atom10:\" ||\n link_object.href == \"atom03:\" ||\n link_object.href == \"atom:\"\n link_object.href = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@href\"\n ], :select_result_value => true)\n end\n if link_object.href.nil? && link_node.base_uri != nil\n link_object.href = \"\"\n end\n begin\n if !(link_object.href =~ /^file:/) &&\n !FeedTools::UriHelper.is_uri?(link_object.href)\n link_object.href = FeedTools::UriHelper.resolve_relative_uri(\n link_object.href,\n [link_node.base_uri, self.base_uri])\n end\n rescue\n end\n if self.configurations[:url_normalization_enabled]\n link_object.href =\n FeedTools::UriHelper.normalize_url(link_object.href)\n end\n link_object.href.strip! unless link_object.href.nil?\n next if link_object.href.blank?\n link_object.hreflang = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@atom10:hreflang\",\n \"@atom03:hreflang\",\n \"@atom:hreflang\",\n \"@hreflang\"\n ], :select_result_value => true)\n if link_object.hreflang == \"atom10:\" ||\n link_object.hreflang == \"atom03:\" ||\n link_object.hreflang == \"atom:\"\n link_object.hreflang = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@hreflang\"\n ], :select_result_value => true)\n end\n unless link_object.hreflang.nil?\n link_object.hreflang = link_object.hreflang.downcase\n end\n link_object.rel = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@atom10:rel\",\n \"@atom03:rel\",\n \"@atom:rel\",\n \"@rel\"\n ], :select_result_value => true)\n if link_object.rel == \"atom10:\" ||\n link_object.rel == \"atom03:\" ||\n link_object.rel == \"atom:\"\n link_object.rel = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@rel\"\n ], :select_result_value => true)\n end\n unless link_object.rel.nil?\n link_object.rel = link_object.rel.downcase\n end\n if link_object.rel.nil? && self.feed_type == \"atom\"\n link_object.rel = \"alternate\"\n end\n link_object.type = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@atom10:type\",\n \"@atom03:type\",\n \"@atom:type\",\n \"@type\"\n ], :select_result_value => true)\n if link_object.type == \"atom10:\" ||\n link_object.type == \"atom03:\" ||\n link_object.type == \"atom:\"\n link_object.type = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@type\"\n ], :select_result_value => true)\n end\n unless link_object.type.nil?\n link_object.type = link_object.type.downcase\n end\n link_object.title = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@atom10:title\",\n \"@atom03:title\",\n \"@atom:title\",\n \"@title\",\n \"text()\"\n ], :select_result_value => true)\n if link_object.title == \"atom10:\" ||\n link_object.title == \"atom03:\" ||\n link_object.title == \"atom:\"\n link_object.title = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@title\"\n ], :select_result_value => true)\n end\n # This catches the ambiguities between atom, rss, and cdf\n if link_object.title == link_object.href\n link_object.title = nil\n end\n link_object.length = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@atom10:length\",\n \"@atom03:length\",\n \"@atom:length\",\n \"@length\"\n ], :select_result_value => true)\n if link_object.length == \"atom10:\" ||\n link_object.length == \"atom03:\" ||\n link_object.length == \"atom:\"\n link_object.length = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@length\"\n ], :select_result_value => true)\n end\n if !link_object.length.nil?\n link_object.length = link_object.length.to_i\n else\n if !link_object.type.nil? && link_object.type[0..4] != \"text\" &&\n link_object.type[-3..-1] != \"xml\" &&\n link_object.href =~ /^http:\\/\\//\n # Retrieve the length with an http HEAD request\n else\n link_object.length = nil\n end\n end\n @links = [] if @links.nil?\n @links << link_object\n end\n end\n return @links\n end",
"def linking?\n self.reload\n self.linkbutton\n end"
] | [
"0.6749465",
"0.6597194",
"0.6500291",
"0.6248242",
"0.614917",
"0.59466434",
"0.5890828",
"0.5890828",
"0.58584404",
"0.5809817",
"0.58008504",
"0.575754",
"0.5689029",
"0.5662376",
"0.5653467",
"0.56521267",
"0.56231433",
"0.5621134",
"0.55996567",
"0.5583648",
"0.55276924",
"0.55187035",
"0.55187035",
"0.55187035",
"0.5511164",
"0.5501309",
"0.54944414",
"0.5479475",
"0.54637593",
"0.5428189",
"0.54201937",
"0.5414532",
"0.54084843",
"0.54083526",
"0.5386108",
"0.5382795",
"0.5353239",
"0.53496414",
"0.5346804",
"0.5338208",
"0.53165203",
"0.52961355",
"0.5279946",
"0.52738243",
"0.5272511",
"0.5267913",
"0.5267913",
"0.526626",
"0.52620536",
"0.5260354",
"0.524781",
"0.524781",
"0.52469784",
"0.52469325",
"0.52453464",
"0.5241268",
"0.52299494",
"0.5225802",
"0.5217897",
"0.5217897",
"0.5217897",
"0.5210079",
"0.52062",
"0.51901084",
"0.5168514",
"0.51669884",
"0.5155732",
"0.51522136",
"0.5142349",
"0.51331776",
"0.51323223",
"0.5130555",
"0.5128992",
"0.51204795",
"0.51157135",
"0.51094025",
"0.5106846",
"0.5099957",
"0.50985354",
"0.5093265",
"0.50896937",
"0.50832826",
"0.5074921",
"0.50658643",
"0.506376",
"0.50624424",
"0.50545055",
"0.5052356",
"0.5044936",
"0.50396675",
"0.5035284",
"0.5030372",
"0.5027332",
"0.5024258",
"0.5022909",
"0.50062335",
"0.5004718",
"0.5003942"
] | 0.59888256 | 7 |
def fact(n) if n <= 1 n else fact(n 1) n end end | def fact(n)
return 1 if n.zero?
(1..n).reduce(1, :*)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fact(n)\n if n == 0 return 0\n elsif n == 1 return 1\n else return fact (0, 1, n)\n end\nend",
"def fact(n)\n\tif n == 0\n\t\t1\n\telse\n\t\t(n * fact(n - 1))\n\tend\nend",
"def fact(n)\n\treturn 1 if n <= 1\n\treturn n * fact(n-1)\nend",
"def fact(n)\n if n<=1\n 1\n else\n n*fact(n-1)\n end\nend",
"def fact(n)\n if n== 0\n 1\n else\n n*fact(n-1)\n end #Fin if-else\nend",
"def fact(n)\n if n == 1 or n == 0\n return 1\n else \n return n * fact(n-1)\n end\nend",
"def fact(n)\n if n == 0\n 1\n else\n n * fact(n-1)\n end\nend",
"def fact(n)\n if n == 0\n 1\n else\n n * fact(n-1)\n end\nend",
"def fact(n)\n if n == 1 || n == 0\n return 1\n end\n return n * fact(n - 1)\nend",
"def fact(n)\n if n == 0\n 1\n else\n n * fact(n-1)\n end\nend",
"def fact(n)\n return 1 if n == 1\n n * fact(n-1)\nend",
"def fact(n)\n if n == 0\n 0\n else\n n * fact(n-1)\n end\nend",
"def fact1(n)\n return 1 if n == 1\n return n * fact1(n - 1)\nend",
"def fact(n)\n if n < 0\n 'Please enter a non-negative integer!' \n elsif n == 0\n 1\n else\n n * fact(n-1)\n end\nend",
"def factTypical (n)\n\tif n == 0\n\t\treturn 1\n\telse\n\t\treturn n * factTypical(n-1)\n\tend\nend",
"def fact(x)\n return 1 if x <= 1\n return fact(x - 1) * x\nend",
"def factRubyStyle (n)\n\tn == 0? 1 : n * factRubyStyle(n-1)\nend",
"def factorial(n)\n\tn==0? 1 : n*factorial(n-1) #if n equals to 0 return 1 otherwise return n*....\nend",
"def factorial (n)\n\tn ==0? 1: n*factorial(n-1)\n\nend",
"def factorial(n)\n if n < 2\n 1\n else\n n * factorial(n-1)\n end\nend",
"def factorial (n)\n\tn == 0? 1 : n * factorial(n-1)\nend",
"def factorial(n)\n if n != 0\n return n *= factorial(n-1)\nelse\n return 1\nend\nend",
"def factorial(n)\n if n == 1 || n == 0\n 1\n else\n n * factorial(n-1)\n end\nend",
"def factorial(n)\n\tn == 0? 1: n * factorial(n - 1)\nend",
"def factorial(n)\n\tif 0 == n or 1 == n\n\t\treturn 1\n\telse\n\t\treturn n * factorial(n - 1)\n\tend\nend",
"def factorial(n)\r\n return 1 if n <= 1\r\n return n*factorial(n-1)\r\nend",
"def factorial(n)\n if n <= 1\n 1\n else\n n * factorial(n - 1)\n end\nend",
"def factorial(n)\n if n <= 1\n 1\n else\n n * factorial(n - 1)\n end\nend",
"def factorial(n)\n if n<=1\n return 1\n else\n return factorial(n-1)*n\n end\nend",
"def factorial (n)\n \t\tn == 0? 1 : n * factorial(n-1);\n\t\tend",
"def factorial(n)\n\tn == 0 ? 1 : n * factorial(n - 1)\nend",
"def factorial(n)\n\tif n == 0\n\t\t1\n\telse\n\t\tn * factorial(n-1)\n\tend\nend",
"def factorial(n)\n\treturn 1 if n <= 1\n\tn * factorial(n - 1)\nend",
"def factorial (n)\r\n\tn==0? 1: n * factorial(n-1)\r\nend",
"def factorial(n)\n if n <= 0\n 1\n else\n n * factorial(n - 1)\n end\nend",
"def factorial(n)\n if n == 0\n 1\n else\n n * factorial(n-1)\n end\nend",
"def factorial(n)\n raise ArgumentError, 'Must provide a number greater than 1' unless n >= 0\n\n if n == 1 || n == 0\n return 1\n else\n return n * factorial(n - 1)\n end \n \nend",
"def factorial(n)\n return nil if n < 0\n n == 0 ? 1 : n*factorial(n-1)\nend",
"def factorial(n)\n n == 1 ? 1 : n * factorial(n-1)\nend",
"def factorial(n)\n return 1 if n <= 0\n n * factorial(n-1)\nend",
"def factorial(n)\n if n == 1\n return 1\n else\n n * factorial(n - 1)\n end\nend",
"def factorial(n)\n n == 1 ? 1 : n * factorial(n - 1)\nend",
"def factorial(n)\n return n if n == 1\n n*factorial(n-1)\nend",
"def factorial(n)\n if n == 0\n return 1\n else\n return n * factorial(n - 1)\n end\nend",
"def factorial(n)\n return 1 if n <= 1\n n * factorial(n-1)\nend",
"def fact(n)\n n.downto(1).inject(:*)\nend",
"def fact(n)\n n.downto(1).inject(:*)\nend",
"def factorial( n )\n if (n <= 1)\n return 1\n else\n return n*factorial( n-1 ).to_i\n end\nend",
"def factorial(n)\n raise ArgumentError if n < 0\n return 1 if n == 0\n return n if n == 1\n return n * factorial(n-1)\nend",
"def factorial(n)\n if n == 0\n \t1\n else\n (1..n).inject {|product, n| product * n }\n end\nend",
"def factorial(n)\n return 1 if n == 0\n return n if n == 1\n n *= factorial(n-1)\nend",
"def factorial(n)\n # n < 2 ? 1 : n * factorial(n - 1)\n if n < 2 # Base Case - helps from calling itself infinitely\n 1 \n else\n n * factorial(n - 1)\n end\nend",
"def fact(num)\n (1..num).reduce(:*) || 1\n end",
"def factorial(n)\n if n == 1\n return 1\n end\n \n return factorial(n-1)*n\n\n\nend",
"def factorial(n)\n return 1 if n == 1\n \n n * factorial(n-1)\nend",
"def get_fact(num)\n factorial = 1\n for i in 1..num\n factorial *= i\n end\n factorial\nend",
"def factorial(n)\n if(n==1)\n return 1\n elsif (n<1)\n return -1\n elsif(n>1)\n return(n*factorial(n-1))\n end\nend",
"def n_factorial(n)\n\tif n == 0\n\t\tx_factorial = 1\n\telse\n\t\tx_factorial = 1\n\t\tfor x in 1..n\n\t\tx_factorial *= x \n\t\tend\n\tend\n\treturn x_factorial\nend",
"def factorial(n)\n raise ArgumentError if n < 0\n if n == 1 || n == 0 \n return 1\n else \n return n * factorial(n-1)\n end\nend",
"def factorial(n)\n raise ArgumentError if n < 0\n return 1 if n == 1 || n == 0\n return n * factorial(n-1)\nend",
"def fact(n)\r\n\t\t\t(1..n).reduce(1, :*)\r\n\t\tend",
"def factorial(n)\n return 1 if n == 0\n n * factorial(n - 1)\nend",
"def factorial(n)\n return 1 if n == 0\n return n * factorial(n - 1)\nend",
"def factorial(n)\n raise ArgumentError, \"Negative number\" if n < 0 \n return 1 if n == 1 || n == 0\n return n * factorial(n-1)\nend",
"def factorial(n)\n return 1 if n == 0\n return factorial(n - 1) * n\nend",
"def factorial(n)\n raise ArgumentError.new(\"Number must be at least 0!\") if n < 0\n return 1 if n == 0\n return n * factorial(n-1)\nend",
"def n_factorial(n)\n\tx_factorial = 1\n\t\n\tif n == 0\n\t\tx_factorial = 1\n\telse\n\n\t\tfor x in 1..n\n\t\t\tx_factorial *= x \n\t\tend\n\tend\n\n\treturn x_factorial\nend",
"def factorial(n)\n if n == 0\n return 1\n end\n return n * factorial(n-1)\nend",
"def fact(n)\n s = 1\n (1..n).to_a.each do |i|\n s *= i\n end\n s\nend",
"def factorial(n)\n return n if n == 1\n\n n * factorial(n - 1)\nend",
"def factorial(n)\n return raise ArgumentError if n < 0\n return 1 if n == 1 || n == 0\n return n * factorial(n-1) if n > 1\nend",
"def factorial(n)\n raise ArgumentError.new if n < 0 \n return 1 if n == 1 || n == 0 \n return n * factorial(n-1)\nend",
"def factorial(n)\n raise ArgumentError, \"Number is less then 0\" if n < 0\n return 1 if n == 0\n\n return n * factorial(n - 1)\nend",
"def factorial(n)\n raise ArgumentError if n < 0\n \n return 1 if n == 0\n return n * factorial(n-1)\nend",
"def factorial(n)\n\n # YOUR CODE HERE #\n if n < 2\n return 1\n else\n return n * factorial(n - 1)\n end\nend",
"def factoriel(n)\n\tif (n <= 1)\n\t return (1)\n\tend\n\t return (n * factoriel(n - 1))\nend",
"def factorial(n)\n raise ArgumentError.new(\"negative input error\") if n < 0 \n return 1 if n < 2\n return n * factorial(n-1)\nend",
"def fact\n n = 5\n f = 1\n 1.upto(n) do |v|\n f = f * v\n end\nend",
"def factorial(n)\n raise ArgumentError, \"A number must be greater than or equal to 0\" if n < 0\n return 1 if n == 0\n\n return n * factorial(n - 1)\nend",
"def factorial(n)\n if n < 0\n raise ArgumentError, \"N must be positive.\"\n elsif n == 0\n return 1\n else\n return n * factorial(n-1)\n end\nend",
"def factorial(n)\n if n < 0\n raise ArgumentError, \"number must be greater than or equal to zero\"\n end\n\n return 1 if n == 0\n return n * factorial(n-1)\nend",
"def factorial(n)\n if n < 0 \n raise ArgumentError.new(\"Number must be greater than zero!\")\n elsif n == 1\n return n\n elsif n == 0\n return 1\n else\n return n * factorial(n - 1)\n end\nend",
"def factorial(n)\n raise ArgumentError.new('It must be a positive number.') if n < 0\n return 1 if n == 0\n return n * factorial(n-1)\nend",
"def factorial(num)\n if num < 2 \n return 1\n end \n fac = num * factorial(num - 1)\nend",
"def fac(n)\n (1..n).inject(:*) || 1\nend",
"def checker(n)\n n = n.to_i\n if n < 0\n print \"This is a negative number.\\n Please enter a new number to find the factorial of.\"\n end\n if n == 0\n print \"The factorial of 0 is 1.\"\n end\n if n == 1\n print \"The factorial of 1 is 1.\"\n end\n if n > 1\n return fact(n)\n end\nend",
"def factorial(n)\n raise ArgumentError if n < 0\n return 1 if n == 0\n return n * factorial(n-1)\nend",
"def factorial(n)\n\n raise ArgumentError unless n >= 0 \n return 1 if n == 1 || n == 0\n\n n * factorial(n - 1)\n\nend",
"def factorial(n)\n raise ArgumentError.new \"N must be greater than or equal to 0\" if n < 0\n return 1 if n <= 1\n return n * factorial(n - 1)\nend",
"def factorial(n)\n raise ArgumentError if n < 0\n return 1 if n == 0\n return n * factorial(n-1)\nend",
"def factorial(n)\n if n < 0\n raise ArgumentError.new(\"#{n} is less than zero\")\n elsif n <= 0\n return 1\n else\n return n * factorial(n-1)\n end\nend",
"def get_fact_rec(num)\n if num == 0\n return 1\n else\n return num *= get_fact(num-1)\n end\nend",
"def factorial(n)\n\tif n < 0\n\t\treturn nil \n\tend\n\tvalue = 1\n\twhile n > 0\n\t\tvalue = value * n \n\t\tn -= 1 \n\tend\n\treturn value \n end",
"def factorial(n)\n raise ArgumentError if n < 0\n return 1 if n == 0\n return n * factorial(n - 1)\nend",
"def fact(n)\n iterator = 1\n factorial_total = 1\n while iterator < n\n iterator += 1\n factorial_total = factorial_total * iterator\n end\n return factorial_total\nend",
"def factorial(n)\n raise ArgumentError if n < 0\n if n == 0\n return 1\n end\n return n * (factorial(n-1))\nend",
"def factorial(n)\n if n < 0\n raise ArgumentError, \"cant do factorials for numbers less than 0\" \n elsif \n n==0\n return 1\n else \n return n * factorial(n-1)\n end\nend",
"def factorial(n)\n raise ArgumentError, 'argument n cannot be a negative number' if n < 0\n return 1 if n == 0\n return n * factorial(n-1)\nend",
"def factorial(n)\n if n == 0 || n == 1 \n \treturn 1\n else\n numbers = []\n n.downto(1) { |x| numbers << x }\n numbers.inject(1) { |x,y| x * y }\n end\nend",
"def short_factorial(n)\r\n n <= 1 ? 1 : n * short_factorial(n - 1)\r\nend"
] | [
"0.9327682",
"0.9201197",
"0.91695404",
"0.91559607",
"0.91497535",
"0.9108872",
"0.90803",
"0.90803",
"0.9067964",
"0.90357137",
"0.8983859",
"0.8922955",
"0.8911128",
"0.8862706",
"0.84694",
"0.84454393",
"0.8287611",
"0.82294744",
"0.8177232",
"0.8174114",
"0.81740856",
"0.81698084",
"0.816219",
"0.8159351",
"0.81544405",
"0.8141869",
"0.8128733",
"0.8128733",
"0.8128349",
"0.8124936",
"0.812484",
"0.8124344",
"0.8122165",
"0.8112868",
"0.8105118",
"0.8103029",
"0.80992204",
"0.80959594",
"0.80940175",
"0.80763775",
"0.8075363",
"0.8073536",
"0.8067663",
"0.80523604",
"0.8046956",
"0.8040435",
"0.8040435",
"0.8034221",
"0.8022566",
"0.8020856",
"0.8020849",
"0.80201274",
"0.8014161",
"0.8006605",
"0.8003861",
"0.799557",
"0.79916507",
"0.79902613",
"0.7985972",
"0.7984659",
"0.79845995",
"0.7982772",
"0.7976248",
"0.7975262",
"0.797314",
"0.7967065",
"0.79623497",
"0.79539686",
"0.7951523",
"0.795033",
"0.79498595",
"0.79482526",
"0.794616",
"0.7945772",
"0.794106",
"0.79316187",
"0.79247767",
"0.79230684",
"0.79171014",
"0.79028255",
"0.78971815",
"0.78883123",
"0.7884284",
"0.7884067",
"0.7878916",
"0.7877871",
"0.7873142",
"0.7868253",
"0.7863778",
"0.78633",
"0.78601015",
"0.7859191",
"0.7858168",
"0.7854508",
"0.78478914",
"0.7847817",
"0.78450704",
"0.7840368",
"0.78399",
"0.78366166"
] | 0.83868355 | 16 |
Initialize the parser and adds the callback that will be called upon stanza completion | def initialize(callback)
@callback = callback
@buffer = ""
super()
reset
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_init\n @parser = XmppParser.new(method(:receive_stanza))\n end",
"def parser_init\n @http = Http::Parser.new\n @http.on_headers_complete = proc do\n p @http.headers\n end\n @http.on_body = proc do |chunk|\n # One chunk of the body\n p chunk\n end\n\n @http.on_message_complete = proc do |env|\n # Headers and body is all parsed\n puts \"Done!\"\n end\n\n\n end",
"def stanza_callbacks\n @stanzacbs\n end",
"def after_parse_callbacks\n @after_parse_callbacks ||= []\n end",
"def after_parse(&block)\n after_parse_callbacks.push(block)\n end",
"def parserDidStartDocument(parser)\n puts \"starting parsing..\"\n end",
"def parse\n @callbacks.on_start_document\n @parser.parse(@data) do |type, name, data|\n @position += @parser.byteCount\n @callbacks.on_start_element(name, data) if type == :START_ELEM\n @callbacks.on_end_element(name) if type == :END_ELEM\n end\n @callbacks.on_end_document\n @callbacks.result\n end",
"def after_parse\n end",
"def after_parse; end",
"def after_parse; end",
"def callback\n @on_declare\n end",
"def initialize parser\n @parser = parser\n end",
"def receive_stanza(stanza)\n Babylon.logger.debug(\"PARSED : #{stanza.to_xml}\")\n # If not handled by subclass (for authentication)\n @stanza_callback.call(stanza) if @stanza_callback\n end",
"def parse\n #puts \"PARSE\"\n @started = false\n begin\n parser = REXML::Parsers::SAX2Parser.new @stream\n\n parser.listen(:end_document) do\n raise Jabber::ConnectionForceCloseError\n end\n\n parser.listen( :start_element ) do |uri, localname, qname, attributes|\n case qname\n when \"stream:stream\"\n openstream = ParsedXMLElement.new(qname)\n attributes.each { |attr, value| openstream.add_attribute(attr, value) }\n @listener.receive(openstream)\n @started = true\n else\n if @current.nil?\n @current = ParsedXMLElement.new(qname)\n else\n @current = @current.add_child(qname)\n end\n attributes.each { |attr, value| @current.add_attribute(attr, value) }\n end\n end\n parser.listen( :end_element ) do |uri, localname, qname|\n case qname\n when \"stream:stream\"\n @started = false\n else\n @listener.receive(@current) unless @current.element_parent\n @current = @current.element_parent\n end\n end\n parser.listen( :characters ) do | text |\n @current.append_data(text) if @current\n end\n parser.listen( :cdata ) do | text |\n @current.append_data(text) if @current\n end\n parser.parse\n rescue REXML::ParseException => e\n @listener.parse_failure\n rescue Jabber::ConnectionForceCloseError => e\n @listener.parse_failure(e)\n end\n end",
"def on_complete(&block)\n @on_complete = block\n end",
"def register_parse_handler(key, &block)\n ArgParser::OnParseHandlers[key] = block\n end",
"def process(&block)\n @parser.on_headers_complete = block\n end",
"def initialize(&chunk_callback)\n @chunk_callback = chunk_callback\n end",
"def set_callback\n if request.streaming?\n response = nil\n easy.on_headers do |easy|\n response = Response.new(Ethon::Easy::Mirror.from_easy(easy).options)\n request.execute_headers_callbacks(response)\n end\n request.on_body.each do |callback|\n easy.on_body do |chunk, easy|\n callback.call(chunk, response)\n end\n end\n else\n easy.on_headers do |easy|\n request.execute_headers_callbacks(Response.new(Ethon::Easy::Mirror.from_easy(easy).options))\n end\n end\n request.on_progress.each do |callback|\n easy.on_progress do |dltotal, dlnow, ultotal, ulnow, easy|\n callback.call(dltotal, dlnow, ultotal, ulnow, response)\n end\n end\n easy.on_complete do |easy|\n request.finish(Response.new(easy.mirror.options))\n Typhoeus::Pool.release(easy)\n if hydra && !hydra.queued_requests.empty?\n hydra.dequeue_many\n end\n end\n end",
"def parsing(parser)\n yield\n resolve parser\n self\n end",
"def initialize block_parser\n @block_parser = block_parser\nend",
"def initialize\n @parser = Grammar::RootParser.new\n end",
"def initialize\n @parser = Grammar::RootParser.new\n end",
"def configure_parser; end",
"def initialize(params)\n super()\n @jid = params[\"jid\"]\n @password = params[\"password\"]\n @host = params[\"host\"]\n @port = params[\"port\"]\n @stanza_callback = params[:on_stanza]\n @connection_callback = params[:on_connection]\n @parser = XmppParser.new(&method(:receive_stanza))\n end",
"def parse\n parser = REXML::Parsers::SAX2Parser.new @stream \n parser.listen( :start_element ) do |uri, localname, qname, attributes|\n case qname\n when \"CougaarEvents\"\n @node = attributes['Node']\n @experiment = attributes['experiment']\n #puts \" Node: #{@node} Experiment: #{@experiment}\"\n @started = true\n when \"CougaarEvent\" \n @current = CougaarEvent.new\n @current.node = @node\n @current.data = \"\"\n @current.experiment = @experiment\n @current.event_type = attributes['type']\n @current.cluster_identifier = attributes['clusterIdentifier']\n @current.component = attributes['component']\n else\n @current.data << \"<#{qname}\"\n attributes.each do |key, value| \n @current.data << \" #{key} = \\\"#{value}\\\"\"\n end\n @current.data << \" >\"\n end\n end\n parser.listen( :end_element ) do |uri, localname, qname|\n case qname\n when \"CougaarEvents\"\n @node = nil\n @started = false\n when \"CougaarEvent\"\n @current.data = [@current.data].pack(\"m\")\n @listener.call(@current)\n @current = nil\n else\n @current.data << \"</#{qname}>\"\n end\n end\n parser.listen( :characters ) do | text |\n @current.data << text if @current\n end\n parser.listen( :cdata ) do | text |\n @current.data << text if @current\n end\n parser.parse\n end",
"def parserDidEndDocument(parser)\n @parsed = true\n puts \"done parsing\"\n if @block\n @items.each{|item| @block.call(item)}\n end\n end",
"def initialize()\n @callbacks = {}\n end",
"def add_callback(type, options, &block); end",
"def initialize(callback)\n @callback = callback\n end",
"def parser_listener\n # create on demand. not always used\n @parser_listener = NvdFsParserListener.new(self,@enable_xml_save) if @parser_listener.nil?\n @parser_listener\n end",
"def on_complete(&block)\n @handlers[:complete] = Array(@handlers[:complete]).compact + [block]\n self\n end",
"def callback\n\n end",
"def pluggable_parser; end",
"def start_element(qname, attributes = [])\n clear_characters_buffer\n @doc ||= Nokogiri::XML::Document.new\n @elem ||= @doc # If we have no current element, then, we take the doc\n @elem = @elem.add_child(Nokogiri::XML::Element.new(qname, @doc))\n \n add_namespaces_and_attributes_to_current_node(attributes)\n \n if @elem.name == \"stream:stream\"\n # We activate the callback since this element will never end.\n @callback.call(@elem)\n @doc = @elem = nil # Let's prepare for the next stanza\n # And then, we start a new Sax Push Parser\n end\n end",
"def on_complete(&block)\n @on_complete = block if block_given?\n @on_complete\n end",
"def start\n prepare_parser\n perform_request\n end",
"def on_complete( handler = nil, &block )\n @on_complete_handler_method = handler\n @on_complete_handler_block = block\n end",
"def on_complete( &block )\n fail 'Block is mandatory!' if !block_given?\n @on_complete_blocks << block\n self\n end",
"def start\n parse!\n run\n end",
"def plugin_init\n arm_subscribe('ricer/messaged') do |sender, message|\n # begin\n # user.localize!\n # encoding = user.encoding || server.encoding\n # args[1].force_encoding(encoding.to_label)\n # rescue StandardError => e\n # bot.log.exception(e)\n # end\n end\n end",
"def parser; end",
"def parser; end",
"def parser; end",
"def parser; end",
"def callback\n end",
"def setup_default_callbacks\n on :query, /^\\001PING \\d+\\001$/ do |event_data|\n time = event_data[:message].scan(/\\d+/)[0]\n notice event_data[:nick], \"\\001PING #{time}\\001\"\n end\n\n on :query, /^\\001VERSION\\001$/ do |event_data|\n notice event_data[:nick], \"\\001VERSION Ponder #{Ponder::VERSION} (https://github.com/tbuehlmann/ponder)\\001\"\n end\n\n on :query, /^\\001TIME\\001$/ do |event_data|\n notice event_data[:nick], \"\\001TIME #{Time.now.strftime('%a %b %d %H:%M:%S %Y')}\\001\"\n end\n\n on 005 do |event_data|\n @isupport.parse event_data[:params]\n end\n end",
"def start_callback\n lambda {\n self.start\n }\n end",
"def parse(init = nil)\n data = init\n @__lexer.lex.each do |pos, event, tok, state|\n @__line, @__col = *pos\n @__state = state\n data = if respond_to?(event, true)\n then __send__(event, tok, data)\n else on_default(event, tok, data)\n end\n end\n data\n end",
"def parser=(_arg0); end",
"def init\n super\n @parser = Nokogiri::XML::SAX::Parser.new(self)\n end",
"def initialize(data)\n super\n pre_parse!\n end",
"def on_start(&block)\n @options[:start] = block\n end",
"def on_start(&block)\n @on_start << block\n end",
"def process(parser)\n end",
"def callbacks; end",
"def callbacks; end",
"def callback=(_arg0); end",
"def perform\n accept(parse_file)\n end",
"def setup\n # return if client && client.setup?\n client.register_handler(:ready) do\n puts \"Connected!\"\n ROSTER << [client.roster.items.keys, Opt.groups].flatten.uniq\n ROSTER.flatten!\n ROSTER.select { |j| j =~ /\\@conference\\./ }.each do |c|\n presence = Blather::Stanza::Presence.new\n presence.to = \"#{c}/#{Opt.hostname}\"\n client.write presence\n end\n\n fetch_pubs\n end\n\n client.register_handler :subscription, :request? do |s|\n if ROSTER.include?(s.from.stripped.to_s)\n puts \"[REQUEST] Approve #{s}\"\n client.write s.approve!\n else\n puts \"[REQUEST] Refuse #{s}\"\n client.write s.refuse!\n end\n end\n\n # client.register_handler :message, :chat?, :body => 'exit' do |m|\n # client.write Blather::Stanza::Message.new(m.from, 'Exiting...')\n # client.close\n # end\n #client.register_handler :roster, [],\n #client.register_handler :message, :error?, :body do |m|\n #client.register_handler :message, :headline?, :body do |m|\n #client.register_handler :message, :normal?, :body do |m|\n client.register_handler :pubsub_affiliations, :affiliations do |m|\n puts \"[PUB] => #{m.inspect}\"\n m.each do |af|\n puts \"[PUB ITEM] => #{af.inspect}\"\n PUBSUB[:pubs] = af[1].map { |p| p.gsub(/\\//, '') }\n end\n end\n\n client.register_handler :pubsub_subscriptions, :subscriptions do |m|\n puts \"[SUB] => #{m.inspect}\"\n m.each do |af|\n puts \"[SUB ITEM] => #{af.inspect}\"\n PUBSUB[:subs] = af[1].map { |p| p[:node].gsub(/\\//, '') }\n end\n end\n\n client.register_handler :pubsub_event, :items do |m|\n puts \"[PUBSUB EV] => #{m.inspect}\"\n alert_peers \"PubSub: #{m.node} #{process_items(m.items)}\"\n end\n\n client.register_handler :pubsub_items, :items do |m|\n puts \"[PUBSUB ITEMS] => #{m.inspect}\"\n alert_peers \"PubSub: #{m.node} #{process_items(m.items)}\"\n end\n\n client.register_handler :disco_items do |r|\n puts \"[ITEM] => #{r}\"\n # Pub.delete_all\n # PubItem.delete_all\n for item in r.items\n puts \"[IT] => #{item.name} on #{item.node.class}\"\n # next if item.name =~ /^home$/\n if item.node =~ /\\//\n puts \"[PUBSUB] => #{item.name} on #{item.node}\"\n alert_peers item.name\n else\n if item.jid.to_s =~ /conference\\./\n puts \"[GROUP] => #{item.name} on #{item.node}\"\n else\n puts \"[USER] => #{item.jid} name #{item.name}\"\n end\n end\n end\n end\n\n client.register_handler :message, :groupchat? do |m|\n if m.body =~ Regexp.new(Opt.hostname)\n body = m.body.split(\":\")[-1].strip\n else\n body = m.body\n end\n if m.body =~ /^!|^>|^\\\\|#{Opt.hostname}/ && m.to_s !~ /x.*:delay/ #delay.nil?\n puts \"[GROUP] => #{m.inspect}\"\n for msg in process_message(m.from.stripped, body, :groupchat)\n client.write msg\n end\n end\n end\n\n client.register_handler :message, :chat?, :body do |m|\n if ROSTER.include?(m.from.stripped.to_s)\n puts \"[PVT] => #{m.inspect}\"\n for msg in process_message(m.from, m.body)\n client.write msg\n end\n end\n end\n\n end",
"def on_complete( &block )\n @on_complete_blocks ||= []\n @on_complete_blocks << block\n end",
"def initialize(file_parser)\n @file_parser = file_parser\n @sub_commands = @file_parser.runnable_methods.map { |m| m.name.to_s }\n @sub_commands_text = @file_parser.runnable_methods.map do |m|\n [\n m.name.to_s,\n FileParser.select_runnable_tags(m).map(&:text).join(\"\\n\")\n ]\n end.to_h\n @parser = Optimist::Parser.new\n @parser.opt(:debug, 'Run in debug mode.', type: :flag)\n @parser.stop_on @sub_commands\n @initialize_method = nil\n end",
"def start\n callback = EM.Callback do\n log \"Adding a #{self.class} at #{@host}:#{@port}...\"\n EM.open_datagram_socket(@host, @port, UDPReaderConnection,\n @write_to_channel, starter)\n end\n\n super(callback)\n end",
"def on_connection_success &block\n @connection_success_callback = block\n end",
"def parse(&block)\n # override block\n if block\n orig_block = self.callback_block\n self.callback_block = block\n end\n\n self.index = -1\n until file.eof? || self.done\n self.index += 1\n line = file.read(64)\n\n tail = line[44, 20]\n tail_data = tail ? parse_tail(tail) : {}\n\n parse_line(line, tail_data)\n end\n self.callback_block = orig_block if orig_block\n self.saved if self.debug || self.done\n end",
"def initialize(parse_tree)\n @parse_tree = parse_tree\n end",
"def receive_stanza(stanza)\n Skates.logger.debug {\n \"PARSED : #{stanza.to_xml}\"\n }\n # If not handled by subclass (for authentication)\n case stanza.name\n when \"stream:error\"\n if !stanza.children.empty? and stanza.children.first.name == \"xml-not-well-formed\"\n Skates.logger.error {\n \"DISCONNECTED DUE TO MALFORMED STANZA\"\n }\n raise XmlNotWellFormed\n end\n # In any case, we need to close the connection.\n close_connection\n else\n begin\n @handler.on_stanza(stanza) if @handler and @handler.respond_to?(\"on_stanza\")\n rescue\n Skates.logger.error {\n \"on_stanza failed : #{$!}\\n#{$!.backtrace.join(\"\\n\")}\"\n }\n end\n end \n end",
"def initialize\n ctx = FFI::MemoryPointer.new :pointer\n result = Gsasl.gsasl_init(ctx)\n @context = ctx.get_pointer(0)\n Gsasl.raise_error!(result)\n @peers = {}\n Gsasl.new_context @context.address, self\n Gsasl.gsasl_callback_set(@context, CALLBACK)\n end",
"def on_eof( &block )\n @on_eof = block\n end",
"def parser( &block )\n nested_class( 'Parser', Yacl::Define::Cli::Parser, &block )\n end",
"def register_parsing_thread\n @parser_thread = Thread.new { parser.parse }\n end",
"def on_initialization_finished()\n end",
"def parse_init\n @tg_end = [] #momorize tag end from regex function\n @doc_src = []\n @doc_out = []\n @tg_hot = {} \n merge_tags @mrg ? @mrg : @ext\n next_tag_init\n end",
"def callback_method\n run(\"on\", \"string\", \"callback\")\n end",
"def receive_data data\n puts \"%% Parser got: #{data}\" if $options[:debug]\n @parser << data\n end",
"def parse(parse_info)\r\n block.call(parse_info)\r\n end",
"def new_parser_with_data\n\tdoc = load_sample_xml\n\tparser = GreenButton::Parser.new(doc)\nend",
"def parse\n @started = false\n begin\n parser = REXML::Parsers::SAX2Parser.new @stream \n parser.listen( :start_element ) do |uri, localname, qname, attributes|\n if @current.nil?\n @current = REXML::Element::new(qname)\n else\n e = REXML::Element::new(qname)\n @current = @current.add_element(e)\n end\n @current.add_attributes attributes\n if @current.name == 'stream'\n @listener.receive(@current)\n @started = true\n end\n end\n parser.listen( :end_element ) do |uri, localname, qname|\n case qname\n when \"stream:stream\"\n @started = false\n else\n @listener.receive(@current) if @current.parent.name == 'stream'\n @current = @current.parent\n end\n end\n parser.listen( :characters ) do | text |\n @current.text = (@current.text.nil? ? '' : @current.text) + text\n end\n parser.listen( :cdata ) do | text |\n raise \"Not implemented !\"\n end\n parser.parse\n rescue REXML::ParseException\n @listener.parse_failure\n end\n end",
"def initialize( raw_msg=nil, &blk )\n @segments = []\n @segments_by_name = {}\n @item_delim = \"^\"\n @element_delim = '|'\n @segment_delim = /[\\n\\r]+/\n @delimiter = HL7::Message::Delimiter.new( @element_delim,\n @item_delim,\n @segment_delim)\n\n @message_parser = HL7::MessageParser.new(@delimiter)\n\n parse( raw_msg.chomp ) if raw_msg\n\n if block_given?\n blk.call self\n end\n end",
"def post_init\n @builder, @parser = Hatetepe::Builder.new, Hatetepe::Parser.new\n @builder.on_write << method(:send_data)\n # @builder.on_write {|data| p \"|--> #{data}\" }\n @parser.on_response << method(:receive_response)\n\n @queue = []\n\n @app = proc {|request| send_request(request) }\n\n self.comm_inactivity_timeout = config[:timeout]\n self.pending_connect_timeout = config[:connect_timeout]\n\n start_tls if config[:ssl]\n end",
"def parse!\n raise NotImplementedError, \"this class is intended to be a top class, not a useful parser\"\n end",
"def on_eof(&block); end",
"def callback(&block)\n @callbacks << block\n end",
"def initialize(sock)\n puts \"New stream: #{sock.peeraddr[2]}:#{sock.peeraddr[1]} (#{sock.peeraddr[3]})\"\n\n c = sock\n\n request = []\n done = false\n while c.gets\n request << $_\n break if $_ =~ /^\\s*$/\n end\n\n headers = {}\n request.each do |line|\n if line =~ /:\\s/\n k, v = line.strip.split(/:\\s/)\n headers[k] = v\n end\n end\n\n pp headers\n\n c.puts(\"HTTP/1.0 200 Connection established\\r\")\n c.puts(\"Proxy-agent: Rubber/0.1\\r\")\n c.puts(\"\\r\")\n c.puts(\"\\r\")\n \n @server_conn = nil\n @server_host = nil\n @jid = Jabber::JID.new\n \n super(true)\n\n add_stanza_callback { |stanza|\n handle_stanza(stanza)\n }\n \n @fd = sock\n parser = Jabber::StreamParser.new(sock, self)\n Thread.new {\n begin\n parser.parse\n rescue Exception => e\n puts \"Exception #{e.class}: #{e} (#{sock.peeraddr[2]}:#{sock.peeraddr[1]} -> #{@jid})\\n#{e.backtrace.join(\"\\n\")}\"\n sock.close\n @server_conn.close\n end\n }\n end",
"def on_complete(&f)\n @on_complete = f\n end",
"def add_end_of_file_callback(&block)\n @callback[:end_of_file] = block\n true\n end",
"def initialize(fr, cb)\n @frame = fr\n @callback = cb\n end",
"def parsed(&block)\n parse unless @parsed\n block.call\n end",
"def on_init; end",
"def on_init; end",
"def done\n # Parse not successful and no reason identified\n # Assuming that parse failed because of a premature end\n premature_end unless success? || failure_reason\n end",
"def initialize(&block)\n @output = block\n @input = Raw.new\n Frappuccino::Stream.new(@input).\n map {|text| Line.new(text) }.\n select {|line| line.good? }.\n muxdemux(rhymes) {|rhyme, line| rhyme.why_not(line) }.\n partition(2).\n map {|couplets| Stanza.new(couplets) }.\n on_value {|stanza| @output.call(stanza) }\n end",
"def callback\n\tend",
"def parse(&block)\n @block = block\n puts \"Parsing #{xml_url}\"\n @parser.parse\n end",
"def options_parse(_options_parser)\n @calls << [:options_parse]\n end",
"def init_parser\n @parser = OptionParser.new do |opts|\n opts.on('-j', '--show-json', 'Show the raw JSON response') do |json|\n @options[:show_json] = json\n end\n opts.summary_width = 50\n end\n end",
"def parse\n parse_command\n load_config\n finalize_setup\n end",
"def parsed; end",
"def parsed; end",
"def initialize\n @option_parser = OptionParser.new do |opt|\n opt.banner = banner\n opt.summary_indent = Shebang::Config[:indent]\n\n # Process each help topic\n help_topics.each do |title, text|\n opt.separator \"#{Shebang::Config[:heading]}#{\n Shebang::Config[:indent]}#{text}\" % title\n end\n\n opt.separator \"#{Shebang::Config[:heading]}\" % 'Options'\n\n # Add all the options\n options.each do |option|\n opt.on(*option.option_parser) do |value|\n option.value = value\n\n # Run a method?\n if !option.options[:method].nil? \\\n and respond_to?(option.options[:method])\n # Pass the value to the method?\n if self.class.instance_method(option.options[:method]).arity != 0\n send(option.options[:method], value)\n else\n send(option.options[:method])\n end\n end\n end\n end\n end\n end"
] | [
"0.7494713",
"0.6637759",
"0.65231305",
"0.63050914",
"0.62487847",
"0.6166404",
"0.6126945",
"0.60921043",
"0.596389",
"0.596389",
"0.57836163",
"0.5735514",
"0.5578383",
"0.5559262",
"0.55379206",
"0.55347496",
"0.55246526",
"0.54666394",
"0.54593784",
"0.5438904",
"0.5419305",
"0.53935915",
"0.538774",
"0.53783876",
"0.537235",
"0.53691393",
"0.53286946",
"0.53254986",
"0.53237456",
"0.5317029",
"0.52947336",
"0.52816707",
"0.52654856",
"0.5253552",
"0.5238733",
"0.5217767",
"0.5206472",
"0.5194665",
"0.5186648",
"0.51739085",
"0.51724344",
"0.516947",
"0.516947",
"0.516947",
"0.516947",
"0.5153062",
"0.5135308",
"0.5129041",
"0.50933665",
"0.5090935",
"0.5076656",
"0.50751513",
"0.5054863",
"0.5053328",
"0.50529575",
"0.5045923",
"0.5045923",
"0.50454605",
"0.503739",
"0.50372994",
"0.5037054",
"0.5033941",
"0.5025933",
"0.50238836",
"0.50224096",
"0.5021821",
"0.50152034",
"0.5007239",
"0.49935317",
"0.49917537",
"0.4990575",
"0.49816754",
"0.49779996",
"0.49737328",
"0.49705982",
"0.4961803",
"0.4956613",
"0.49540275",
"0.49478072",
"0.494581",
"0.49448183",
"0.49401104",
"0.49371964",
"0.49370357",
"0.49183136",
"0.4898528",
"0.48774883",
"0.48551106",
"0.48436463",
"0.48436463",
"0.48360792",
"0.48250934",
"0.48143235",
"0.4812383",
"0.48089898",
"0.48053116",
"0.4790433",
"0.47891635",
"0.47891635",
"0.47862625"
] | 0.4855342 | 87 |
Resets the Pushed SAX Parser. | def reset
@parser = Nokogiri::XML::SAX::PushParser.new(self, "UTF-8")
@elem = @doc = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset\n @parser = Nokogiri::XML::SAX::PushParser.new(self)\n end",
"def reset\n @parsers = nil\n @transformer = nil\n @cache = nil\n end",
"def reset!\n @path_stack = []\n @stack = []\n @stacks = Hash.new { |hsh, k| hsh[k] = Stack.new }\n @text = nil\n end",
"def DataReset()\n @xml_data = \"\"\n end",
"def reset\n dup.reset!\n end",
"def reset\n @current = nil\n @pos = 0\n end",
"def rewind\n create_parser\n end",
"def reset\n @pointer = 0\n self\n end",
"def reset\n @data = nil\n end",
"def reset\n end",
"def reset\n end",
"def reset\n @push = @temp\n @index = @mark\n end",
"def reset\n # Empty, but subclasses will override this.\n end",
"def reset\n # TODO\n end",
"def reset\n cleanup(true)\n end",
"def reset_handlers\n @handlers = nil\n end",
"def reset\n @array = nil\n end",
"def reset\n @source.each_value(&:reset)\n nil\n end",
"def reset\n @prev_pos = @pos = 0\n @match = nil\n self\n end",
"def reset\n\t\t\[email protected]\n\t\t\[email protected]\n\t\t\[email protected]\n\t\tend",
"def reset\n self\n end",
"def reset\n\n end",
"def reset\n @index = -1\n @element = nil\n @value = nil\n end",
"def reset!\n # this should be overridden by concrete adapters\n end",
"def reset()\n #This is a stub, used for indexing\n end",
"def reset()\n #This is a stub, used for indexing\n end",
"def reset\n end",
"def reset\n end",
"def reset\n end",
"def reset\n end",
"def push_reset\n @stack << Set.new\n end",
"def reset\n clear\n @position = 0\n @current_index = 0\n end",
"def reset() end",
"def reset\n @tags.clear\n end",
"def reset\n @buffer.string = @buffer.read; nil\n end",
"def clear!\n @@parsers = {}\n end",
"def reset\n @stack = []\n @current_scope = @current_scope.parent until @current_scope.type == Scope::TYPE_MAIN\n @lexer.reset\n end",
"def reset\n\t\t@lineno = 0\n\t\t@filelineno = 0\n\t\t@filename = @files.first\n\t\t@index = 0\n\t\t@lines = nil\n\tend",
"def reset\n each(&:reset)\n self\n end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset\n\t\t\t@out_pos = -1\n\t\t\t@in_pos = -1\n\t\t\t@input_buffer = []\n\t\t\t@output_buffer = []\n\t\tend",
"def reset\n\t\tend",
"def reset\n @p = 0\n @line = 1\n @char_position_in_line = 0\n @mark_depth = 0\n end",
"def reset\n\t\t@out_pos = -1\n\t\t@in_pos = -1\n\t\t@input_buffer = []\n\t\t@output_buffer = []\n\tend",
"def reset!\n @buffer = ''\n end",
"def reset\n @buffer = ''\n @length = 0\n @position = 0\n end",
"def reset\n raise \"Not implemented\"\n end",
"def reset!\n @buffer = buffer.reset!\n end",
"def reset\n end",
"def reset\n end",
"def reset\n\n end",
"def reset\n @source_buffer = nil\n\n @lexer.reset\n @static_env.reset\n @context.reset\n @current_arg_stack.reset\n @pattern_variables.reset\n @pattern_hash_keys.reset\n\n self\n end",
"def reset\n\t @result_set = nil\n\t self\n\tend",
"def reset()\n end",
"def reset!\n self.result = nil\n @rows = nil\n @docs = nil\n end",
"def reset\n @finished = false\n @headers = nil\n @chunk = \"\"\n end",
"def reset!\n end",
"def reset!\n end",
"def reset\n invoke_on_reset_callbacks\n self\n end",
"def reset\r\n super\r\n @rootNode = @currentNode = Document.new\r\n end",
"def reset\n @callbacks = []\n @closebacks = []\n end",
"def reset ; end",
"def reset()\n raise NotImplementedError\n @lineno = 1\n\t\t@line_offset = 0\n @token_pos = 0\n end",
"def reset\n reset_adapters\n reset_config\n reset_handlers\n reset_hooks\n end",
"def reset\n @args = nil\n end",
"def reset\n set InitialPosition\n end",
"def reset_state\n @children = nil\n @logdev = nil\n @loglvl = nil\n end",
"def interpreter_reset\r\n @data_stack = Array.new\r\n @ctrl_stack = Array.new\r\n @start_time = Time.now\r\n end",
"def reset()\n \n end",
"def reset\n @params = {}\n @query_filters = []\n @uri = ''\n self\n end",
"def clear\n\t\[email protected]\n\tend",
"def reset!\n @events = nil\n end",
"def reset\n @value = nil\n @count = 0\n end",
"def reset\n @xhead = '<?xml version=\"1.0\" encoding=\"UTF-8\" ?><FMPXMLRESULT xmlns=\"http://www.filemaker.com/fmpxmlresult\"><ERRORCODE>0</ERRORCODE><PRODUCT BUILD=\"06-11-2010\" NAME=\"FileMaker\" VERSION=\"ProAdvanced 11.0v2\"/><DATABASE DATEFORMAT=\"M/d/yyyy\" LAYOUT=\"\" NAME=\"post_y.fp7\" RECORDS=\"\" TIMEFORMAT=\"h:mm:ss a\"/><METADATA><FIELD EMPTYOK=\"YES\" MAXREPEAT=\"1\" NAME=\"url\" TYPE=\"TEXT\"/><FIELD EMPTYOK=\"YES\" MAXREPEAT=\"1\" NAME=\"date\" TYPE=\"TEXT\"/><FIELD EMPTYOK=\"YES\" MAXREPEAT=\"1\" NAME=\"reply_to\" TYPE=\"TEXT\"/><FIELD EMPTYOK=\"YES\" MAXREPEAT=\"1\" NAME=\"title\" TYPE=\"TEXT\"/></METADATA><RESULTSET FOUND=\"\">'\n @rhead = '<ROW MODID=\"\" RECORDID=\"\"><COL><DATA>'\n @rdiv = '</DATA></COL><COL><DATA>'\n @rtail = '</DATA></COL></ROW>'\n @xtail = '</RESULTSET></FMPXMLRESULT>'\n end",
"def reset!; end",
"def reset!; end",
"def reset!; end",
"def reset!; end",
"def reset\n @params = nil\n @logger = nil\n end",
"def reset\n @rows = nil\n end",
"def reset\n @count = 0\n end",
"def reset\n lexer.reset\n self.in_def = false\n self.in_single = 0\n self.env.reset\n self.last_token_type = nil\n end",
"def clear\n while peek\n pop\n end\n end"
] | [
"0.83507216",
"0.6598847",
"0.6285908",
"0.62609667",
"0.62215257",
"0.60990304",
"0.6034145",
"0.60305864",
"0.6018839",
"0.60098904",
"0.60098904",
"0.5997657",
"0.5992764",
"0.5972017",
"0.5934072",
"0.5931546",
"0.5917266",
"0.5916757",
"0.5903755",
"0.5902981",
"0.58908755",
"0.5867712",
"0.58535117",
"0.5845283",
"0.5833683",
"0.5833683",
"0.58316624",
"0.58316624",
"0.58316624",
"0.58316624",
"0.58301294",
"0.5824404",
"0.58211106",
"0.58081037",
"0.5804658",
"0.5798151",
"0.57970345",
"0.579297",
"0.5763136",
"0.5760124",
"0.5760124",
"0.5760124",
"0.5760124",
"0.5760124",
"0.5760124",
"0.5760124",
"0.5760124",
"0.5760124",
"0.5760124",
"0.5760124",
"0.5760124",
"0.5760124",
"0.5760124",
"0.5760124",
"0.5760124",
"0.5760124",
"0.5760124",
"0.575244",
"0.57284653",
"0.5723143",
"0.5688457",
"0.5686686",
"0.56811756",
"0.56793916",
"0.5661757",
"0.5655469",
"0.5655469",
"0.5649786",
"0.56464785",
"0.56449735",
"0.56255984",
"0.5613899",
"0.56045794",
"0.56012166",
"0.56012166",
"0.55999863",
"0.5590601",
"0.55876833",
"0.5587133",
"0.55857235",
"0.55776036",
"0.5560706",
"0.555918",
"0.5553469",
"0.553948",
"0.5532244",
"0.5529656",
"0.5521484",
"0.5517605",
"0.5513637",
"0.5509598",
"0.55085886",
"0.55085886",
"0.55085886",
"0.55085886",
"0.549941",
"0.5498187",
"0.54956466",
"0.5487327",
"0.5482088"
] | 0.82716626 | 1 |
Pushes the received data to the parser. The parser will then callback the document's methods (start_tag, end_tag... etc) | def push(data)
@parser << data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse\n @callbacks.on_start_document\n @parser.parse(@data) do |type, name, data|\n @position += @parser.byteCount\n @callbacks.on_start_element(name, data) if type == :START_ELEM\n @callbacks.on_end_element(name) if type == :END_ELEM\n end\n @callbacks.on_end_document\n @callbacks.result\n end",
"def receive_data data\n puts \"%% Parser got: #{data}\" if $options[:debug]\n @parser << data\n end",
"def parserDidStartDocument(parser)\n puts \"starting parsing..\"\n end",
"def receive_data(data)\n # p \"|<-- #{data}\"\n @parser << data\n end",
"def parse\n _build_document\n _close_open_block_commands\n @document\n end",
"def receive_data(data)\n Babylon.logger.debug(\"RECEIVED : #{data}\")\n @parser.push(data)\n end",
"def <<(data)\n @parser << data\n @buffer << data\n end",
"def parse_doc\n @parse_started = true\n nil while @lexer.get and parse_children\n # in case there was an error and there is still data stuff\n parse_tail\n @cc = nil\n @ret.call nil\n end",
"def <<(data)\n @parser << data\n end",
"def start\n REXML::Document.parse_stream(@source, self)\n end",
"def receive_data(data)\n @last_data_received_at = Time.now\n @parser << data\n end",
"def on_start_document() end",
"def parse\n @started = false\n begin\n parser = REXML::Parsers::SAX2Parser.new @stream \n parser.listen( :start_element ) do |uri, localname, qname, attributes|\n if @current.nil?\n @current = REXML::Element::new(qname)\n else\n e = REXML::Element::new(qname)\n @current = @current.add_element(e)\n end\n @current.add_attributes attributes\n if @current.name == 'stream'\n @listener.receive(@current)\n @started = true\n end\n end\n parser.listen( :end_element ) do |uri, localname, qname|\n case qname\n when \"stream:stream\"\n @started = false\n else\n @listener.receive(@current) if @current.parent.name == 'stream'\n @current = @current.parent\n end\n end\n parser.listen( :characters ) do | text |\n @current.text = (@current.text.nil? ? '' : @current.text) + text\n end\n parser.listen( :cdata ) do | text |\n raise \"Not implemented !\"\n end\n parser.parse\n rescue REXML::ParseException\n @listener.parse_failure\n end\n end",
"def parse\n self.new_part\n self.file_contents.each_line do |line|\n\n # parse the current line\n result = self.parser.parse(line, @@parse_signatures)\n\n # if there is no documentation for the result,\n # create a new part and then set the current part to nil.\n if result.nil?\n self.new_part\n self.current_part = nil\n next\n else\n\n # if new doc block is found with the current part == nil,\n # create a new part\n self.new_part if self.current_part.nil?\n end\n \n # log the result if the logger is enabled\n Logger.new(STDOUT).info(result) if @@log_lines\n\n # figure out what to do based on the result type\n case result[:tag]\n when :title\n self.title = result[:title]\n when :route\n self.current_part.set_route(result[:route])\n when :method\n self.current_part.set_method(result[:method])\n when :signature\n self.current_part.set_signature(result[:text])\n when :response\n\n # open the current response tag using the code as a key\n if result[:open]\n @@open_response = result[:code]\n @@open_response_id = result[:id]\n else\n @@open_response = nil\n end\n when :header\n\n # open the current header tag using the code as a key\n if result[:open]\n @@open_header = result[:name]\n else\n @@open_header = nil\n end\n when :param\n\n # open the current param tag using the name as the key\n if result[:open]\n @@open_param = result[:name]\n @@open_param_type = result[:type]\n @@open_param_default = result[:default]\n else\n @@open_param = nil\n end\n when :doc\n\n # figure out if the doc needs to be added to an\n # open response or param tag\n if !@@open_response.nil?\n self.current_part.append_response(@@open_response.to_i, @@open_response_id, result[:text])\n elsif !@@open_param.nil?\n self.current_part.append_param(@@open_param, result[:text], @@open_param_type, @@open_param_default)\n elsif !@@open_header.nil?\n self.current_part.append_header(@@open_header, result[:text])\n else\n self.current_part.append_doc(result[:text])\n end\n end\n\n self.lines += 1\n end\n\n # add the part and create a new one\n self.new_part\n\n # remove any empty parts or parts without method signatures (for ruby docs)\n if self.type == :RUBY\n self.parts = self.parts.select{ |part| !part.route.nil? || !part.signature.nil? }\n end\n end",
"def parse\n return @document if @document\n\n @document = super @text, @format\n @document.file = @location\n @document\n end",
"def parse\n parser = REXML::Parsers::SAX2Parser.new @stream \n parser.listen( :start_element ) do |uri, localname, qname, attributes|\n case qname\n when \"CougaarEvents\"\n @node = attributes['Node']\n @experiment = attributes['experiment']\n #puts \" Node: #{@node} Experiment: #{@experiment}\"\n @started = true\n when \"CougaarEvent\" \n @current = CougaarEvent.new\n @current.node = @node\n @current.data = \"\"\n @current.experiment = @experiment\n @current.event_type = attributes['type']\n @current.cluster_identifier = attributes['clusterIdentifier']\n @current.component = attributes['component']\n else\n @current.data << \"<#{qname}\"\n attributes.each do |key, value| \n @current.data << \" #{key} = \\\"#{value}\\\"\"\n end\n @current.data << \" >\"\n end\n end\n parser.listen( :end_element ) do |uri, localname, qname|\n case qname\n when \"CougaarEvents\"\n @node = nil\n @started = false\n when \"CougaarEvent\"\n @current.data = [@current.data].pack(\"m\")\n @listener.call(@current)\n @current = nil\n else\n @current.data << \"</#{qname}>\"\n end\n end\n parser.listen( :characters ) do | text |\n @current.data << text if @current\n end\n parser.listen( :cdata ) do | text |\n @current.data << text if @current\n end\n parser.parse\n end",
"def receive_data(data)\n Blather.logger.debug \"\\n#{'-'*30}\\n\"\n Blather.logger.debug \"STREAM IN: #{data}\"\n @parser << data\n\n rescue ParseError => e\n @error = e\n send \"<stream:error><xml-not-well-formed xmlns='#{StreamError::STREAM_ERR_NS}'/></stream:error>\"\n stop\n end",
"def after data\n classes = document.class.name.split('::')\n classes[-1] = 'SAX::Parser'\n\n handler = AfterHandler.new(self, data)\n parser = eval(classes.join('::')).new(handler)\n parser.parse(data)\n handler.after_nodes.reverse.each do |sibling|\n self.add_next_sibling sibling\n end\n end",
"def on_start_document\n end",
"def receive_data(data)\n Blather.logger.debug \"\\n#{'-'*30}\\n\"\n Blather.logger.debug \"STREAM IN: #{data}\"\n @parser << data\n\n rescue ParseError => e\n @error = e\n send_data \"<stream:error><xml-not-well-formed xmlns='#{StreamError::STREAM_ERR_NS}'/></stream:error>\"\n stop\n rescue => e\n Blather.logger.debug e\n Blather.logger.debug e.backtrace.join(\"\\n\")\n end",
"def before data\n classes = document.class.name.split('::')\n classes[-1] = 'SAX::Parser'\n\n parser = eval(classes.join('::')).new(BeforeHandler.new(self, data))\n parser.parse(data)\n end",
"def parse!(markup)\n doc(markup)\n end",
"def receive_data(data)\n data = UTF8Cleaner.clean(data)\n begin\n Skates.logger.debug {\n \"RECEIVED : #{data}\"\n }\n @parser.push(data) \n rescue\n Skates.logger.error {\n \"#{$!}\\n#{$!.backtrace.join(\"\\n\")}\"\n }\n end\n end",
"def parserDidEndDocument(parser)\n @parsed = true\n puts \"done parsing\"\n if @block\n @items.each{|item| @block.call(item)}\n end\n end",
"def parse\n\t\t\tGlyph.info \"Parsing: #{@context[:source][:name]}\" if Glyph.debug? && @context[:info] && @context[:source][:name]\n\t\t\t@tree = @parser.parse\n\t\t\t@document = Glyph::Document.new @tree, @context\n\t\t\[email protected]_from @context[:document] if @context[:document]\n\t\t\t@tree\n\t\tend",
"def start_document; end",
"def start_document; end",
"def after_parse\n end",
"def receive_data(data)\n begin\n @parser << data\n return if restarting\n if @parser.upgrade?\n if [email protected][UPGRADE_DATA]\n @current.env[UPGRADE_DATA] = @parser.upgrade_data\n @current.process\n else\n @current.parse(data)\n end\n end\n\n rescue HTTP::Parser::Error => e\n terminate_request(false)\n end\n end",
"def after_parse; end",
"def after_parse; end",
"def << data\n buffer << data if data\n parse_loop!\n end",
"def call\n doc.search('pre').each do |pre|\n process_pre_tag(pre)\n end\n\n doc\n end",
"def process(parser)\n end",
"def start_doc\n return if @done_documenting\n\n @document_self = true\n @document_children = true\n @ignored = false\n @suppressed = false\n end",
"def parser_init\n @http = Http::Parser.new\n @http.on_headers_complete = proc do\n p @http.headers\n end\n @http.on_body = proc do |chunk|\n # One chunk of the body\n p chunk\n end\n\n @http.on_message_complete = proc do |env|\n # Headers and body is all parsed\n puts \"Done!\"\n end\n\n\n end",
"def add(data)\n @parser << data\n end",
"def on_end_document\n end",
"def parse(doc)\n parser = parser_class.new\n parser.run(doc)\n end",
"def on_start_document\n STDOUT << \"on_start_document\\n\"\n STDOUT.flush\n end",
"def parse\n #puts \"PARSE\"\n @started = false\n begin\n parser = REXML::Parsers::SAX2Parser.new @stream\n\n parser.listen(:end_document) do\n raise Jabber::ConnectionForceCloseError\n end\n\n parser.listen( :start_element ) do |uri, localname, qname, attributes|\n case qname\n when \"stream:stream\"\n openstream = ParsedXMLElement.new(qname)\n attributes.each { |attr, value| openstream.add_attribute(attr, value) }\n @listener.receive(openstream)\n @started = true\n else\n if @current.nil?\n @current = ParsedXMLElement.new(qname)\n else\n @current = @current.add_child(qname)\n end\n attributes.each { |attr, value| @current.add_attribute(attr, value) }\n end\n end\n parser.listen( :end_element ) do |uri, localname, qname|\n case qname\n when \"stream:stream\"\n @started = false\n else\n @listener.receive(@current) unless @current.element_parent\n @current = @current.element_parent\n end\n end\n parser.listen( :characters ) do | text |\n @current.append_data(text) if @current\n end\n parser.listen( :cdata ) do | text |\n @current.append_data(text) if @current\n end\n parser.parse\n rescue REXML::ParseException => e\n @listener.parse_failure\n rescue Jabber::ConnectionForceCloseError => e\n @listener.parse_failure(e)\n end\n end",
"def parse(data); end",
"def new_parser_with_data\n\tdoc = load_sample_xml\n\tparser = GreenButton::Parser.new(doc)\nend",
"def parser; end",
"def parser; end",
"def parser; end",
"def parser; end",
"def start\n parse!\n run\n end",
"def parse_stream()\r\n #puts \"parse_stream\"\r\n REXML::Document.parse_stream(@pipe, self)\r\n end",
"def parse(document_xml)\n @xml = Nokogiri::XML(document_xml)\n\n # Iterate over each element node and dispatch it to the appropriate parser\n @xml.xpath('//w:body').children.each do |node|\n case node.name\n when 'p'\n no_numbering_prop = node.xpath('.//w:numPr').length.zero? || node.xpath('.//w:numPr/w:ilvl | .//w:numPr/w:numId').length.zero?\n not_multiparagraph_list_item = (@buffer.is_a?(Swordfish::Node::List) ? node.xpath('.//w:ind[@w:left]').length.zero? : true)\n if no_numbering_prop && not_multiparagraph_list_item\n # Regular paragraph\n # (The buffer check makes sure that this isn't an indented paragraph immediately after a list item,\n # which means we're most likely dealing with a multi-paragraph list item)\n flush\n @swordfish_doc.append _node_parse_paragraph(node)\n elsif node.xpath('.//w:numPr/ancestor::w:pPrChange').length.zero?\n # List paragraph\n # (must have a numPr node, but cannot have a pPrChange ancestor, since that means\n # we are just looking at historical changes)\n # (Don't flush because we need to first ensure the list is fully parsed)\n _node_parse_list(node)\n end\n when 'tbl'\n flush\n @swordfish_doc.append _node_parse_table(node)\n end\n end\n flush\n end",
"def parse\n @started = false\n\n parser = XMLParser.new(\"UTF-8\")\n def parser.unknownEncoding(e)\n raise \"Unknown encoding #{e.to_s}\"\n end\n def parser.default\n end\n\n begin\n parser.parse(@stream) do |type, name, data|\n begin\n case type\n when XMLParser::START_ELEM\n case name\n when \"stream:stream\"\n openstream = ParsedXMLElement.new(name)\n data.each {|key, value| openstream.add_attribute(key, value)}\n @listener.receive(openstream)\n @started = true\n else\n if @current.nil?\n @current = ParsedXMLElement.new(name.clone)\n else\n @current = @current.add_child(name.clone)\n end\n data.each {|key, value| @current.add_attribute(key.clone, value.clone)}\n end\n when XMLParser::CDATA\n @current.append_data(data.clone) if @current\n when XMLParser::END_ELEM\n case name\n when \"stream:stream\"\n @started = false\n else\n @listener.receive(@current) unless @current.element_parent\n @current = @current.element_parent\n end\n end\n rescue\n puts \"Error #{$!}\"\n end\n end\n rescue XMLParserError\n line = parser.line\n print \"XML Parsing error(#{line}): #{$!}\\n\"\n end\n end",
"def parse(io)\n self.doc = Nokogiri::XML(io)\n end",
"def parse_init\n @tg_end = [] #momorize tag end from regex function\n @doc_src = []\n @doc_out = []\n @tg_hot = {} \n merge_tags @mrg ? @mrg : @ext\n next_tag_init\n end",
"def parsed_resume\n build_resume('ParsedDocument')\n end",
"def parse\n self.payload ||= []\n while element = yield\n payload << element\n end\n end",
"def perform\n accept(parse_file)\n end",
"def parse\n super\n if next_page_url\n @doc = get_document(URI(next_page_url))\n self.parse\n end\n self\n end",
"def parse(xml, parse_ext = false)\n if @external\n @tree = @document.createDocumentFragment\n else\n @tree = @document\n end\n @parse_ext = parse_ext\n @current = @tree\n @inDocDecl = 0\n @decl = \"\"\n @inDecl = 0\n @idRest = 0\n @extID = nil\n @cdata_f = false\n @cdata_buf = ''\n @nsdecl = []\n super(xml)\n @tree\n end",
"def receive_data(data)\n @data_last_received_at = Time.now\n\n @parser.parse_data(data)\n end",
"def post_process(doc)\n doc\n end",
"def process!(document); end",
"def html_parser; end",
"def receive_data(data)\n @buffer ||= StringScanner.new(\"\")\n @buffer << data\n\n while line = @buffer.scan_until(/\\n/)\n response.chunk renderer.render(line)\n flush\n end \n end",
"def parsed; end",
"def parsed; end",
"def parse_content(w, p, r)\n# puts \"parse_content #{name}\"\n if r.empty_element?\n @children.each do |c|\n raise MissingElement.new(c.name) if !c.optional?\n end\n r.read\n return\n end\n\n # Move away from our opening tag\n r.read\n @children.each do |c|\n# puts \"parse_content: parsing child #{c.class}\"\n c.parse(w, self, r)\n# puts \"parse_content: parsed child #{c.class}\"\n end\n\n if r.empty_element? && r.name == self.name\n# puts \"parse_content: got empty self #{r.name}\"\n r.read\n# puts \"parse_content: now got this #{r.name}\"\n else\n# puts \"parse_content: mopping up #{self.name}\"\n WikiAvro::XML.exit_tag(w, r, self.name)\n end\n end",
"def parse!\n raise NotImplementedError, \"this class is intended to be a top class, not a useful parser\"\n end",
"def after_parse_callbacks\n @after_parse_callbacks ||= []\n end",
"def receive_data data\n #log.debug { \"Receiving data (#{data.size} bytes)\" }\n @lock.synchronize { @parser.parse(data) }\n rescue\n log.warn { \"Error handling data: #{data.hth}\" }\n p $!; puts *$@\n end",
"def parse(source_buffer); end",
"def parse(source_buffer); end",
"def parse(source_buffer); end",
"def <<(buf)\n @buffer << buf\n parse\n end",
"def after_parse(&block)\n after_parse_callbacks.push(block)\n end",
"def process\n document.add_opinions_layer\n opinions.each.with_index do |opinion, index|\n document.add_opinion opinion, index+1\n end\n\n document.add_linguistic_processor\n\n if document.pretty then pretty_print document else document.to_xml end\n end",
"def on_data( &block )\n @on_data = block\n end",
"def receive_document(doc)\n folder.documents << doc\n end",
"def parse(tokenizer)\n @doc = REXML::Document.new\n @pos = @doc\n while node=tokenizer.next\n append(node)\n end\n end",
"def parse(data)\n if !data.respond_to?(:read)\n data = StringIO.new(data || \"\")\n end\n\n if data.eof?\n {}\n else\n require_rexml unless defined?(REXML::Document)\n doc = REXML::Document.new(data)\n\n if doc.root\n merge_element!({}, doc.root, XmlMini.depth)\n else\n raise REXML::ParseException,\n \"The document #{doc.to_s.inspect} does not have a valid root\"\n end\n end\n end",
"def accept visitor\n visitor.start_accepting\n\n visitor.accept_document self\n\n visitor.end_accepting\n end",
"def parse\n read_header\n parse_text_segment\n parse_data_segment\n @data = nil\n end",
"def on_eof(&block); end",
"def start\n prepare_parser\n perform_request\n end",
"def pluggable_parser; end",
"def parse\n level = @reader.level\n while @reader.level && @reader.level == level\n lev, tag, data = @reader.info\n @reader.advance\n\n # The default arguments to the XML builder will use the tag\n # value as the XML tag.\n xml_tag = tag.downcase\n attrs = {}\n\n # Concatendate any lower level continued data.\n while data && @reader.level && continued?(level)\n data << (@reader.data || \"\") << \"\\n\"\n @reader.advance\n end\n\n # If there are children, we will parse them in a block passed to\n # the builder.\n block = children?(level) ? lambda { parse } : nil\n\n # if the tag is a @xx@ reference, then the data becomes the tag\n # and the reference is passed as an 'id' attributes.\n if ref?(tag)\n xml_tag = data.downcase\n data = nil\n attrs['id'] = tag\n end\n\n # If the data is a @xx@ reference, then pass it as a 'ref'\n # attribute rather than a data value.\n if ref?(data)\n attrs['ref'] = data\n data = nil\n end\n\n # if there are children, then pass the data as a value attribute.\n if children?(level)\n attrs['value'] = data if exist?(data)\n data = nil\n end\n\n # Construct the arguments to the XML builder and call it.\n args = [xml_tag]\n args << data if exist?(data)\n args << attrs if exist?(attrs)\n @builder.tag!(*args, &block)\n end\n end",
"def parse_markup\n @html = PARSER.parse(@markup, :base_heading_level => 1)\n end",
"def initialize(data)\n super\n pre_parse!\n end",
"def parse\n while @parser.has_next?\n res = @parser.pull\n\n if res.start_element?\n @tags << res[0]\n\n case res[0]\n when \"a\"\n attrs = normalize_attrs res[1]\n attrs['url'] = attrs['href']\n attrs.delete 'href'\n push attrs\n @textstack << ''\n\n when \"dl\"\n push({})\n\n when \"ol\", \"ul\"\n push []\n\n when \"li\", \"dt\", \"dd\"\n @textstack << ''\n\n end\n elsif res.end_element?\n @tags.pop\n\n case res[0]\n when \"a\"\n val = @textstack.pop\n unless val.empty?\n val = '' if @xostack.last['title'] == val\n val = '' if @xostack.last['url'] == val\n @xostack.last['text'] = val unless val.empty?\n end\n @xostack.pop\n\n when \"dl\", \"ol\", \"ul\"\n @xostack.pop\n\n when \"li\"\n val = @textstack.pop\n while @structs.last != @xostack.last\n val = @structs.pop\n @xostack.last << val\n end\n @xostack.last << val if val.kind_of? String\n\n when \"dt\"\n # skip\n\n when \"dd\"\n val = @textstack.pop\n key = @textstack.pop\n\n val = @structs.pop if @structs.last != @xostack.last\n @xostack.last[key] = val\n\n end\n elsif res.text?\n unless @tags.empty? || CONTAINER_TAGS.include?(@tags.last)\n @textstack.last << res[0]\n end\n end\n end\n\n self\n end",
"def on_end_document\n STDOUT << \"on_end_document\\n\"\n STDOUT.flush\n end",
"def parse(rawdata)\n end",
"def parse(content, object = T.unsafe(nil), handler = T.unsafe(nil)); end",
"def receive_internal_data data\n @tokenizer.extract(data) do |b_data|\n data_obj = load_data(b_data)\n receive_data(data_obj) if data_obj\n end\n end",
"def on_doc_loaded\r\n\t\t@graph = @doc.at('Graph')\r\n\t\t@scene = @graph.at('Scene')\r\n\t\t@logic = @doc.at('Logic')\r\n\r\n\t\tgenerate_custom_classes\r\n\t\trebuild_caches_from_document\r\n\r\n\t\tnil\r\n\tend",
"def parse\n end",
"def receive data\n data.each_char do |char|\n @buffer.concat char\n if @in_header\n prepare_to_parse_message if @buffer.end_with?(\"\\r\\n\\r\\n\")\n else\n parse_message_from_buffer if @buffer.bytesize == @content_length\n end\n end\n end",
"def parse; end",
"def parse; end",
"def parse; end",
"def close\n @parser.data ''\n @closed = true\n end"
] | [
"0.8032534",
"0.69366324",
"0.686857",
"0.6703675",
"0.6490557",
"0.63304013",
"0.63266534",
"0.63215995",
"0.6204941",
"0.6139274",
"0.61382896",
"0.6080106",
"0.6016244",
"0.6004609",
"0.6000373",
"0.59895855",
"0.5983916",
"0.59829366",
"0.59613585",
"0.59089863",
"0.58976334",
"0.5893648",
"0.58908474",
"0.5889314",
"0.58581835",
"0.5800174",
"0.5800174",
"0.57981247",
"0.57895947",
"0.57742435",
"0.57742435",
"0.5772794",
"0.57620144",
"0.57443273",
"0.57395756",
"0.57320344",
"0.56811273",
"0.56422335",
"0.5635293",
"0.5634982",
"0.5630817",
"0.5579252",
"0.55697715",
"0.55357856",
"0.55357856",
"0.55357856",
"0.55357856",
"0.55281955",
"0.5493766",
"0.54871553",
"0.54716253",
"0.5462934",
"0.54571354",
"0.5441937",
"0.5433572",
"0.54002565",
"0.53915495",
"0.53910744",
"0.53838605",
"0.538066",
"0.5377831",
"0.5371297",
"0.5344243",
"0.53390837",
"0.53390837",
"0.53315735",
"0.5327179",
"0.5322622",
"0.53184533",
"0.5316608",
"0.5316608",
"0.5316608",
"0.52795917",
"0.52794653",
"0.5261151",
"0.52496123",
"0.52453244",
"0.5244107",
"0.5240518",
"0.52376467",
"0.5225863",
"0.52176726",
"0.52048266",
"0.5201267",
"0.51995814",
"0.5193011",
"0.5189859",
"0.51857954",
"0.518149",
"0.51733565",
"0.51682985",
"0.5159754",
"0.51558554",
"0.51548725",
"0.51493615",
"0.51460975",
"0.51460975",
"0.51460975",
"0.5145476"
] | 0.6498544 | 5 |
Adds characters to the current element (being parsed) | def characters(string)
@buffer ||= ""
@buffer += string
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parser(parser, foundCharacters:string)\n if @current_item && @current_item.respond_to?(@current_element)\n el = @current_item.send(@current_element)\n el << string\n end\n end",
"def add_character(char)\n @characters << char\n end",
"def characters(string)\n @elem.add_child(Nokogiri::XML::Text.new(string, @doc))\n end",
"def on_characters(chars)\n\t\tif (@store_chars) then\n\t\t\t#TODO: why can't we just edit @stack.last ?\n\t\t\tbuffer = @stack.pop\n\t\t\tbuffer += chars\n\t\t\[email protected](buffer)\n\t\tend\n\tend",
"def <<(char)\n @text << char\n @cursor += 1\n end",
"def <<(char)\n @text << char\n @cursor += 1\n end",
"def on_characters(text)\n\t\t\t\t\tif @vals[@tag] == nil then\n\t\t\t\t\t\t@vals[@tag] = text\n\t\t\t\t\telse\n\t\t\t\t\t\t@vals[@tag] << text\n\t\t\t\t\tend\n\t\t\t\tend",
"def on_characters(text)\n\t\t\t\t\tif @vals[@tag] == nil then\n\t\t\t\t\t\t@vals[@tag] = text\n\t\t\t\t\telse\n\t\t\t\t\t\t@vals[@tag] << text\n\t\t\t\t\tend\n\t\t\t\tend",
"def on_characters(chars)\n if(@is_row)\n @row << chars;\n end\n end",
"def forward characters\n @char += characters\n char || false\n end",
"def characters(string)\n @plaintext << string if @interesting\n end",
"def characters(string)\n @plaintext << string if @interesting\n end",
"def read_character(characters)\n # Read the character the cursor is pointed at and the next character if available\n char = characters[@cursor]\n read_ahead = @cursor < characters.length - 1 ? characters[@cursor + 1] : nil\n @cursor += 1\n\n # if first char is *, throw error\n raise 'SYNTAX ERROR' if char == '*'\n\n # Check if current element is repeatable\n is_repeatable = false\n if read_ahead == '*'\n raise 'SYNTAX ERROR' if char == '|'\n\n is_repeatable = true\n @cursor += 1\n end\n\n # handle element storage\n element = create_element(char, is_repeatable)\n return if element.nil?\n\n # Put elements as deep as possible\n if nested_child?\n @elements.last.add_element(element)\n else\n @elements << element\n end\n end",
"def parse_escaped_chars\n @src.pos += @src.matched_size\n add_text(@src[1])\n end",
"def add(chr)\n @str += chr\n end",
"def add(character)\n if @total_width + @char_widths[character] <= MAX_WIDTH and\n @text.size < @chars_max\n if $input_text_sound_mode == 1\n $game_system.se_play($data_system.cursor_se)\n end\n @text.size.downto(@index+1) do |i|\n @text[i] = @text[i-1]\n end\n @text[@index] = character\n @index += 1\n @cursor_x += @char_widths[character]\n else\n $game_system.se_play($data_system.cancel_se)\n end\n end",
"def add_one(input)\n newc = new_char\n input + newc\n end",
"def next_char\n @current_char_pos += 1\n @current_char = @string[@current_char_pos, 1]\n end",
"def clear_characters_buffer\n if @buffer && @elem\n @buffer.strip!\n @elem.add_child(Nokogiri::XML::Text.new(@buffer, @doc)) unless @buffer.empty?\n @buffer = nil # empty the buffer\n end\n end",
"def characters(text)\n @characters << text if @buffer_characters\n end",
"def value_with (char)\n temp_val = @value\n \n if @cursor_location == @value.length\n temp_val = @value + char\n else\n temp_val = @value.slice(0..@cursor_location-1) + char + @value.slice(@[email protected])\n end\n \n temp_val\n end",
"def add_children(char)\n @childrens[char] = Node.new(char)\n end",
"def add_letter(letter)\n fragment << letter\n end",
"def characters(str)\n @text << str if str && !str.empty?\n end",
"def on_characters(chars)\n end",
"def add_element_for_CharacterStyleRange(char)\n el = parent_el = nil\n char_style = :regular\n l = { :story => @story_name, :line => char.line }\n\n # Only proceed if char has at least one non-empty Content node\n char_has_non_whitespace_content = char.children.any? { |child|\n 'Content' == child.name && !child.inner_text.strip.empty?\n }\n return el unless char_has_non_whitespace_content\n\n if (\n 'CharacterStyle/Bold Italic' == char['AppliedCharacterStyle'] ||\n 'Bold Italic' == char['FontStyle']\n )\n # Create pair of nested elements to include both bold and italic styles.\n parent_el = ElementRt.new(:strong, nil, nil, :location => l)\n el = ElementRt.new(:em, nil, nil, :location => l)\n parent_el.add_child(el)\n char_style = :bold_italic\n else\n # TODO: assignment of char_style depends on code execution: if both are present, it will always be 'Italic' and never 'Bold'\n # Is this ok or intended?\n if (\n 'CharacterStyle/Bold' == char['AppliedCharacterStyle'] ||\n 'Bold' == char['FontStyle']\n )\n el = parent_el = ElementRt.new(:strong, nil, nil, :location => l)\n char_style = :bold\n end\n\n if (\n 'CharacterStyle/Italic' == char['AppliedCharacterStyle'] ||\n 'Italic' == char['FontStyle']\n )\n if parent_el\n el = ElementRt.new(:em, nil, nil, :location => l)\n parent_el.add_child(el)\n else\n el = parent_el = ElementRt.new(:em, nil, nil, :location => l)\n end\n char_style = :italic\n end\n\n end\n\n if 'CharacterStyle/$ID/[No character style]' == char['AppliedCharacterStyle']\n # Preserve FontStyles\n if 'Italic' == char['FontStyle']\n el = parent_el = ElementRt.new(:em, nil, nil, :location => l)\n char_style = :italic\n elsif 'Bold' == char['FontStyle']\n el = parent_el = ElementRt.new(:strong, nil, nil, :location => l)\n char_style = :bold\n else\n # No FontStyle applied so we don't need to add any parent elements\n # for this CharacterStyleRange\n end\n end\n\n add_class_to_self_or_parent = lambda do |css_class|\n parent_el = el = ElementRt.new(:em, nil, nil, :location => l) if el.nil?\n parent_el.add_class(css_class)\n parent_el.add_class(\n case char_style\n when :regular then ''\n when :italic then ' italic'\n when :bold then ' bold'\n when :bold_italic then ' bold italic'\n end\n )\n end\n\n add_class_to_self_or_parent.call('underline') if 'true' == char['Underline']\n add_class_to_self_or_parent.call('smcaps') if 'SmallCaps' == char['Capitalization']\n\n if \"Color/GAP RED\" == char['FillColor']\n (el.nil? ? @tree : el).add_child(\n ElementRt.new(:gap_mark, nil, nil, :location => l)\n )\n end\n\n if \"Color/TRANSLATORS OMIT\" == char['FillColor']\n containing_para_ke = @stack.last.first\n if (\n containing_para_ke &&\n :p == containing_para_ke.type\n )\n # append omit class\n containing_para_ke.add_class('omit')\n end\n end\n\n if 'CharacterStyle/Paragraph number' == char['AppliedCharacterStyle']\n if @tree.has_class?('normal')\n @tree.remove_class('normal')\n @tree.add_class('normal_pn')\n end\n add_class_to_self_or_parent.call('pn')\n end\n\n if !HANDLED_CHARACTER_STYLES.include?(char['AppliedCharacterStyle'])\n add_class_to_self_or_parent.call(normalize_style_name(char['AppliedCharacterStyle']))\n end\n\n @tree.add_child(parent_el) if !parent_el.nil?\n\n el\n end",
"def each_escape(node); end",
"def add(ch)\n return false if @index >= @max_char\n @name += ch\n @index += 1\n refresh\n return true\n end",
"def initialize(append_characters)\n super(FIRST_CHARACTER, append_characters)\n end",
"def characters(value)\n @document.last << value if @document\n end",
"def characters(text)\n\t\t\t\tif @vals[@tag] == nil then\n\t\t\t\t\t@vals[@tag] = text.strip\n\t\t\t\telse\n\t\t\t\t\t@vals[@tag] << text.strip\n\t\t\t\tend\n\t\t\tend",
"def new_char(name)\n new_char = CharacterSheet.roll_char(name)\n self.characters << new_char\n end",
"def advance \n \n @pos += 1\n if @pos > @text.length - 1\n @currentChar = nil\n else \n @currentChar = @text[@pos]\n end\n \n end",
"def add_horizontal_char(char)\n node = find_horizontal(char);\n if node != nil\n return node\n end\n node = Node.new(char, up)\n add_horizontal(node)\n return node\n end",
"def add(term)\n root.add Buffer.new(normalize(term) + delimiter), term\n end",
"def self\n @fundamental_character = current_character",
"def +(chr)\n @str += chr\n end",
"def new_char()\n case\n when current_char == \"\\n\"\n # Underline, and Strikethrough\n if @options[:extended_markup] == true\n self.data.gsub!(/---([^-]+)---/,\"<strike>\\\\1</strike>\")\n self.data.gsub!(/_([^_]+)_/,\"<u>\\\\1</u>\")\n end\n\n # Behavior Switches\n self.data.gsub!(/__([\\w]+)__/) { |r|\n case behavior_switch_key_name($1)\n when \"behavior_switches.toc\"\n @options[:link_handler].toc(@options[:sections], @options[:toc_numbered])\n when \"behavior_switches.noeditsection\"\n @options[:noedit] = true\n when \"behavior_switches.editsection\"\n @options[:noedit] = false\n else\n \"\"\n end\n }\n\n # Horizontal Rule\n self.data.gsub!(/^([-]{4,})/) { |r| \"<hr />\" }\n\n render_bold_italic()\n\n # Lists\n tmp = ''\n self.data.each_line do |line|\n if line =~ /^([#\\*:;]+)/\n # Add current line to list data\n @list_data << line\n else\n # render list if list data was just closed\n tmp += render_list_data() unless @list_data.empty?\n tmp += line\n end\n end\n self.data = tmp\n\n # Headings\n is_heading = false\n self.data.gsub!(/^([=]{1,6})\\s*(.*?)\\s*(\\1)/) { |r|\n is_heading = true\n (@paragraph_open ? \"</p>\" : \"\") + gen_heading($1.length,$2)\n }\n\n self.data = self.data.auto_link\n\n # Paragraphs\n if is_heading\n @paragraph_open = false\n else\n if self.data =~ /^\\s*$/ && @paragraph_open && @list_data.empty?\n self.data = \"</p>#{self.data}\"\n @paragraph_open = false\n else\n if self.data !~ /^\\s*$/\n self.data = \"<p>#{self.data}\" and @paragraph_open = true unless @paragraph_open\n end\n end\n end\n\n self.params << self.data\n self.data = \"\"\n else\n self.data << current_char\n end\n return true\n end",
"def on_CHAR(body)\n @last_sexp = super(body)\n end",
"def insert(chars)\n self[@cursor] = chars\n end",
"def insert(chars)\n self[@cursor] = chars\n end",
"def <<( element )\n case element\n when Otus\n add_otus element\n when Trees\n add_trees element\n when Characters\n add_characters element\n end\n end",
"def insert_character(character)\n return self if character.is_a?(Symbol)\n\n @lines = lines.insert_character(character, y, x)\n\n right\n\n refresh\n end",
"def characters(str)\n @text ||= \"\"\n @text << str\n end",
"def start_element(name, attrs = [])\n values = attrs.to_h\n return if name != 'String'\n token = values['CONTENT']\n @text << token\n @words << {\n word: token,\n coordinates: s_coords(values)\n }\n end",
"def append letter \n @letters << letter \n render\n self\n end",
"def rb_mvaddch row, col, char\n super(row-@top, col-@left, char)\n end",
"def end_element(name)\n @text << \" \" if name == 'String'\n @text << \"\\n\" if name == 'TextBlock'\n @text << \"\\n\" if name == 'TextLine'\n end",
"def comp_line\n @xml += \"<#{@tokens[@i].type}> #{@tokens[@i].val} </#{@tokens[@i].type}> \"\n @i += 1\n end",
"def characters(text)\n return unless @state[:has_text]\n @text ||= \"\"\n @text << text\n end",
"def read_raw_text(element, x, doc_element, raw_indent, i)\n\n #val = @indent == true ? padding(doc_element, raw_indent, x) : ''\n if x.to_s.strip.length > 0 then\n\n val = x.to_s.strip #\n puts ('val: ' + val.inspect).debug if @debug\n doc_element.add_element x.to_s\n end\n\n end",
"def next_char\n self.cursor += 1\n end",
"def nextChar\n if getChar == \"\\n\"\n @line += 1\n @column = @lastLineSize\n end\n @index += 1\n @column += 1\n end",
"def build_up_new_tag(element)\n @current_node.children << TagNode.new(element)\n end",
"def append! x\n\t\t\tcurrent << x\n\t\t\tx\n\t\tend",
"def add_tags chars\n # TODO: write your code here\nend",
"def addchar(c)\n\t\tif @marked == false\n\t\t\tinsertchar(@row,@col,c.chr)\n\t\telse\n\t\t\tmark_row,row = ordered_mark_rows\n\t\t\tfor r in mark_row..row\n\t\t\t\tif (@text[r].length==0)&&((c==?\\s)||(c==?\\t)||(c==$ctrl_i)||(c==$space))\n\t\t\t\t\tnext\n\t\t\t\tend\n\t\t\t\tif @colmode\n\t\t\t\t\tsc = bc2sc(@row,@col)\n\t\t\t\t\tcc = sc2bc(r,sc)\n\t\t\t\t\tif(cc>@text[r].length) then next end\n\t\t\t\t\tinsertchar(r,cc,c.chr)\n\t\t\t\telse\n\t\t\t\t\tinsertchar(r,0,c.chr)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tcursor_right\n\t\tif @linewrap\n\t\t\tjustify(true)\n\t\tend\n\tend",
"def read characters\n forward characters\n end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def handleTextElement someText\r\n @output << someText.value.strip if @output\r\n end",
"def add_character(character_obj)\n # instance.cast << character_obj\n # self.cast << character_obj\n character_obj.series = self\n end",
"def characterReference(n)\n\t finishStartTag() if @inStartTag\n\t @io << \"&\\##{n.instance_of?(String) ? n[0] : n};\"\n\tend",
"def fill_with char\n fill_from_with(0 , char)\n end",
"def create_element(char, is_repeatable)\n case char\n # Create wild\n when '.'\n WildElement.new(is_repeatable)\n\n # Open alternation, collect previous elements at current depth\n when '|'\n previous_elements = []\n if nested_child?\n @elements.last.add_alternation\n return nil\n else\n @elements.each { |elem| previous_elements << elem }\n @elements.clear\n\n end\n AlternateElement.new(previous_elements)\n\n # Open new group\n when '('\n raise 'SYNTAX ERROR' if is_repeatable\n\n @depth += 1\n GroupElement.new(@depth)\n\n # Try close group at current depth\n when ')'\n raise 'SYNTAX ERROR' if @depth.zero?\n\n @elements.last.close_group(@depth, is_repeatable)\n @depth -= 1\n nil\n\n # else ASCII element\n else\n CharacterElement.new(is_repeatable, char)\n end\n end",
"def append(text); end",
"def nextchar\n c = self.more?() ? @source[@index,1] : \"\\0\"\n @index += 1\n return(c)\n end",
"def parse\n length = @chars.length\n @index = 0\n while @index < length\n @tokens << if custom?\n parse_custom\n else\n parse_char\n end\n @index += 1\n end\n @tokens\n end",
"def set_params(word, char)\n @previous = @current\n @current = word\n add_used_chars(char)\n end",
"def add_tags chars\n chars.map!.each_with_index do |ch, idx|\n if ch == ' '\n [ch]\n else\n prev_ch = idx > 0 ? chars[idx-1][0] : ' '\n next_ch = chars[idx+1] || ' '\n\n [ch, pick_tag(prev_ch, next_ch)]\n end\n end\n chars.map! {|*arr| arr.join(\"\\t\")}\nend",
"def insert_character(char)\n @background_grid[@state.row][@state.column] = Character.new(char, @state.style.dup)\n @state.column += 1\n end",
"def set_char(attr, val); end",
"def insert_character(character, index = nil)\n return self unless character\n\n Vedeu::Editor::Line.coerce(Vedeu::Editor::Insert\n .into(collection, character, index, size))\n end",
"def each_char\n idx = 0\n while idx < length\n yield self[idx]\n idx += 1\n end\n self\n end",
"def char\n\t\t\t\t@char\n\t\t\tend",
"def append(s)\n if @input.nil?\n @input = \"\"\n end\n @input += s\n @output.text = @input\n end",
"def append(s)\n if @input.nil?\n @input = \"\"\n end\n @input += s\n @output.text = @input\n end",
"def append(s)\n if @input.nil?\n @input = \"\"\n end\n @input += s\n @output.text = @input\n end",
"def NextChar\r\n\t\[email protected]!(0, 1)\r\n\tend",
"def on_characters(chars)\n STDOUT << \"on_characters\" << \"\\n\" <<\n \" chars \" << chars << \"\\n\" \n STDOUT.flush\n end",
"def add(chars)\n result = chars[0]\n \n for i in 1...chars.length\n result = binaryAdd(result, chars[i])\n end\n \n result\n end",
"def <<(text_element)\n self.text_elements << text_element\n self.merge!(text_element)\n end",
"def add_character_with_count(last_char, char_count)\n last_char + char_count.to_s\n end"
] | [
"0.707553",
"0.6635222",
"0.6616516",
"0.6205433",
"0.60509676",
"0.60509676",
"0.59892976",
"0.59892976",
"0.5954188",
"0.5910093",
"0.58252835",
"0.58252835",
"0.57752824",
"0.574673",
"0.572862",
"0.5667856",
"0.5620692",
"0.560615",
"0.55919355",
"0.55826414",
"0.5576558",
"0.5569296",
"0.5567866",
"0.5564273",
"0.5553262",
"0.55150455",
"0.5511198",
"0.5498301",
"0.54527366",
"0.5439598",
"0.5439468",
"0.5437845",
"0.54216605",
"0.541793",
"0.54044384",
"0.5365793",
"0.5345169",
"0.53410727",
"0.5324703",
"0.5316849",
"0.5316849",
"0.5312653",
"0.52982676",
"0.52598035",
"0.52473956",
"0.5230845",
"0.52239406",
"0.5185845",
"0.5180068",
"0.5179522",
"0.5171856",
"0.5171222",
"0.5163486",
"0.515943",
"0.51540583",
"0.51379764",
"0.51317734",
"0.5128083",
"0.50999004",
"0.50999004",
"0.50999004",
"0.50999004",
"0.50999004",
"0.50999004",
"0.50999004",
"0.50999004",
"0.50999004",
"0.50999004",
"0.5099886",
"0.5099886",
"0.5099886",
"0.5099886",
"0.5099886",
"0.5099886",
"0.5099886",
"0.5099886",
"0.5099886",
"0.50984526",
"0.5092001",
"0.5089529",
"0.5068024",
"0.5053764",
"0.5043628",
"0.50417733",
"0.5040529",
"0.503933",
"0.50130796",
"0.50063795",
"0.49934208",
"0.4990848",
"0.49758354",
"0.49730816",
"0.49561796",
"0.49561796",
"0.49561796",
"0.49515143",
"0.49513504",
"0.49483466",
"0.494748",
"0.49418312"
] | 0.49615842 | 92 |
Instantiate a new current Element, adds the corresponding attributes and namespaces. The new element is eventually added to a parent element (if present). If no element is being parsed, then, we create a new document, to which we add this new element as root. (we create one document per stanza to avoid memory problems) | def start_element(qname, attributes = [])
clear_characters_buffer
@doc ||= Nokogiri::XML::Document.new
@elem ||= @doc # If we have no current element, then, we take the doc
@elem = @elem.add_child(Nokogiri::XML::Element.new(qname, @doc))
add_namespaces_and_attributes_to_current_node(attributes)
if @elem.name == "stream:stream"
# We activate the callback since this element will never end.
@callback.call(@elem)
@doc = @elem = nil # Let's prepare for the next stanza
# And then, we start a new Sax Push Parser
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_element(qname, attributes = [])\n e = Nokogiri::XML::Element.new(qname, @doc)\n add_namespaces_and_attributes_to_node(attributes, e)\n\n # Adding the newly created element to the @elem that is being parsed, or, if no element is being parsed, then we set the @root and the @elem to be this newly created element.\n @elem = @elem ? @elem.add_child(e) : (@root = e)\n \n if @elem.name == \"stream:stream\"\n # Should be called only for stream:stream.\n # We re-initialize the document and set its root to be the doc.\n # Also, we activate the callback since this element will never end.\n @doc = Nokogiri::XML::Document.new\n @doc.root = @root = @elem\n @callback.call(@elem)\n end\n end",
"def from_xml_elem(ctx, root)\n #p [:from_xml_elem, :ctx, root]\n attributes = root.attributes.inject({ }) { |hash, (k, v)| hash[k] = EscapeXML.unescape(v.to_s); hash}\n text, children = root.children.partition{ |x| text_node?(x) }\n text = text.map{ |x| x.to_s}.reject{ |s| s =~ /^\\s*$/}.join('')\n element_name = root.name\n if element_name !~ /[A-Z]/\n element_name = Doodle::Utils.camel_case(element_name)\n end\n klass = Utils.const_lookup(element_name, ctx)\n #p [:creating_new, klass, text, attributes]\n #p [:root1, root]\n # don't pass in empty text - screws up when class has only\n # child elements (and no attributes) because tries to\n # instantiate child element from empty string \"\"\n if text == \"\"\n text = nil\n end\n args = [text, attributes].compact\n oroot = klass.new(*args) {\n #p [:in_block]\n from_xml_elem(root)\n }\n #p [:oroot, oroot]\n oroot\n end",
"def add_element(element, attrs=nil)\n self << new_element = XML::Node.new(element.to_s, self.document)\n new_element.add_attributes(attrs)\n return new_element\n end",
"def new_empty_doc\n Atom::XML::Document.new\n end",
"def parse\n\t\t#todo Check|Split for comment.\n\t\t\n\t\t# increment level of recursion for debugging\n\t\t@level += 1\n\t\t\n\t\t#todo check for closing identifier\n\t\twhile closing_element?\n\t\t\tdown_line\n\t\tend\n\t\t\n\t\t# Gets the namespace, if one exists.\n\t\ttmp_namespace = get_namespace\n\t\t\n\t\t#todo Check|Register identifier prefix.\n\t\ttmp_identifier = get_identifier\n\t\t\n\t\t# creates attribute list for this level of the stack.\n\t\tattributes = []\n\t\twhile attributes_exist?\n\t\t\t#todo Check|Register attribute prefix.\n\t\t\tattribute_prefix = get_attribute_prefix\n\t\t\t\n\t\t\t#todo Check|Register attribute identifier.\n\t\t\tattribute_identifier = get_attribute_identifier\n\t\t\t\n\t\t\t#todo Check|Register attribute field.\n\t\t\tattribute_field = get_attribute_field\n\t\t\t\n\t\t\tattributes.push Attribute.new(attribute_prefix, attribute_identifier, attribute_field)\n\t\tend\n\t\telement = Element.new(tmp_namespace, tmp_identifier, attributes)\n\t\t\n\t\t#check for children of the element, then recursively create them.\n\t\tif children_exist?\n\t\t\t# Find the openning of a element.\n\t\t\twhile children_exist?\n\t\t\t\telement.add(parse)\n\t\t\tend\n\t\tend\n\t\t#todo add element data\n\t\telement.data = get_element_data\n\t\treturn element\n\tend",
"def build_up_new_tag(element)\n @current_node.children << TagNode.new(element)\n end",
"def build(attrs = {}, &block)\n create_document(:new, attrs, &block)\n end",
"def initialize_xml(xml, root_element)\n @xml = XMLElement.build_xml(xml, root_element)\n\n if OpenNebula.is_error?(@xml)\n @xml = nil\n else\n if NOKOGIRI\n if @xml.size == 0\n @xml = nil\n end\n else\n if @xml.name != root_element\n @xml = nil\n end\n end\n end\n @xml\n end",
"def initialize\n\n # This call to Builder creates our main XML document. \n\n @builder = Nokogiri::XML::Builder.new {\n wrap_it( 'WRAP' => \"demo\") {\n # The parent element is \"wrap_it\", thus method parent()\n # returns a Nokogiri::XML::Element that we can operate on later.\n @fs_parent = parent;\n }\n \n # This is our home grown accessor method since @fs_parent is an\n # instance variable and is normally private.\n\n def fs_parent\n return @fs_parent;\n end\n }\n\n print \"Parent class: #{@builder.fs_parent.class}\\n\"\n\n # Create two new child elements just to demonstrate how we use an\n # parameter to the method. We are still in method initialize() so\n # the code below runs during Test_child.new(). In some cases you\n # may want to create the Builder object, have some instance\n # variables for elements to be expanded, and add those child\n # elements long after initialize() has been called.\n\n create_new_element(\"one\", @builder.fs_parent);\n create_new_element(\"two\", @builder.fs_parent);\n end",
"def add_element(name, attrs=nil)\n self.root = new_element = XML::Node.new(name, self)\n self.root.add_attributes(attrs) if attrs\n\n new_element\n end",
"def add_element(name, attrs={})\n ns = XMLNamespaces.map {|k, v| [\"xmlns:#{k}\", v]}\n ns = Hash[*ns.flatten]\n attrs.merge!(ns)\n super(name, attrs)\n end",
"def start_element_namespace(name, attrs = T.unsafe(nil), prefix = T.unsafe(nil), uri = T.unsafe(nil), ns = T.unsafe(nil)); end",
"def start_element_namespace(name, attrs = T.unsafe(nil), prefix = T.unsafe(nil), uri = T.unsafe(nil), ns = T.unsafe(nil)); end",
"def __set_element(el, opts = {})\n unless el.is_a?(Nokogiri::XML::Element)\n el = Nokogiri::XML::Element.new(opts[:tag], @__node)\n @__node << el\n if opts[:namespace]\n el.namespace = el.namespace_scopes.find { |n| n.prefix == opts[:namespace] }\n end\n end\n h = __elements_handlers.for_xml_object(el)\n el.instance_variable_set(:@__handler, h)\n __initialize_elements_container(h) << h.from_xml_element(el)\n end",
"def createElementNS(nsuri, qname)\n ret = Element.new([nsuri, qname])\n ret.ownerDocument = self\n ret\n end",
"def parse\n #return a cached version if it exists\n return @nexml if @nexml\n\n #start at the root element\n skip_leader\n\n #start with a new Nexml object\n version = attribute( 'version' )\n generator = attribute( 'generator' )\n @nexml = NeXML::Nexml.new( version, generator )\n\n #perhaps a namespace api as well\n \n #start parsing other elements\n while next_node\n case local_name\n when \"otus\"\n @nexml.add_otus( parse_otus )\n when \"trees\"\n @nexml.add_trees( parse_trees )\n when \"characters\"\n @nexml.add_characters( parse_characters )\n end\n end\n\n #close the libxml parser object\n #close\n\n #return the Nexml object\n @nexml\n end",
"def on_start_element_ns(element, attributes, prefix, uri, namespaces)\n\t\telement.downcase!\n\t\tputs \"Start \"+element.downcase if Debug > 2\n\n\t\t# NOTE: This parsing relies on the simple two-level structure \n\t\t# of VIP data.\n\t\tif (@stack.size == 0 && TopElements.include?(element)) then\n\t\t if element == 'source'\n\t\t obj = Source.new\n\t\t @source = obj\n\t\t else\n\t\t raise if @source.nil?\n\t\t obj = element.camelcase.constantize.new\n\t\t obj.source = @source\n\t\t end\n\n\t\t #store attributes inside start tag\n\t\t attributes.each {|k,v| \n\t\t\t puts k if Debug > 4\n\t\t\t add_xml_attribute(obj,k,v)\n\t\t }\n\t\t @stack.push(obj)\n\n\t\telsif (@stack.size == 1) then # && Innerelements.include?(element)) then\n\t\t\t @stack.push(String.new(element))\n\t\t\t @stack.push(String.new())\n\t\t\t @store_chars = true\n\t\telse\n\t\t\tputs \"Ignoring element: \"+element if Debug > 0\n\t\tend\n\n\tend",
"def start_new_element(name, attrs)\r\n parent = @element_stack.last\r\n\r\n #puts \"Adding element '#{name}' to '#{parent.name}'\"\r\n\r\n child = REXML::Element.new(name, parent)\r\n child.add_attributes(attrs)\r\n\r\n @element_stack.push(child)\r\n end",
"def initialize\n\t@xml = '<?xml version=\"1.0\"?>\n<?misc:processingInstruction \"with arguments\"?>\n<?other:piNoArgs ?>\n<!DOCTYPE outer PUBLIC \"public id\" \"foobar\" [\n <!ENTITY foo \"bletch\">\n <!ELEMENT el>\n <!ATTLIST el EMPTY>\n <!NOTATION notation ignored>\n]>\n<!-- comment -->\n<outer>\n data&&foo;\nmore on next line<simpleTag>text</simpleTag>\n<inner:tag a=\"tabs\tto\tspaces&foo;\"/><![CDATA[xx<z&xx</\nnewline in cdata\n]]>\n<p>text <b>bold café coffee</b> more text</p>\n</outer>'\n\n\temptyAttrs = Hash.new()\n\t@newlineTok = NQXML::Text.new(\"\\n\")\n\n\tattrs = Hash.new()\n\tattrs['version'] = '1.0'\n\t@xmlDecl = NQXML::XMLDecl.new('xml', attrs, '<?xml version=\"1.0\"?>')\n\n\tsrc = '<?misc:processingInstruction \"with arguments\"?>'\n\t@piWithArgs =\n\t NQXML::ProcessingInstruction.new('misc:processingInstruction',\n\t\t\t\t\t '\"with arguments\"', src)\n\n\t@piNoArgs = NQXML::ProcessingInstruction.new('other:piNoArgs', '',\n\t\t\t\t\t\t '<?other:piNoArgs ?>')\n\n\t@entityTag =\n\t NQXML::GeneralEntityTag.new('foo', 'bletch', nil, nil,\n\t\t\t\t\t'<!ENTITY foo \"bletch\">')\n\t@element = NQXML::Element.new('el', '', '<!ELEMENT el>')\n\t@attlist = NQXML::Attlist.new('el', 'EMPTY', '<!ATTLIST el EMPTY>')\n\t@notation = NQXML::Notation.new('notation', 'ignored',\n\t\t\t\t\t'<!NOTATION notation ignored>')\n\t@doctypePubid =\n\t NQXML::PublicExternalID.new('\"public id\"', '\"foobar\"',\n\t\t\t\t\t'PUBLIC \"public id\" \"foobar\"')\n\t@doctype =\n\t NQXML::Doctype.new('outer', @doctypePubid,\n\t\t\t [@entityTag, @element, @attlist, @notation],\n\t\t\t \"<!DOCTYPE outer PUBLIC \\\"public id\\\" \\\"foobar\\\" [\\n\" +\n\t\t\t \" <!ENTITY foo \\\"bletch\\\">\\n\" +\n\t\t\t \" <!ELEMENT el>\\n\" +\n\t\t\t \" <!ATTLIST el EMPTY>\\n\" +\n\t\t\t \" <!NOTATION notation ignored>\\n\" +\n\t\t\t \"]>\")\n\n\t@comment = NQXML::Comment.new('<!-- comment -->')\n\t@outerStart = NQXML::Tag.new('outer', emptyAttrs, false, '<outer>')\n\t@textDataWithSub = NQXML::Text.new(\"\\n data&bletch\\nmore on next line\")\n\t@simpleTagStart = NQXML::Tag.new('simpleTag', emptyAttrs, false,\n\t\t\t\t\t '<simpleTag>')\n\t@simpleTextData = NQXML::Text.new('text')\n\t@simpleTagEnd = NQXML::Tag.new('simpleTag', nil, true, '</simpleTag>')\n\n\tattrs = Hash.new()\n\tattrs['a'] = 'tabs to spacesbletch'\n\t@innerTagStart = NQXML::Tag.new('inner:tag', attrs, false,\n\t\t\t\t\t'<inner:tag a=\"tabs\tto\tspaces&foo;\"/>')\n\n\t@innerTagEnd = NQXML::Tag.new('inner:tag', nil, true,\n\t\t\t\t\t'<inner:tag a=\"tabs\tto\tspaces&foo;\"/>')\n\t@pTagStart = NQXML::Tag.new('p', emptyAttrs, false, '<p>')\n\t@pTagEnd = NQXML::Tag.new('p', nil, true, '</p>')\n\t@bTagStart = NQXML::Tag.new('b', emptyAttrs, false, '<b>')\n\t@bTagEnd = NQXML::Tag.new('b', nil, true, '</b>')\n\t@textText = NQXML::Text.new('text ')\n\t@boldText = NQXML::Text.new('bold café coffee')\n\t@moreTextText = NQXML::Text.new(' more text')\n\n\t@cdata = NQXML::Text.new(\"xx<z&xx</\\nnewline in cdata\\n\",\n\t\t\t\t \"<![CDATA[xx<z&xx</\\nnewline in cdata\\n]]>\")\n\t@outerEnd = NQXML::Tag.new('outer', nil, true, '</outer>')\n\n\t@sub1_xml = '<?xml version=\"1.0\"?>\n<!DOCTYPE outer SYSTEM \"foobar\" [\n <!ENTITY example \"<p>An ampersand (&#38;) may be escaped numerically (&#38;#38;) or with a general entity (&amp;).</p>\" >\n]>\n'\n\tsrc = '<!ENTITY example \"<p>An ampersand (&#38;) may be' +\n\t ' escaped numerically (&#38;#38;) or with a general entity' +\n\t ' (&amp;).</p> >'\n\tval = \"<p>An ampersand (&) may be escaped numerically\" +\n\t \" (&#38;) or with a general entity (&amp;).</p>\"\n\t@sub1Entity = NQXML::GeneralEntityTag.new('example', val, nil, nil,\n\t\t\t\t\t\t src)\n\t\t\t\t\t\t\n\t@sub2_xml = '<?xml version=\"1.0\"?>\n<!DOCTYPE test [\n<!ELEMENT test (#PCDATA) >\n<!ENTITY % xx \\'%zz;\\'>\n<!ENTITY % zz \\'<!ENTITY tricky \"error-prone\" >\\' >\n%xx;\n]>\n<test>This sample shows a &tricky; method.</test>\n'\n\t@xxEntity =\n\t NQXML::ParameterEntityTag.new('xx', '%zz;', nil,\n\t\t\t\t\t '<!ENTITY % zz \\'%zz;\\'>')\n\n\tsrc = '<!ENTITY % zz \\'<!ENTITY tricky \"error-prone\" >\\' >'\n\tval = '<!ENTITY tricky \"error-prone\" >'\n\t@zzEntity = NQXML::ParameterEntityTag.new('zz', val, nil, src)\n end",
"def create(element, element_id=nil, &block)\n element = initialize_element(element, element_id)\n style_and_context(element, element_id, &block)\n\n element\n end",
"def new\n @element = Element.new\n end",
"def start_document\n @doc = Nokogiri::XML::Document.new\n end",
"def xml_convert(xml, element)\n xml.doc.root.add_child(element)\n end",
"def start_element_namespace(name, attrs_ary = [], prefix = nil, uri = nil, ns = [])\n @text = nil\n node = Node.new(uri, name, attrs_ary.inject({}) { |hsh, a| hsh[a.localname] = a.value; hsh }, '')\n path << node\n\n # call delegate\n delegate.start_element(path, self, node) if delegate.respond_to?(:start_element)\n end",
"def push_element\n return if @element_name.nil?\n\n # Add the class attribute if the element is a <p> element.\n @attrs[:class] = 'ppp' if :p == @element_name\n\n # Check @void_elements to determine how the element start would be\n # written. HTML includes void elements that are self closing so those\n # should be handled correctly.\n if VOID_ELEMENTS.include?(@element_name)\n @builder.void_element(@element_name, @attrs)\n else\n @builder.element(@element_name, @attrs)\n end\n # Reset the element name.\n @element_name = nil\n @attrs = {}\n end",
"def create_element(name, *contents_or_attrs, &block); end",
"def new(attributes = {})\n element = attributes[:element] || Element.find_by(id: attributes[:element_id])\n return super if attributes.empty? || element.nil?\n\n definition = element.content_definition_for(attributes[:name])\n if definition.blank? && attributes[:essence_type].nil?\n raise ContentDefinitionError, \"No definition found in elements.yml for #{attributes.inspect} and #{element.inspect}\"\n end\n\n super(\n name: attributes[:name],\n essence_type: attributes[:essence_type] || normalize_essence_type(definition[:type]),\n element: element\n ).tap(&:build_essence)\n end",
"def build_document\n self.root = XML::Node.new('Workbook')\n root['xmlns'] = 'urn:schemas-microsoft-com:office:spreadsheet'\n root['xmlns:o'] = 'urn:schemas-microsoft-com:office:office'\n root['xmlns:x'] = 'urn:schemas-microsoft-com:office:excel'\n root['xmlns:ss'] = 'urn:schemas-microsoft-com:office:spreadsheet'\n root['xmlns:html'] = 'http://www.w3.org/TR/REC-html40'\n end",
"def create_ng_element(xml_translation, document)\n element_name = xml_translation.fetch('element', nil)\n validate_present element_name, \"element key\"\n document.create_element(element_name)\n end",
"def build\r\n builder = Builder::XmlMarkup.new\r\n builder.instruct!(:xml, encoding: 'UTF-8')\r\n builder.tag! :env, :Envelope, namespaces do |env|\r\n env.tag!(:env, :Header) do |env_header|\r\n create_header(env_header)\r\n end\r\n env.tag!(:env, :Body) do |env_body|\r\n create_body(env_body)\r\n end\r\n end\r\n end",
"def new_from_element(element)\n OpenStruct.new.tap do |obj|\n obj.asin = element.at('ASIN').inner_text\n obj.url = element.at('DetailPageURL').inner_text\n obj.title = element.at(\"Title\").inner_text\n end\n end",
"def initialize html\n @doc = to_doc html\n @additional_namespaces = []\n end",
"def initialize(xml_path, namespace='vmw')\n @xml_path = xml_path\n load\n @xml.root.add_namespace namespace, NameSpaces[namespace]\n @namespace = namespace\n end",
"def initialize(tagname_or_element, *a, &block)\n case tagname_or_element\n when Element\n @tagname = tagname_or_element.tagname_symbol\n @attrs = tagname_or_element.attrs\n @attrs.shared = true\n @attrs_hash = tagname_or_element.attrs_hash\n @hide_hid = tagname_or_element.hide_hid\n if block_given?\n init_body(&block)\n else\n @body = tagname_or_element.body.clone\n end\n when Symbol, String\n set_tag(tagname_or_element)\n @attrs = AttrArray.new\n @attrs_hash = {}\n @hide_hid = false\n if a.size() == 1 and a.kind_of?(AttrArray)\n @attrs = a\n @attrs.shared = true\n @attrs.each do |a|\n @attrs_hash[a.key_symbol] = a\n end\n else\n a.each { |aa| put_attr(aa) }\n end\n if block_given?\n init_body(&block)\n else\n @body = Null\n end\n end\n end",
"def welo_node\n node = find_first(\"//#{self.class.resource_xml_element}\", self.class.registered_ns)\n node ||= find_first(\"//ns:#{self.class.resource_xml_element}\", :ns => self.class.registered_ns)\n unless node\n (self << (node = Blather::XMPPNode.new(self.class.resource_xml_element, self.document)))\n node.namespace = self.class.registered_ns\n end\n node\n end",
"def initialize\n @compositor = nil\n @sym = :document\n @children = {}\n creation\n end",
"def test_element_creation\r\n xdoc = XmlDocument.new()\r\n products = xdoc.create_element('Products')\r\n xdoc.append_child(products)\r\n\r\n product1 = xdoc.create_element('Product')\r\n product2 = xdoc.create_element('Product')\r\n\r\n products.append_child(product1)\r\n products.append_child(product2)\r\n\r\n assert_equal xdoc.child_nodes.count, 1\r\n assert_equal xdoc.child_nodes[0].child_nodes.count, 2\r\n end",
"def construct_the_data_structures(element, attrs)\n if @config.include? element\n @data_identifier = true\n @current_parent_element = @config[element]\n @attributes << [attrs]\n end\n\n if @data_identifier\n if @current_parent_element\n if @current_parent_element.include? element\n @attributes << [@current_parent_element[element], attrs]\n end\n end\n end\n end",
"def start_element(element, attributes = [])\n\t\t\t\t@tag = element\n\t\t\t\t@vals[@tag] = \"\"\n\n\t\t\t\tif !@valid_elements.include?(element)\n\t\t\t\t\tputs \"New XML element detected: #{element}. Please report this to #{Kekkan::EMAIL}\"\n\t\t\t\tend\n\n\t\t\t\tcase element\n\t\t\t\t\twhen \"entry\"\n\t\t\t\t\t\t@entry = Kekkan::Models::Entry.create\n\t\t\t\t\t\[email protected]\n\n\t\t\t\t\twhen \"vuln:cvss\"\n\t\t\t\t\t\t@cvss = @entry.cvsses.create\n\t\t\t\t\t\[email protected]\n\n\t\t\t\t\twhen \"vuln:cwe\"\n\t\t\t\t\t\[email protected] = { :cwe => Hash[attributes][\"id\"] }\n\t\t\t\t\t\[email protected]\n\n\t\t\t\t\twhen \"vuln:references\"\n\t\t\t\t\t\t@reference = @entry.references.create\n\t\t\t\t\t\[email protected] = {\n\t\t\t\t\t\t\t:ref_type => Hash[attributes][\"reference_type\"]\n\t\t\t\t\t\t}\n\t\t\t\t\t\[email protected]\n\n\t\t\t\t\twhen \"vuln:reference\"\n\t\t\t\t\t\[email protected] = {\n\t\t\t\t\t\t\t:href => Hash[attributes][\"href\"],\n\t\t\t\t\t\t\t:language => Hash[attributes][\"xml:lang\"]\n\t\t\t\t\t\t}\n\t\t\t\t\t\[email protected]\n\n\t\t\t\t\twhen \"vuln:assessment_check \"\n\t\t\t\t\t\t@ass = @entry.assessment_check.create\n\t\t\t\t\t\[email protected] = {\n\t\t\t\t\t\t\t:name => Hash[attributes][\"name\"],\n\t\t\t\t\t\t\t:href => Hash[attributes][\"href\"],\n\t\t\t\t\t\t\t:system => Hash[attributes][\"system\"]\n\t\t\t\t\t\t}\n\t\t\t\t\t\[email protected]\n\n\t\t\t\t\twhen \"vuln:definition\"\n\t\t\t\t\t\t@scanner = @entry.scanners.create\n\t\t\t\t\t\[email protected] = {\n\t\t\t\t\t\t\t:name => Hash[attributes][\"name\"],\n\t\t\t\t\t\t\t:href => Hash[attributes][\"href\"],\n\t\t\t\t\t\t\t:system => Hash[attributes][\"system\"]\n\t\t\t\t\t\t}\n\t\t\t\t\t\[email protected]\n\t\t\t\tend\n\t\t\tend",
"def init\n f = File.open(@pref_file)\n @doc = Nokogiri::XML(f)\n f.close\n @doc.remove_namespaces! \n end",
"def build\n nodes << element_klass.new\n\n yield(nodes.last) if block_given?\n\n nodes.last\n end",
"def build_root\n root << document_properties = XML::Node.new('DocumentProperties')\n document_properties['xmlns'] = 'urn:schemas-microsoft-com:office:office'\n\n document_properties << author = XML::Node.new('Author')\n author << 'Scarlet'\n document_properties << last_author = XML::Node.new('LastAuthor')\n last_author << 'Scarlet'\n document_properties << version = XML::Node.new('Version')\n version << '12.256'\n\n root << office_document_settings = XML::Node.new('OfficeDocumentSettings')\n office_document_settings['xmlns'] = 'urn:schemas-microsoft-com:office:office'\n office_document_settings << XML::Node.new('AllowPNG')\n\n root << excel_workbook = XML::Node.new('ExcelWorkbook')\n excel_workbook['xmlns'] = 'urn:schemas-microsoft-com:office:excel'\n\n excel_workbook << window_height = XML::Node.new('WindowHeight', '20260')\n excel_workbook << window_width = XML::Node.new('WindowWidth', '29600')\n excel_workbook << window_top_x = XML::Node.new('WindowTopX', '3440')\n excel_workbook << window_top_y = XML::Node.new('WindowTopY', '-80')\n excel_workbook << XML::Node.new('Date1904')\n excel_workbook << XML::Node.new('ProtectStructure', 'False')\n excel_workbook << XML::Node.new('ProtectWindows', 'False')\n\n root << styles = XML::Node.new('Styles')\n styles << style = XML::Node.new('Style')\n style['ss:ID'] = 'Default'\n style['ss:Name'] = 'Normal'\n style << alignment = XML::Node.new('Alignment')\n alignment['ss:Vertical'] = 'Bottom'\n style << XML::Node.new('Borders')\n style << font = XML::Node.new('Font')\n font['ss:FontName'] = 'Verdana'\n style << XML::Node.new('Interior')\n style << XML::Node.new('NumberFormat')\n style << XML::Node.new('Protection')\n end",
"def new_node(element)\n Node.new(element)\n end",
"def create_new_xml_document( options = nil)\n p \"new xml doc created!\"\n \n blog_doc = <<-eos\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your blog. -->\n<!-- It contains information about your blog's posts, comments, and categories. -->\n<!-- You may use this file to transfer that content from one site to another. -->\n<!-- This file is not intended to serve as a complete backup of your blog. -->\n\n<!-- To import this information into a WordPress blog follow these steps. -->\n<!-- 1. Log into that blog as an administrator. -->\n<!-- 2. Go to Tools: Import in the blog's admin panels (or Manage: Import in older versions of WordPress). -->\n<!-- 3. Choose \"WordPress\" from the list. -->\n<!-- 4. Upload this file using the form provided on that page. -->\n<!-- 5. You will first be asked to map the authors in this export file to users -->\n<!-- on the blog. For each author, you may choose to map to an -->\n<!-- existing user on the blog or to create a new user -->\n<!-- 6. WordPress will then import each of the posts, comments, and categories -->\n<!-- contained in this file into your blog -->\n\n<!-- generator=\"WordPress/MU\" created=\"2009-03-10 00:13\"-->\n<rss version=\"2.0\"\n\txmlns:excerpt=\"http://wordpress.org/export/1.0/excerpt/\"\n\txmlns:content=\"http://purl.org/rss/1.0/modules/content/\"\n\txmlns:wfw=\"http://wellformedweb.org/CommentAPI/\"\n\txmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n\txmlns:wp=\"http://wordpress.org/export/1.0/\"\n>\n\n<channel>\n\t<title>xxx</title>\n\t<link>xxx</link>\n\t<description>xxx</description>\n\t<pubDate>xxx</pubDate>\n\t<generator>http://wordpress.org/?v=MU</generator>\n\t<language>en</language>\n\t<wp:wxr_version>1.0</wp:wxr_version>\n\t<wp:base_site_url>http://wordpress.com/</wp:base_site_url>\n\t<wp:base_blog_url>xxx</wp:base_blog_url>\n\t<wp:category><wp:category_nicename>uncategorized</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[Uncategorized]]></wp:cat_name></wp:category>\n\t<image>\n\t\t<url>http://www.gravatar.com/blavatar/bc8a29036e9d9925e702dcf90996d0cd?s=96&d=http://s.wordpress.com/i/buttonw-com.png</url>\n\t\t<title>xxx</title>\n\t\t<link>xxx</link>\n\t</image>\n \n</channel>\n</rss>\n eos\n \n doc = Hpricot.XML(blog_doc)\n \n #change created date to be right-now\n #element at fixed-offset 30\n #<!-- generator=\"WordPress/MU\" created=\"2009-03-10 00:13\"-->\n doc.search(\"*\")[30].swap(\n \"<!-- generator=\\\"WordPress/MU\\\" created=\\\"#{Time.now.strftime(\"%Y-%m-%d %H:%M\")}\\\"-->\"\n )\n \n #replace default_title, default_link, the name of the blog and link to blog (wordpress), respectively\n doc.search(\"title\")[0].inner_html = @options[:default_title]\n doc.search(\"title\")[1].inner_html = @options[:default_title]\n doc.search(\"link\")[0].inner_html = @options[:default_link]\n doc.search(\"link\")[1].inner_html = @options[:default_link]\n\n #replace default_description, pub_date\n doc.search(\"description\").inner_html = @options[:default_description]\n doc.search(\"pubDate\").inner_html = @options[:pub_date]\n doc.search(\"wp:base_blog_url\").inner_html = @options[:base_blog_url]\n\n @doc = doc\n end",
"def insert_as_root\n collection.insert_one(as_attributes, session: _session)\n end",
"def initialize(name, bindings, attributes, parent)\n\t\t\tself.cacheable = true unless @cacheable == false\n\t\t\tself.replaceable = false unless replaceable?\n\t\t\tself.fragment = false unless fragment?\n\t\t\t@creation_time = Time.now\n\t\t\t@parent = parent\n\t\t\t@session = parent ? parent.session : nil\n\n\t\t\tself.allow_docroot_caching = false if allow_docroot_caching?.nil?\n\n\t\t\t@subcomponents = {}\n\t\t\tsuper(name, bindings, attributes)\n\n\t\t\tawake()\n\t\tend",
"def create\n create_hiera_template\n create_manifests_node\n create_node_checkpoint\n end",
"def parse_tree\n id = attribute( 'id' )\n label = attribute( 'label' )\n\n type = attribute( 'xsi:type' )[4..-1]\n klass = NeXML.const_get( type )\n tree = klass.new( id, :label => label )\n\n #a 'tree' element *will* have child nodes.\n while next_node\n case local_name\n when \"node\"\n #parse child 'node' element\n node = parse_node\n\n #and add it to the 'tree'\n tree.add_node node\n\n #root?\n tree.roots << node if node.root?\n when \"rootedge\"\n #parse child 'edge' element\n rootedge = parse_rootedge\n\n #and add it to the 'tree'\n # tree.add_rootedge rootedge # XXX it looks like the super class(es)\n # can only deal with edges that have source and target\n when \"edge\"\n #parse child 'edge' element\n edge = parse_edge( type )\n\n #and add it to the 'tree'\n tree.add_edge edge\n when \"tree\"\n #end of current 'tree' element has been reached\n break\n end\n end\n\n #return the 'tree' object\n tree\n end",
"def to_rexml\n node = REXML::Element.new(xml_tagname)\n\n node.add_namespace(self.class.namespace) if self.class.namespace\n\n self.class.attributes.each do |atr|\n val = instance_variable_get(\"@_#{atr}\")\n next unless val\n node.add_attribute(val.to_rexml)\n end\n\n xml_schema_elements.each do |name, kind, opts|\n obj = send(name)\n next unless obj\n case obj\n when Array\n obj.each do |v|\n if v.is_a? Tag\n node.add_element(v.to_rexml) #(xml_namespace)\n else\n node.add_element(REXML::Element.new(name, v.to_s))\n end\n end\n else\n if obj.is_a? Tag\n node.add_element(obj.to_rexml) #(xml_namespace)\n else\n node.add_element(REXML::Element.new(name, obj.to_s))\n end\n end\n end\n\n #if @__text\n # node.add_text(@__text.to_rexml)\n #end\n node\n end",
"def initialize(element, x = 0, y = 0, width = nil, height = nil)\n super()\n\n # If the element is not a group, defs, symbol, or rvg,\n # wrap a group around it so it can get a transform and\n # possibly a new viewport.\n if !element.respond_to?(:ref)\n @element = Group.new\n @element << element.deep_copy\n else\n @element = element.deep_copy\n end\n @element.ref(x, y, width, height)\n end",
"def document\n return TypeElement.new({name: 'document', content: @document}, main_element: self)\n end",
"def initialize \n @doc = Document.new \n @action = @doc.add_element('action')\n @param = Element.new('parameter')\n end",
"def build(element, essence_hash)\n definition = content_definition(element, essence_hash)\n if definition.blank?\n raise ContentDefinitionError, \"No definition found in elements.yml for #{essence_hash.inspect} and #{element.inspect}\"\n else\n new(name: definition['name'], element_id: element.id)\n end\n end",
"def xml_document\n xml = XML::Document.new\n xml.root = self.to_xml\n xml\n end",
"def initialize(document)\n @root = Node.new\n\n document.length.times do |i|\n substring = document[i..-1]\n substring.chars.inject(root) do |node, c|\n node.add(c)\n end.add(EOS)\n end\n end",
"def init(element, count)\r\n self.pid = element.attributes['id']\r\n self.pitcher_name = element.attributes['name']\r\n self.out = element.attributes['out']\r\n self.inn = convert_out_to_inn(element.attributes['out'])\r\n self.er = element.attributes['er']\r\n self.r = element.attributes['r']\r\n self.h = element.attributes['h']\r\n self.so = element.attributes['so']\r\n self.hr = element.attributes['hr']\r\n self.bb = element.attributes['bb']\r\n self.w = element.attributes['w']\r\n self.l = element.attributes['l']\r\n self.era = element.attributes['era']\r\n self.note = element.attributes['note']\r\n if count == 1\r\n self.start = true\r\n else\r\n self.start = false\r\n end\r\n end",
"def createElement(tagName)\n ret = Element.new(tagName)\n ret.ownerDocument = self\n ret\n end",
"def xml_document\n xml = XML::Document.new\n xml.root = self.to_xml\n xml\n end",
"def add(element, element_id=nil, options={}, &block)\n # make sure we have a target - raises NoContextError if none exists\n self.target\n\n unless @context\n create_default_root_context\n end\n\n # We want to be sure that the element has a supeview or superlayer before\n # the style method is called.\n element = initialize_element(element, element_id)\n self.apply(:add_child, element, options)\n style_and_context(element, element_id, &block)\n\n element\n end",
"def test_xml_declaration\r\n xdoc = XmlDocument.new()\r\n node = xdoc.create_xml_declaration('1.0', 'UTF-8')\r\n assert_equal node.attributes.count, 2\r\n xdoc.append_child(node)\r\n assert_equal xdoc.child_nodes.count, 1\r\n assert_equal xdoc.attributes.count, 0\r\n end",
"def add_header\n @document.root = Atom::XML::Node.new('atom:entry')\n\n Atom::XML::Namespace.new(@document.root, 'atom', 'http://www.w3.org/2005/Atom')\n Atom::XML::Namespace.new(@document.root, 'apps', 'http://schemas.google.com/apps/2006')\n Atom::XML::Namespace.new(@document.root, 'gd', 'http://schemas.google.com/g/2005')\n end",
"def on_start_element_ns(name, attributes, prefix, uri, namespaces)\n STDOUT << \"on_start_element_ns\" << \"\\n\" <<\n \" name: \" << name << \"\\n\" <<\n \" attr: \" << (attributes || Hash.new).inspect << \"\\n\" <<\n \" prefix: \" << prefix << \"\\n\" <<\n \" uri: \" << uri << \"\\n\" <<\n \" ns_defs: \" << (namespaces || Hash.new).inspect << \"\\n\"\n STDOUT.flush\n end",
"def new_from_link(href)\n self.class.new(:root => self.root,\n :auth => self.auth,\n :headers => self.headers,\n :namespace => self.namespace,\n :href => href)\n end",
"def load_document(document_string, document_uri = nil)\n document = Nokogiri.XML(document_string, document_uri).extend(Document) # returns a Nokogiri::XML::Document\n document.root.extend(self)\n document\n end",
"def new_definition(sax, author_id)\n Definition.new.tap do |definition|\n definition.author_id = author_id\n definition.text = sax.text\n definition.source = sax.source\n definition.uri = sax.uri\n end\nend",
"def initialize(data)\n if data[:schema] == \"dc\"\n @root_element = \"//metadata/dc\"\n elsif data[:schema] == \"mods\"\n @root_element = \"//mods\"\n else\n @root_element = data[:root_element]\n end\n\n @raw_data = data[:raw]\n end",
"def initialize(parser)\n document = parser.metadata_document\n return if document.nil?\n document.remove_namespaces!\n metadata = document.css('metadata')\n self.version = document.css('package')[0]['version']\n self.titles = metadata.xpath('.//title').map(&:content)\n self.creators = metadata.xpath('.//creator').map {|c| EPUBInfo::Models::Person.new(c) }\n self.subjects = metadata.xpath('.//subject').map(&:content)\n self.description = metadata.xpath('.//description').first.content rescue nil\n self.publisher = metadata.xpath('.//publisher').first.content rescue nil\n self.contributors = metadata.xpath('.//contributor').map {|c| EPUBInfo::Models::Person.new(c) }\n self.dates = metadata.xpath('.//date').map { |d| EPUBInfo::Models::Date.new(d) }\n modified_date = metadata.xpath(\".//meta[@property='dcterms:modified']\").map do |d|\n date = EPUBInfo::Models::Date.new(d)\n date.event = 'modification'\n date\n end\n self.dates += modified_date;\n self.identifiers = metadata.xpath('.//identifier').map { |i| EPUBInfo::Models::Identifier.new(i) }\n self.source = metadata.xpath('.//source').first.content rescue nil\n self.languages = metadata.xpath('.//language').map(&:content)\n self.rights = metadata.xpath('.//rights').first.content rescue nil\n self.drm_protected = parser.drm_protected?\n self.cover = EPUBInfo::Models::Cover.new(parser)\n end",
"def initialize_element(elem, element_id)\n if elem.is_a?(Class) && elem < TreeLayout\n layout = elem.new\n elem = layout.view\n elsif elem.is_a?(Class)\n elem = elem.new\n elsif elem.is_a?(TreeLayout)\n layout = elem\n elem = elem.view\n end\n\n if layout\n if element_id\n name_element(layout, element_id)\n end\n @child_layouts << layout\n elsif element_id\n name_element(elem, element_id)\n end\n\n return elem\n end",
"def add_element(parent, key, value)\n elem = Nokogiri::XML::Node.new(key, @xml.document)\n elem.content = value\n\n parent.add_child(elem)\n end",
"def build(document)\n build_simple_attributes(document)\n build_complex_attributes(document)\n end",
"def new_element(key)\n Element.new('Key' => key)\n end",
"def initialize(xmldoc)\n @xmldoc = xmldoc\n @output = {}\n end",
"def initialize(element)\n @html_string = element\n element = valid_tag(element) unless element.is_a? Array\n case element[0]\n when :start_element\n @name = element[2]\n @attributes = element[3]\n @children = (Array(element[4..-1]) || []).map {|c | TestTag.new c}\n when :text\n @text = element[1]\n @name = \"text\"\n @attributes = []\n @children = []\n end\n\n end",
"def initialize(name)\n super()\n\n @name = name\n build_document\n build_root\n end",
"def initialize(element, parent)\n super(element, parent)\n end",
"def parser(parser, didStartElement:element, namespaceURI:uri, qualifiedName:name, attributes:attrs)\n if element == 'item'\n @current_item = RSSItem.new\n elsif element == 'enclosure'\n @current_item.enclosure = attrs\n end\n @current_element = element\n end",
"def create(attrs = {}, &block)\n create_document(:create, attrs, &block)\n end",
"def create_element(target, type, parent, options = {})\n # Create element\n element = `document.createElement(#{type})`\n\n # Add element to DOM\n if options[:prepend]\n `#{parent.element}.insertBefore(#{element}, #{options[:prepend].element})`\n else\n `#{parent.element}.appendChild(#{element})`\n end\n\n # Add ruby class to the node\n `#{element}.classList.add(#{dasherize(target.class.name)})`\n\n # Add ruby superclass to the node to allow for more generic styling\n if target.class.superclass != BaseElement\n `#{element}.classList.add(#{dasherize(target.class.superclass.name)})`\n end\n\n # Set ruby object_id as default element id\n if !options.has_key?(:id)\n `#{element}.id = #{target.object_id}`\n end\n \n # Set attributes\n options.each do |name, value|\n case name\n when :prepend\n nil\n when :content\n `#{element}.appendChild(document.createTextNode(#{value}))`\n else\n `#{element}.setAttribute(#{name}, #{value})`\n end\n end\n\n element\n end",
"def create_element(name, builder=nil, **options, &block)\n opts = {}\n\n if options[:is] ||= (options.dig(:attrs, :is))\n opts[:is] = options[:is]\n end\n\n if ns = options[:namespace]\n elem = `#@native.createElementNS(#{ns}, #{name}, #{opts.to_n})`\n else\n elem = `#@native.createElement(name, #{opts.to_n})`\n end\n\n if options[:classes]\n `#{elem}.className = #{Array(options[:classes]).join(\" \")}`\n end\n\n if options[:id]\n `#{elem}.id = #{options[:id]}`\n end\n\n if options[:attrs]\n options[:attrs].each do |k,v|\n next unless v\n `#{elem}.setAttribute(#{k}, #{v})`\n end\n end\n\n dom = DOM(elem)\n\n if block_given?\n dom.inner_dom(builder, &block)\n end\n\n if builder\n builder << dom\n end\n\n dom\n end",
"def initialize(*args)\n super\n decorators(Nokogiri::XML::Node) << Nokogiri::Decorators::XBEL\n decorate!\n\n# self.root = '<xbel version=\"1.0\"></xbel>'\n end",
"def xml_root(string) # :doc:\n xml = XML::Document.new\n xml.root = XML::Node.new(string)\n xml\n end",
"def parse(xml, parse_ext = false)\n if @external\n @tree = @document.createDocumentFragment\n else\n @tree = @document\n end\n @parse_ext = parse_ext\n @current = @tree\n @inDocDecl = 0\n @decl = \"\"\n @inDecl = 0\n @idRest = 0\n @extID = nil\n @cdata_f = false\n @cdata_buf = ''\n @nsdecl = []\n super(xml)\n @tree\n end",
"def initialize element, class_chain, blocks\n @element = element.dup\n # TODO: how to convert lists, tables, definition lists etc. to text\n @text = element.text\n @parent = element.parent.name\n @path = element.path\n @wrapper = BLOCK_ELEMENTS.include?(element.name) ? \\\n element.name : parent\n @class_chain = class_chain\n @blocks = blocks\n end",
"def add_elements\n Nokogiri::XML::Builder.with(@doc.at('svg')) do |xml|\n yield xml\n end\n end",
"def create_node( name, options )\n node = XML::Node.new( name )\n \n namespaces = options.delete( :namespaces )\n add_namespaces( node, namespaces ) if namespaces\n \n attributes = options.delete( :attributes )\n add_propertys( node, attributes ) if attributes\n node\n end",
"def create\n element_params = params[:element]\n association_params = {}\n element_params.keys.select{|key| key.include? 'associations'}.each{|key| association_params[key] = element_params.delete(key)}\n @element = Element.new(element_params)\n respond_to do |format|\n if @element.save\n associations = @element.category_element_associations\n association_params.each_value do |associations_param|\n category_ids = !associations_param.nil? && !associations_param[:category_ids].blank? ? associations_param[:category_ids].collect(&:to_i) : []\n root_id = !associations_param.nil? && !associations_param[:root_id].blank? ? associations_param[:root_id] : nil\n category_ids.each{|c_id| associations.create :category_id => c_id, :root_id => root_id.blank? ? Category.find(c_id).root.id : root_id}\n end\n flash[:notice] = 'Element was successfully created.'\n format.html { redirect_to elements_url }\n format.xml { render :xml => @element, :status => :created, :location => @element }\n else\n @root_category = Category.find(272)\n format.html { render :action => \"new\" }\n format.xml { render :xml => @element.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def append(node)\n if node.is_a?(EndTag)\n return if empty_tag?(node.name)\n po = @pos\n while po.parent and po.name != node.name\n po = po.parent\n end\n if po.name == node.name\n @pos = po.parent\n end\n else\n rexml = to_rexml(node)\n\n # if node is second root element, add root element wrap html tag\n if rexml.is_a?(REXML::Element) and @pos == @doc and @doc.root\n if @doc.root.name != 'html'\n html = REXML::Element.new\n html.name = \"html\"\n i = @doc.root.index_in_parent-1\n while pos = @doc.delete_at(i)\n @doc.delete_element(pos) if pos.is_a?(REXML::Element)\n html << pos\n end\n @doc << html\n @pos = html\n end\n @pos = @doc.root\n end\n @pos << rexml\n if rexml.is_a?(REXML::Element) and !empty_tag?(node.name) and !node.empty?\n @pos = rexml\n end\n end\n end",
"def to_xml(parent=nil, persp=:default, id=:default)\n ret = Nokogiri::XML::Builder.new({}, parent) do |xml|\n xml.send(xml_element,{:xmlns => ns(persp)}, :path => File.join('',path(id))) do\n serialized_pairs(persp).each do |name, val|\n case val\n when Welo::Embedder\n val.to.to_xml(xml.parent, persp).to_xml\n when Welo::EmbeddersEnumerator\n xml.send(val.label) do\n val.each do |embedder|\n embedder.to.to_xml(xml.parent, persp).to_xml\n end\n end\n else\n xml.send(name, val)\n end\n end\n end\n end\n ret\n end",
"def initialize(element)\n @element = element\n @name = element.name\n end",
"def make_new_file\n\t\tmetadata_file_data = \"\"\n\t\tmetadata_file_data << \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?><cp:coreProperties\"\n\t\tmetadata_file_data << \" xmlns:cp=\\\"http://schemas.openxmlformats.org/package/2006/metadata/core-properties\\\" \"\n\t\tmetadata_file_data << \"xmlns:dc=\\\"http://purl.org/dc/elements/1.1/\\\" xmlns:dcterms=\\\"http://purl.org/dc/terms/\\\" \"\n\t\tmetadata_file_data << \"xmlns:dcmitype=\\\"http://purl.org/dc/dcmitype/\\\" xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\">\"\n\t\tmetadata_file_data << \"<dc:creator>#{datastore['DOCAUTHOR']}</dc:creator><cp:lastModifiedBy>#{datastore['DOCAUTHOR']}\"\n\t\tmetadata_file_data << \"</cp:lastModifiedBy><cp:revision>1</cp:revision><dcterms:created xsi:type=\\\"dcterms:W3CDTF\\\">\"\n\t\tmetadata_file_data << \"2013-01-08T14:14:00Z</dcterms:created><dcterms:modified xsi:type=\\\"dcterms:W3CDTF\\\">\"\n\t\tmetadata_file_data << \"2013-01-08T14:14:00Z</dcterms:modified></cp:coreProperties>\"\n\n\t\t#where to find the skeleton files required for creating an empty document\n\t\tdata_dir = File.join(Msf::Config.install_root, \"data\", \"exploits\", \"docx\")\n\n\t\t#making the actual docx\n\t\tdocx = Rex::Zip::Archive.new\n\t\t#add skeleton files\n\t\tvprint_status(\"Adding skeleton files from #{data_dir}\")\n\t\tDir[\"#{data_dir}/**/**\"].each do |file|\n\t\t\tif not File.directory?(file)\n\t\t\t\tdocx.add_file(file.sub(data_dir,''), File.read(file))\n\t\t\tend\n\t\tend\n\t\t#add on-the-fly created documents\n\t\tvprint_status(\"Adding injected files\")\n\t\tdocx.add_file(\"docProps/core.xml\", metadata_file_data)\n\t\tdocx.add_file(\"word/_rels/settings.xml.rels\", @rels_file_data)\n\t\t#add the otherwise skipped \"hidden\" file\n\t\tfile = \"#{data_dir}/_rels/.rels\"\n\t\tdocx.add_file(file.sub(data_dir,''), File.read(file))\n\t\t#and lets create the file\n\t\tfile_create(docx.pack)\n\tend",
"def initialize(data)\n if `typeof #{data} === 'string'`\n tag, rest = data.match(TAG_REGEXP).to_a[1..2]\n @el = `document.createElement(#{tag})`\n `#{@el}._instance = #{self}`\n\n rest = apply_attributes rest\n rest = apply_modifiers rest\n\n if (match = rest.match(/\\s(.+)$/))\n self.text = match[0].strip\n end\n else\n super data\n end\n @style = Style.new @el\n end",
"def initialize_element\n end",
"def prepare_request(request, soap, args)\n super(request, soap, args)\n soap.header[:attributes!] ||= {}\n header_name = prepend_namespace(@element_name)\n soap.header[:attributes!][header_name] ||= {}\n soap.header[:attributes!][header_name]['xmlns'] = @auth_namespace\n end",
"def build_bookmark(attributes = {}, &block)\n node = Nokogiri::XML::Node.new('bookmark', document)\n assign_to node, attributes\n\n add_child node\n end",
"def initialize_from_element!\n end",
"def build_folder(attributes = {}, &block)\n node = Nokogiri::XML::Node.new('folder', document)\n assign_to node, attributes\n\n add_child node\n end",
"def make_document(xml)\n xml.is_a?(Atom::XML::Document) ? xml : Atom::XML::Document.string(xml)\n end",
"def node element, attributes = {}\n Nokogiri::XML::Node.new(element, Nokogiri::HTML::Document.new).tap do |node|\n attributes.each do |name, value|\n node[name] = value\n end\n end\n end",
"def get_xml_doc()\n doc = REXML::Document.new \"<top description='My Description' name='My Data Set'></top>\"\n root_node = @all_depths[0].first[1]\n doc.elements[\"top\"].add_element root_node.xml\n\n # see method below\n xml_recurse_helper(root_node)\n\n return doc\n end",
"def initialize(element, attributes = {})\n @element = element\n @attributes = Saxxy::Helpers.stringify_keys(attributes)\n end"
] | [
"0.65296626",
"0.62123144",
"0.5921134",
"0.58608925",
"0.5729298",
"0.5713127",
"0.5630217",
"0.5627875",
"0.5576944",
"0.5528622",
"0.54829365",
"0.5453136",
"0.5453136",
"0.5451393",
"0.54502577",
"0.5445182",
"0.5433218",
"0.5398238",
"0.5394258",
"0.53925645",
"0.53818345",
"0.53493154",
"0.5346648",
"0.534483",
"0.53171146",
"0.53127533",
"0.5278234",
"0.5275977",
"0.52126026",
"0.5189763",
"0.518958",
"0.5138841",
"0.5134722",
"0.5103465",
"0.5103368",
"0.5103066",
"0.50954616",
"0.5086028",
"0.50524384",
"0.50456476",
"0.50277424",
"0.5022949",
"0.5018308",
"0.50137943",
"0.4999104",
"0.49807444",
"0.49666324",
"0.49621898",
"0.49499553",
"0.49441496",
"0.49357677",
"0.49306038",
"0.49233586",
"0.49173415",
"0.4913765",
"0.4911974",
"0.49013647",
"0.4893204",
"0.48887607",
"0.48876292",
"0.4879877",
"0.4869967",
"0.4868736",
"0.48618624",
"0.48612472",
"0.48603433",
"0.48549992",
"0.48362282",
"0.48202565",
"0.48192295",
"0.48187768",
"0.48154616",
"0.4813004",
"0.48128182",
"0.48036098",
"0.4799942",
"0.47860333",
"0.4780112",
"0.47785166",
"0.47711274",
"0.47666594",
"0.47622135",
"0.4756266",
"0.47484642",
"0.47450525",
"0.47435564",
"0.47400162",
"0.47373712",
"0.47284523",
"0.4726798",
"0.47076836",
"0.4693891",
"0.46840766",
"0.46820933",
"0.46814317",
"0.46786007",
"0.46777678",
"0.46753347",
"0.46740246",
"0.4666931"
] | 0.6551934 | 0 |
Clears the characters buffer | def clear_characters_buffer
if @buffer && @elem
@buffer.strip!
@elem.add_child(Nokogiri::XML::Text.new(@buffer, @doc)) unless @buffer.empty?
@buffer = nil # empty the buffer
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clearBuffer() \n @buffer = \"\" ;\n end",
"def reset_character_buffer\n @buffer_characters = false\n @characters = ''\n end",
"def clear_buffer\n buffer.clear\n end",
"def clear_buffer\n @buffer.clear\n end",
"def clear\n @buffer.clear\n end",
"def clear_buffer!\n @out_mutex.synchronize do\n @buffer = ''.encode(\"UTF-8\")\n @out_update = false\n end\n end",
"def reset!\n @buffer = ''\n end",
"def reset\n @buffer = ''\n @length = 0\n @position = 0\n end",
"def clear_buffer!\n @out_mutex.synchronize do\n @buffer.clear\n end\n end",
"def clear\n @monitor.synchronize {\n new_buffer\n }\n end",
"def clear_accumulation_buffer!\n @buffer = \"\"\n @buffer_mode = nil\n @buffered_lines = []\n end",
"def clear(str)\n end",
"def clear\n send_cmd \"clear\"\n nil\n end",
"def clear\n writeln(\"clear\")\n end",
"def clear\n ''\n end",
"def clear; puts \"\\e[2J\" end",
"def clear\n @data = \"O\" * size\n end",
"def clear\n \"\\e[2J\\e[H\"\nend",
"def reset\n @buffer.string = @buffer.read; nil\n end",
"def clear\n puts \"\\n\" # pour certaines méthodes\n puts \"\\033c\"\nend",
"def clear\n puts \"\\e[2J\\e[f\"\nend",
"def clear_to_end\n ConsoleGlitter.escape('0J')\n end",
"def clear\n say \"\\e[2J\\e[H\"\n end",
"def clear_buffer_cache!\n @buffers = nil\n end",
"def clear_data!\n @data = ''\n end",
"def clear_scr\n system 'clear'\n system 'cls'\n end",
"def clear\n @lines.clear\n end",
"def clear\n $stdout.print \"\\n\"\n $stdout.flush\n end",
"def clear\n Vedeu::Direct.write(value: clear_output, x: bx, y: by)\n end",
"def clear\n io.truncate(0)\n io_index.clear\n self\n end",
"def reset!\n @buffer = buffer.reset!\n end",
"def reset_buffer(new_buf = '')\n @buf.replace new_buf\n @index = 0\n end",
"def reset_buffer(new_buf = '')\n @buf.replace new_buf\n @index = 0\n end",
"def clear() end",
"def clear() end",
"def clear()\n \n if OS.linux? or OS.mac?\n\n system(\"clear\")\n\n elsif OS.windows?\n\n system(\"cls\")\n\n end\n\n end",
"def clear\n Vedeu::Terminal.clear\n end",
"def clear\n @output_buffer=\"\"\n @binding_rebuild_count=0\n @xyz123page_blurbs=Set.new\n @args=nil\n end",
"def clear_screen\n output(Esc.string('clear'))\n end",
"def clear\n if visible?\n Vedeu.timer(\"Clearing: #{name}\") do\n y, x = *position\n\n @clear ||= Array.new(height) do |iy|\n Array.new(width) do |ix|\n Vedeu::Char.new(value: ' ',\n colour: clear_colour,\n style: style,\n position: Vedeu::Position[y + iy, x + ix])\n end\n end\n end\n else\n []\n\n end\n end",
"def clear_matches\n buffer_current.clear_matches Buffer::DO_DISPLAY\n end",
"def clear_rx_data\n return self.sendcmd(\"text.clear_rx\")\n end",
"def clear\r\n system('clear')\r\n end",
"def do_clear\n @editor.value = ''\n @editor.focus\n end",
"def flush_buffer\n buf = @@output_buffer.dup\n @@output_buffer.clear\n buf\n end",
"def puts_clear; puts \"\\e[0J\" end",
"def clear_line; print \"\\e[2K\" end",
"def clear!\n @output = ''\n @verbose = false\n end",
"def clear_char(n = nil)\n CSI + \"#{n}X\"\n end",
"def clear\n # Work in both unix and win32 shells\n system(\"cls\") || system(\"clear\")\nend",
"def clear\n @mutex.synchronize {\n @pos = 0\n @sio.seek 0\n @sio.truncate 0\n }\n end",
"def clear_line\n puts \"\\e[0A\\e[0G\"\n end",
"def clear\n WIN_OS ? system(\"cls\") : system(\"clear\")\n end",
"def clear_expression\n @input = \"\"\n @output.text = \"\"\n end",
"def output\n Vedeu.timer(\"Clearing: '#{name}'\") do\n @y = geometry.y\n @x = geometry.x\n @width = geometry.width\n @height = geometry.height\n @colour = interface.colour\n\n @clear ||= Array.new(@height) do |iy|\n Array.new(@width) do |ix|\n Vedeu::Views::Char.new(value: ' ',\n colour: @colour,\n position: [@y + iy, @x + ix])\n end\n end\n end\n end",
"def clear\n\n # remove the trailing newline, otherwise an upper line will get eaten\n @rendered.sub!(/\\n\\z/, '')\n\n # determine how many lines to move up\n lines = @rendered.scan(/\\n/).length\n\n if @bottomline\n print IOChar.cursor_down + IOChar.carriage_return + IOChar.clear_line + IOChar.cursor_up\n end\n\n # jump back to the first position and clear the line\n print IOChar.cursor_down + IOChar.carriage_return + IOChar.clear_line + IOChar.cursor_up + IOChar.clear_line + IOChar.carriage_return + ( IOChar.cursor_up + IOChar.clear_line ) * lines + IOChar.clear_line\n end",
"def print_clear; print \"\\e[0J\" end",
"def clear\n @raw.clear\n self\n end",
"def remove\n\t\t\tback if (@buffer.at_end?)\n\t\t\tch = @buffer.char\n\t\t\[email protected]\n\t\t\tredraw_line((ch == Ruvim::API::CR) ? (@cursor.y ... @height) : @cursor.y) \n\t\t\tself\n\t\tend",
"def clear_line!\n print \"\\r\\e[2K\"\n end",
"def clear!; end",
"def clear!; end",
"def clear!; end",
"def flush_buffer\n if @timer\n @timer.cancel\n @timer = nil\n end\n unless @buffer.empty?\n internal_send_request('append_output', :text => @buffer)\n @buffer = ''\n end\n end",
"def flush\n out = @buffer\n @buffer = ''\n out\n end",
"def enter_to_clear\n begin\n system('stty raw -echo')\n response = STDIN.getc\n ensure\n system('stty -raw echo')\n end\n if response.chr == \"\\r\"\n system('clear')\n end\n exit\n end",
"def clear_display\n system('clear') || system('clc')\n end",
"def clear(p)\n p.to_plain_text.gsub(/\\n/, \"\").gsub(/\\[.*?\\]/, '')\n end",
"def reset_buffer(new_buf = '')\n @buf.replace Bytes.force_binary_encoding(new_buf)\n @index = 0\n end",
"def clear\n system 'clear'\n \n end",
"def clear_to_beginning\n ConsoleGlitter.escape('1J')\n end",
"def clear_output\n clear_output = ''\n\n (by..byn).each do |row|\n clear_output << \"\\e[#{row};#{bx}H\" + (' ' * width)\n end\n\n # reset cursor to top left of document\n clear_output << \"\\e[#{by};#{bx}H\"\n end",
"def clear!\n begin\n @trigger << \"c\"\n rescue IOError\n end\n end",
"def clear_to_cursor; print \"\\e[1K\" end",
"def clear_tx_data\n return self.sendcmd(\"text.clear_tx\")\n end",
"def clear()\n @sock.recv(65535)\n end",
"def clear_stream\n @stream.print(' ' * IO.console.winsize[1])\n end",
"def clear\r\n self.value = \"\"\r\n end",
"def flush_buffer; self.input_buffer = \"AAAA\"; end",
"def clear\n end",
"def clear\n end",
"def clear\n warn \"StringScanner#clear is obsolete; use #terminate instead\" if $VERBOSE\n terminate\n end",
"def clear_stdout\n $stdout.string = ''\n end",
"def flush_buffer\n # note we must discard cancelled timer or else we never create a new timer and stay cancelled.\n if @timer\n @timer.cancel\n @timer = nil\n end\n\n to_send = nil\n @mutex.synchronize do\n unless @buffer.empty?\n to_send = @buffer\n @buffer = ''\n end\n end\n\n if to_send\n internal_send_audit(:kind => :output, :text => to_send, :category => EventCategories::NONE)\n end\n end",
"def clear_screen(str = \"\")\n \"\\x1b[H\\x1b[2J#{\n str\n }\"\n end",
"def clear; end",
"def clear; end",
"def clear; end",
"def clear; end",
"def clear; end",
"def clear; end",
"def clear; end",
"def clear_terminal\n system(\"cls\") || system(\"clear\")\nend",
"def clear\n do_clear\n end",
"def clear(letter)\n @available_digits.add @letters[letter]\n @letters[letter] = nil\n end",
"def self_clear\n print \"\\e[2J\\e[f\"\nend",
"def clear\n system('clear')\nend",
"def clear\r\n @commands.clear\r\n nil\r\n end",
"def clear!\n end",
"def clear\n set ' '\n # PhoneNumber inputs have country dial code pre-populated on focus. To have\n # it fully cleared, need more than one \"backspace\" hit\n wait_until_true do\n native.send_keys :backspace\n value.empty?\n end\n end"
] | [
"0.841956",
"0.83710027",
"0.81852645",
"0.79017407",
"0.7879505",
"0.78773123",
"0.7528629",
"0.7338918",
"0.7071273",
"0.70546085",
"0.7048196",
"0.7038999",
"0.6996191",
"0.69135374",
"0.6875512",
"0.68103045",
"0.680195",
"0.6796196",
"0.6787073",
"0.6764853",
"0.66514295",
"0.6637828",
"0.66271186",
"0.6609255",
"0.65850735",
"0.65828526",
"0.65699214",
"0.6556323",
"0.6547299",
"0.65131485",
"0.65110767",
"0.64924204",
"0.64924204",
"0.6464778",
"0.6464778",
"0.64357597",
"0.64163953",
"0.64023376",
"0.63639563",
"0.6356614",
"0.6344232",
"0.63178194",
"0.63158107",
"0.6310158",
"0.6296607",
"0.6271198",
"0.627005",
"0.62678015",
"0.6264262",
"0.62596333",
"0.6257385",
"0.6250484",
"0.6248652",
"0.6244846",
"0.6234666",
"0.62324125",
"0.6232232",
"0.6220684",
"0.62146366",
"0.62118745",
"0.6199993",
"0.6199993",
"0.6199993",
"0.61806494",
"0.6166038",
"0.6154137",
"0.61339676",
"0.6129676",
"0.6113633",
"0.61113477",
"0.61084193",
"0.6099899",
"0.6083897",
"0.6080119",
"0.6066062",
"0.6063163",
"0.606036",
"0.6050644",
"0.6050544",
"0.6049588",
"0.6049588",
"0.6043554",
"0.60259277",
"0.6019615",
"0.60183024",
"0.60139143",
"0.60139143",
"0.60139143",
"0.60139143",
"0.60139143",
"0.60139143",
"0.60139143",
"0.600466",
"0.6002364",
"0.6000388",
"0.5999221",
"0.5989975",
"0.59871036",
"0.5979878",
"0.59747756"
] | 0.73417497 | 7 |
Terminates the current element and calls the callback | def end_element(name)
clear_characters_buffer
if @elem
if @elem.parent == @doc
# If we're actually finishing the stanza (a stanza is always a document's root)
@callback.call(@elem)
# We delete the current element and the doc (1 doc per stanza policy)
@elem = @doc = nil
else
@elem = @elem.parent
end
else
# Not sure what to do since it seems we're not processing any element at this time, so how can one end?
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_element(name)\n if @elem\n if @elem.parent == @root\n @callback.call(@elem) \n # And we also need to remove @elem from its tree\n @elem.unlink \n # And the current elem is the next sibling or the root\n @elem = @root \n else\n @elem = @elem.parent \n end\n end\n end",
"def cancel!\n @callback = nil\n end",
"def end_element(name); end",
"def end_element(name); end",
"def on_end(&callback)\n @end_callback = callback\n end",
"def cancel()\n @callback = nil\n @cancelled = true\n end",
"def after_terminated\n end",
"def cancel element\n element.perform :cancel\n end",
"def finish(span)\n raise NotImplementedError\n end",
"def onEnd\r\n end",
"def end_element(name=nil)\n block = @block\n case name\n when \"entity\" # Wrap it up\n if @state[:address]\n host_object = report_host &block\n report_services(host_object)\n report_vulns(host_object)\n end\n # Reset the state once we close a host\n @report_data = {:workspace => @args[:workspace]}\n @state[:root] = {}\n when \"property\"\n if @state[:props]\n @text.strip! if @text\n process_property\n @state[:props].pop\n end\n end\n @state[:path].pop\n @text = nil\n end",
"def end_span\n return unless (span = current_spans.pop)\n\n span.done\n\n enqueue.call span\n\n span\n end",
"def callback\n Proc.new do |data, type, ev|\n event = Ecore::EcoreEventSignalExit.new(ev)\n\t event_type = [:interrupt, :quit, :terminate].find {|sym| event[sym] }\n\n\t @callback.call(event_type)\n\t 1\n\tend\n end",
"def cancel!\n\t\t\t\t# The simplest way to keep track of cancelled status is to nullify the\n\t\t\t\t# callback. This should also be optimal for garbage collection.\n\t\t\t\t@callback = nil\n\t\t\tend",
"def end() end",
"def end_element(name)\n if name.to_s == 'work'\n save_work\n end\n end",
"def stop\n yield\n end",
"def apply anElement\r\n unless anElement \r\n return\r\n end\r\n anElement.each {|e| \r\n unless @abort\r\n handle(e)\r\n yield if block_given?\r\n end }\r\n end",
"def finish()\n #This is a stub, used for indexing\n end",
"def on_close\n @closebacks.each {|closeback| closeback.call}\n end",
"def finish\n @ole.Finish\n end",
"def stop(&block)\n yield(DONE)\n puts stop_message\n end",
"def stop\n raise NotImplementedError.new(\"Implement stop() in your Invoker. \")\n end",
"def on_finish &block\r\n @finish_block = block\r\n end",
"def end_el(output, object, depth = 0, args = {})\n end",
"def end_hook name\n # this should be implemented in sub-classes\n end",
"def stop_handler\n\t\tderef_handler\n\tend",
"def cancel\n\n close_node\n\n do_wrap_cancel_children ||\n pop_on_receive_last ||\n wrap_cancelled\n end",
"def cancel!\n # The simplest way to keep track of cancelled status is to nullify the\n # callback. This should also be optimal for garbage collection.\n @callback = nil\n end",
"def close_notification\n self.div(:class=>\"gritter-item\").hover\n self.div(:class=>\"gritter-close\").fire_event \"onclick\"\n end",
"def end_span span\n unless span.context.parent == self\n raise \"The given span was not created by this context\"\n end\n span.finish!\n end",
"def call_end_handler\n return unless @end_handler\n @end_handler.call\n end",
"def end_div\n @browser.div(data_semantic: 'end-of-feed-message')\n end",
"def callback\n EM.Callback do\n if @readers.none?(&:running?)\n EM.stop_event_loop\n end\n end\n end",
"def finish(path, doc, node)\n invoke_block @options[:finish], doc, node\n end",
"def parserDidEndDocument(parser)\n @parsed = true\n puts \"done parsing\"\n if @block\n @items.each{|item| @block.call(item)}\n end\n end",
"def abort\n unless @finished\n do_abort\n end\n end",
"def shutdown(callback)\n @shutdown_callback = callback\n return self\n\tend",
"def stop\n @selector.stop\n end",
"def on_end_element(name)\n if(name == \"Row\")\n @data_table.set_table_row(@row);\n @is_row = false;\n @row = \"\";\n end\n end",
"def pop_interrupt; end",
"def destroy\n run_callbacks :destroy do\n connection.delete(element_path, encode, self.class.headers)\n end\n end",
"def done\n self.group.topic.unsubscribe(:wise_group_callback_handler)\n end",
"def end_item\n @p.end_item(self)\n end",
"def ending\n abstract!\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def stop\n raise \"NotImplemented\"\n end",
"def stop\n throw @context.stop\n end",
"def on_finish &block\n signal_connect \"finish\" do \n block.call()\n end\n end",
"def end_special_list_item\n end",
"def end(resource)\n end",
"def nuixWorkerItemCallbackClose\nend",
"def cancel; end",
"def cancel; end",
"def end_span span\n context = span_context\n raise \"No currently active span context\" unless context\n unless span.equal? context.this_span\n raise \"The given span doesn't match the currently active span\"\n end\n span.finish!\n self.span_context = context.parent\n span\n end",
"def _end!; end",
"def at_end; end",
"def stop_handler\n end",
"def end_element(name)\n case name\n when 'book', 'c'\n end_verse if @mode == 'verse'\n when 'h'\n end_book_title\n when 'f', 'x'\n end_footnote\n end\n end",
"def finish\n #\n end",
"def finish()\n @device.finish() ;\n end",
"def on_finish &block\n signal_connect \"finish\" do\n block.call\n end\n end",
"def finish\r\n #\r\n end",
"def stop; end",
"def stop; end",
"def stop; end",
"def stop; end",
"def stop; end",
"def stop; end",
"def stop; end",
"def terminate_message\n self.active = false\n self.pause = false\n @contents_showing = false\n $game_temp.message_proc&.call\n reset_game_temp_message_info\n dispose_sub_elements\n reset_overwrites\n @auto_skip = false\n end",
"def stop\n\t\t# No-op\n\tend",
"def on_close(&callback)\n @close_cb = callback\n end",
"def cancel ; @finished = true ; @buff = '' ; end",
"def finish\n @bars.each(&:finish)\n end",
"def end_element(name)\n if name == 'RecordDetails'\n @record = InstrumentDocument.save_from_array(@document)\n @document = nil\n end\n end",
"def kill_when_ended\n\n [] # no effect\n end",
"def close\n send_termination_event\n end",
"def on_close(*a, &b)\n @close_cb = EM::Callback(*a, &b)\n end",
"def emit_end\n @end_callback.call unless @end_callback.nil?\n end",
"def on_finish(&block)\n @options[:finish] = block\n end",
"def exit_current\n return if empty?\n current.exit\n end",
"def call_cancel_handler; call_handler(:cancel); end",
"def terminate\n set_or_terminate do\n @terminated = true\n end\n end",
"def finish(value)\n @ole.Finish = value\n nil\n end",
"def force_end\n stop\n end",
"def end(arg0)\n end",
"def addTeardownBlock( &block ); self.class.addTeardownBlock( &block ); end",
"def close\n synchronize do\n @callbacks.values.flatten.each(&:close)\n @state = :closed\n clear!\n end\n end",
"def on_finish &b\n @on_finish_cb = b\n end",
"def stop(&block)\n @stop = block\n end",
"def end_row\n @block.call(@current_row)\n @rows_loaded += 1\n end",
"def on_end_element(element)\n\t\t\t\t\t@tag = nil\n\t\t\t\t\tcase element\n\t\t\t\t\t\twhen \"device\"\n\t\t\t\t\t\t\t@in_device = false\n\t\t\t\t\t\twhen \"description\"\n\t\t\t\t\t\t\tif @in_device && @in_fingerprint\n\t\t\t\t\t\t\t\[email protected] = { VALID_FINGERPRINTS[element] => @vals[element].gsub(\"\\n\", \",\") } if VALID_FINGERPRINTS.key?(element)\n\t\t\t\t\t\t\t\[email protected]\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\twhen \"fingerprint\"\n\t\t\t\t\t\t\t@in_fingerprint = false\n\t\t\t\t\tend\n\t\t\t\tend",
"def endState(tag)\n raise \"Not implemented\"\n end",
"def finish\n #\n end",
"def endPage()\n @device.endPage() ;\n end",
"def stop\n @bars.each(&:stop)\n end",
"def cancel!; end"
] | [
"0.7087421",
"0.60376847",
"0.58250034",
"0.58250034",
"0.5787149",
"0.5766771",
"0.5736605",
"0.57225055",
"0.5675317",
"0.56606823",
"0.5636234",
"0.5515769",
"0.5509259",
"0.5430281",
"0.5406744",
"0.5390259",
"0.53895587",
"0.53862596",
"0.53801715",
"0.53567",
"0.5338179",
"0.5317801",
"0.53089786",
"0.5305221",
"0.5302097",
"0.5298854",
"0.5298355",
"0.52779484",
"0.52742964",
"0.52734935",
"0.52652085",
"0.52647954",
"0.52612245",
"0.52520376",
"0.5248273",
"0.5243397",
"0.5237346",
"0.52272046",
"0.5220629",
"0.5220043",
"0.5214654",
"0.52132964",
"0.52097476",
"0.5174651",
"0.5171362",
"0.51562274",
"0.51562274",
"0.51562274",
"0.5154972",
"0.5145344",
"0.5143641",
"0.51396716",
"0.51269543",
"0.51252407",
"0.51124036",
"0.51124036",
"0.51116455",
"0.51053333",
"0.5102279",
"0.50936437",
"0.5089873",
"0.50893044",
"0.50888777",
"0.5087543",
"0.5085198",
"0.5084544",
"0.5084544",
"0.5084544",
"0.5084544",
"0.5084544",
"0.5084544",
"0.5084544",
"0.50837827",
"0.50831145",
"0.50774723",
"0.50737846",
"0.50730485",
"0.50631243",
"0.5059995",
"0.505192",
"0.50306594",
"0.5029361",
"0.5027814",
"0.5025052",
"0.5019031",
"0.5015264",
"0.50151956",
"0.5011573",
"0.5007577",
"0.49970603",
"0.498155",
"0.49688718",
"0.49686807",
"0.49662745",
"0.49612695",
"0.49559623",
"0.49553376",
"0.495396",
"0.49528143",
"0.4949605"
] | 0.6811315 | 1 |
Adds namespaces and attributes. Nokogiri passes them as a array of [[ns_name, ns_url], [ns_name, ns_url]..., key, value, key, value]... | def add_namespaces_and_attributes_to_current_node(attrs)
# Namespaces
attrs.select {|k| k.is_a? Array}.each do |pair|
set_namespace(pair[0], pair[1])
# set_normal_attribute(pair[0], pair[1])
end
# Attributes
attrs.select {|k| k.is_a? String}.in_groups_of(2) do |pair|
set_normal_attribute(pair[0], pair[1])
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_namespaces_and_attributes_to_node(attrs, node) \n (attrs.size / 2).times do |i|\n name, value = attrs[2 * i], attrs[2 * i + 1]\n if name =~ /xmlns/\n node.add_namespace(name, value)\n else\n node.set_attribute name, value\n end\n end\n end",
"def add_namespaces node\n raw.root.namespace_definitions.each do |ns|\n node.add_namespace_definition ns.prefix, ns.href if ns.href != NS\n end\n end",
"def add_namespaces( node, namespaces )\n #pass nil as the prefix to create a default node\n default = namespaces.delete( \"default\" )\n node.namespaces.namespace = XML::Namespace.new( node, nil, default )\n namespaces.each do |prefix, prefix_uri|\n XML::Namespace.new( node, prefix, prefix_uri )\n end\n end",
"def load_namespaces\n\t\t\tnamespace_instructions = []\n\t\t\tns_pi = self.find_all { |i| i.is_a? REXML::Instruction and i.target == 'xml:ns' }\n\t\t\tns_pi.each do |i|\n\t\t\t\tif i.attributes.has_key?('name')\n i.attributes['prefix'] = i.attributes['name']\n elsif i.attributes.has_key?('prefix')\n i.attributes['name'] = i.attributes['prefix']\n else\n raise \"parse error namespace instruction missing required name or prefix attribute.\"\n end\n if i.attributes.has_key?('space')\n i.attributes['uri'] = i.attributes['space']\n elsif i.attributes.has_key?('uri')\n i.attributes['space'] = i.attributes['uri']\n else\n\t\t\t\t\traise \"parse error namespace instruction missing required space or uri attribute.\"\n\t\t\t\tend\n namespace_instructions << i\n\t\t\tend\n\t\t\treturn namespace_instructions\n\t\tend",
"def add_element(name, attrs={})\n ns = XMLNamespaces.map {|k, v| [\"xmlns:#{k}\", v]}\n ns = Hash[*ns.flatten]\n attrs.merge!(ns)\n super(name, attrs)\n end",
"def register_namespaces(namespaces); end",
"def register_namespaces(namespaces); end",
"def register_namespaces_with_builder(builder)\n return unless self.class.instance_variable_get(:@registered_namespaces)\n\n self.class.instance_variable_get(:@registered_namespaces).sort.each do |name, href|\n name = nil if name == \"xmlns\"\n builder.doc.root.add_namespace(name, href)\n end\n end",
"def namespace_hash\n opt = {}\n namespaces.each do |type, attrs|\n key = \"xmlns:#{attrs[:key]}\"\n opt[key] = attrs[:value]\n end\n opt\n end",
"def add_xmlns(attributes)\n attributes['xmlns:samlp'] = \"urn:oasis:names:tc:SAML:2.0:protocol\" \n attributes['xmlns:saml'] = \"urn:oasis:names:tc:SAML:2.0:assertion\"\n attributes\n end",
"def fix_namespaces(doc)\n if is_jruby?\n # Only needed in jruby, nokogiri's jruby implementation isn't weird\n # around namespaces in exactly the same way as MRI. We need to keep\n # track of the namespaces in outer contexts ourselves, and then see\n # if they are needed ourselves. :(\n namespaces = namespaces_stack.compact.reduce({}, :merge)\n default_ns = namespaces.delete(\"xmlns\")\n\n namespaces.each_pair do |attrib, uri|\n ns_prefix = attrib.sub(/\\Axmlns:/, '')\n\n # gotta make sure it's actually used in the doc to not add it\n # unecessarily. GAH.\n if doc.xpath(\"//*[starts-with(name(), '#{ns_prefix}:')][1]\").empty? &&\n doc.xpath(\"//@*[starts-with(name(), '#{ns_prefix}:')][1]\").empty?\n next\n end\n doc.root.add_namespace_definition(ns_prefix, uri)\n end\n\n if default_ns\n doc.root.default_namespace = default_ns\n # OMG nokogiri, really?\n default_ns = doc.root.namespace\n doc.xpath(\"//*[namespace-uri()='']\").each do |node|\n node.namespace = default_ns\n end\n end\n\n end\n return doc\n end",
"def start_element_namespace(name, attrs = T.unsafe(nil), prefix = T.unsafe(nil), uri = T.unsafe(nil), ns = T.unsafe(nil)); end",
"def start_element_namespace(name, attrs = T.unsafe(nil), prefix = T.unsafe(nil), uri = T.unsafe(nil), ns = T.unsafe(nil)); end",
"def collect_namespaces\n # TODO: print warning message if a prefix refers to more than one URI in the document?\n ns = {}\n traverse {|j| ns.merge!(j.namespaces)}\n ns\n end",
"def namespace=(ns); end",
"def namespace=(ns); end",
"def add_namespace(namespace) \n @namespaces[namespace.name] = namespace\n end",
"def xml_ns\r\n { \"rdf\" => \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\",\r\n \"rss\" => \"http://purl.org/rss/1.0/\",\r\n \"prism\"=>\"http://prismstandard.org/namespaces/1.2/basic/\",\r\n \"dc\"=>\"http://purl.org/dc/elements/1.1/\",\r\n \"mn\"=>\"http://usefulinc.com/rss/manifest/\",\r\n \"content\"=>\"http://purl.org/rss/1.0/modules/content/\"\r\n }\r\n end",
"def register_namespace(name_and_href)\n (@default_namespaces ||= []) <<name_and_href\n end",
"def register_namespace(name_and_href)\n (@default_namespaces ||= []) <<name_and_href\n end",
"def on_start_element_ns(name, attributes, prefix, uri, namespaces)\n STDOUT << \"on_start_element_ns\" << \"\\n\" <<\n \" name: \" << name << \"\\n\" <<\n \" attr: \" << (attributes || Hash.new).inspect << \"\\n\" <<\n \" prefix: \" << prefix << \"\\n\" <<\n \" uri: \" << uri << \"\\n\" <<\n \" ns_defs: \" << (namespaces || Hash.new).inspect << \"\\n\"\n STDOUT.flush\n end",
"def xmlns\n a = collection.map(&:xmlns).uniq\n a.delete nil\n h = {}\n a.each { |e| h.merge! e }\n h\n end",
"def metadata_namespaces\n \n ## Possible to automate this if I bodge the XML processing less...?\n ## This is not a good solution, it would be better if Nokogiri was allowed\n ## to sort this out itself.\n \n @metadata_namespaces ||= {\n 'ukfedlabel' => 'http://ukfederation.org.uk/2006/11/label',\n 'elab' => 'http://eduserv.org.uk/labels',\n 'wayf' => 'http://sdss.ac.uk/2006/06/WAYF',\n 'mdui' => 'urn:oasis:names:tc:SAML:metadata:ui',\n 'saml' => 'urn:oasis:names:tc:SAML:2.0:assertion',\n 'md' => 'urn:oasis:names:tc:SAML:2.0:metadata',\n nil => 'urn:oasis:names:tc:SAML:2.0:metadata',\n 'shibmd' => 'urn:mace:shibboleth:metadata:1.0'\n }\n \n return @metadata_namespaces\n \n end",
"def namespaces\n @namespaces ||= {\n wse: Akami::WSSE::WSE_NAMESPACE,\n ds: 'http://www.w3.org/2000/09/xmldsig#',\n wsu: Akami::WSSE::WSU_NAMESPACE,\n }\n end",
"def namespaces\n @namespaces ||= {\n wse: Akami::WSSE::WSE_NAMESPACE,\n ds: 'http://www.w3.org/2000/09/xmldsig#',\n wsu: Akami::WSSE::WSU_NAMESPACE,\n }\n end",
"def declare_namespaces\n foaf = Namespace.new(\"http://xmlns.com/foaf/0.1/\", \"foaf\")\n rdf = Namespace.new(\"http://www.w3.org/1999/02/22-rdf-syntax-ns\", \"rdf\", true)\n rdfs = Namespace.new(\"http://www.w3.org/2000/01/rdf-schema\", 'rdfs', true)\n xsd = Namespace.new('http://www.w3.org/2001/XMLSchema', 'xsd', true)\n owl = Namespace.new('http://www.w3.org/2002/07/owl', 'owl', true)\n end",
"def namespaces\n ns = {}\n ns[:envelope] = {key:'env', value: 'http://www.w3.org/2003/05/soap-envelope'}\n ns[:content] = {key:'ns1', value: 'http://tempuri.org/'}\n ns[:profile] = {key:'ns2', value: 'http://schemas.datacontract.org/2004/07/SAPI.Entities.Admin'}\n ns[:wsa] = {key:'ns3', value: 'http://www.w3.org/2005/08/addressing'}\n ns[:shipment] = {key:'ns4', value: 'http://schemas.datacontract.org/2004/07/SAPI.Entities.WayBillGeneration'}\n ns[:pickup] = {key:'ns5', value: 'http://schemas.datacontract.org/2004/07/SAPI.Entities.Pickup'}\n ns\n end",
"def register_namespace(name, href)\n @registered_namespaces.merge!(name => href)\n end",
"def namespaces; end",
"def namespaces; end",
"def namespaces; end",
"def namespaces; end",
"def namespaces=(hash = {})\n hash = {} unless hash.is_a? Hash\n\n @namespaces ||= {}\n @namespaces.merge!(hash)\n end",
"def collect_namespaces(object); end",
"def xmlns_hash\n {xmlns_attr => @uri.to_s}\n end",
"def on_start_element_ns(name, attributes, prefix, uri, namespaces)\n end",
"def sfa_add_namespace(prefix, urn)\n @@sfa_namespaces[prefix] = urn\n end",
"def namespaces\n root ? root.namespaces : {}\n end",
"def start_element_namespace(name, attrs_ary = [], prefix = nil, uri = nil, ns = [])\n @text = nil\n node = Node.new(uri, name, attrs_ary.inject({}) { |hsh, a| hsh[a.localname] = a.value; hsh }, '')\n path << node\n\n # call delegate\n delegate.start_element(path, self, node) if delegate.respond_to?(:start_element)\n end",
"def add_namespace(ns, prefix = \"unknown#{rand 65536}\")\n return nil if ns.nil? || ns.empty?\n unless namespaces.key? ns\n namespaces[ns] = prefix\n return prefix\n end\n end",
"def default_namespace(url)\n @namespaces[''] = url\n end",
"def namespaces_by_uri\n namespace_scopes.reduce({}, &->(m, ns) { m[ns.href]=ns; m })\n end",
"def namespaces\n root ? root.collect_namespaces : {}\n end",
"def namespace(name = nil, url = nil)\n @namespaces[name.to_s] = url\n end",
"def update!(**args)\n @namespaces = args[:namespaces] if args.key?(:namespaces)\n end",
"def update!(**args)\n @namespaces = args[:namespaces] if args.key?(:namespaces)\n end",
"def namespace=(value)\n self.namespaces = [value]\n end",
"def get_attribute_ns(namespace, name); end",
"def namespaces\n ns = {}\n\n JSON.parse(raw_namespaces)[\"results\"][\"bindings\"].each {|x|\n ns[x[\"prefix\"][\"value\"]] = x[\"namespace\"][\"value\"]\n }\n ns\n end",
"def namespace_declarations(ctx); end",
"def namespace_declarations(ctx); end",
"def xml_namespace(node, name, uri, namespaces = {})\n XML::Namespace.new(node, name, uri)\n end",
"def namespaces_by_prefix\n form_data = { 'action' => 'query', 'meta' => 'siteinfo', 'siprop' => 'namespaces' }\n res = make_api_request(form_data)\n REXML::XPath.match(res, \"//ns\").inject(Hash.new) do |namespaces, namespace|\n prefix = namespace.attributes[\"canonical\"] || \"\"\n namespaces[prefix] = namespace.attributes[\"id\"].to_i\n namespaces\n end\n end",
"def normalize_xmlliteral(contents, options = {})\n options[:namespaces] ||= {}\n\n begin\n # Only normalize if Nokogiri is included\n require 'nokogiri' unless defined?(Nokogiri)\n rescue LoadError => e\n contents.to_s # No normalization\n end\n \n if contents.is_a?(String)\n ns_hash = {}\n options[:namespaces].each_pair do |prefix, uri|\n attr = prefix.to_s.empty? ? \"xmlns\" : \"xmlns:#{prefix}\"\n ns_hash[attr] = uri.to_s\n end\n ns_strs = []\n ns_hash.each_pair {|a, u| ns_strs << \"#{a}=\\\"#{u}\\\"\"}\n\n # Add inherited namespaces to created root element so that they're inherited to sub-elements\n contents = Nokogiri::XML::Document.parse(\"<foo #{ns_strs.join(\" \")}>#{contents}</foo>\").root.children\n end\n\n # Add already mapped namespaces and language\n contents.map do |c|\n if c.is_a?(Nokogiri::XML::Element)\n c = Nokogiri::XML.parse(c.dup.to_xml(:save_with => Nokogiri::XML::Node::SaveOptions::NO_EMPTY_TAGS)).root\n # Gather namespaces from self and decendant nodes\n c.traverse do |n|\n ns = n.namespace\n next unless ns\n prefix = ns.prefix ? \"xmlns:#{ns.prefix}\" : \"xmlns\"\n c[prefix] = ns.href.to_s unless c.namespaces[prefix]\n end\n \n # Add lanuage\n if options[:language] && c[\"lang\"].to_s.empty?\n c[\"xml:lang\"] = options[:language]\n end\n end\n c.to_xml(:save_with => Nokogiri::XML::Node::SaveOptions::NO_EMPTY_TAGS)\n end.join(\"\")\n end",
"def namespace(name, href)\n @resource.add_namespace(name, href)\n end",
"def add_namespace(source_ns_key, output_namespace, *args, &block)\n # raise 'expected arg1 not be empty string or an integer' if source_ns_key.empty? || source_ns_key.is_a?(Integer)\n # raise 'expected arg2 not be empty string or an integer' if output_namespace.empty? || output_namespace.is_a?(Integer)\n # raise 'expected arg3 not be empty' if args.empty?\n\n map = Map.new((source_ns + [source_ns_key]).join('.'),\n output_namespace,\n nil,\n :add_namespace)\n map.properties = args\n @mappings[map.container_key] = map\n\n map = self.class.new((source_ns + [source_ns_key]),\n output_namespace.to_s.split('.'),\n :add_namespace,\n args)\n\n map.instance_exec(&block) if block_given?\n @mappings.merge!(map.mappings)\n end",
"def add_propertys( node, attributes )\n attributes.each do |name, value|\n XML::Attr.new( node, name, value )\n end\n end",
"def writeXML(xml)\n if @targetNamespace.nil?\n xml.send(self.class.to_s.split(\"::\").last){\n write_attributes_elements(xml)\n }\n else\n prefix = \"#{@targetNamespace[:prefix]}\"\n namespace = \"#{@targetNamespace[:namespace]}\"\n xml.send(self.class.to_s.split(\"::\").last){\n=begin\n ins = xml.parent.add_namespace_definition(prefix, namespace)\n xml.parent.namespace = ins\n=end\n\n write_attributes_elements(xml)\n }\n end\n end",
"def prefix_for(ns_href)\n namespaces[ns_href] || add_namespace(ns_href)\n end",
"def post_save xml, options={:mapping=>:_default}\n # using REXML's element namespace method doesn't seem to set the namespace correctly...?\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\")\n xml.root.add_namespace \"xsi\", \"http://www.w3.org/2001/XMLSchema-instance\"\n xml.root.add_namespace \"xsd\", \"http://www.w3.org/2001/XMLSchema\"\n # for challengeResponses/response\n xml.each_element(\"//response\") do |x| \n x.add_namespace \"v11\", \"http://schema.intuit.com/platform/fdatafeed/challenge/v1\"\n x.name = \"v11:response\"\n end\n # for challengeResponses root\n xml.each_element(\"//challengeResponses\") do |x| \n x.add_namespace \"v1\", \"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\"\n x.name = \"challengeResponses\"\n end\n end",
"def namespaces(*namespaces)\n namespaces.each do |ns|\n namespace ns\n end\n @namespaces\n end",
"def ns(ns)\n self.namespace = ns\n self\n end",
"def define_namespaces #:nodoc:\n unless self.respond_to?(:namespaces)\n send(:define_singleton_method, :namespaces) { @namespaces }\n send(:define_method, :namespaces) { self.class.namespaces }\n end\n end",
"def namespace=(ns)\n return set_namespace(ns) unless ns\n\n unless Nokogiri::XML::Namespace === ns\n raise TypeError, \"#{ns.class} can't be coerced into Nokogiri::XML::Namespace\"\n end\n if ns.document != document\n raise ArgumentError, \"namespace must be declared on the same document\"\n end\n\n set_namespace ns\n end",
"def namespace=(ns) @namespace = @store.namespace = ns; end",
"def setNamespace(prefix, uri) \n @obj.setNamespace(prefix, uri)\n end",
"def set_namespace(ns = '')\n settings['namespace'] = ns\n end",
"def post_save xml, options={:mapping=>:_default}\n # using REXML's element namespace method doesn't seem to set the namespace correctly...?\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\")\n xml.root.add_namespace \"xsi\", \"http://www.w3.org/2001/XMLSchema-instance\"\n xml.root.add_namespace \"xsd\", \"http://www.w3.org/2001/XMLSchema\"\n # for challengeResponses/response\n xml.each_element(\"//response\") do |x|\n x.add_namespace \"v11\", \"http://schema.intuit.com/platform/fdatafeed/challenge/v1\"\n x.name = \"v11:response\"\n end\n # for challengeResponses root\n xml.each_element(\"//challengeResponses\") do |x|\n x.add_namespace \"v1\", \"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\"\n x.name = \"challengeResponses\"\n end\n end",
"def update!(**args)\n @namespaces = args[:namespaces] if args.key?(:namespaces)\n @numeric_namespaces = args[:numeric_namespaces] if args.key?(:numeric_namespaces)\n end",
"def xmlns\n {\n 'xs' => 'http://www.w3.org/2001/XMLSchema',\n 'ncs' => 'http://www.nationalchildrensstudy.gov',\n 'ncsdoc' => 'http://www.nationalchildrensstudy.gov/doc'\n }\n end",
"def xmlns\n {\n 'xs' => 'http://www.w3.org/2001/XMLSchema',\n 'ncs' => 'http://www.nationalchildrensstudy.gov',\n 'ncsdoc' => 'http://www.nationalchildrensstudy.gov/doc'\n }\n end",
"def namespace(options={}, &block)\n model = Caracal::Core::Models::NamespaceModel.new(options, &block)\n if model.valid?\n ns = register_namespace(model)\n else\n raise Caracal::Errors::InvalidModelError, 'namespace must specify the :prefix and :href attributes.'\n end\n ns\n end",
"def ns_prefixes\n {\n 'jerm' => JERMVocab.to_uri.to_s,\n 'dcterms' => RDF::Vocab::DC.to_uri.to_s,\n 'owl' => RDF::Vocab::OWL.to_uri.to_s,\n 'foaf' => RDF::Vocab::FOAF.to_uri.to_s,\n 'sioc' => RDF::Vocab::SIOC.to_uri.to_s\n }\n end",
"def namespaces=(raw_namespaces)\n @namespaces = NamespaceSet.new(raw_namespaces)\n end",
"def custom_namespace\n @attributes[:custom_namespace]\n end",
"def test_setNamedItemNS01\n doc = nil\n elementList = nil\n anotherElement = nil\n anotherMap = nil\n arg = nil\n testAddress = nil\n map = nil\n setNode = nil\n doc = load_document(\"staffNS\", true)\n elementList = doc.getElementsByTagName(\"address\")\n anotherElement = elementList.item(2)\n anotherMap = anotherElement.attributes()\n arg = anotherMap.getNamedItemNS(\"http://www.netzero.com\", \"domestic\")\n testAddress = elementList.item(0)\n map = testAddress.attributes()\n \n begin\n success = false;\n begin\n setNode = map.setNamedItemNS(arg)\n rescue Taka::DOMException => ex\n success = (ex.code == Taka::DOMException::INUSE_ATTRIBUTE_ERR)\n end \n assert(success, \"throw_INUSE_ATTRIBUTE_ERR\")\n end\n\n end",
"def get_namespaces\n response = get_siteinfo('namespaces')\n ret = {}\n response['query']['namespaces'].each do |id, _|\n idid = response['query']['namespaces'][id]['id']\n name = response['query']['namespaces'][id]['*']\n ret[idid] = name\n end\n ret\n end",
"def package_namespaces\n namespaces = [EPUB2_NAMESPACES]\n namespaces << EPUB3_NAMESPACES if @target.epub_version >= 3\n namespaces << IBOOKS_NAMESPACES if @target.epub_version >= 3 && @target.ibooks?\n namespaces.reduce(:merge)\n end",
"def node_namespace name:\n label = make_label name\n attrs = { name: name }\n\n add_node :Namespace, label, attrs\n end",
"def option_namespaces\n option_parser.on('-n', '--namespace NAME', 'add a namespace to output') do |name|\n options[:namespaces] ||= []\n options[:namespaces] << name\n end\n end",
"def get_namespace(node, prefix); end",
"def extract_mappings(element, uri_mappings, namespaces)\n # look for xmlns\n # (note, this may be dependent on @host_language)\n # Regardless of how the mapping is declared, the value to be mapped must be converted to lower case,\n # and the URI is not processed in any way; in particular if it is a relative path it is\n # not resolved against the current base.\n ns_defs = {}\n element.namespaces.each do |prefix, href|\n prefix = nil if prefix == \"xmlns\"\n add_debug(\"extract_mappings\") { \"ns: #{prefix}: #{href}\"}\n ns_defs[prefix] = href\n end\n\n # HTML parsing doesn't create namespace_definitions\n if ns_defs.empty?\n ns_defs = {}\n element.attributes.each do |attr, href|\n next unless attr =~ /^xmlns(?:\\:(.+))?/\n prefix = $1\n add_debug(\"extract_mappings\") { \"ns(attr): #{prefix}: #{href}\"}\n ns_defs[prefix] = href\n end\n end\n\n ns_defs.each do |prefix, href|\n # A Conforming RDFa Processor must ignore any definition of a mapping for the '_' prefix.\n next if prefix == \"_\"\n href = uri(base_uri, href).to_s\n\n # Downcase prefix for RDFa 1.1\n pfx_lc = (@version == :\"rdfa1.0\" || prefix.nil?) ? prefix : prefix.downcase\n if prefix\n if uri_mappings.fetch(pfx_lc.to_sym, href) != href\n add_warning(element, \"Redefining prefix #{pfx_lc}: from <#{uri_mappings[pfx_lc]}> to <#{href}>\", RDF::RDFA.PrefixRedefinition)\n end\n uri_mappings[pfx_lc.to_sym] = href\n namespaces[pfx_lc] ||= href\n prefix(pfx_lc, href)\n add_info(element, \"extract_mappings: #{prefix} => <#{href}>\")\n else\n add_info(element, \"extract_mappings: nil => <#{href}>\")\n namespaces[\"\"] ||= href\n end\n end\n\n # Set mappings from @prefix\n # prefix is a whitespace separated list of prefix-name URI pairs of the form\n # NCName ':' ' '+ xs:anyURI\n mappings = element.attribute(\"prefix\").to_s.strip.split(/\\s+/)\n while mappings.length > 0 do\n prefix, uri = mappings.shift.downcase, mappings.shift\n #puts \"uri_mappings prefix #{prefix} #{uri.to_base}\"\n next unless prefix.match(/:$/)\n prefix.chop!\n\n unless prefix.empty? || prefix.match(NC_REGEXP)\n add_error(element, \"extract_mappings: Prefix #{prefix.inspect} does not match NCName production\")\n next\n end\n\n # A Conforming RDFa Processor must ignore any definition of a mapping for the '_' prefix.\n next if prefix == \"_\"\n uri = uri(base_uri, uri).to_s\n\n pfx_index = prefix.to_s.empty? ? nil : prefix.to_s.to_sym\n if uri_mappings.fetch(pfx_index, uri) != uri\n add_warning(element, \"Redefining prefix #{prefix}: from <#{uri_mappings[pfx_index]}> to <#{uri}>\", RDF::RDFA.PrefixRedefinition)\n end\n uri_mappings[pfx_index] = uri\n prefix(prefix, uri)\n add_info(element, \"extract_mappings: prefix #{prefix} => <#{uri}>\")\n end unless @version == :\"rdfa1.0\"\n end",
"def to_nokogiri\n base_document = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|\n xml.entry('xmlns:atom' => 'http://www.w3.org/2005/Atom',\n 'xmlns:apps' => 'http://schemas.google.com/apps/2006' ) {\n\n # Namespaces cannot be used until they are declared, so we need to\n # retroactively declare the namespace of the parent\n xml.parent.namespace = xml.parent.namespace_definitions.select {|ns| ns.prefix == \"atom\"}.first\n xml.category(\"scheme\" => \"http://schemas.google.com/g/2005#kind\",\n \"term\" =>\"http://schemas.google.com/apps/2006#user\")\n xml['apps'].login(login_attributes)\n xml['apps'].quota(\"limit\" => @limit) if @limit\n xml['apps'].name(\"familyName\" => @family_name, \"givenName\" => @given_name)\n }\n end\n\n base_document\n end",
"def cleanup_namespaces\n namespaces.reject! { |namespace| namespace['prefix'].blank? || namespace['uri'].blank? } if namespaces.present?\n end",
"def default_namespace=(url); end",
"def default_namespace=(url); end",
"def set_attribute_node_ns( new_attr )\n if new_attr.owner_document != self.owner_document then\n raise \"WRONG_DOCUMENT_ERR\"\n end\n if not new_attr.owner_element.nil? then\n raise \"INUSE_ATTRIBUTE_ERR\"\n end\n old_attr = nil\n @attr_nodes << new_attr\n new_attr._set_owner_element( self )\n old_attr\n end",
"def namespaces_by_prefix\n namespace_scopes.reduce({}, &->(m, ns) { m[ns.prefix]=ns; m })\n end",
"def test_namespaces\n with_feed(:from_file => 'wellformed/rss/rss_namespace_1.xml') { |feed|\n assert_equal(\"Example description\", feed.description)\n assert_equal(nil, feed.title)\n }\n with_feed(:from_file => 'wellformed/rss/rss_namespace_2.xml') { |feed|\n assert_equal(\"Example description\", feed.description)\n assert_equal(nil, feed.title)\n }\n with_feed(:from_file => 'wellformed/rss/rss_namespace_3.xml') { |feed|\n assert_equal(\"Example description\", feed.description)\n assert_equal(nil, feed.title)\n }\n with_feed(:from_file => 'wellformed/rss/rss_namespace_4.xml') { |feed|\n assert_equal(\"Example description\", feed.description)\n assert_equal(nil, feed.title)\n }\n with_feed(:from_file => 'wellformed/rss/rss_version_090.xml') { |feed|\n assert_equal(\"rss\", feed.feed_type)\n assert_equal(0.9, feed.feed_version)\n }\n with_feed(:from_file => 'wellformed/rss/rss_version_091_netscape.xml') { |feed|\n assert_equal(\"rss\", feed.feed_type)\n assert_equal(0.91, feed.feed_version)\n }\n with_feed(:from_file => 'wellformed/rss/rss_version_091_userland.xml') { |feed|\n assert_equal(\"rss\", feed.feed_type)\n assert_equal(0.91, feed.feed_version)\n }\n with_feed(:from_file => 'wellformed/rss/rss_version_092.xml') { |feed|\n assert_equal(\"rss\", feed.feed_type)\n assert_equal(0.92, feed.feed_version)\n }\n with_feed(:from_file => 'wellformed/rss/rss_version_093.xml') { |feed|\n assert_equal(\"rss\", feed.feed_type)\n assert_equal(0.93, feed.feed_version)\n }\n with_feed(:from_file => 'wellformed/rss/rss_version_094.xml') { |feed|\n assert_equal(\"rss\", feed.feed_type)\n assert_equal(0.94, feed.feed_version)\n }\n with_feed(:from_file => 'wellformed/rss/rss_version_20.xml') { |feed|\n assert_equal(\"rss\", feed.feed_type)\n assert_equal(2.0, feed.feed_version)\n }\n with_feed(:from_file => 'wellformed/rss/rss_version_201.xml') { |feed|\n assert_equal(\"rss\", feed.feed_type)\n assert_equal(2.0, feed.feed_version)\n }\n with_feed(:from_file => 'wellformed/rss/rss_version_21.xml') { |feed|\n assert_equal(\"rss\", feed.feed_type)\n assert_equal(2.0, feed.feed_version)\n }\n with_feed(:from_file => 'wellformed/rss/rss_version_missing.xml') { |feed|\n assert_equal(\"rss\", feed.feed_type)\n assert_equal(nil, feed.feed_version)\n }\n end",
"def goo_namespaces\n return if defined?(@@configured) && @@configured\n Goo.configure do |conf|\n conf.add_namespace(:omv, RDF::Vocabulary.new(\"http://omv.ontoware.org/2005/05/ontology#\"))\n conf.add_namespace(:skos, RDF::Vocabulary.new(\"http://www.w3.org/2004/02/skos/core#\"))\n conf.add_namespace(:owl, RDF::Vocabulary.new(\"http://www.w3.org/2002/07/owl#\"))\n conf.add_namespace(:rdfs, RDF::Vocabulary.new(\"http://www.w3.org/2000/01/rdf-schema#\"))\n conf.add_namespace(:metadata, RDF::Vocabulary.new(\"http://data.bioontology.org/metadata/\"), default = true)\n conf.add_namespace(:metadata_def, RDF::Vocabulary.new(\"http://data.bioontology.org/metadata/def/\"))\n conf.add_namespace(:dc, RDF::Vocabulary.new(\"http://purl.org/dc/elements/1.1/\"))\n conf.add_namespace(:xsd, RDF::Vocabulary.new(\"http://www.w3.org/2001/XMLSchema#\"))\n conf.add_namespace(:oboinowl_gen, RDF::Vocabulary.new(\"http://www.geneontology.org/formats/oboInOWL#\"))\n conf.add_namespace(:obo_purl, RDF::Vocabulary.new(\"http://purl.obolibrary.org/obo/\"))\n conf.add_namespace(:umls, RDF::Vocabulary.new(\"http://bioportal.bioontology.org/ontologies/umls/\"))\n conf.id_prefix = \"http://data.bioontology.org/\"\n conf.pluralize_models(true)\n end\n @@configured = true\n end",
"def namespaces\n @opts[:namespace]\n end",
"def namespace=(v); end",
"def propstats(xml, stats)\n return if stats.empty?\n for status, props in stats\n xml.propstat do\n xml.prop do\n for element, value in props\n defn = xml.doc.root.namespace_definitions.find{|ns_def| ns_def.href == element[:ns_href]}\n if defn.nil?\n if element[:ns_href] and not element[:ns_href].empty?\n _ns = \"unknown#{rand(65536)}\"\n xml.doc.root.add_namespace_definition(_ns, element[:ns_href])\n else\n _ns = nil\n end\n else\n # Unfortunately Nokogiri won't let the null href, non-null prefix happen\n # So we can't properly handle that error.\n _ns = element[:ns_href].nil? ? nil : defn.prefix\n end\n ns_xml = _ns.nil? ? xml : xml[_ns]\n if (value.is_a?(Nokogiri::XML::Node)) or (value.is_a?(Nokogiri::XML::DocumentFragment))\n xml.__send__ :insert, value\n elsif(value.is_a?(Symbol))\n ns_xml.send(element[:name]) do\n ns_xml.send(value)\n end\n else\n ns_xml.send(element[:name], value) do |x|\n # Make sure we return valid XML\n x.parent.namespace = nil if _ns.nil?\n end\n end\n\n # This is gross, but make sure we set the current namespace back to DAV:\n xml['D']\n end\n end\n xml.status \"#{http_version} #{status.status_line}\"\n end\n end\n end",
"def add_header\n @document.root = Atom::XML::Node.new('atom:entry')\n\n Atom::XML::Namespace.new(@document.root, 'atom', 'http://www.w3.org/2005/Atom')\n Atom::XML::Namespace.new(@document.root, 'apps', 'http://schemas.google.com/apps/2006')\n Atom::XML::Namespace.new(@document.root, 'gd', 'http://schemas.google.com/g/2005')\n end",
"def _sfa_add_ns(name, opts = {})\n if prefix = opts[:namespace]\n unless @@sfa_namespaces[prefix]\n raise \"Unknown namespace '#{prefix}'\"\n end\n name = \"#{prefix}:#{name}\"\n end\n name\n end",
"def add_attributes(xml_translation, df_data, ng_element)\n xml_translation['attrs']&.each do |attr_key, attr_val|\n next unless render?(attr_val['render_if'], df_data)\n\n val = generate_field_val(attr_val, df_data)\n val = val.strip if val.respond_to?(:strip)\n\n next if val.blank?\n\n if attr_key.start_with?('xmlns')\n # Do not treat xmlns attribute additions like other attribute additions. Add namespace definition instead.\n ng_element.add_namespace_definition(attr_key.gsub(/^xmlns:/, ''), val)\n else\n processed_val = value_with_substitutions(val, df_data)\n ng_element.set_attribute(attr_key, processed_val) if processed_val.present?\n end\n end\n end",
"def add_ns2_prefix(content)\n %w{ actuate arcrole entityref from href id linktype parent role show target title to xpointer }.each do | xa |\n content.gsub!(/ #{xa}=/) {|match| \" ns2:#{match.strip}\"} if content =~ / #{xa}=/\n end\n content\n end",
"def add_for_namespace(namespace:, tags:)\n @registry[namespace] = Set.new(tags)\n end",
"def namespace=(value)\n @namespace = value\n end",
"def namespace=(value)\n @namespace = value\n end"
] | [
"0.7546422",
"0.7166083",
"0.6943499",
"0.67078906",
"0.6606577",
"0.6552891",
"0.6552891",
"0.6535118",
"0.6392071",
"0.6293695",
"0.62740844",
"0.6265993",
"0.6265993",
"0.62067163",
"0.6175167",
"0.6175167",
"0.6161771",
"0.61488795",
"0.6140472",
"0.6140472",
"0.60804564",
"0.60623276",
"0.6047441",
"0.60388017",
"0.60388017",
"0.60199094",
"0.6008716",
"0.60007274",
"0.59908897",
"0.59908897",
"0.59908897",
"0.59908897",
"0.59767187",
"0.5952761",
"0.5934329",
"0.593367",
"0.59069306",
"0.58864087",
"0.58366543",
"0.58222526",
"0.58183914",
"0.5804281",
"0.578884",
"0.5748674",
"0.5709702",
"0.5709702",
"0.5692113",
"0.56865",
"0.5661015",
"0.56333065",
"0.56333065",
"0.56224966",
"0.5606005",
"0.5605014",
"0.5582315",
"0.5579709",
"0.55764157",
"0.55714655",
"0.5563305",
"0.5548801",
"0.553996",
"0.5539633",
"0.5532395",
"0.55323845",
"0.5530278",
"0.5496227",
"0.54910505",
"0.5482444",
"0.5475858",
"0.54198027",
"0.54198027",
"0.5416576",
"0.5382438",
"0.5365543",
"0.5326141",
"0.53247714",
"0.5322418",
"0.53216803",
"0.53062695",
"0.52986366",
"0.5291437",
"0.52894956",
"0.52683264",
"0.5261143",
"0.525727",
"0.525727",
"0.52408665",
"0.5227099",
"0.5217733",
"0.5217484",
"0.5212702",
"0.5210586",
"0.5209353",
"0.5204545",
"0.51962405",
"0.5195479",
"0.51893145",
"0.51875854",
"0.51704216",
"0.51704216"
] | 0.71356946 | 2 |
In production we limit calls to results posting/reading/processing endpoints. | def check_production_password(request)
if $production &&
(!request.env['HTTP_AUTHORIZATION'] ||
request.env['HTTP_AUTHORIZATION'] != ENV['ACCESS_CONTROL_PASSWORD'])
status 403
raise "Incorrect password"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def maximum_requests\n super\n end",
"def throttled_response; end",
"def server_result_limit\n self.parameters[:result_limit]\n end",
"def throttled_responder; end",
"def consider_all_requests_local; end",
"def consider_all_requests_local; end",
"def validate_api_call_count\n if outbound_request?\n data = $redis.get(\"api_call_count_for_#{from}\")\n errors.add(:base, message: \"limit reached for from #{from}\") if data && JSON.parse(data)['count'] > 50\n end\n end",
"def rate_limit\n connection.rate_limit\n end",
"def throttle_api\n Rate::Limiter.new(request.env['REMOTE_ADDR'], request.env['REQUEST_PATH']).set\n end",
"def before\n endpoint = env['api.endpoint']\n logger = options[:logger] || Logger.new($stdout)\n\n return unless throttle_options = endpoint.route_setting(:throttle)\n\n limit, period = find_limit_and_period(throttle_options)\n\n check_limit_and_period(limit, period)\n\n limit = limit.call(env) if limit.is_a?(Proc)\n return true if limit.negative?\n\n user_value = find_user_value(options) || \"ip:#{env['REMOTE_ADDR']}\"\n rate_key = generate_rate_key(endpoint, user_value)\n\n begin\n redis = options[:cache]\n redis.ping\n\n current = redis.get(rate_key).to_i\n\n if !current.nil? && current >= limit\n endpoint.error!('Too Many Requests', 429)\n else\n redis.multi do\n redis.set(rate_key, COUNTER_START, nx: true, ex: period.to_i)\n redis.incr(rate_key)\n end\n end\n rescue StandardError => e\n logger.warn(e.message)\n end\n end",
"def rate_limit\n options[:rate_limit]\n end",
"def index\n if params[:filter]\n case params[:filter]\n when \"by_me\"\n requests = Request.where(:user_id => current_user.id)\n when \"recent\"\n requests = Request.limit_5\n when \"for_me\"\n requests = []\n current_user.followers.each do |f|\n f.parent.requests.each do |r|\n requests << r\n end\n end\n requests = Request.in(:user_id => current_user.following.map {|f| f.user_id})\n end\n else\n #TODO: change this to paginate\n requests = Request.limit_5\n end\n\n render json: requests\n end",
"def rest\n @options[:limit] - @count if @options[:limit] > 0\n end",
"def apply_filter\n offset = (params[:page].to_i - 1) * params[:perpage].to_i\n limit = params[:perpage]\n\n results = get_results(offset, limit)\n result_list = get_fields_to_show(results['elements'])\n \n data = Hash.new\n data['total'] = results['total']\n data['result'] = result_list\n respond_to do |format|\n format.json { render :json => data.to_json }\n end\n end",
"def set_maximum_requests(opts)\n opts = check_params(opts,[:maximum_requests])\n super(opts)\n end",
"def conditional_requests; end",
"def conditional_requests; end",
"def twitter_api_rate_limit\n # +++ move to app config\n @@_admin_account_access_rate_limit ||= 50 # times per hour\n end",
"def fetch(params)\n Resque.logger.info \"Requestable.fetch received #{params.inspect}\"\n past = Time.now\n total = api_count(params)\n remain_requests = (total/250.to_f).ceil\n Resque.logger.info \"pages to request total: #{remain_requests}\"\n batch_num = (remain_requests / BATCH_SIZE.to_f).ceil\n Resque.logger.info \"batch number: #{batch_num}\"\n chap_start = 1\n chap_end = 0\n entity = params.fetch(:entity)\n Resque.logger.info \"entity name: #{entity}\"\n cache = $redis\n pages = []\n batch_num.times do\n entity_url = entity.pluralize\n if remain_requests > BATCH_SIZE\n chap_end += BATCH_SIZE\n remain_requests -= BATCH_SIZE\n else\n chap_end += remain_requests\n end\n hydra = Typhoeus::Hydra.new(max_concurrency: 30)\n\n chap_start.upto(chap_end) do |page|\n pages << page\n # queue up current batch\n request = Typhoeus::Request.new(\n \"https://api.rechargeapps.com/#{entity_url}?#{params[:query]}&limit=250&page=#{page}\",\n # followlocation: true,\n headers: HEADER\n )\n # error logging callbacks\n request.on_complete do |res|\n @used = res.headers['x-recharge-limit'].to_i\n if res.success?\n puts \"#{entity.upcase} request queued\"\n elsif res.timed_out?\n Resque.logger.error \"(HYDRA request) TIMED OUT: #{res.response_headers}\"\n elsif res.code.zero?\n Resque.logger.error \"(HYDRA request) Couldnt get an http response #{res.return_message}\"\n else\n Resque.logger.error(\"(HYDRA request) HTTP request failed: #{res.code}\")\n end\n end\n\n request.on_success do |res|\n # @used = res.headers['x-recharge-limit'].to_i\n # Resque.logger.info res.headers['x-recharge-limit']\n key = \"#{entity}_pull:#{Time.now.strftime(\"%Y%m%d\")}#{page.to_s.rjust(3, '0')}\"\n hash_set(cache, key, res.response_body)\n end\n\n hydra.queue(request)\n chap_start = chap_end\n end\n hydra.run\n batch_throttle(@used)\n end\n Resque.logger.info \"Pages iterated: #{pages.inspect}\"\n Resque.logger.info(\"RUN TIME per #{total} records: #{(Time.now - past)}\")\n end",
"def filter_excessive_posts\n\n # -- TEMPORARY --\n # for now, the app is only working with a single camera per user\n # in future versions, get the camera as a parameter\n @camera = current_user.default_camera\n \n # grabs most recent log and checks time interval since the last update\n @last_log = @camera.activity_logs.last;\n if @last_activity and Time.now - @last_activity.created_at < OmniEye::INTERVAL_BETWEEN_ACTIVITY_UPDATES\n render :json => { :sucess => false, :errors => \"too many posts in a short interval\" }\n end\n end",
"def doGetMaxCountPerRequest()\n end",
"def rate_limit_check\n status = 200\n result = {}\n if rate_limit_on?\n if rate_limit_left > 0\n status = 429\n result[:error] = \"you need to wait #{rate_limit_left} ms before you can request anything again\"\n render status: status, json: result\n end\n end\n end",
"def limit_posts; end",
"def rate_limit\n response = self.class.get('/rate_limit', options)\n\n return_value_for response\n end",
"def params\n { :params => { 'max-results' => '1000' }}\n end",
"def rate_limit\n new_request=RequestLimit.new({ip:request.remote_ip.to_s})\n\n # create a new record of RequestLimit to keep count of the incomming requests\n new_request.save\n\n # Check if current request exceeds max limit specified\n\n if RequestLimit.all.size > RequestLimit::MAX_LIMIT\n\n # Calculate the Time till the count will get reset\n time_left=(Time.now.end_of_hour).to_i-(Time.now).to_i\n render status: 429, json: { message: \"Rate limit exceeded. Try again in #{time_left} seconds\" } ## response when limit is exceeded\n end\n end",
"def limit\n @request.params[:limit] || 10\n end",
"def rate_limit\n if current_user.nil?\n rate_limit_by_api_key\n else\n rate_limit_by_user\n end\n end",
"def index\n @http_requests = HttpRequest.order(\"created_at DESC\").page(params[:page]).per(10)\n end",
"def index\n if params[:last_requested]\n expires_in 2.second, :public => true, :must_revalidate => false\n respond_with Post.order(\"created_at DESC\").where('created_at > ?', params[:last_requested])\n else\n respond_with Post.order(\"created_at DESC\").limit(100)\n end\n end",
"def limit_posts!; end",
"def check_for_rate_limits\n rate_limit_remaining < 10\n end",
"def default_limit\n 10\n end",
"def pending_response_requests; end",
"def results_limit\n # max number of search results to display\n 10\n end",
"def apply_limit\n @query = @query.limit(@options[:limit])\n end",
"def index\n @requests = Request.all.paginate(page: params[:page], per_page: 15)\n end",
"def default_action_block\n proc do\n all_records = model\n\n if allowed?(:paging) && params[:page]\n page = params[:page]\n per_page = params[:per_page] || 10\n lower_bound = (per_page - 1) * page\n upper_bound = lower_bound + per_page - 1\n\n body all_records[lower_bound..upper_bound]\n else\n body all_records\n end\n end\n end",
"def handle_results(env, request = nil)\n # override me!\n end",
"def rate_limit_calls\n calls = ENV['RATE_LIMIT_CALLS'].to_i\n calls > 0 ? calls : 5\n end",
"def enforce_max_records_scan; end",
"def result_limit(offset, limit)\n # we create a new object in case the user wants to store off the\n # filter chain and reuse it later\n APIParameterFilter.new(self.target, @parameters.merge({ :result_offset => offset, :result_limit => limit }))\n end",
"def post_action_rate_limiter\n return unless is_flag? || is_bookmark? || is_like?\n\n return @rate_limiter if @rate_limiter.present?\n\n %w(like flag bookmark).each do |type|\n if public_send(\"is_#{type}?\")\n limit = SiteSetting.get(\"max_#{type}s_per_day\")\n\n if is_like? && user && user.trust_level >= 2\n multiplier = SiteSetting.get(\"tl#{user.trust_level}_additional_likes_per_day_multiplier\").to_f\n multiplier = 1.0 if multiplier < 1.0\n\n limit = (limit * multiplier).to_i\n end\n\n @rate_limiter = RateLimiter.new(user, \"create_#{type}\", limit, 1.day.to_i)\n return @rate_limiter\n end\n end\n end",
"def get_limit\n return request.query_parameters['limit'] || 100\n end",
"def manage_process(endpoint = nil)\n\n\t endpoint = @endpoint if endpoint.nil?\n\n\t @uri_path = \"/insights/engagement/#{@endpoint}\"\n\n\t if @endpoint == 'historical'\n\n\t\t @start_date = @utils.set_ISO_date_string(@start_date) if @start_date != nil\n\t\t @end_date = @utils.set_ISO_date_string(@end_date) if @end_date != nil\n\n\t\t if not (@start_date == nil and @end_date == nil) #Only set dates if one or both are specified. If both are nil, API handles defaults.\n\n\t\t\t@start_date = @utils.crop_date(@start_date, 'hour', 'before') if @start_date != nil\n\t\t\t@end_date = @utils.crop_date(@end_date, 'hour', 'after') if @end_date != nil\n\n\t\t\tset_dates(@start_date, @end_date)\n\n\t\t end\n\t end\n\n\t continue = true\n\n\t load_ids if @tweet_ids.length == 0\n\n\t AppLogger.log_info \"Generating sets of Tweet IDs for API requests to #{endpoint} endpoint...\"\n\n\t @tweets_of_interest = generate_tweets_of_interest_for_requests(endpoint)\n\n\t AppLogger.log_info \"Will make #{@tweets_of_interest.count} API requests...\"\n\n\t results = {}\n\t results['continue'] = true\n\n\t rate_limit_pause = @rate_limit_seconds/@rate_limit_requests\n\n\t AppLogger.log_info \"Max Top Tweets #{@max_top_tweets} Rate Limit Pause #{rate_limit_pause}\"\n\t\t\n\t start_process = Time.now\n\t \n\t @tweets_of_interest.each do |toi| #These tweets_of_interest items each map to a single request.\n\n\t\t begin\n\n\t\t\tresults['request'] = assemble_request(toi)\n\t\t\tstart_request = Time.now\n\t\t\t@num_requests += 1\n\t\t\tAppLogger.log_info \"Making #{@num_requests} of #{@tweets_of_interest.count} requests...\"\n\t\t\tresults['response'] = JSON.parse(make_post_request(@uri_path, results['request']))\n\t\t\tduration = Time.now - start_request\n\t\t\tresults['retry'] = nil\n\n\t\t\t#--------------------------------------\n\n\t\t\tresults = check_results(results)\n\n\t\t\t#----------------------------------------\n\n\t\t\tif results['continue'] # if success, sleep and continue.\n\n\t\t\t if results['retry'].nil?\n\t\t\t\t AppLogger.log_info \"Managing Top Tweets, handling metadata in API response.\"\n\n\t\t\t\t if @save_api_responses\n\t\t\t\t\t save_api_response(results['response'])\n\t\t\t\t end\n\n\t\t\t\t manage_top_tweets(results['response']) unless (@max_top_tweets == 0 or !results['errors'].nil?)\n\t\t\t\t duration = Time.now - start_request\n\n\t\t\t\t if @tweets_of_interest.count > 1\n\t\t\t \t AppLogger.log_info \"Sleeping #{format('%.02f', rate_limit_pause - duration)} seconds before next API request... \" if duration < rate_limit_pause\n\t\t\t\t\t sleep (rate_limit_pause - duration) if duration < rate_limit_pause\n\t\t\t\t end\n\t\t\t else #some error that has a try-again reaction...\n\t\t\t\t #Like hitting a rate limit\n\t\t\t\t if results['retry'] == 'rate-limit'\n\t\t\t\t\t AppLogger.log_warn \"Rate-limit hit, sleeping #{rate_limit_pause} seconds before next API request...\"\n\t\t\t\t\t sleep (rate_limit_pause)\n\t\t\t\t\t results['response'] = JSON.parse(make_post_request(@uri_path, results['request']))\n\t\t\t\t elsif results['retry'] == 'forbidden-tweets'\n\t\t\t\t\t AppLogger.log_warn \"Retrying after forbidden Tweets removed from request... Sleeping #{rate_limit_pause} seconds before next API request...\"\n\t\t\t\t\t sleep (rate_limit_pause)\n\t\t\t\t\t results['response'] = JSON.parse(make_post_request(@uri_path, results['request']))\n\t\t\t\t else\n\t\t\t\t\t AppLogger.log_warn \"Error not handled?\"\n\n\t\t\t\t end\n\t\t\t end\n\t\t\telse\n\t\t\t AppLogger.log_info \"An 'no retry' type error occurred. Quitting... \"\n\t\t\t continue = false\n\t\t\t return continue\n\n\t\t\tend\n\t\t\t\n\t\t rescue\n\t\t\tAppLogger.log_error \"ERROR occurred, skipping request.\"\n\t\t end\n\t end\n\t \n\t @process_duration = Time.now - start_process\n\n\t AppLogger.log_info \"Sorting Top Tweets...\"\n\t sort_top_tweets(@top_tweets) unless (@max_top_tweets == 0 or @top_tweets.nil?)\n\t continue\n\n end",
"def get_cvr_dropped_query_slow\n p \"controller called get_cvr_dropped_query params\", params.to_yaml\n date = DateTime.strptime(params[:query_date], \"%m-%d-%Y\") rescue DateTime.now\n days_range = params[:weeks_apart] ? Integer(params[:weeks_apart]) * 7 : 7\n sum_count = params[:sum_count] ? Integer(params[:sum_count]) : 5000\n p \"controller sum_count\", sum_count\n p \"query_date\", date\n p \"days_range\", days_range\n before_start_date = date-1.day-days_range+1.day\n before_end_date = date-1.day\n after_start_date = date\n after_end_date = date + days_range-1.day \n respond_to do |format|\n format.json do \n result= QueryCatMetricsDaily.get_cvr_dropped_query(before_start_date,before_end_date,after_start_date,after_end_date,sum_count,@page,@limit)\n p 'result', result.length, result\n p @page, @limit\n\n start_index = @limit * @page - @limit\n end_index = start_index + @limit -1\n if result.nil? or result.empty?\n render :json => [{:total_entries => 0}, result]\n else\n render :json => [\n {:total_entries => result.length,\n :date => @date, :sum_count => sum_count}, result[start_index..end_index]]\n end\n end\n end\n end",
"def index\n requests = current_user.admin? ? Request.all : Request.select { |r| r.user == current_user }\n split_requests(requests)\n end",
"def get_limits\n # code\n end",
"def call_api_response(response)\n rate_limit(headers: response.headers)\n end",
"def add_limit(limit)\r\n filter.max_returned = limit if limit\r\n end",
"def throttled_responder=(_arg0); end",
"def index\n unless params[:requests] && params[:requests].is_a?(Array)\n render :json => {:error => \"Must pass an array of requests\"}, :status => :bad_request and return\n end\n\n if params[:requests].size > MAX_REQUESTS\n render :json => {:error => \"This batch API accepts a maximum of #{MAX_REQUESTS} requests\"}, :status => :bad_request and return\n end\n\n fetcher = Batchy::Fetcher.new(app: Rails.application, requests: params[:requests]).run\n render :json => {:succeeded => fetcher.succeeded, :failed => fetcher.failed, :responses => fetcher.responses}, :status => :ok\n end",
"def grabResults(address, auth)\n request = Net::HTTP::Get.new address.request_uri\n\n # Set up Net::HTTP to use SSL, which is required by Twitter.\n http = Net::HTTP.new address.host, address.port\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n\n # # Issue the request.\n request.oauth! http, auth[:ckey], auth[:atok]\n response = http.request request\n\n ## Check to see if exceeded API limit\n while response.code == '429'\n\n pp 'rate limited, waiting 5min'\n \tsleep 5*60\n \tresponse = grabResults(address, auth)\n end\n\n return response\nend",
"def set_request_limit\n @limit = Limit.uniq.pluck(:classification)\n end",
"def redirection_limit; end",
"def redirection_limit; end",
"def redirection_limit=(limit); end",
"def index\r\n if session[:search_query].blank?\r\n @posts = Post.all.order(\"created_at DESC\").page(params[:page])\r\n\r\n else\r\n st = \"%#{session[:search_query]}%\"\r\n @posts = Post.where(\"spot_name like ?\", st).order(\"created_at DESC\").page(params[:page])\r\n end\r\n @requests = Post.where(service_type: 'request').order(\"created_at DESC\").page(params[:page_1]).per(5)\r\n @provides = Post.where(service_type: 'provide').order(\"created_at DESC\").page(params[:page_2]).per(5)\r\n end",
"def paginate_all_data(url:, more_params: nil)\n query_params = \"since=#{@start_date}&until=#{@end_date}#{more_params ? \"&#{more_params}\" : ''}\"\n total_count = parse_json_from_api(\"#{url}?#{query_params}\")['page']['total_elements']\n puts \"[#{Time.new.strftime('%k:%M')}] total count for #{url}?#{query_params}: #{total_count}\"\n idx = 0\n result = []\n while idx * PER_PAGE < total_count\n result += parse_json_from_api(\"#{url}?page=#{idx}&per_page=#{PER_PAGE}&#{query_params}\")['data']\n idx += 1\n end\n puts \"[#{Time.new.strftime('%k:%M')}] ERROR: result.length #{result.length} != total_count #{total_count}\" if result.length != total_count\n result\nrescue MyApiError\n []\nend",
"def request_count; end",
"def search_time_limit\n super\n end",
"def price_bulk_load\n logger.info 'PRICE BULK LOAD REQUESTED.'\n FeedWorker.perform_async('price_bulk_load')\n head :accepted\n end",
"def quotas()\n return get_request(address(\"/limits\"), @token)\n end",
"def index_trending\n @items = Item.most_hit(1.week.ago, 100)\n @items = @items.select { |item| privilege(item.user_id) }\n @items = Kaminari.paginate_array(@items)\n #paginating in either case, uses params[:page] if present otherwise uses page 1 of results.\n #option to change the numOfresults shown perpage also available \n @items = @items.page(page).per(per_page(15))\n @per_page = per_page.to_i\n render :index\n end",
"def execute_bulk_requests\n begin\n @responses = Hash.new\n @headers = Hash.new\n @all_urls = Hash.new\n data = ActiveSupport::JSON.decode(params[:data])\n @detailed_results = data[\"detailed_results\"]\n num_threads = data[\"threads\"].to_i\n data[\"lines_to_send\"].threadify(num_threads) { |line|\n path = data[\"path\"].gsub(/XXXCHANGEMEXXX/, line)\n headers = data[\"headers\"].gsub(/XXXCHANGEMEXXX/, line)\n body = data[\"body\"].gsub(/XXXCHANGEMEXXX/, line)\n data.each do |key, value|\n if key.start_with?(\"replace_\") && !key.end_with?(\"_by\")\n path.gsub!(\"XXX#{value}XXX\",data[key + \"_by\"]) if data[key + \"_by\"] != \"\"\n headers.gsub!(\"XXX#{value}XXX\",data[key + \"_by\"]) if data[key + \"_by\"] != \"\"\n body.gsub!(\"XXX#{value}XXX\",data[key + \"_by\"]) if data[key + \"_by\"] != \"\"\n end\n end\n if @cloud\n if @cloud.api == \"Atmos\"\n @responses[line], @headers[line], @all_urls[line] = atmos_request(data[\"http_method\"], path, headers, body)\n elsif @cloud.api == \"Amazon\"\n @responses[line], @headers[line], @all_urls[line] = amazon_request(data[\"http_method\"], path, headers, body)\n elsif @cloud.api == \"Swift\"\n @responses[line], @headers[line], @all_urls[line] = swift_request(data[\"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 @responses[line] = http_request(url, uri.port, data[\"http_method\"], headers_to_send, body)\n @headers[line] = headers_to_send\n end\n }\n rescue Exception => e\n @exception = e\n end\n respond_to do |format|\n format.js { render 'shared/execute_bulk_requests' }\n end\n end",
"def over_limit?\n count > max_calls\n end",
"def paginate; false; end",
"def index\n \n api_posts = Api::Post.all\n \n # Rabbit Sync - push 10k messages\n Publisher.publish(\"posts_all\",api_posts)\n @api_posts = Subscriber.pop(\"posts_all\")\n\n # Regular\n render json: @api_posts\n\n end",
"def consider_all_requests_local=(_arg0); end",
"def consider_all_requests_local=(_arg0); end",
"def perform_request url, verb = :get, body = nil, options = {}\n options_id = options.inspect\n can_cache = [:post, :put].include?(verb) ? false : cached?\n if can_cache && result = store.get(\"#{clean_url(url)}#{options_id}\")\n return JSON.parse(result)\n end\n response = perform_rate_limited_request(url, verb, body, options)\n store.setex \"#{clean_url(url)}#{options_id}\", ttl, response.to_json if can_cache\n response\n end",
"def op_request(*_)\n force_break\n end_page\n until @page_number.even? # Because if we stop on an even page, the next one will be odd\n break_page\n end\n end",
"def index \n @borrower_requests = params[:filter] ? BorrowerRequest.where(status: params[:filter]).page(params[:page]) : BorrowerRequest.all.page(params[:page])\n @request_counts = BorrowerRequest.get_requests_count(current_user)\n end",
"def index\n @posts = Post.all\n @posts = paginate(@posts)\n authorize @posts\n\n render json: @posts, each_serializer: Api::V1::PostSerializer, meta: meta_attributes(@posts)\n end",
"def endpoint\n \"v1/action/queryMore\"\n end",
"def resource_limits; end",
"def resource_limits; end",
"def fetch_with_limit\n start_result = 10\n start_result.step(RESULTS_LIMIT, 10) do |number|\n response = get_subdomains!(number)\n break unless response.items_present?\n end\n end",
"def index\n if !@current_user.admin?\n redirect_to '/home'\n end\n\n @responses = Response.paginate(:page => params[:page], :per_page => 15)\n end",
"def connection_limit\n super\n end",
"def connection_limit\n super\n end",
"def connection_limit\n super\n end",
"def index\n @requests = Request.paginate(:page => params[:page], :per_page => 8).order(\"created_at DESC\").find_all_by_user_id(current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end",
"def limit; end",
"def limit; end",
"def limit; end",
"def index\n result = []\n db_data = get_thermostats_reading_aggregation\n redis_data = get_redis_data\n render status: 400, :json=>{:error => I18n.t('no_data_household')} and return if db_data.blank? && redis_data.blank?\n if redis_data.empty?\n result = db_data\n elsif db_data.empty?\n result = redis_data\n else\n result = get_aggregated_data(db_data,redis_data,result)\n end\n render status: 200, :json=>{:thermostat_data => result} and return\n end",
"def index\n sleep 1\n if current_user.department.name == \"Department Head\"\n\t @requests = Request.where(:department_id => current_user.department_id).order(\"date_created DESC\").paginate(page: params[:page], per_page: 25)\n else\n @requests = Request.where(:user_id => current_user.id).order(\"date_created DESC\").paginate(page: params[:page], per_page: 25)\n end\n\tend",
"def perform(request, response); end",
"def index \n @requests = Request.get_unexpired_requests\n end",
"def index\n self.limit\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @jobs }\n end\n end",
"def process(request); end",
"def handle_pagination(query, ts_params, result)\n # Tablesorter submits row count or simply 'all'. If user requests more rows\n # than available do nothing.\n return query if (ts_params[:size] == 'all') || (ts_params[:size].to_i >= result[:total_rows])\n\n query.limit(ts_params[:size].to_i).offset(ts_params[:size].to_i * ts_params[:page].to_i)\n end",
"def index\n\t\t@request = Request.new\n\t\tset_need_types\n\t\t@counts = Request.where('status is NOT NULL').group(:fulfiller).count.to_a\n\t\tif params[:status] == \"met\"\n\t\t\t@requests = Request.where(:status => \"met\")\n\t\t\t@status = params[:status]\n\t\t\t@requests = @requests.order(\"updated_at DESC\")\n\t\telse\n\t\t\t@requests = Request.where(:status => nil)\n\t\t\t@requests = @requests.order(\"created_at DESC\")\n\t\tend\t\n\n\tend",
"def index\n\n if params[:processed].nil?\n @demands = Demand.scoped(\n :include => [:svns, :vms, :books, :enquiries],\n :order => \"created_at DESC\").page(params[:page]).per(10)\n else\n @demands = Demand.scoped(\n :include => [:svns, :vms, :books, :enquiries],\n :order => \"created_at DESC\").where(:processed => false).page(params[:page]).per(15)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @demands }\n end\n end",
"def http_statistics\n super\n end",
"def restrict_results\n\t\t\t\t# 10 = residential, 20 = sales, 30 = commercial\n\t\t\t\t# default to residential\n\t\t\t\t@listing_type = %w[10 20 30].include?(listing_params[:listing_type]) ? listing_params[:listing_type] : \"\".freeze\n\t\t\t\t# 10 - studio, 20 - 1 BR, 30 - 2 BR, 40 - 3 BR, 50 - 4+ BR, 80 - LOFT\n\t\t\t\tlayout = %w[10 20 30 40 50 80].include?(listing_params[:layout]) ? listing_params[:layout] : \"\".freeze\n\t\t\t\t# 10 - 1 B, 15 - 1.5 B, 20 - 2 B, 25 - 2.5 B, 30 - 3 B, 35 - 3.5+ B\n\t\t\t\tbathrooms = %w[10 15 20 25 30 35].include?(listing_params[:bathrooms]) ? listing_params[:bathrooms] : \"\".freeze\n\t\t\t\t# cats allowed\n\t\t\t\tcats_allowed = _is_valid_bool_value(listing_params[:cats_allowed])\n\t\t\t\t# dogs allowed\n\t\t\t\tdogs_allowed = _is_valid_bool_value(listing_params[:dogs_allowed])\n\t\t\t\t# elevator\n\t\t\t\televator = _is_valid_bool_value(listing_params[:elevator])\n\t\t\t\t# doorman\n\t\t\t\tdoorman = _is_valid_bool_value(listing_params[:doorman])\n\t\t\t\t# laundry in building\n\t\t\t\tlaundry_in_building = _is_valid_bool_value(listing_params[:laundry_in_building])\n\t\t\t\t# laundry in unit\n\t\t\t\tlaundry_in_unit = _is_valid_bool_value(listing_params[:laundry_in_unit])\n\t\t\t\t# has_photos\n\t\t\t\thas_photos = _is_valid_bool_value(listing_params[:has_photos])\n\t\t\t\t#status\n\t\t\t\tstatus = listing_params[:status] ? listing_params[:status] : 'active,pending'\n\t\t\t\t# sort order defaults to order by last udpated\n\t\t\t\tsort_column = %w[layout rent date_available updated status_updated].include?(listing_params[:sort]) ? listing_params[:sort] : \"updated\".freeze\n\t\t\t\t# sort_dir\n\t\t\t\tsort_dir = %w[asc desc].include?(listing_params[:sort_dir]) ? listing_params[:sort_dir] : \"\".freeze\n\t\t\t\t# pagination\n\t\t\t\tper_page = 50\n\t\t\t\t# if listing_params[:per_page] && !listing_params[:per_page].empty?\n\t\t\t\t# \tper_page = listing_params[:per_page].to_i\n\t\t\t\t# \tif per_page < 50\n\t\t\t\t# \t\tper_page = 50\n\t\t\t\t# \tend\n\t\t\t\t# \tif per_page > 50\n\t\t\t\t# \t\tper_page = 50\n\t\t\t\t# \tend\n\t\t\t\t# end\n\n\t\t\t\t# calls our API::V1::NestioInterface module located under /lib\n\t\t\t\tsearch_params = {\n\t\t\t\t\tlisting_type: @listing_type,\n\t\t\t\t\tlayout: layout,\n\t\t\t\t\tbathrooms: bathrooms,\n\t\t\t\t\tmin_rent: listing_params[:min_rent],\n\t\t\t\t\tmax_rent: listing_params[:max_rent],\n\t\t\t\t\tcats_allowed: cats_allowed,\n\t\t\t\t\tdogs_allowed: dogs_allowed,\n\t\t\t\t\televator: elevator,\n\t\t\t\t\tdoorman: doorman,\n\t\t\t\t\tdate_available_before: listing_params[:date_available_before],\n\t\t\t\t\tdate_available_after: listing_params[:date_available_after],\n\t\t\t\t\tlaundry_in_building: laundry_in_building,\n\t\t\t\t\tlaundry_in_unit: laundry_in_unit,\n\t\t\t\t\thas_photos: has_photos,\n\t\t\t\t\tsort_column: sort_column,\n\t\t\t\t\tsort_dir: sort_dir,\n\t\t\t\t\tper_page: per_page,\n\t\t\t\t\tpage: listing_params[:page],\n\t\t\t\t\tagents: listing_params[:agents],\n\t\t\t\t\tneighborhoods: listing_params[:neighborhoods],\n\t\t\t\t\tchanged_at: listing_params[:changed_at],\n\t\t\t\t\tstatus: status\n\t\t\t\t}\n\n\t\t\t\tsearch_type_breakdown(search_params)\n\t\t\t\t@listing_type = @listing_type.to_i\n\t\t\tend",
"def batch_query\n render nothing: true\n\n # logger.info \"params: \" + params.inspect\n #\n # endpoints_all = Endpoint.all\n # logger.info \"List of all endpoints:\"\n # endpoints_all.each do |endpoint|\n # logger.info ' name: ' + endpoint[:name] + ', url: ' + endpoint[:base_url]\n # end\n\n # Select endpoints using array of endpoint names;\n # Unfortunately, they are not necessarily unique\n endpoint_names = params[:endpoint_names]\n logger.info 'param endpoint_names:' + endpoint_names.inspect\n selected_endpoints = []\n if endpoint_names\n parse_array(endpoint_names).each do |endpoint_name|\n match_ep = Endpoint.find_by_name(endpoint_name)\n if match_ep\n logger.info endpoint_name.to_s + ' matches: ' + match_ep[:name].inspect\n selected_endpoints.push(match_ep)\n else\n logger.info 'WARNING: ' + endpoint_name.to_s + ' has no match!'\n end\n end\n end\n # logger.info 'selected endpoings: ' + selected_endpoints.inspect\n\n\n # users = User.all\n # users.each do |user|\n # logger.info 'username: ' + user[:username]\n # end\n\n # queries_all = Query.all\n # logger.info \"List of all queries:\"\n # queries_all.each do |query|\n # logger.info ' title: ' + query[:title] + ', desc: ' + query[:description]\n # end\n\n # Select query using array of query descriptions;\n # Unfortunately, they are not necessarily unique\n #query_titles = params[:query_titles]\n username = params[:username]\n current_user = User.find_by_username(username)\n if current_user\n query_descriptions = params[:query_descriptions]\n # logger.info 'param query_descriptions:' + query_descriptions.inspect\n selected_queries = []\n if query_descriptions\n parse_array(query_descriptions).each do |query_desc|\n match_query = current_user.queries.find_by_description(query_desc)\n if match_query\n logger.info query_desc + ' matches: ' + match_query[:description].inspect\n selected_queries.push(match_query)\n else\n logger.info 'WARNING: ' + query_desc + ' has no match!'\n end\n end\n end\n end\n # logger.info 'selected queries: ' + selected_queries.inspect\n\n if selected_endpoints && !selected_endpoints.empty? &&\n selected_queries && !selected_queries.empty?\n notify = params[:notification]\n selected_queries.each do |eachQuery|\n #Parallel.each(selected_queries, :in_threads=>15) do |eachQuery|\n # execute the query, and pass in the endpoints and if the user should be notified by email when execution completes\n # logger.info 'title: ' + eachQuery[:title].inspect\n # logger.info 'desc: ' + eachQuery[:description].inspect\n # logger.info 'user_id: ' + eachQuery[:user_id].inspect\n eachQuery.execute(selected_endpoints, notify)\n end\n else\n flash[:alert] = 'Cannot execute a query if no endpoints are provided.'\n end\n end",
"def work()\n # FIXME : .rel[...].get doesn't update $client.rate_limit...\n\n rate_limit = $client.rate_limit\n dbgp \"#{rate_limit.remaining} API calls left.\"\n\n # A little buffer in case we use a feature from octokit\n # which doesn't update rate_limit on `$client`.\n if rate_limit.remaining < 5 then\n reset = rate_limit.resets_in + 10\n puts \"💤 zleepy timez (back in #{reset} seconds)\"\n sleep(reset)\n end\n\n begin\n yield\n rescue Octokit::BadGateway, Octokit::InternalServerError => e\n puts \"Uuuh... github is having a bad time :( #{e.response_status}\"\n pp \"=====\"\n pp \"=====\"\n pp e.response_body\n pp \"=====\"\n pp e.response_headers\n pp \"=====\"\n pp \"=====\"\n sleep 10\n retry\n end\nend",
"def index\n @user = User.find(params[:user_id])\n if @user.auth_token == params[:auth_token]\n @posts = @user.posts.reverse_order\n start = params[:start].to_i\n count = params[:count].to_i\n @posts = @posts[start, count]\n render json: @posts, meta: { status: :ok, count: @posts.count }, meta_key: 'result'\n else\n render json: 'Permission Denied'\n end\n end",
"def process_data_requests\n # guard against recursive calls\n return if @processing_data_requests\n\n # guard against simultaneous calls\n @data_requests_mutex.synchronize do\n begin\n @processing_data_requests = true\n @data_requests.map! do |req|\n while req && req.channel.window_size > 0\n remaining = if req.type\n req.channel.send_extended_data_packet( req.type, req.data )\n else\n req.channel.send_data_packet( req.data )\n end\n if remaining\n req.data = remaining\n else\n req = nil\n end\n end\n\n req\n end\n @data_requests.compact!\n ensure\n @processing_data_requests = false\n end\n end\n end"
] | [
"0.67054147",
"0.61752224",
"0.61362654",
"0.60483456",
"0.59340256",
"0.59340256",
"0.58743125",
"0.5870607",
"0.585522",
"0.5826036",
"0.57998216",
"0.576575",
"0.5758575",
"0.57272464",
"0.57147765",
"0.56974256",
"0.56974256",
"0.5696746",
"0.5687746",
"0.5676666",
"0.56605756",
"0.563693",
"0.56271464",
"0.5598871",
"0.5592457",
"0.55869955",
"0.5584059",
"0.55748487",
"0.55738294",
"0.5563068",
"0.5561835",
"0.5553955",
"0.5547321",
"0.55403155",
"0.553771",
"0.55348635",
"0.55261457",
"0.5523461",
"0.5516862",
"0.551351",
"0.5511575",
"0.5501228",
"0.54936975",
"0.5478992",
"0.54554415",
"0.5451682",
"0.5425813",
"0.5423275",
"0.5407196",
"0.538139",
"0.53729725",
"0.5363556",
"0.5348183",
"0.5346924",
"0.5344771",
"0.5344771",
"0.5335841",
"0.5334477",
"0.53219354",
"0.5317352",
"0.5309917",
"0.53076965",
"0.530481",
"0.52984774",
"0.5291569",
"0.5277771",
"0.5269645",
"0.52610695",
"0.52603567",
"0.52603567",
"0.52597564",
"0.5259584",
"0.52585614",
"0.5254411",
"0.5251475",
"0.52473915",
"0.52473915",
"0.52470815",
"0.5245378",
"0.5242379",
"0.5242379",
"0.5242379",
"0.5232541",
"0.5227042",
"0.5227042",
"0.5227042",
"0.5222683",
"0.5220138",
"0.5219239",
"0.5212414",
"0.520871",
"0.52010983",
"0.5196279",
"0.5194487",
"0.5192591",
"0.5191204",
"0.51897645",
"0.5187385",
"0.51854163",
"0.5177803",
"0.5176642"
] | 0.0 | -1 |
Only allow awarding of manually awarded achievements. | def authorize_achievement!
authorize!(:award, @achievement) if achievement_params.include?(:course_user_ids)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authorize_admin_manage_achievements\n unless current_user.permission.manage_achievements\n redirect_back fallback_location: root_path\n end\n end",
"def award; end",
"def award\n\tend",
"def dean_approve_awards(user)\n for award in awards.valid\n award.update_attribute(:amount_awarded, award.amount_requested) if award.amount_awarded.blank?\n award.update_attribute(:amount_awarded_user_id, user.id)\n end\n update_attribute(:approved_at, Time.now)\n end",
"def validate_awarded_attributes\n return if awarded_at && awarder\n\n errors.add(:experience_points_record, :absent_award_attributes)\n end",
"def allows_reward?\n false\n end",
"def allows_reward?\n true\n end",
"def assign_zero_experience_points\n self.points_awarded = 0\n self.awarded_at = Time.zone.now\n self.awarder = User.stamper || User.system\n end",
"def access\n if @ajar == true || if @unlocked == false\n raise ArgumentError.new(\"Further permissions required\")\n elsif @ajar == false && if @unlocked == true\n puts \"your wish is granted\"\n return @ajar = true\n end\n end\n end\n end",
"def award!(badge, award_date = nil)\n if !badge.awarded_to?(self) or badge.allow_duplicates\n\n if badge.expire_in_days != 0\n base_date = award_date.present? ? award_date : DateTime.now\n abs_expiry = base_date.advance(:days => badge.expire_in_days)\n else\n abs_expiry = nil\n end\n\n self.awards.create(:badge_id => badge.id, :award_date => award_date, :expiry => abs_expiry )\n end\n end",
"def award!(badge, award_date = nil)\n return unless !badge.awarded_to?(self) || badge.allow_duplicates\n\n if badge.expire_in_days != 0\n base_date = award_date.present? ? award_date : DateTime.now\n abs_expiry = base_date.advance(days: badge.expire_in_days)\n else\n abs_expiry = nil\n end\n\n awards.create(badge_id: badge.id, award_date: award_date, expiry: abs_expiry)\n end",
"def awarded?\n return false if declined?\n case offering.award_basis\n when \"review\" then awarded_by_review_committee?\n when \"interview\" then awarded_by_interview_committee?\n when \"final\" then awarded_by_final_committee?\n else awarded_by_review_committee?\n end\n end",
"def calc_achievements\n\n #TODO: Use a list of achievements in db with conditions stored in db, iterate and award as necessary. \n if (self.games_won_as_pacman == 10)\n self.user.achievements << Achievement.create(:name => \"The Elusive Pacman\", :desc => \"Win 10 games as Pacman\");\n elsif (self.games_won_as_pacman == 100)\n self.user.achievements << Achievement.create(:name => \"Pacman Supreme\", :desc => \"Win 100 games as Pacman\");\n elsif (self.games_won_as_ghost == 10)\n self.user.achievements << Achievement.create(:name => \"Pacman Killer\", :desc => \"Win 10 games as a Ghost\");\n elsif (self.games_won_as_ghost == 100)\n self.user.achievements << Achievement.create(:name => \"Guardian of all the dots in the world\", :desc => \"Win 100 games as a Ghost\");\n elsif (self.total_ghosts_eaten == 50)\n self.user.achievements << Achievement.create(:name => \"Om nom nom!\", :desc => \"Eat 50 ghosts.\");\n elsif (self.total_pacman_eaten == 50)\n self.user.achievements << Achievement.create(:name => \"He never saw it coming.\", :desc => \"Eat 50 Pacman\");\n end \n end",
"def admited?\n return true unless admited_on.nil?\n end",
"def person_award?\n !store_award?\n end",
"def enforce_permissions\n bounce unless is_admin?\n end",
"def awarded?\n return is_expired && !best_proposal.nil?\n end",
"def valid_for_grading?(answer)\n return true if @assessment.autograded?\n return true unless answer.specific.is_a?(Course::Assessment::Answer::Programming)\n\n answer.specific.attempting_times_left > 0 || can?(:manage, @assessment)\n end",
"def autograde?(submission)\n not (submission.nil? or submission.handinFile().nil?)\n end",
"def allowDamage _obj, _args\n \"_obj allowDamage _args;\" \n end",
"def attack_attempt?(enemy)\n valid_attack = true\n if self.health_points <= 0 or enemy.health_points <= 0\n valid_attack = false\n end\n valid_attack\n end",
"def assign_experience_points\n # publish event (from grade) - Deduce points awarded from draft or updated attribute.\n if workflow_state == 'published' &&\n (workflow_state_was == 'graded' || workflow_state_was == 'submitted')\n self.points_awarded ||= draft_points_awarded\n self.draft_points_awarded = nil\n end\n end",
"def require_permission\n if Goal.find(params[:id]).user != current_user\n redirect_to goals_url, flash: { error: \"You do not have permission to do that.\"}\n end\n end",
"def manage?\n allowed_to?(:manage_assessments?, with: GraderPermissionPolicy)\n end",
"def awaiting_dean_approval?\n awarded? && !dean_approved?\n end",
"def owner_only_offers_reward?\n self.rewards_count == 1 && self.rewards.visible[0].sender == self.person\n end",
"def allows_reward?\n self.class.allows_reward?\n end",
"def grant_achievement_for_booth_visit_without_notification(user)\n if BOOTH_VISIT_ACHIEVEMENT_ENABLED && request.remote_ip.starts_with?(BOOTH_VISIT_REMOTE_IP)\n achievement = Achievement.find(BOOTH_VISIT_ACHIEVEMENT_ID)\n if !user.achievements.include?achievement\n user.achievements << achievement\n end\n end\n end",
"def allowTalkToSelf()\n banner(\"Allow Agents to mumble\")\n @mumbleFlag = true\n end",
"def approve_user\n # set the enabled flag to true for the user\n # send out approval notification\n end",
"def allow?(*args)\n true\n end",
"def loyalty_allowance\n if @faculty.eligible_for_loyality_allowance?(@generation_date)\n ((component_criterias[:loyalty_allowance]/100)*basic) #* eligibility_fraction)\n end\n end",
"def can_activate?\n self.person && self.person_match? && self.has_not_expired?\n end",
"def has_achievement?(name)\n achievements.exists?(name: name)\n end",
"def approve_adoption\n self[:adoptable] = false\n save\n end",
"def credit_unlimited?\n #if prepaid?\n # raise \"Prepaid users do not have credit\"\n credit == -1\n end",
"def create\n @achievement = Achievement.new(achievement_params)\n @remaining_points = 2000\n current_game_owner.game.achievements.each do |achievement|\n @remaining_points = @remaining_points - achievement.points\n end\n\n respond_to do |format|\n if @achievement.points.nil?\n points = @remaining_points\n else\n points =@remaining_points - @achievement.points\n end\n\n if points > 0\n if @achievement.save\n format.html { redirect_to edit_game_path(current_game_owner.game), notice: 'Se ha guardado el logro correctamente.' }\n format.json { render :show, status: :created, location: @achievement }\n else\n format.html { render :new }\n format.json { render json: @achievement.errors, status: :unprocessable_entity }\n end\n else\n format.html { render :new, alert: \"No te quedan suficientes puntos disponibles.\" }\n format.json { render json: \"not enough points\", status: :unprocessable_entity }\n end\n\n\n end\n end",
"def action_allowed?(action_name)\n # TODO: this does some unnecessary work\n compute_allow_and_deny(action_name).then do\n\n deny = @__deny_fields == true || (@__deny_fields && @__deny_fields.size > 0)\n\n clear_allow_and_deny\n\n !deny\n end\n end",
"def no_advantage_check\n $game_temp.advantage = false if $game_temp.no_advantage or not Allow_Advantage\n $game_temp.disvantage = false if $game_temp.no_disvantage or not Allow_Disvantage\n $game_temp.pre_emptive = false if $game_temp.no_pre_emptive or not Allow_Pre_Emptive\n $game_temp.surprised = false if $game_temp.no_surprised or not Allow_Surprised\n $game_temp.raid_attack = false if $game_temp.no_raid_attack or not Allow_Raid_Attack\n $game_temp.back_attack = false if $game_temp.no_back_attack or not Allow_Back_Attack\n $game_temp.invert_postion = ($game_temp.back_attack and Invert_Back_Attack)\n end",
"def check_and_grant_awards!(observed_object)\n # for the observed object, let's see which awards it may grant\n # for each grantable award, we'll add the award using our\n # dependency graph award method: add_awards!\n # We'll return the list of all actual awarded adds, as stated by\n # add_awards!.\n added_grants = []\n candidate_grants = []\n status, headers, body = @routes.call :source => observed_object\n # We make sure we have a good status code\n return [] unless status == 200\n # Define a proc to do the adding of grants and parent candidates.\n do_grant = Proc.new { |grant|\n source = (\n observed_object.class.respond_to?(:base_class) and\n observed_object.respond_to?(:id)) ? observed_object : nil\n grant.awardable.award_with! grant.award, :source => source\n added_grants << grant\n # This is if we have ancestry enabled.\n if grant.award.respond_to?(:parent) and !grant.award.parent.nil?\n candidate_grants << Grant.new(grant.awardable, grant.award.parent)\n end\n }\n grants = Array(body)\n grants.each { |g| do_grant.call(g) }\n while !candidate_grants.empty?\n candidate = candidate_grants.shift\n do_grant.call(candidate) if(\n meets_requirements?(candidate) and\n !added_grants.include?(candidate.award))\n end\n return added_grants\n end",
"def award_with!(award, options={})\n return false unless award\n awarding = Awarding.new\n case award\n when Award\n awarding.award = award\n else\n result = Award.find_by_name award.to_s\n return false unless result\n awarding.award = result\n end\n options.each do |key, value|\n awarding.send(\"#{key}=\", value) if awarding.respond_to? \"#{key}=\"\n end\n awarding.awardable = self\n # Save this awarding, and also makes it available in the Awardable model.\n return awarding.save\n end",
"def achievements_done\n achievements if @achievements_done.nil?\n @achievements_done\n end",
"def update_award\n\t\tif !params[:profile_setting].present?\n\t\t\tredirect_to user_profile_data_profile_path \n\t\telse\n\t\t\t# creating the award by using the award params\n\t\t\t@award = @user.update_attributes(award_params)\n\t\t\t# redirect to the profile app page\n\t\t\tredirect_to user_profile_data_profile_path\n\t\tend\n\tend",
"def check_goal_status_for(current_user)\n if self.goal_achieved_for(current_user)\n \n self.update_attributes(:goal_achieved => true,\n :goal_id_achieved => current_user.current_goal.id)\n \n current_user.current_goal.update_attributes(:achieved_at => Time.now,\n :current => false)\n\n end\n end",
"def allowed?\n raise \"Unimplemented 'allowed?' for intention: #{self.inspect}!\"\n end",
"def award_vps(player, amount)\n unless amount <= 0\n @vps -= amount\n @finishing ||= @vps <= 0\n player.add_vps(amount)\n end\n end",
"def set_eligibility\n update_attribute_without_callbacks(:eligible,\n mandatory ||\n (amount != 0 && eligible_for_originator?))\n end",
"def correct_initiative_only\n unless current_user.admin?\n if current_user.service_user? || current_user.initiatives.exclude?(Initiative.find(params[:id]))\n flash[:danger] = 'You are not allowed to access that page.'\n redirect_to current_user\n end\n end\n end",
"def allow_access\n !@current_user.nil?\n end",
"def approve!\n\t\tif self.status == \"active\"\n\t\t\traise \"ERROR in approving an already active member\"\n\t\telsif self.status == \"rejected\"\n\t\t\traise \"ERROR cannot approve rejected member\"\n\t\telse\n\t\t\tself.update!(status: \"active\")\n\t\tend\n\tend",
"def can_set_appt?\n has_pixan? && !is_completed?\n end",
"def correct_initiative_only\n unless current_user.admin?\n if current_user.service_user? || current_user.initiatives.exclude?(Initiative.find(params[:initiative_id]))\n flash[:danger] = 'You are not allowed to access that page.'\n redirect_to current_user\n end\n end\n end",
"def set_achievement(name)\n if initted?\n ok = @@dll_SteamAPI_ISteamUserStats_SetAchievement.call(@i_user_stats, name) % 256 != 0\n @@dll_SteamAPI_ISteamUserStats_StoreStats.call(@i_user_stats) % 256 != 0 && ok\n else\n false\n end\n end",
"def soft_ace\n # softy method refactor for when an ace is played\nend",
"def charge_privileges_denied?\n parse_fixed_boolean 0\n end",
"def require_permission\n if current_user.id != @squad.owner_id\n redirect_to api_squads_path, notice: 'You must be owner of a squad to do that action.'\n end\n end",
"def enable_auto_approve\n add option: \"-auto-approve=true\"\n end",
"def accomplished_all_enrolled_missions?\n mission_enrollments.select{|m| !m.accomplished? }.empty?\n end",
"def attackable?\n true\n end",
"def action_allowed?\n current_user_has_ta_privileges?\n end",
"def action_allowed?\n current_user_has_ta_privileges?\n end",
"def approve\n registration = Registration.find(params[:id])\n if (params[:assigned_points].present? || registration.evidence.points)\n registration.update(assigned_points: params[:assigned_points])\n registration.update(approved: true)\n end\n redirect_to :registrations\n end",
"def manually_awarded?\n actable_type.nil? && actable.nil?\n end",
"def enforce_requested_account_authorized!\n clear_authorization! unless requested_account_authorized?\n end",
"def is_valid_action?(aid)\n return aid > 0 && aid <= @total_actions\n end",
"def validate_allows_response\n if self.kase\n # self.errors.add(:kase, \"is %{status}\".t % {:status => self.kase.current_state_t}) unless self.kase.active?\n # self.errors.add(:kase, \"is not open\".t) unless self.kase.open?\n \n if self.person \n if self.kase.offers_reward?\n\n # only disallow rewarded self answers\n self.errors.add(:base, \"You cannot respond to your own rewarded %{type}\".t % {:type => self.kase.class.human_name}) unless self.person != self.kase.person\n\n end\n end\n end\n end",
"def set_achievment\n @achievment = Achievment.find(params[:id])\n end",
"def set_achievment\n @achievment = Achievment.find(params[:id])\n end",
"def create\n @award = Award.new(award_params)\n\n if request.format != \"application/json\" then\n @award.user = current_user_credential.user\n end\n\n respond_to do |format|\n if @award.save\n format.html { redirect_to new_answer_url, notice: 'Award was successfully created.' }\n format.json { render :show, status: :created, location: @award }\n else\n format.html { render :new }\n format.json { render json: {:errors => @award.errors}, status: :unprocessable_entity }\n end\n end\n end",
"def allow_access\n !current_cas_user.nil?\n end",
"def guild_achievements\r\n BnetApi::make_request('/wow/data/guild/achievements')\r\n end",
"def authorized_for_making_adj\n @tournament = Tournament.find(params[:id]);\n hasAuthority = (current_user.is_a_tabbie?(@tournament) ||\n \n ((@tournament.tournament_setting[:registration] == \n GlobalConstants::SETTINGS_VALUES[:registration][\"Completely open\"]) &&\n (safe_params[:email] == current_user.email)) ||\n \n (current_user.has_exec_position?([:president, :externals]) &&\n (@tournament.tournament_setting[:registration] != \n GlobalConstants::SETTINGS_VALUES[:registration][\"Manual\"]) &&\n [email protected]_maxed_out_adjs(current_user.institution)));\n redirect_to root_path unless hasAuthority;\n end",
"def can_enroll?\n self.self_enrollment_allowed && effective_cutoff_date >= Time.now\n end",
"def authorize_resource\n authorize!(:disburse, @disbursement)\n @disbursement.experience_points_records.each do |record|\n authorize!(:create, record)\n end\n end",
"def action_allowed?\n ['Instructor',\n 'Teaching Assistant',\n 'Administrator'].include? current_role_name\n end",
"def action_allowed?\n ['Instructor',\n 'Teaching Assistant',\n 'Administrator'].include? current_role_name\n end",
"def action_allowed?\n ['Instructor',\n 'Teaching Assistant',\n 'Administrator'].include? current_role_name\n end",
"def can_see_ads?(user)\n !user.is_gold?\n end",
"def set_admitted!\n if remote?\n update(admitted: true, start_date: Date.today.to_datetime, \n graduation_date: (Date.today + 1.month).to_datetime, remaining_mentor_sessions: 4, \n bootstrap_access: true, ruby_access: true)\n elsif immersive?\n update(admitted: true, start_date: Date.today.to_datetime, \n graduation_date: (Date.today + 2.month).to_datetime, bootstrap_access: true, ruby_access: true)\n end\n end",
"def authorized_for?(*args)\n return false if current_user.nil? # If current_user is not defined or the model is accessed outside of the request/response cycle, bail out\n is_allowed = current_user.can_do( :appointments, args[0][:action] )\n\n return is_allowed && multi_appointment_receipt_allowed? if args[0][:column].blank? && (args[0][:action] == :issue_receipt)\n return is_allowed\n end",
"def mandate_given?\n !self.given_mandates.empty?\n end",
"def prohibit\n @profile.approved = false\n @profile.save!\n redirect_to profiles_path(status: 'approved')\n end",
"def ensure_eligible_for_confirmation\n unless @offering.confirmations_allowed?\n flash[:error] = \"We're sorry, but the confirmation process is currently disabled.\"\n redirect_to apply_url(@offering) and return\n end\n unless @user_application.passed_status?(\"fully_accepted\") || @user_application.passed_status?(\"fully_accepted_vad\")\n flash[:error] = \"You cannot go through the confirmation process until your application has been fully accepted.\"\n redirect_to apply_url(@offering) and return\n end\n end",
"def check_eligible\n redirect_to matches_path(date: @match.kickoff.to_date), flash: { notice: 'Cannot submit Man of the Match for that match.' } unless @match.voteable?\n end",
"def authorize_user_as_member_of_paid_account!\n railse CanCan::AccessDenied if current_user.nil? || (!current_user.has_role?(:system_administrator) && !current_user.member_of_paid_account?) \n # handle_unauthorized_access if current_user.nil? || (!current_user.has_role?(:system_administrator) && !current_user.member_of_paid_account?)\n end",
"def prevent_self\n if current_user.proposals.include?(@proposal)\n redirect_to reviewer_event_proposals_path\n end\n end",
"def read_achievements\n end",
"def authorize_leader!\n raise CanCan::AccessDenied if current_user.managed_chapters.count.zero?\n end",
"def autograded?\n if @assessment&.autograded\n true\n elsif @assessment && @assessment.autograded == false\n false\n else\n params[:assessment] && params[:assessment][:autograded]\n end\n end",
"def cannot_edit(_offer)\n !session[:is_administrator] && _offer.unbilled_balance <= 0\n end",
"def check_accessibility(current_user)\n accessible_by_user?(current_user) ||\n (try(:user).try(:dxuser) == CHALLENGE_BOT_DX_USER &&\n current_user.logged_in? &&\n current_user.is_challenge_evaluator?\n )\n end",
"def award_badge(participant_id, badge_name)\n badge_id = Badge.get_id_from_name(badge_name: badge_name)\n AwardedBadge.where(participant_id: participant_id, badge_id: badge_id, approval_status: 0).first_or_create\n end",
"def blue_first(award)\n award.expires_in -= 1\n if award.expires_in >= 0\n award.quality += 1\n elsif award.expires_in < 0\n award.quality += 2\n end\nend",
"def before_save_goal\n\t\t# \n\t\tif self.current_user_role == 'sm'\n\t\t\traise \"Super Manager don't need goal\"\n\t end\n\tend",
"def allowed?; true end",
"def update\n raise 'Unimplemented award type update!'\n end",
"def can_apply?(opportunity)\n\n if alum_signed_in? && !current_user.is_owner?(opportunity) && !current_user.applied?(opportunity)\n true\n else\n false \n end\n end",
"def become_angry\n update(anger_level: 0, angry_since: Time.now)\n true\n end",
"def reputation_threshold_action\n :offer_reward\n end",
"def show\n unless admin?\n unless @project.approved\n redirect_to projects_path, notice: 'Project is not approved yet.'\n end\n end\n @awards = Award.all.order(:id)\n end"
] | [
"0.657844",
"0.6570108",
"0.65216535",
"0.6470702",
"0.63609046",
"0.63316333",
"0.62955874",
"0.62314117",
"0.61716115",
"0.6152459",
"0.6116133",
"0.6068654",
"0.59023225",
"0.5891844",
"0.588764",
"0.5856144",
"0.57596177",
"0.5716753",
"0.570942",
"0.5677872",
"0.56643",
"0.5658035",
"0.56234515",
"0.5619276",
"0.55978054",
"0.5595125",
"0.5586691",
"0.55838907",
"0.5540279",
"0.5535903",
"0.5513755",
"0.5511686",
"0.55090475",
"0.55065715",
"0.5506508",
"0.54955494",
"0.5471481",
"0.546987",
"0.54676175",
"0.54659104",
"0.54645145",
"0.5452722",
"0.54379386",
"0.5420814",
"0.5417438",
"0.54172736",
"0.5393684",
"0.5383954",
"0.538147",
"0.53763133",
"0.5365738",
"0.53590566",
"0.5354528",
"0.53538424",
"0.53503203",
"0.534257",
"0.53374606",
"0.53320444",
"0.53253263",
"0.5324291",
"0.5324291",
"0.5320265",
"0.53028804",
"0.5296367",
"0.52950174",
"0.5292418",
"0.52886254",
"0.52886254",
"0.52868444",
"0.5283733",
"0.52755827",
"0.527542",
"0.52653253",
"0.52635825",
"0.52572703",
"0.52572703",
"0.52572703",
"0.5253547",
"0.5253044",
"0.52475226",
"0.5247295",
"0.5243861",
"0.5243083",
"0.5238776",
"0.52354383",
"0.5229476",
"0.5226709",
"0.5222228",
"0.5220332",
"0.52199113",
"0.52189815",
"0.5218183",
"0.52169776",
"0.5209951",
"0.5203946",
"0.52037334",
"0.51958",
"0.51957226",
"0.5195641",
"0.51927996"
] | 0.6915091 | 0 |
Checks if a proposed achievement ordering is valid | def valid_ordering?(proposed_ordering)
achievements_hash.keys.sort == proposed_ordering.sort
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_ordering?(proposed_ordering)\n question_assessments_hash.keys.sort == proposed_ordering.sort\n end",
"def valid_ordering?(proposed_ordering)\n question_assessments_hash.keys.sort == proposed_ordering.sort\n end",
"def valid_ordering?(proposed_ordering)\n questions_hash.keys.sort == proposed_ordering.sort\n end",
"def valid_question_ordering?(proposed_ordering)\n ordering_hash = proposed_ordering.to_h\n section_ids = ordering_hash.keys\n question_ids = ordering_hash.values.flatten\n valid_section_ids?(section_ids) && valid_question_ids?(question_ids)\n end",
"def validate_order!\n _validate_order!\n rescue AASM::InvalidTransition => e\n false\n end",
"def valid_order?(order)\n valid_orders.include? order.to_s\n end",
"def validate_order_approval\n units_beings_prepared = self.has_units_being_prepared\n if not units_beings_prepared.empty?\n errors[:order_status] << \"cannot be set to approved because units #{units_beings_prepared.map(&:id).join(', ')} are neither approved nor canceled\"\n end\n end",
"def fix_ude_approval_order_gaps?\n return false if self.reviewers.size == 0\n fixes_made = false\n\n last_o = 0\n self.reviewers.sort_by{|ude|ude.approval_order}.each do |ude|\n if ude.approval_order - last_o > 1\n ude.approval_order = last_o + 1\n ude.save\n fixes_made = true\n end\n last_o = ude.approval_order\n end\n max_o = last_o\n last_o = 0\n self.others_notified.sort_by{|ude|ude.approval_order}.each do |ude|\n if ude.approval_order > max_o\n ude.approval_order = max_o\n ude.save\n fixes_made = true\n end\n end\n return fixes_made\n end",
"def is_conflict?\n from_json\n (@order && @order.paid?).tap do |x|\n @error = true if x\n end\n end",
"def ensure_not_referenced_by_any_ordered_item\n if ordered_items.empty?\n return true\n else\n errors.add(:base, \"Ordered items present.\")\n return false\n end\n end",
"def order_completable?\n force_completion || actual_end_at || reserve_end_at < Time.current\n end",
"def complete?()\n if (self.order_in_lines.length == 0)\n return false\n end\n self.order_in_lines.each do | line |\n if (line.qty < line.qty_in)\n return false\n end\n end\n return true\n end",
"def valid_section_ordering?(proposed_ordering)\n valid_section_ids?(proposed_ordering, require_all: true)\n end",
"def valid_edit_entry_reqs\n if !params[:edit_entry_req].nil?\n edit_reqs_vals = params[:edit_entry_req].values\n edit_reqs_vals.each_slice(3) do |grade, info, remove|\n if grade.empty?\n return false\n end\n end\n end\n return true\n end",
"def valid_item?\n # PCP Items can only be created by Commenting Group\n return 1 if pcp_step.in_presenting_group?\n\n # scenario without comments; note that I can safely assume that there are at\n # least two steps ... because it is not allowed to add PCP Items to the first\n # PCP Step (0), hence the current step is at least PCP Step (1).\n ps = pcp_subject.current_steps\n if pcp_comments.count == 0 then\n if pcp_step == ps[ 0 ] # newly created?\n return ( pub_assmt.nil? && new_assmt == assessment ) ? 0 : 2\n elsif pcp_step == ps[ 1 ] # new item released\n return ( pub_assmt == new_assmt && new_assmt == assessment ) ? 0 : 3\n else\n # inconsistent: there should be comments in the previous step\n return 4\n end\n end\n # we have comments here ( pcp_comments.count > 0 )\n \n # if PCP Item was newly created for step, last public comment -\n # if existing - determines current assessment, else assessment\n if pcp_step == ps[ 0 ]\n return 5 unless pub_assmt.nil?\n na = assessment\n pcp_comments.each do | c |\n return 6 unless c.pcp_step == pcp_step\n na = c.assessment if c.is_public\n end\n return ( new_assmt == na ) ? 0 : 7\n end\n\n # PCP Item was created for earlier step, determine current assessment\n # from current comments: default is last, most recent comment, look\n # for any public comments which then override new_assmt\n pc = pcp_comments.for_step( ps[ 0 ])\n if pc.count == 0 \n # no comments for current step (yet - or if closed)\n return 8 unless ( pub_assmt == new_assmt )\n elsif ps[ 0 ].in_commenting_group?\n na = pc.last.assessment\n pc.each do | c |\n na = c.assessment if c.is_public\n end\n return 9 unless ( new_assmt == na )\n else\n # no assessment changes allowed by presenting group\n pc.each do | c |\n return 10 if assessment_changed?( c.assessment )\n end\n end\n\n # now check if pub_assmt is correctly computed from previous step:\n # determine last released assessment, if any\n\n if ps[ 1 ].in_presenting_group?\n # there should be no changes at all\n pc = pcp_comments.for_step( ps[ 1 ])\n pc.each do | c |\n return 11 unless ( pub_assmt == c.assessment )\n # note: new_assmt could be different now due to new comments\n # in current step ...\n end\n else # in_commenting_group?\n pc = pcp_comments.is_public.for_step( ps[ 1 ])\n if pc.count > 0\n return 12 unless ( pub_assmt == pc.last.assessment )\n else # no public comments, assessment comes from item\n return 13 unless ( pub_assmt == new_assmt && new_assmt == assessment )\n end\n end\n\n return 0\n end",
"def purchase_order_required?\n if self.solution.purchase_order_required && self.purchase_order.blank?\n errors.add(:purchase_order_required, \"PROBLEM: A purchase order is required for solution #{self.solution.name}.\")\n end\n end",
"def check_task_order\n # Checks if column is present\n # (not column id because an id that does not belong to a column can be provided)\n # in case this valdiation is run before the one that checks the presence of column\n # If column is nil the comparison inside the if failed\n # the same goes for column order\n if column.present? && self.task_order.present?\n if self.task_order > self.column.tasks.count + 1\n errors.add(:task_order, 'must be maximum last task order + 1')\n end\n end\n end",
"def requirement_met?(equip)\n return false if $game_party.item_number(@item) < @number\n return false if $game_party.gold < required_gold(equip)\n true\n end",
"def eligible?(order)\n return false if expired? || usage_limit_exceeded?(order)\n rules_are_eligible?(order, {})\n end",
"def valid?\n return false if @beez_up_order_item_id.nil?\n return false if @order_item_order_item_type.nil?\n return true\n end",
"def is_valid_for_ranking\n !(\n (meeting_event && meeting_event.is_out_of_race) ||\n (meeting_program && meeting_program.is_out_of_race) ||\n is_out_of_race ||\n is_disqualified\n )\n end",
"def verify_integrity(object_data, entry)\n if object_data[\"policies\"].empty?\n yield(\"Policy group #{object_data[\"name\"]} does not have any policies in it.\")\n end\n end",
"def correct?\n inorder.each_cons(2).all? { |p, n| p <= n }\n end",
"def valid_for?(cart)\n minimum_order_value.nil? || minimum_order_value < cart.item_sum\n end",
"def check_order\n rps = RankParticipant.all\n\n #sort the rank participants and extract an array of only the ranks (that are sorted)\n all_ranks_sorted = rps.sort_by { |x| [x.rank] }.map { |rp| rp.rank }\n\n #array of missing ranks\n @missing = []\n\n all_ranks_sorted.each_with_index do |item, index|\n if index > 0\n #difference between consecutive ranks, should be 1\n difference = all_ranks_sorted[index] - all_ranks_sorted[index - 1]\n\n if difference > 1\n @missing.concat(((all_ranks_sorted[index - 1] + 1)...(all_ranks_sorted[index])).to_a)\n end\n end\n end\n end",
"def ensure_not_referenced\n if order_items.empty?\n true\n else\n errors.add(:base, 'Line Order present')\n false\n end\n end",
"def validate_order!(options)\r\n return unless options && options[:order]\r\n\r\n (options[:order] = options[:order].to_s).split(/, +/).each do |order|\r\n sort = order.split(/ +/)\r\n\r\n if [1, 2].include? sort.size\r\n attribute, direction = sort\r\n else\r\n raise InvalidSort, \"order must be in the form 'attribute [asc/desc]'\"\r\n end\r\n\r\n if column = sortable(options[:version])[attribute.to_sym]\r\n if column.is_a? TrueClass\r\n column = attributes(options[:version])[attribute.to_sym].to_s\r\n end\r\n\r\n options[:order] = options[:order].sub attribute, column\r\n else\r\n if sortable.empty?\r\n raise InvalidSort, \"this resource can not be sorted\"\r\n else\r\n raise InvalidSort, \"order must be one of #{sortable.keys * ', '}\"\r\n end\r\n end\r\n\r\n unless direction.nil? || direction =~ /^(?:asc|desc)$/i\r\n raise InvalidSort, \"order direction must be 'asc' or 'desc'\"\r\n end\r\n end\r\n\r\n options[:order]\r\n end",
"def check\n if implicit_order_column_defined?\n report_template(:ok)\n else\n report_template(:fail, error_slug: :implicit_order_column_missing)\n end\n end",
"def available_for_order?(_order)\n true\n end",
"def assert_valid_gqueries!\n return true if queries.length == @requested_queries.length\n\n (@requested_queries - queries.map(&:key)).each do |key|\n @errors.push(\"Gquery #{ key } does not exist\")\n end\n\n false\n end",
"def is_valid_for_ranking\n !(\n (meeting_event && meeting_event.is_out_of_race) ||\n (meeting_program && meeting_program.is_out_of_race)\n )\n end",
"def validate_order(orders)\n raise App::InvalidParameter, 'incorrect input provided, expects Array' if orders.class != Array\n raise App::InvalidParameter, \"machine serves #{@outlets} at a time\" if orders.length > @outlets\n\n invalid_o = orders.reject { |x| @beverages.key?(x) }\n raise App::InvalidParameter, \"machine does not serve #{invalid_o.join('')}\" unless invalid_o.empty?\n end",
"def check_empty_order(items)\r\n flag = items.item.length\r\n items.item.each do |h|\r\n (flag -= 1) if h[:num] == 0\r\n end\r\n return true if flag == 0\r\n return false\r\nend",
"def finished?\n @game.finished || @pass_order.size == @game.players.size\n end",
"def is_valid?\n instructor_approved || (non_rejected_student_memberships.size >= assignment.group_min)\n end",
"def eligible?(options = {})\n return unless order = options[:order]\n quantity_ordered = product.variants_including_master.inject(0) do |sum, v|\n sum + order.quantity_of(v)\n end\n quantity_ordered >= preferred_quantity\n end",
"def ensure_requirements_position\n reqs = self.requirements.where(position: nil)\n return if reqs.length < 1\n good_reqs = self.requirements.where(\"position IS NOT NULL\").order(:position)\n #consolidate ordered items at first\n good_reqs.each_with_index do |req, i|\n req.update_column(:position, i+1)\n end\n #add order to items missing it at end\n reqs.each_with_index do |req, i|\n req.update_column(:position, i + good_reqs.length + 1)\n end\n end",
"def has_order_items?\n @cores != nil || @ram != nil || @max_port_speed != nil\n end",
"def has_ordered?(item_to_check)\n if item_to_check.class == Item\n @order.any? {|item| item.name == item_to_check.name}\n else \n false\n end \nend",
"def check_if_approval_is_required\n check_by_families || check_by_supplier || check_by_project ||\n check_by_office || check_by_company || check_by_zone\n end",
"def order?\n !order.nil?\n end",
"def verify_vote_proposal_options\n return true unless vote_proposal_options\n if status == \"preview\"\n correct_options = vote_proposal.vote_proposal_options.map(&:name)\n correct_options << \"Accept\"\n correct_options << \"Decline\"\n else\n correct_options = vote_proposal.vote_proposal_options.map(&:name)\n end\n\n vote_proposal_options.all? do |option|\n correct_options.index(option.name)\n end \n end",
"def eligible?(order)\n order.completed? or (!expired? and rules_are_eligible?(order))\n end",
"def check_order\n return if order.present? && Faq.where(order: order).where.not(id: id).empty?\n self.order = begin\n Faq.order(order: :desc).limit(1).first.order + 1.0\n rescue\n 1\n end\n end",
"def validate_order_args(args)\n args.each do |arg|\n next unless arg.is_a?(Hash)\n arg.each do |_key, value|\n raise ArgumentError, \"Direction \\\"#{value}\\\" is invalid. Valid \" \\\n \"directions are: #{VALID_DIRECTIONS.inspect}\" unless VALID_DIRECTIONS.include?(value)\n end\n end\n end",
"def duplicate_order?(response)\n response.params.has_key?(:ErrInfo) and response.params[:ErrInfo] == DUPLICATE_ORDER_CODE\n end",
"def ratings_cannot_be_out_of_order\n check_ratings(throwing_ratings, 'throwing')\n check_ratings(fielding_ratings, 'fielding')\n check_ratings(running_ratings, 'running')\n check_ratings(hitting_ratings, 'hitting')\n end",
"def valid?\n @points.count > 3 && @points.first == @points.last\n end",
"def validate_item_quantity\n return true if item.nil?\n unless item.could_be_ordered?(quantity - quantity_was.to_i) # check only quantities diff\n errors.add(:quantity, :could_not_be_ordered)\n end\n end",
"def awarded?\n return is_expired && !best_proposal.nil?\n end",
"def probe?\n self.order == -1\n end",
"def new_quality_must_complete\n if (id.nil? && half==2)\n if (!indicator_desc_quality.blank? && !target_quality.blank? && !achievement_quality.blank? && !progress_quality.blank?)\n return true\n elsif (!indicator_desc_quality.blank? && target_quality.blank? && achievement_quality.blank? && progress_quality.blank?) || (!indicator_desc_quality.blank? && !target_quality.blank? && achievement_quality.blank? && progress_quality.blank?) || (!indicator_desc_quality.blank? && !target_quality.blank? && !achievement_quality.blank? && progress_quality.blank?) || (!indicator_desc_quality.blank? && !target_quality.blank? && achievement_quality.blank? && !progress_quality.blank?) || (indicator_desc_quality.blank? && !target_quality.blank? && !achievement_quality.blank? && !progress_quality.blank?)|| (indicator_desc_quality.blank? && target_quality.blank? && !achievement_quality.blank? && !progress_quality.blank?) || (indicator_desc_quality.blank? && target_quality.blank? && achievement_quality.blank? && !progress_quality.blank?) || (indicator_desc_quality.blank? && target_quality.blank? && !achievement_quality.blank? && progress_quality.blank?) \n return false\n end\n end \n end",
"def PO_required?\n # company doesn't, true (acceptable) either way\n return true if !self.quote.project.company.PO_required\n # company requirement and true\n return true if self.quote.project.company.PO_required and self.purchase_order_required\n # company does and we didn't\n errors.add(:PO_required, \"PROBLEM: #{self.quote.project.company.name} requires a purchase order.\")\n end",
"def is_valid_action?(aid)\n return aid > 0 && aid <= @total_actions\n end",
"def valid_order?\n order.coupon.nil? && coupon.cancelled_at.nil?\n end",
"def valid_orders\n VALID[:order_by]\n end",
"def approve_initial_requirements?\n approve_step?('#3')\n end",
"def approve_initial_requirements?\n approve_step?('#3')\n end",
"def approve_initial_requirements?\n approve_step?('#3')\n end",
"def is_ordered?\n # TODO Stubbed - Requires definition and implementation\n end",
"def updated_values?(order)\n super or submitted_assets_have_changed?(order)\n end",
"def accomplished_all_enrolled_missions?\n mission_enrollments.select{|m| !m.accomplished? }.empty?\n end",
"def is_empty?\n if self.order_details.any? == false\n errors.add(:base,\"order shold have minimum one menu item\")\n end\n end",
"def grade_is_valid?\n if not_nil_and_string(self.grade)\n if GRADES.include? self.grade\n if self.grade == \"k\";self.grade = \"K\";end #force uppercase K\n return true\n end\n end\n return false\n end",
"def q3_layout_ok?(historical_orders, layout)\r\n # (i) basic checks\r\n if layout == nil\r\n return \"layout is nil. It should be a 2D array of items (strings)\"\r\n elsif !layout.is_a?(Array)\r\n return \"layout is not an array. It should be a 2D array of items (strings).\"\r\n elsif layout.length != 5\r\n return \"layout is an array of #{layout.length} elements. It should be a 2D array of 5 elements (each to represent 1 row).\"\r\n end\r\n \r\n # check if each of the 5 elements in layout are arrays as well\r\n for i in 0...layout.length\r\n if layout[i]==nil or !layout[i].is_a?(Array)\r\n return \"layout should be a 2D array. There are elements in layout that are not correct.\"\r\n end\r\n end\r\n \r\n your_items = layout.flatten.sort \r\n # (ii) all items in your returned array must be unique.\r\n if your_items.length != your_items.uniq.length # there are duplicates\r\n duplicated_items = your_items.select{ |e| your_items.count(e) > 1 }.uniq\r\n return \"layout should not contain duplicated items. These are the duplicated items in your layout :#{duplicated_items}.\"\r\n end\r\n \r\n # (iii) \r\n historical_items = historical_orders.flatten.uniq.sort\r\n if historical_items != your_items\r\n missing_items = historical_items - your_items\r\n extra_items = your_items - historical_items\r\n \r\n # construct long-winded error message\r\n temp = \"layout should contain exactly the same items as the historical orders.\"\r\n \r\n if missing_items.length > 0\r\n temp += \"These items are missing in your layout: #{missing_items}.\"\r\n end\r\n \r\n if extra_items.length > 0\r\n temp += \"These items are in your layout, but not required: #{extra_items}.\"\r\n end\r\n \r\n return temp\r\n end\r\n \r\n # all ok\r\n return true \r\nend",
"def valid?\n return false if @marketplace_technical_code.nil?\n return false if @account_id.nil?\n return false if @beez_up_order_id.nil?\n return false if @marketplace_business_code.nil?\n return false if @order_marketplace_order_id.nil?\n return false if @order_status_beez_up_order_status.nil?\n return false if @order_purchase_utc_date.nil?\n return false if @order_last_modification_utc_date.nil?\n return false if @order_marketplace_last_modification_utc_date.nil?\n return false if @processing.nil?\n return false if @etag.nil?\n return false if @links.nil?\n return false if @order_items.nil?\n return false if @transition_links.nil?\n return true\n end",
"def validate_options!\n if incomplete_policyfile_options?\n ui.error(\"Policy group and name must be specified together\")\n exit 1\n end\n true\n end",
"def eligible_for_early_disposition_request?\n return false if disposed?\n # otherwise check the policy year and see if it is less than or equal to\n # the current planning year\n return false if policy_replacement_year.blank?\n\n if policy_replacement_year <= current_planning_year_year\n # Eligible for after ESL disposal\n false\n else\n # Prior ESL disposal request\n last_request = early_disposition_requests.last\n # No previous request or was rejected\n !last_request || last_request.try(:is_rejected?)\n end\n end",
"def autograde?(submission)\n not (submission.nil? or submission.handinFile().nil?)\n end",
"def usable_item_conditions_met?(item)\r\n movable? && occasion_ok?(item)\r\n end",
"def input_valid?\n could_refund = @order.total_price - @order.refund_price\n @params[:refund_price].to_f.positive? && @params[:refund_price].to_f <= could_refund\n end",
"def q1_sequence_ok?(answer, order)\r\n # check (i) format of answer. assumption: order is always correct\r\n if answer == nil\r\n return \"Proposed seqence is nil. Proposed sequence should be a 1D array of items (strings).\"\r\n elsif !answer.is_a?(Array)\r\n return \"Proposed sequence is not an array. Proposed sequence should be a 1D array of items (strings).\"\r\n end\r\n answer.each{|x| if !x.is_a?(String)\r\n return \"Proposed sequence contains an element which is not a string. Proposed sequence should be a 1D array containing only strings.\"\r\n end}\r\n \r\n # check (ii) contents of answer; is it same as order?\r\n if answer.sort == order.sort\r\n return true # ok\r\n end\r\n\r\n # construct error message for returning\r\n missing_items = order - answer\r\n additional_items = answer - order\r\n \r\n error_msg = \"The items in order are different from the items in your proposed sequence. They must contain identical items! \"\r\n if missing_items.length>0\r\n error_msg += \"These items are missing from your sequence :#{missing_items}.\"\r\n end\r\n if additional_items.length>0\r\n error_msg += \"These items should not be in your sequence :#{additional_items}.\"\r\n end \r\n return error_msg\r\nend",
"def validate_prerequisites_consistency\n used = map_attributes(RoleConfigFile::PREREQUISITE).compact\n return if used.empty? || used.size == @elements.size && used.uniq.size <= 1\n\n @errors << \"Prerequisite annotation must be used consistently across all resources of each role\"\n end",
"def valid?(side1, side2, side3)\n return false if (side1 <= 0) || (side2 <= 0) || (side3 <= 0)\n tmp = [side1, side2, side3]\n tmp.sort!\n tmp[0..1].sum > tmp[-1]\nend",
"def eligible?(order, _options = {})\n return false unless order.user\n\n last_order = last_completed_order(order.user)\n return false unless last_order\n\n last_order.completed_at < preferred_days_ago.days.ago\n end",
"def requirements_unlocked_or_can_be?\n true\n end",
"def valid?\n score.eql?(@issue.labels.sort.find { |l| grid.any? { |g| l.eql? g } })\n end",
"def check_for_released\n if released_to_students && marking_state_changed?(to: Result::MARKING_STATES[:incomplete])\n errors.add(:base, I18n.t('results.marks_released'))\n throw(:abort)\n end\n true\n end",
"def valid?\n return false if @ir.nil?\n return false if @loi.nil?\n return false if @approval_id.nil?\n return false if @calculated_max_price.nil?\n return false if @completes.nil?\n return false if @event_id.nil?\n return false if @id.nil?\n return false if @new_estimated_cost.nil?\n return false if @original_cpi.nil?\n return false if @original_estimated_cost.nil?\n return false if @project_id.nil?\n return false if @quota_group_id.nil?\n return false if @reason.nil?\n return false if @request_new_price.nil?\n return false if @required_completes.nil?\n true\n end",
"def confirm_placement\n return @place_coms.activate && buz if @@place_count < 1 && min_one\n size = $game_party.members.size\n return @place_coms.activate && buz if @@place_count < size && MinAll\n @@place_count = 0\n TactBattleManager.first_turn if !TactBattleManager.party_on_map # 1st units\n TactBattleManager.clear_valid_pos\n return_scene\n end",
"def ready_to_approve?\n status = self.units.map(&:unit_status) & ['condition', 'copyright', 'unapproved']\n return status.empty?\n end",
"def has_met_requirement?\n yeas >= required_votes\n end",
"def can_be_added?(order)\n eligible?(order) &&\n (can_combine?(order) || order.promotion_credits.empty?) &&\n Credit.count(:conditions => {\n :adjustment_source_id => self.id,\n :adjustment_source_type => self.class.name,\n :order_id => order.id\n }) == 0\n end",
"def approvable?\n (!current_stage.nil? &&\n current_stage.stage.eql?('verify') &&\n current_stage.status.eql?('passed') &&\n !AutomateSoup.url.nil? &&\n !AutomateSoup.credentials.nil? &&\n !links.nil? &&\n !links['approve'].nil? &&\n !links['approve']['href'].nil?)\n end",
"def valid?\n validate_survivors and validate_items && validate_records\n end",
"def valid_guce_params?\n if @order_id == nil || @amount == nil || not_a_number?(@amount)\n return false\n else\n return true\n end\n end",
"def has_achievement?(name)\n achievements.exists?(name: name)\n end",
"def needs_beta_approval?\n fairness_level_comparison < 0\n end",
"def valid_add_entry_req\n if !params[:add_entry_req].nil?\n add_er_vals = params[:add_entry_req].values\n add_er_vals.each_slice(3) do |incoming_qual, grade, info|\n if (!incoming_qual.empty? && grade.empty?) ||\n (incoming_qual.empty? && (!grade.empty? || !info.empty?))\n return false\n end\n end\n end\n return true\n end",
"def ab_options_is_complete?(ab_options = {})\n result = true\n\n ab_options.values.each do |value|\n # Has :a, :b and :goal options\n result = value.keys.size >= 3 && value.key?(:a) && value.key?(:b) && value.key?(:goal)\n break if result == false\n end\n\n result\n end",
"def validate_command\n if requester != player\n errors.add(:allowed, I18n.t(\"errors.not_authorized\"))\n end\n unless airlift?\n if game.actions_taken == 4\n errors.add(:allowed, I18n.t(\"player_actions.no_actions_left\"))\n end\n if proposal.turn_nr != game.turn_nr\n errors.add(:allowed, I18n.t(\"movement_proposals.expired\"))\n end\n if destination_is_not_a_neighbor? && another_player_is_not_at_destination?\n errors.add(:allowed, I18n.t(\"movement_proposals.not_allowed\"))\n end\n end\n end",
"def validate_completion(completion_params)\n compute_completion_hash_from_params(completion_params)\n true\n rescue ArgumentError, TypeError => e\n errors.add :completions, \"Invalid completion '#{completion_params}': #{e.message}\"\n false\n end",
"def is_ordered?\n # TODO Stubbed to always return false until ordered lists are implemented\n return false\n end",
"def punch_out_order_message?\n !punch_out_order_message.nil?\n end",
"def unappliable_order?\n order.bought? == false\n end",
"def has_enough_inventory\n inventory_amounts = self.inventory_orders.reduce({}) do |inv_amounts, inv_ord|\n inv_amounts[inv_ord.inventory_id].present? ?\n inv_amounts[inv_ord.inventory_id] += inv_ord.order_quantity :\n inv_amounts[inv_ord.inventory_id] = inv_ord.order_quantity\n inv_amounts\n end\n has_insufficient_amount = inventory_amounts.any? do |inv_id, amount|\n Inventory.find(inv_id).quantity_available < amount\n end\n if has_insufficient_amount\n errors.add(:order_amount, \"exceeds available inventory\")\n end\n end",
"def can_supply?(required)\n total_on_hand >= required || backorderable?\n end",
"def update_ok?(order_hash)\n\t\tif !order_hash[:order_number]\n\t\t\treturn false\n\t\telsif order_hash[:status] == 'SH' \n\t\t\t\treturn true unless order_hash[:tracking_number] == nil || order_hash[:ship_method] == nil\n\t\telse\n\t\t\treturn true\n\t\tend \n\tend",
"def update_ok?(order_hash)\n\t\tif !order_hash[:order_number]\n\t\t\treturn false\n\t\telsif order_hash[:status] == 'SH' \n\t\t\t\treturn true unless order_hash[:tracking_number] == nil || order_hash[:ship_method] == nil\n\t\telse\n\t\t\treturn true\n\t\tend \n\tend",
"def isValid\n # check that the amino acid is complete\n nonHydrogenAtoms = self.atoms.select{|atom| atom.atom != \"H\"}\n if (nonHydrogenAtoms.size == AMINO_ACID_SIZES[self.resname])\n @isvalid = true\n end\n puts \"ISVALID : #{self.isvalid} #{nonHydrogenAtoms.size} \"\n end"
] | [
"0.75595075",
"0.75595075",
"0.71142715",
"0.6603639",
"0.639604",
"0.61943823",
"0.6177739",
"0.6028429",
"0.6017315",
"0.59035313",
"0.58922213",
"0.5844696",
"0.5844137",
"0.5754543",
"0.5732574",
"0.57145613",
"0.56725645",
"0.56583273",
"0.5610223",
"0.5556813",
"0.5514022",
"0.55119616",
"0.5506912",
"0.5497205",
"0.5494602",
"0.5492492",
"0.54850805",
"0.5475169",
"0.54628956",
"0.54446656",
"0.5440731",
"0.54305977",
"0.542979",
"0.54214203",
"0.5408879",
"0.5407254",
"0.53923005",
"0.539042",
"0.5386759",
"0.53845626",
"0.53806955",
"0.5372701",
"0.5371697",
"0.53654224",
"0.53409505",
"0.5328767",
"0.531732",
"0.53121936",
"0.53054917",
"0.52976346",
"0.5295655",
"0.52854896",
"0.5278055",
"0.5274679",
"0.5262199",
"0.52359635",
"0.5233585",
"0.5233585",
"0.5233585",
"0.5232714",
"0.52224857",
"0.5215566",
"0.521448",
"0.521411",
"0.5209535",
"0.5204061",
"0.5203573",
"0.5201633",
"0.51975197",
"0.51932466",
"0.51928896",
"0.51912576",
"0.51894116",
"0.5188829",
"0.5183777",
"0.517411",
"0.51701903",
"0.5159419",
"0.51558423",
"0.5150392",
"0.51482433",
"0.51477134",
"0.5146892",
"0.51434326",
"0.51418006",
"0.5138719",
"0.5138492",
"0.51361793",
"0.51331085",
"0.5130616",
"0.51232445",
"0.5122601",
"0.51192486",
"0.5110581",
"0.51089185",
"0.51007575",
"0.5100474",
"0.5100322",
"0.5100322",
"0.50976866"
] | 0.8310939 | 0 |
A team gets two points for a won game, and 1 point for each drawn or abandoned game | def score
2 * won + drawn + noresult
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def points(team)\n first = 0\n res = self.result\n\n if res\n if team == 1\n first_team = res[0]\n sec_team = res[1]\n elsif team == 2\n first_team = res[1]\n sec_team = res[0]\n else \n raise \"Invalid Team chosen\"\n end\n\n p first_team <=> sec_team\n # Compare the results\n outcome = first_team <=> sec_team\n\n if outcome > 0\n # Win\n result = 3\n elsif outcome < 0\n # Loss\n result = 0\n else \n # Draw\n result = 1\n end\n else\n result = nil\n end\n\n result\n end",
"def winning_team\n total_points = 0 #initialize points at zero \n \n win_team = '' #set win team to an empty string \n \n game_hash.each do |location, team| #iterating over game hash\n team_points = 0 #initialize team points at zero \n team_name = game_hash[location][:team_name] \n # set team name = to game_hash at the the location at the # :team name \n \n team[:players].each do |player| #iterate over players \n points = player[:points] # set points = player points \n team_points += points #team points is the addition of every single point value from each player\n \n #binding.pry \n end\n \n win_team, total_points = team_name, team_points if team_points > total_points\n \n #binding.pry \n \n end\n \n return win_team\n\nend",
"def winning_team\n home_points = collection_by_prop(game_hash[:home], :points).reduce(0, :+)\n away_points = collection_by_prop(game_hash[:away], :points).reduce(0, :+)\n home_points > away_points ? game_hash[:home][:team_name] : game_hash[:away][:team_name]\n end",
"def add_points(team)\n games_played = Game.where(\"team_one = #{team.id} or team_two = #{team.id}\")\n @rankings[team.name][\"points_for\"] = 0\n @rankings[team.name][\"points_against\"] = 0\n if !games_played.nil?\n games_played.each do |game|\n if !game.winner.nil? && !game.winner_score.nil?\n if team.id == game.winner # if team won, add winner points to PF and losing points to PA\n @rankings[team.name][\"points_for\"] += game.winner_score\n @rankings[team.name][\"points_against\"] += game.loser_score\n else # if team lost, add winner points to PA and losing points to PF\n @rankings[team.name][\"points_for\"] += game.loser_score\n @rankings[team.name][\"points_against\"] += game.winner_score\n end\n end\n end\n end\n end",
"def winning_team\n final_scores = player_collection.reduce(home: 0, away: 0) { |teams_points, next_player|\n case \n when next_player[:location] === :away\n teams_points[:away] += next_player[:points];\n when next_player[:location] === :home\n teams_points[:home] += next_player[:points];\n end\n teams_points; \n }\n winner = final_scores.reduce { |highest_points, team_points| \n highest_points[1] > team_points[1] ? highest_points : team_points; \n }\n game_hash[winner[0]][:team_name]; \nend",
"def points\n deal_points = tricks_points @tricks\n\n if not deal_points.inside? bid_said_by_team\n deal_points.add_points_to(bid_said_by_team, MatchPoints::VALAT_BONUS) if valat?\n\n if not @mode.is_a? DoubleMode\n @mode.match_points deal_points\n else\n Points.zeros[bid_said_by_team] = doubling_points deal_points, @mode\n end\n elsif deal_points.inside? bid_said_by_team\n deal_points.add_points_to(opposing_team, MatchPoints::VALAT_BONUS) if valat?\n\n Points.zeros[opposing_team] = doubling_points deal_points, @mode\n elsif deal_points.hanging?\n if not @mode.is_a? DoubleMode\n @mode.match_points deal_points\n else\n doubled_points = doubling_points deal_points, @mode\n\n result = Points.zeros\n result[bid_said_by_team] = doubled_points / 2\n resutl[opposing_team] = doubled_points / 2\n\n result\n end\n end\n end",
"def calculate_player_points\n # Sort the teams by points in descending order. This way, the output will\n # follow the teams' finishing order, which will be easier to read.\n @teams.sort_by(&:points).reverse_each do |team|\n puts \"Awarding #{team.points} points to #{team.name}: \" +\n @players[team.id].map(&:to_s).join(\", \")\n\n @players[team.id].each do |player|\n player.points = team.points\n end\n end\n end",
"def winning_team\n team_p = []\n team_n = []\n\n game_hash.each do | location, team_data|\n temp = 0\n team_data[:players].each do |p_name, stats|\n temp += stats[:points]\n end\n team_n << team_data[:team_name]\n team_p << temp\n end\n\n team_p[0] > team_p[1] ? team_n[0] : team_n[1]\n\nend",
"def winning_team\n home_team_points = game_hash[:home][:players].sum { |e| e[:points] }\n away_team_points = game_hash[:away][:players].sum { |e| e[:points] }\n\n if home_team_points > away_team_points\n return game_hash[:home][:team_name]\n else\n return game_hash[:away][:team_name]\n end\nend",
"def winning_team\n if homeTeamPoints.sum > awayTeamPoints.sum\n \"Brooklyn Nets\"\n else\n \"Charlotte Hornets\"\n end\nend",
"def wins_point(winner)\n \n if winner == @player1\n @player1.record_won_ball!\n @score_counter += 1\n return @player1.points\n else\n @player2.record_won_ball!\n @score_counter += 1\n return @player2.points\n end\n # TODO: Think it's gross to pass an integer instead of a player object?\n # Then reimplement this method!\n end",
"def test_set_points__when_win\n sports_team = SportsTeam.new('Benfica', ['Rafa', 'Raul', 'Pizzi', 'Odisseias'], 'Bruno Nascimento', 0)\n sports_team.add_or_remove_points(2)\n assert_equal(2, sports_team.points())\n end",
"def winning_team\n home_points = 0\n away_points = 0\n team1 = \"Brooklyn Nets\"\n team2 = \"Charlotte Hornets\"\n game_hash.each do |team,info|\n info.each do |team_info,team_data|\n if team_data.is_a? (Array) \n if team_info != :colors\n if info[:team_name] == \"Brooklyn Nets\"\n team_data.each do |player_index|\n home_points += player_index[:points]\n end\n else \n team_data.each do |player_index|\n away_points += player_index[:points]\n winning_team end\n end\n end\n end\n end\n end\n\n if home_points > away_points\n team1\n else\n team2\n end\n\nend",
"def team_with_more_points(game)\n home_points = game[:home_team][:players].collect do |player|\n player[:stats][:points]\n end.inject {|sum, n| sum + n}\n away_points = game[:away_team][:players].collect do |player|\n player[:stats][:points]\n end.inject {|sum, n| sum + n}\n home_points > away_points ? game[:home_team][:team_name] : game[:away_team][:team_name]\nend",
"def test_add_points__win\n sports_team = SportsTeam.new(\"AC Milan\",[\"Suso\", \"Zapata\", \"Higuain\"], \"Gattuso\")\n sports_team.play_game(true)\n assert_equal(1, sports_team.points)\n end",
"def calculate_team_points\n # If the bracket is complete, we can calculate points based on the\n # teams' `final_rank`s.\n if @state == \"complete\"\n calculate_team_points_by_final_rank\n return\n end\n\n # For each team, look at the matches that it is in, look at the point\n # values of those matches, and take the maximum point value. That's the\n # number of points that the team has earned so far in the bracket.\n base_point_value = @config.base_point_value\n\n @teams.each do |team|\n matches_with_team = @matches.select { |match| match.has_team?(team.id) }\n\n puts \"Team #{team.name} was in #{matches_with_team.size} matches\"\n\n points_earned = matches_with_team.max_by(&:points).points\n\n puts \"The largest point value of those matches is #{points_earned}\" \\\n \"#{\" + #{base_point_value} base\" if base_point_value > 0}\"\n\n team.points = points_earned + base_point_value\n end\n end",
"def create\n sport_id = user_session.get(:filter_sport_id) # okay that's how mistakes happen.... TODO!!!\n sport = Sport.find(sport_id)\n team_points = Hash.new(0)\n team_games = Hash.new(0)\n team_goals_for = Hash.new(0)\n team_goals_against = Hash.new(0)\n\n sport.leagues.each do |league|\n league.games.each do |game| #iterate through EVERY game in EVERY league, calculate points, set it in team table\n if game.tie == false and not game.winner_id.nil? # no tie and winner exists\n team_points[game.winner_id] += 2\n team_games[game.team_1_id] += 1\n team_games[game.team_2_id] += 1\n elsif game.tie == true\n team_points[game.team_1_id] += 1\n team_points[game.team_2_id] += 1\n team_games[game.team_1_id] += 1\n team_games[game.team_2_id] += 1\n end # else, game has not been played yet\n\n # go through all the sets and calculate goal difference\n game.gamesets.each do |set|\n team_goals_for[game.team_1_id] += set.points_team_1.to_i\n team_goals_for[game.team_2_id] += set.points_team_2.to_i\n team_goals_against[game.team_1_id] += set.points_team_2.to_i\n team_goals_against[game.team_2_id] += set.points_team_1.to_i\n end\n\n end\n\n league.teams.each do |team|\n team.points = team_points[team.id] #|| 0 should work without this\n team.game_count = team_games[team.id]\n team.goals_for = team_goals_for[team.id]\n team.goals_against = team_goals_against[team.id]\n team.goals_difference = team_goals_for[team.id] - team_goals_against[team.id]\n team.save\n end\n end\n redirect_to rankings_path, success: t(:object_created)\n end",
"def winning_team_with_spread\n\t\tif self.final?\n\t\t\treturn home_team_id if home_team_score > away_team_score + point_spread\n\t\t\treturn away_team_id if away_team_score + point_spread > home_team_score\n\t\t\treturn \"tie\" if home_team_score == away_team_score + point_spread\n\t\telse\n\t\t\treturn nil\n\t\tend\n\tend",
"def winning_team\n home_points = 0\n away_points = 0\n result = \"\"\n i = 0\n game_hash.each do |team, about|\n about[:players].each do |name , stats|\n if i == 0\n home_points += stats[:points]\n else\n away_points += stats[:points]\n end\n end\n i += 1\n end\n home_points > away_points ? result = game_hash[:home][:team_name] : result = game_hash[:away][:team_name]\nend",
"def points\n points_by_round = [nil, 3, 5, 8, 13, 21, 34]\n points_by_round[@game.round] + @winner.seed\n end",
"def winning_team\n points_home = 0\n points_away = 0\n result = \"\"\n\n game_hash.each do |side,team|\n team.each do |specs,info|\n if specs == :players\n info.each do |player|\n if side = :home\n points_home += player[:points]\n else\n points_away += player[:points]\n end\n end\n end\n end\n end\n if points_home > points_away\n result = game_hash[:home][:team_name]\n else\n result = game_hash[:away][:team_name]\n end\n result\nend",
"def record_won_ball!\n # Check to see if a win-point results in a win-game outcome. \n if @points > 3 && @points >= @opponent.points + 2\n @game_points += 1\n \n record_won_game!\n reset_points\n\n else\n @points +=1 \n end \n end",
"def test_team_win\n @team.was_the_match_a_victory(true)\n assert_equal(1, @team.points)\n @team.was_the_match_a_victory(true)\n @team.was_the_match_a_victory(true)\n @team.was_the_match_a_victory(false)\n @team.was_the_match_a_victory(true)\n assert_equal(4, @team.points)\n end",
"def winning_team\n blue_team.winner? ? blue_team : red_team\n end",
"def winning_team\n home_score = 0\n away_score = 0\n game_hash[:home][:players].keys.each do |name|\n home_score += game_hash[:home][:players][name][:points]\n end\n game_hash[:away][:players].keys.each do |name|\n away_score += game_hash[:away][:players][name][:points]\n end\n home_score > away_score ? game_hash[:home][:team_name] : game_hash[:away][:team_name]\nend",
"def get_standings(games)\n teams = Hash.new\n games.each do |game|\n division_id = game.division_id\n home_team = game.home_team\n away_team = game.visiting_team\n if(teams[home_team.name].nil?)\n teams[home_team.name] = {:win => 0, :loss => 0, :tie => 0, :point=> 0}\n end\n\n if(teams[away_team.name].nil?)\n teams[away_team.name] = {:win => 0, :loss => 0, :tie => 0, :point => 0}\n end\n if(game.home_team_score && game.visiting_team_score)\n if(game.home_team_score > game.visiting_team_score)\n # home team won\n teams[home_team.name][:win] += 1\n teams[home_team.name][:point] += 5\n # visiting team loss\n teams[away_team.name][:loss] += 1\n elsif(game.home_team_score < game.visiting_team_score)\n # home team loss\n teams[home_team.name][:loss] += 1\n #visiting team won\n teams[away_team.name][:win] += 1\n teams[away_team.name][:point] += 5\n else\n # tie game\n teams[home_team.name][:tie] += 1\n teams[home_team.name][:point] += 1\n teams[away_team.name][:tie] += 1\n teams[away_team.name][:point] += 1\n end\n end\n end\n teams.each do |team, value|\n puts team\n total_games = value[:win] + value[:loss] + value[:tie]\n if total_games > 0 \n win_percentage = value[:win]/total_games.to_f\n else\n win_percentage = 0\n end \n value[:percentage] = win_percentage\n end\n teams_sorted = teams.sort_by{ |k, v| v[:point]}.reverse\n return teams_sorted\n end",
"def winning_team\n home_team_sum = 0\n away_team_sum = 0\n game_hash.each do |team, team_stats|\n if team_stats[:team_name] == \"Brooklyn Nets\"\n team_stats[:players].each do |player_stats|\n home_team_sum += player_stats[:points]\n end\n elsif team_stats[:team_name] == \"Charlotte Hornets\"\n team_stats[:players].each do |player_stats|\n away_team_sum += player_stats[:points]\n end\n end\n end\n if home_team_sum > away_team_sum\n game_hash[:home][:team_name]\n elsif home_team_sum < away_team_sum\n game_hash[:away][:team_name]\n end\nend",
"def win_pts\n self.score += 1\n end",
"def total_points\n\n points = 0\n wattball_matches_as_team1.each do |match|\n points += match.points(1) || 0\n end\n\n wattball_matches_as_team2.each do |match|\n points += match.points(2) || 0\n end\n\n points\n end",
"def calculate_points\n if team.exhibition?\n event.standings_including(team).find_index(self) + 1\n else\n event.standings.find_index(self) + 1\n end\n end",
"def determine_winner game\n winner = game.max_by {|team| team[:score]}\n team_standings = get_team_by_name(winner)\n team_standings[:winnings] += 3\nend",
"def test_team_points()\n team = SportsTeam.new(\"Belgium\", [\"Player 1\", \"Player 2\", \"Player 3\"], \"Mr Belgium\")\n assert_equal(0, team.points())\n end",
"def points() \n\t\t(self.wins()*3+self.draws()) \n\tend",
"def get_score(point_winner,point_loser)\n if point_winner.points < 40\n point_winner.points = point_winner.next_point\n if point_winner.points == 40 && point_loser.points == 40\n point_winner.stage = point_loser.stage = 'Deuce'\n else\n \"#{@player1.points}-#{@player2.points}\"\n end\n else\n stage = get_stage(point_winner,point_loser)\n if stage == 'Game'\n \"Game won by #{point_winner.name}\"\n elsif stage == 'Advantage'\n \"Advantage #{point_winner.name}\"\n else\n \"Deuce\"\n end\n end\n end",
"def winning_team\n most_points_scored_helper\n winning_team = \"\"\n \n game_hash.each do |key, value|\n players = value[:players]\n players.each do |element|\n if most_points_scored_helper == element[:points]\n winning_team = value[:team_name]\n end\n end\n end\n winning_team\nend",
"def its_a_tie game\n game.each do |team|\n team_standings = get_team_by_name(team)\n team_standings[:winnings] += 1\n end\nend",
"def compute_team_winner\n if completed?\n team_winner\n else\n if first_team && second_team\n if sets_won(first_team) == min_sets_to_play\n first_team\n elsif sets_won(second_team) == min_sets_to_play\n second_team\n end\n end\n end\n end",
"def points\n return 0 if match.invalid_result?\n return 4 if self.score == match.score\n return 3 if self.goals_diff == match.goals_diff\n return 2 if self.winner == match.winner\n return 0\n end",
"def points_for(source_result, team_size = nil)\n points = point_schedule[source_result.place.to_i].to_f\n if source_result.last_event?\n points = points * 2\n end\n points\n end",
"def calculate_team_points_by_final_rank\n # Calculate how many points to award to each rank. When multiple teams\n # have the same rank (e.g., two teams tie for 5th place), those teams\n # get the average of the points available to those ranks. For example,\n # in a 6-team bracket, the teams in 1st through 4th place get 6 through 3\n # points respectively. The two teams in 5th get 1.5, the average of 2 and 1.\n sorted_teams = @teams.sort_by(&:final_rank)\n num_teams = sorted_teams.size.to_f\n\n final_rank_points = sorted_teams.each_with_index.\n each_with_object({}) do |(team, idx), rank_points|\n rank_points[team.final_rank] ||= []\n rank_points[team.final_rank] << num_teams - idx\n end\n\n base_point_value = @config.base_point_value\n\n sorted_teams.each do |team|\n points_earned = final_rank_points[team.final_rank].sum /\n final_rank_points[team.final_rank].size\n\n puts \"#{team.name} finished in position #{team.final_rank} and gets\" \\\n \" #{points_earned} points\" \\\n \"#{\" + #{base_point_value} base\" if base_point_value > 0}\"\n\n team.points = points_earned + base_point_value\n end\n end",
"def winner_team(game)\n result = nil\n if game.team1_goals.present? && game.team2_goals.present?\n result = game.team1 if game.team1_goals > game.team2_goals\n result = game.team2 if game.team1_goals < game.team2_goals\n end\n\n result\n end",
"def winning_team\n nets = []\n hornets = []\n\n game_hash.values.each do |nets_stats|\n if nets_stats[:team_name] == \"Brooklyn Nets\"\n nets_stats[:players].each do |bk|\n nets << bk[:points]\n end\n end\n end\n\n game_hash.values.each do |hornets_stats|\n if hornets_stats[:team_name] == \"Charlotte Hornets\"\n hornets_stats[:players].each do |ch|\n hornets << ch[:points]\n end\n end\n end\n\n if nets.reduce(:+) > hornets.reduce(:+)\n return \"Brooklyn Nets\"\n else\n return \"Charlotte Hornets\"\n end\nend",
"def won_with_points\n self.chips += 2 * self.bet_chips\n self.is_complete = true\n \"#{name}'s point is bigger than dealer! #{name} get extra one bet. Win for #{name}\"\n end",
"def record_won_game!\n if @game_points >= 5 && @game_points >= @opponent.game_points + 2\n\n record_won_set!\n end\n end",
"def result_game1\n \n minus_result = @player1.points - @player2.points\n\n # While less than 4 points have been recorded\n while @score_counter < 4\n if minus_result > 0\n return \"Player 1 leads: #{@player1.score} - #{@player2.score}.\"\n elsif minus_result < 0\n return \"Player 2 leads: #{@player2.score} - #{@player1.score}.\"\n else \n return \"The game is tied: #{@player1.score} - #{@player2.score}.\"\n end\n end\n\n # While either 4 or 5 points have been recorded\n while (@score_counter >= 4 && @score_counter < 6)\n if (@player1.points >= 4 || @player2.points >= 4)\n if minus_result > 0\n return \"Congratulations Player 1. YOU WIN!\"\n @player1.points = 0\n elsif minus_result < 0\n return \"Congratulations Player 2. YOU WIN!\"\n @player2.points = 0\n end\n else\n if minus_result > 0\n return \"Player 1 leads: #{@player1.score} - #{@player2.score}.\"\n elsif minus_result < 0\n return \"Player 2 leads: #{@player2.score} - #{@player1.score}.\"\n else \n return \"The game is tied: #{@player1.score} - #{@player2.score}.\"\n end\n end\n end\n\n # Once 6 points have been recorded\n while @score_counter >= 6\n case minus_result\n when 0\n return \"The game is tied. Duece! Next point takes advantage.\"\n when 1\n @player1.player_advantage = true\n return \"Advantage: Player 1\"\n when -1\n @player2.player_advantage = true\n return \"Advantage: Player 2\"\n when 2\n return \"Congratulations Player 1. YOU WIN!\"\n @score_counter = 0\n @player1.points = 0\n else\n return \"Congratulations Player 2. YOU WIN!\"\n @score_counter = 0\n @player2.points = 0\n end\n end\n end",
"def match_points(match, player)\n scores = Result.where(:match_id => match)\n score_1 = scores.first\n score_2 = scores.last\n if score_1[:player_id] == player\n if score_1[:score] == 3 && score_2[:score] == 2\n points = 6\n elsif score_1[:score] == 3 && score_2[:score] == 1\n points = 6\n elsif score_1[:score] == 3 && score_2[:score] == 0\n points = 7\n elsif score_1[:score] == 2 && score_2[:score] == 3\n points = 4\n elsif score_1[:score] == 1 && score_2[:score] == 3\n points = 3\n elsif score_1[:score] == 0 && score_2[:score] == 3\n points = 2\n elsif score_1[:score] == 2 && score_2[:score] == 0\n points = 4\n elsif score_1[:score] == 2 && score_2[:score] == 1\n points = 4\n elsif score_1[:score] == 1 && score_2[:score] == 2\n points = 3\n elsif score_1[:score] == 0 && score_2[:score] == 2\n points = 2\n elsif score_1[:score] == 2 && score_2[:score] == 2\n points = 4\n elsif score_1[:score] == 1 && score_2[:score] == 0\n points = 3\n elsif score_1[:score] == 0 && score_2[:score] == 1\n points = 2\n elsif score_1[:score] == 1 && score_2[:score] == 1\n points = 3\n elsif score_1[:score] == 0 && score_2[:score] == 0\n points = 2\n elsif score_2[:score] == -1\n points = 6\n elsif score_1[:score] == -1\n points = 0\n end\n elsif score_2[:player_id] == player\n if score_2[:score] == 3 && score_1[:score] == 2\n points = 6\n elsif score_2[:score] == 3 && score_1[:score] == 1\n points = 6\n elsif score_2[:score] == 3 && score_1[:score] == 0\n points = 7\n elsif score_2[:score] == 2 && score_1[:score] == 3\n points = 4\n elsif score_2[:score] == 1 && score_1[:score] == 3\n points = 3\n elsif score_2[:score] == 0 && score_1[:score] == 3\n points = 2\n elsif score_2[:score] == 2 && score_1[:score] == 0\n points = 4\n elsif score_2[:score] == 2 && score_1[:score] == 1\n points = 4\n elsif score_2[:score] == 1 && score_1[:score] == 2\n points = 3\n elsif score_2[:score] == 0 && score_1[:score] == 2\n points = 2\n elsif score_2[:score] == 2 && score_1[:score] == 2\n points = 4\n elsif score_2[:score] == 1 && score_1[:score] == 0\n points = 3\n elsif score_2[:score] == 0 && score_1[:score] == 1\n points = 2\n elsif score_2[:score] == 1 && score_1[:score] == 1\n points = 3\n elsif score_2[:score] == 0 && score_1[:score] == 0\n points = 2\n elsif score_1[:score] == -1\n points = 6\n elsif score_2[:score] == -1\n points = 0\n end\n end\n return points\n end",
"def winner(game)\n result = nil\n if game.team1_goals.present? && game.team2_goals.present?\n result = TEAM1_WIN if game.team1_goals > game.team2_goals\n result = TEAM2_WIN if game.team1_goals < game.team2_goals\n result = DRAW if game.team1_goals == game.team2_goals\n end\n\n result\n end",
"def record_won_ball!\n @points += 1\n win?\n end",
"def points_scored_for_player(name,game)\n game[:home_team][:players].each do |player_hash|\n return player_hash[:stats][:points] if player_hash[:player_name] == name\n end\n game[:away_team][:players].each do |player_hash|\n return player_hash[:stats][:points] if player_hash[:player_name] == name\n end\nend",
"def awayTeamPoints\n teamSelect(\"Charlotte Hornets\")[:players].collect do|name, stats|\n stats[:points]\n end\nend",
"def won_game?\n @points > @opponent.points + 1 && @points >= 3\n end",
"def give_point\n if@current_player == @player1\n @p1_score += 1\n else\n @p2_score += 1\n end\nend",
"def record_won_ball!\n @points += 1\n return @points\n end",
"def record_won_ball!\n @points += 1\n return @points\n end",
"def wins_ball(winner)\n # TODO: Think it's gross to pass an integer instead of a player object?\n # Then reimplement this method!\n winner.points += 1\n end",
"def result\n if (hand.player_points <= LIMIT_POINTS && hand.player_points > hand.points_dealer) ||\n (hand.player_points <= LIMIT_POINTS && hand.points_dealer > LIMIT_POINTS)\n :player_win\n elsif (hand.points_dealer <= LIMIT_POINTS && hand.points_dealer > hand.player_points) ||\n (hand.points_dealer <= LIMIT_POINTS && hand.player_points > LIMIT_POINTS)\n puts 'Dealer win.'\n :dealer_win\n else\n :draw\n end\n end",
"def winning_team\n self.teams.order('score DESC').first\n end",
"def test_points_update_after_win\n brechin_bball_team = Team.new( @team, @players, @coach )\n brechin_bball_team.points_update('win')\n assert_equal(2, brechin_bball_team.team_points)\nend",
"def points(name)\n \n consolidated_player_list = game_hash[:home][:players] + game_hash[:away][:players]\n consolidated_player_list\n player_stat_hash = {}\n\n consolidated_player_list.each do |player|\n key = player[:player_name]\n player_stat_hash[key] = player\n end\n\n points = 0\n player_stat_hash.each do |player|\n points = player[1][:points] if player[0] == name\n end\n points\nend",
"def test_add_points__win\n team = SportsTeam.new(\"Greens\", [\"Jonny\",\"Sam\",\"Charlie\"], \"Dr Hockey\", 0)\n team.add_points(\"win\")\n assert_equal(1, team.points)\n end",
"def num_points win_condition\n points = 0\n @game_objects.each do |game|\n points += game.score_osu game_meets_win_cond win_condition, game\n end\n points\n end",
"def point_calculator(team)\n game_hash[team][:players].reduce(0) { | memo, player |\n memo += player[:points]\n }\nend",
"def update\n\n # Vérifie si il y a les points des matches dans les params\n if (params[:points_manche])\n\n # Additionne tous les points des annonces\n team1_total_point_announce = params[:team1_num0_announce].to_i + params[:team1_num01_announce].to_i + params[:team1_num2_announce].to_i + params[:team1_num3_announce].to_i + params[:team1_num4_announce].to_i\n team2_total_point_announce = params[:team2_num0_announce].to_i + params[:team2_num01_announce].to_i + params[:team2_num2_announce].to_i + params[:team2_num3_announce].to_i + params[:team2_num4_announce].to_i\n\n # Met a jour la manche de la partie\n @game.update(rounds: @game.rounds + 1)\n\n # Permet de définir le nouveau distributeur\n @game.teams.each do |team|\n team.players.each do |player|\n if (player.distributor)\n @distributor_position = player.position\n player.update(distributor: false)\n end\n end\n end\n @new_distributor_position = @distributor_position + 1\n if (@new_distributor_position == 5)\n @new_distributor_position = 1\n end\n @game.teams.each do |team|\n team.players.each do |player|\n if (player.position == @new_distributor_position)\n player.update(distributor: true)\n end\n end\n end\n\n # Permet de définir le joueur qui devra chosir l'atout\n @game.teams.each do |team|\n team.players.each do |player|\n if (player.first_to_play)\n @first_to_play_position = player.position\n player.update(first_to_play: false)\n end\n end\n end\n @new_first_to_play_position = @first_to_play_position + 1\n if (@new_first_to_play_position == 5)\n @new_first_to_play_position = 1\n end\n @game.teams.each do |team|\n team.players.each do |player|\n if (player.position == @new_first_to_play_position)\n player.update(first_to_play: true)\n end\n end\n end\n\n # Verifie si les points de la manche sont a 0 et met a jour les points de l'équipe 2\n if params[:points_manche].to_i == 0\n # Vérifie si il y a un match; Si oui on ajoute 257 points sinon 157\n if params[:match] == \"oui\"\n @game.teams.last.update(points: 257 + @game.teams.last.points.to_i + team2_total_point_announce)\n else\n @game.teams.last.update(points: 157 + @game.teams.last.points.to_i + team2_total_point_announce)\n end\n elsif 157 - params[:points_manche].to_i <= 0\n @game.teams.last.update(points: 0 + @game.teams.last.points.to_i + team2_total_point_announce)\n else\n @game.teams.last.update(points: 157 - params[:points_manche].to_i + @game.teams.last.points.to_i + team2_total_point_announce)\n end\n\n # Met a jour les points de l'équipe 2\n @game.teams.first.update(points: params[:points_manche].to_i + @game.teams.first.points.to_i + team1_total_point_announce )\n\n # Vérifie si il y a un gagnant dans la partie\n if (@game.teams.first.points >= @game.points)\n @game.teams.first.update(winner: true)\n @game.update(winner: true)\n elsif (@game.teams.last.points >= @game.points)\n @game.teams.last.update(winner:true)\n @game.update(winner: true)\n end\n\n # Sauvegarde une partie\n if @game.save\n render json: { success: true, teams: @game.teams, game: @game}\n end\n\n # Met a jour l'atout et affichige l'icone sur le bon joueur (atout)\n elsif (params[:atout] != '')\n @game.update(atout: params[:atout])\n if (params[:chibre] == \"true\")\n @game.teams.each do |team|\n team.players.each do |player|\n if (player.first_to_play)\n @first_to_play_position = player.position\n player.update(first_to_play: false)\n end\n end\n end\n @new_first_to_play_position = @first_to_play_position + 2\n if (@new_first_to_play_position == 5)\n @new_first_to_play_position = 1\n end\n if (@new_first_to_play_position == 6)\n @new_first_to_play_position = 2\n end\n @game.teams.each do |team|\n team.players.each do |player|\n if (player.position == @new_first_to_play_position)\n player.update(first_to_play: true)\n render json: { success: true, teams: @game.teams}\n end\n end\n end\n else\n render json: { success: true, teams: @game.teams}\n end\n\n # Verifie le status de la partie\n elsif (params[:status] != '')\n @game.update(status: params[:status])\n end\n\n end",
"def winner(game)\nwinner = \"\"\nwinner_points = 0\n game.each do |team, team_contents|\n total = 0\n team_contents[:roster].each do |player, player_contents| \n total += player_contents[:points]\n end\n if total > winner_points\n winner = team_contents[:team_name]\n winner_points = total\n elsif total == winner_points\n winner = \"tie\"\n end\n end\n\n if winner == \"tie\"\n puts \"The game was a tie, with each team scoring #{winner_points} points\"\n else\n puts \"#{winner} scored #{winner_points} points and won the game\"\n end\nend",
"def point_differential\r\n self.home_score-self.away_score\r\n end",
"def wins_ball(winner)\n # this is where we increment the winner of each ball by 1 point\n if winner == 1\n @player1.record_won_ball!\n #Player.record_won_ball!(@player1)\n elsif winner == 2\n @player2.record_won_ball!\n end\n\n\n end",
"def record_won_ball!\n @points += 1\n end",
"def record_won_ball!\n @points += 1\n end",
"def record_won_ball!\n @points += 1\n end",
"def record_won_ball!\n @points += 1\n end",
"def record_won_ball!\n @points += 1\n end",
"def record_won_ball!\n @points += 1\n end",
"def record_won_ball!\n @points += 1\n end",
"def record_won_ball!\n @points += 1\n end",
"def outcome\n if self.final\n \th = home_team\n \ta = away_team\n \t# h.wins=0 if h.wins==nil\n \t# h.losses=0 if h.losses==nil\n \t# a.wins=0 if a.wins==nil\n \t# a.losses=0 if a.losses==nil\n \tif home_score == away_score\n \t\treturn 'T'\n \telsif home_score > away_score\n \t\tif !self.recorded\n \t \t\th.wins += 1\n \t \t\ta.losses += 1\n \t \t\th.save\n \t \t\ta.save\n \t \t\tself.recorded=true\n \t \t\tself.save\n \t \tend\n \t\tif overtime\n \t\t\treturn 'h'\n \t\telse\n \t\t\treturn 'H'\n \t\tend\n \telse\n \t\tif !self.recorded\n \t \t\th.losses += 1\n \t \t\ta.wins += 1\n \t \t\ta.save\n \t \t\th.save\n \t \t\tself.recorded=true\n \t \t\tself.save\n \t \tend\n \t\tif overtime\n \t\t\treturn 'a'\n \t\telse\n \t\t\treturn 'A'\n \t\tend\n \tend\n end\n end",
"def points_if_not_trial\n n = event.tournament.number_of_non_exhibition_teams\n\n if disqualified? then n + 2\n elsif !participated? then n + 1\n elsif score.nil? then n\n else calculate_points\n end\n end",
"def team_hitting_pull_up\n return nil unless pull_up?\n team1.stats.wins > team2.stats.wins ? team1 : team2\n end",
"def record_won_ball!\n @points +=1\n end",
"def earn_point(player)\n player ==1 ? @player_2_wins += 1 : @player_1_wins +=1\nend",
"def test_add_points()\n team = SportsTeam.new(\"Belgium\", [\"Player 1\", \"Player 2\", \"Player 3\"], \"Mr Belgium\")\n team.add_points(3)\n assert_equal(3, team.points())\n end",
"def update_score_from_games!\n return if self.games.count == 0\n score_by_steam_id = {}\n self.games.each do |g|\n # Add one point to winning team, 0 to losing team so that they show up in the keyset when we check later\n if g.radiant_win === true\n score_by_steam_id[g.radiant_team_id] = score_by_steam_id[g.radiant_team_id].to_i + 1\n score_by_steam_id[g.dire_team_id] = score_by_steam_id[g.dire_team_id].to_i\n elsif g.radiant_win === false\n score_by_steam_id[g.radiant_team_id] = score_by_steam_id[g.radiant_team_id].to_i\n score_by_steam_id[g.dire_team_id] = score_by_steam_id[g.dire_team_id].to_i + 1\n end\n end\n\n # OK the keys are team ids, so now save them\n if score_by_steam_id[self.home_participant.id] != nil && score_by_steam_id[self.away_participant.id] != nil\n self.home_score = score_by_steam_id[self.home_participant.id]\n self.away_score = score_by_steam_id[self.away_participant.id]\n self.save!\n else\n puts score_by_steam_id.inspect\n puts self.home_participant_id.inspect\n puts self.away_participant_id.inspect\n puts \"WARNING: teams did not match, not updating match score\"\n end\n end",
"def wattball_matches\n self.wattball_matches_as_team1 + self.wattball_matches_as_team2\n end",
"def score\n return 'win' if (@points >= 4 && @points >= opponent.points + 2)\n return 'deuce' if (@points >= 3 && @points == opponent.points)\n return 'advantage' if (@points >= 3 && @points == opponent.points + 1)\n return 'love' if @points == 0\n return 'fifteen' if @points == 1\n return 'thirty' if @points == 2\n return 'forty' if @points == 3\n end",
"def games_won_or_lost(add_one_point)\n if add_one_point > 0\n return\n @points += add_one_point\n else\n add_one_point == 0\n return\n @points \n end\nend",
"def winning_team(result)\n goals = result.split(\"-\")\n if goals[0] == goals[1]\n \"draw\"\n elsif goals[0].to_i > goals[1].to_i\n \"home\"\n else\n \"away\"\n end\n end",
"def test_point_counter\n team = SportsTeam.new(\"Celtic\", [\"Hendrik Larsson\", \"Captain Football\", \"Some Guy\"], \"Mr. Manager\")\n team.point_counter(\"Win\")\n assert_equal(1, team.points)\n end",
"def point_won_by(player)\n case player\n when player1 then active_set.increment(player: 1)\n when player2 then active_set.increment(player: 2)\n end\n end",
"def num_points_scored (player_name)\n game_hash.each do |place_name, team|\n \n team[:players].each do |player|\n \n if player[:player_name] == player_name\n return player[:points]\n end\n \n end\n \n end\n\n nba_match\nend",
"def who_win\n @players.each do |player|\n result_sum = 0\n player.cards_wins.each do |cards|\n result_sum += cards.value.to_i\n end\n player.points = result_sum\n end\n players_win = @players.sort_by(&:points).reverse![0]\n puts 'GANADOR--------GANADOR---------GANADOR----'\n puts \"Nombre: #{players_win.name} || Puntos: #{players_win.points}\"\n #players_win.cards_wins.each do |cards|\n # puts cards.id\n #end\n @players.each do |player|\n puts ''\n puts player.name\n puts 'Cartas: '\n player.cards_wins.each do |cards|\n print \"#{cards.id}\"\n print ' || '\n end\n end\n end",
"def near_team_winner?(team)\n unless completed?\n sets_won(team) + 1 == min_sets_to_play\n end\n end",
"def points_in_team(team)\r\n perfs = self.performances.where(team: team)\r\n perfs.map(&:points).inject(:+) / perfs.length\r\n end",
"def beat?(team)\n my_rounds = Array.new\n their_rounds = Array.new\n\n self.round_teams.each do |round_team|\n my_rounds.push(round_team.round_id)\n end\n\n team.round_teams.each do |round_team|\n their_rounds.push(round_team.round_id)\n end\n\n intersect = my_rounds & their_rounds\n\n if (intersect.size == 0)\n # these teams have never faced each other\n return 0\n end\n \n round = Round.find(intersect[0])\n\n # the round we're looking at isn't complete, so we can't use it\n unless round.complete?\n return 0\n end\n\n my_round_team = round.round_teams.find_by_quiz_team_id(self.id)\n their_round_team = round.round_teams.find_by_quiz_team_id(team.id)\n\n logger.info('tie between...')\n logger.info(my_round_team.inspect)\n logger.info(their_round_team.inspect)\n\n if my_round_team.place > their_round_team.place\n return 1\n else\n return -1\n end\n end",
"def team_points\n return @total if @total\n # This version is implemented as a database sum operation,\n # but it cannot be eager loaded so it results in 5 more\n # database queries:\n #\n # students_projects.select(:points).sum :points\n\n # This version programmatically adds the points:\n total = 0\n students_projects.each { |s| total += s.points }\n @total = total\n total\n end",
"def mark_winner\n winning_team = teams.reject{|team| team.goals < 10}.sort_by(&:goals).last\n winning_team.is_winner = true unless winning_team.nil?\n self.goals_count = teams.collect(&:goals).inject(&:+)\n\n if rating_pending? && !Game.before(self).with_rating_pending.exists?\n set_ratings\n end\n return true\n end",
"def homeTeamPoints\n teamSelect(\"Brooklyn Nets\")[:players].collect do |name, stats|\n stats[:points]\n end\nend",
"def recalculate_points\n # First, clear the points for all users and add any winners_tips points.\n users = User.all\n users.each do |u|\n u.points = 0\n if u.admin?\n # If we don't do this, there is a risk that we get the key and not \"the other\" winners_tip\n u.winners_tip = WinnersTip.where(:user_id => u.id, :key => false).first\n end\n if u.winners_tip\n u.points = u.winners_tip.points\n end\n u.save\n end\n\n # Loop through all games and add the points\n games = Game.all\n games.each do |game|\n if game.final? then\n tips = game.tips\n tips.each do |tip|\n tip.user.points += tip.points\n tip.user.save\n end\n end\n end\n end",
"def record_won_set!\n reset_points\n reset_game_points \n \n @set_points +=1\n end",
"def league_point_calculator\n\n\tleague_hash = Hash.new\n\n\twhile true\n\n\t\tputs \"\\nWhat is the name of the home team?\"\n\t\thome_team_name = gets.chomp.capitalize\n\n\t\twhile true \n\t\t\tputs \"\\nWhat did #{home_team_name} score?\"\n\t\t\thome_team_score = gets.chomp\n\n\t\t\t# make sure the score is an interger\n\n\t\t\tif home_team_score.to_i.to_s == home_team_score\n\t\t\t\tbreak\n\t\t\telse\n\t\t\t\tputs \"Please enter an interger score value.\"\n\t\t\tend\n\t\tend\n\n\t\tputs \"\\nWhat is the name of the away team?\"\n\t\taway_team_name = gets.chomp.capitalize\n\n\t\twhile true \n\t\t\tputs \"\\nWhat did #{away_team_name} score?\"\n\t\t\taway_team_score = gets.chomp\n\n\t\t\t# make sure the score is an interger\n\n\t\t\tif away_team_score.to_i.to_s == away_team_score\n\t\t\t\tbreak\n\t\t\telse\n\t\t\t\tputs \"Please enter an interger score value.\"\n\t\t\tend\n\t\tend\n\n\t\thome_team_league_points = 0\n\t\taway_team_league_points = 0\n\n\t\t#Compare game scores to detemine earned league points for that game\n\n\t\tif home_team_score > away_team_score\n\t\t\thome_team_league_points += 3\n\t\telsif home_team_score < away_team_score\n\t\t\taway_team_league_points += 3\n\t\telse\n\t\t\thome_team_league_points += 1\n\t\t\taway_team_league_points += 1\n\t\tend\n\n\t\tputs \"\\nThe #{home_team_name} has #{home_team_league_points} league points from this game.\"\n\t\tputs \"The #{away_team_name} has #{away_team_league_points} league points from this game.\\n\"\n\t\t\n\t\t# Add data from game to league hash\n\n\t\tif league_hash.has_key?(\"#{home_team_name}\")\n\t\t\tleague_hash[\"#{home_team_name}\"] += home_team_league_points\n\t\telse \n\t\t\tleague_hash[\"#{home_team_name}\"] = home_team_league_points\n\t\tend\n\n\t\tif league_hash.has_key?(\"#{away_team_name}\")\n\t\t\tleague_hash[\"#{away_team_name}\"] += away_team_league_points\n\t\telse\n\t\t\tleague_hash[\"#{away_team_name}\"] = away_team_league_points\n\t\tend\n\n\t\t# Sorting the hash of league scores\t\n\n\t\tsorted_league_hash = league_hash.sort do |a,b|\n\t\t\ta.last == b.last ? a.first <=> b.first : b.last <=> a.last\n\t\tend\n\n\t\t# List the sorted league scores\n\n\t\tputs \"\\nThe current league scores are as follows:\"\n\t\tsorted_league_hash.each { |team,score| puts \"#{team} #{score}\"}\n\n\t\t# Make decision to add data for additional games\n\n\t\twhile true\n\t\t\tputs \"\\nIs there another game for which you would like to log data? (yes/no)\"\n\t\t\tresponse = gets.chomp.downcase\n\n\t\t\tif response == 'yes'\n\t\t\t\tputs \"\\n~~Please enter data for the next game~~\\n\"\n\t\t\t\tbreak\n\t\t\telsif response == 'no'\n\t\t\t\texit\n\t\t\telse\n\t\t\t\tputs \"please answer 'yes' or 'no'\"\n\t\t\tend\n\t\tend\n\tend\nend",
"def setup_winners_right_now\n # create a Hash with ongoing games\n @honorable_hash = Hash.new\n @games.each do |g|\n if g.started?\n tips = Tip.joins(:user).where(\"game_id =? and home_score = ? and away_score = ?\", g.id, g.home_score, g.away_score).order(\"users.points DESC\")\n @honorable_hash[g.id] = tips\n end\n end\n end",
"def mark_win!\n # update point tables\n if @winner && @looser\n game.point_tables.create(winner_id: winner, looser_id: looser, started_at: game.started_at, ended_at: Time.zone.now, result: 'won')\n game.update_status(Game::WIN)\n end\n\n # reset board!\n reset_board!\n\n # reset winner and looser histories!\n @winner = false\n @looser = false\n\n true\n end",
"def calculate_points\n raise \"The bracket was not loaded\" if !@loaded\n\n calculate_team_points\n calculate_player_points\n end"
] | [
"0.80077326",
"0.75322354",
"0.7514713",
"0.7442195",
"0.7394928",
"0.7331161",
"0.7277209",
"0.72668517",
"0.7235234",
"0.72152346",
"0.72013307",
"0.719529",
"0.7176918",
"0.7161972",
"0.70655936",
"0.7061958",
"0.7053167",
"0.70268846",
"0.702611",
"0.7018191",
"0.7002166",
"0.698693",
"0.69816476",
"0.6967386",
"0.68805975",
"0.68256474",
"0.6821295",
"0.6812167",
"0.6811735",
"0.6811116",
"0.6809122",
"0.67971337",
"0.67372173",
"0.672922",
"0.6648169",
"0.66213673",
"0.66126037",
"0.6601169",
"0.6593901",
"0.656966",
"0.65384424",
"0.65381944",
"0.6510649",
"0.64926434",
"0.6489654",
"0.648595",
"0.64640474",
"0.64621425",
"0.64607304",
"0.64567244",
"0.64468074",
"0.6446114",
"0.6443443",
"0.6443443",
"0.64305615",
"0.64202964",
"0.6418578",
"0.641698",
"0.64043754",
"0.6385159",
"0.63835055",
"0.6373726",
"0.6367464",
"0.6367339",
"0.636265",
"0.63563627",
"0.6352126",
"0.6352126",
"0.6352126",
"0.6352126",
"0.6352126",
"0.6352126",
"0.6352126",
"0.6352126",
"0.6346679",
"0.6338791",
"0.6337527",
"0.6328634",
"0.6324695",
"0.63213485",
"0.63206863",
"0.63153625",
"0.63112617",
"0.6310186",
"0.63027656",
"0.6289594",
"0.62867",
"0.6286233",
"0.62825054",
"0.6278292",
"0.62745994",
"0.6272213",
"0.6259408",
"0.62515855",
"0.62369215",
"0.62327695",
"0.6231164",
"0.62240934",
"0.6223963",
"0.62231",
"0.62197465"
] | 0.0 | -1 |
Obviously, the total games played is the sum of all these fields | def played
won + drawn + lost + noresult
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_score\n @all_games.map do |games|\n games[\"home_goals\"].to_i + games[\"away_goals\"].to_i\n end\n end",
"def get_total_games_played\n\t\treturn games.size\n\tend",
"def get_total_games_played\n return games.size\n end",
"def total_score\n sum = self.games.sum{|game|game.points}\n sum.to_i / self.games.count\n end",
"def total\n @frame.inject(0){|rez, item| item ? rez + item[:score] : rez }\n end",
"def rankings\n self.total_against_goals = 0\n self.total_goals = 0\n if self.players != []\n self.players.each do |player|\n if player.scores.first != nil\n Game.all.each do |game|\n unless self.total_goals.nil? || self.total_against_goals.nil? || game.scores.last.goals.nil? || game.scores.first.goals.nil?\n if game.scores.first.player == player\n self.total_goals += game.scores.first.goals\n self.total_against_goals += game.scores.last.goals\n else\n self.total_goals += game.scores.last.goals\n self.total_against_goals += game.scores.first.goals\n end\n self.save\n end\n end\n end\n end\n end\n end",
"def week_1_total\n total = 0\n rostered_players.each do |rostered_player|\n total += rostered_player.player.week_1_score\n end\n return total\n end",
"def games_played\n self.results.to_a.count\n end",
"def pays_players\n self.players.inject(0) {|sum, player| sum += player.pay}\n end",
"def total_games_by_coach_by_season\n @total_games_by_coach = Hash.new{ |hash, key| hash[key] = 0}\n @by_season_game_team_objects.each do |game_by_season|\n @total_games_by_coach[game_by_season[\"head_coach\"]] += 1\n end\n end",
"def fielding_total\n self.rating_6 +\n self.rating_7 +\n self.rating_8 +\n self.rating_9 +\n self.rating_10 +\n self.rating_11 +\n self.rating_12 +\n self.rating_13 +\n self.rating_14\n end",
"def total_point(team)\n team[:players].collect { |player| player[:points] }.sum\nend",
"def game_value(cards)\n sum = 0\n cards.each do |card|\n sum += card.game_value\n end\n sum\nend",
"def games_played\n games.size\n end",
"def games_played\n games.size\n end",
"def total\n wins + losses\n end",
"def calculate_score(team)\n scores.includes(:wattball_player).where(:wattball_players => {:team_id => team}).sum(:amount) \n end",
"def wins\n wins = 0\n self.teams.each do |team|\n wins += team.games_won.length\n end\n wins\n end",
"def total_rounds\n self.count_wins + self.count_losses\n end",
"def pays_players_week\n self.players.inject(0) {|sum, player| sum += player.pay_week}\n end",
"def total_score\n plays.inject(0) { |sum, word| sum + Scoring.score(word) }\n end",
"def total_score\n\t\t0 + score_one.to_i + score_two.to_i + score_three.to_i + score_four.to_i\n\tend",
"def getPlayTotal()\n\ttotal = 0\n\ti = 0\n\twhile i < $playerCards.length\n\t\tx = $playerCards.at(i)\n\t\tif x == 1\n\t\t\t$playerSoft = true\n\t\tend\t\n\t\ttotal = total + x\n\t\ti += 1\n\tend\n\treturn total\nend",
"def player_hand_total\n players_hand.inject(0) {|sum, card| sum + card.value}\n end",
"def calculate_score\n #set default user score value to 0 in the database but to prevent any errors and remove database dependencies i am including this line in the model as well\n score || 0\n self.games.each do |game|\n score+=game.points\n end\n score\n end",
"def total_points\n\n points = 0\n wattball_matches_as_team1.each do |match|\n points += match.points(1) || 0\n end\n\n wattball_matches_as_team2.each do |match|\n points += match.points(2) || 0\n end\n\n points\n end",
"def get_total_score\n\t\tquestion_scores = Question_score.for_game_record(self.id)\n\t\tscore = 0\n\t\tquestion_scores.length.times do |i|\n\t\t\tscore += question_scores[i].score\n\t\tend\n\t\tscore\n\tend",
"def sum_total_playing_time\n sum_total = 0 \n self.lib.songs.each do |song|\n sum_total += (song.metadata['total_time'].to_i)/1000\n end\n hour_total = ((sum_total)/3600)\n puts \"The total playing time is #{hour_total} hour\" #converts to hours\n ((sum_total)/3600)\n end",
"def matchup_count(season = 2015)\n r = Record.find_by(team_id: self.id, year: season)\n r.wins + r.losses + r.ties\n end",
"def total_score\n return @plays.reduce(0) { |memo, word| memo + Scrabble::Scoring.score(word) }\n end",
"def total_score(play)\n sum = 0;\n play.decision_array.each_with_index{|v, i|\n sum += 1 if v == decision_array[i] && i != 0 # exclude an example\n }\n sum\n end",
"def total_goals\n Score.joins(:player).where(players: { user_id: self.id }).count\n end",
"def get_sum_frame()\n sum = 0\n @frames.each do |frame|\n if !frame.score.nil?\n sum += frame.score\n end\n end\n sum\n end",
"def get_total_score\n scores.map(&:score).sum\n end",
"def total_score\n Scrabble::Scoring.make_array_of_scores(@plays_array)\n @total_score_instance = Scrabble::Scoring.return_array_of_scores.inject(0, :+)\n end",
"def total\n sum = 0\n hand.each do |card|\n sum += card.find_face_value\n end\n sum = correct_for_aces(sum)\n end",
"def total_score\n total_score = 0\n plays.each do |word|\n total_score += Scrabble::Scoring.score(word)\n end\n return total_score\n end",
"def sum_bets() \n\t\t@sum = 0\n\t\t#loop through players array\n\t\tfor i in 0...@num_players\n\t\t\t@sum += @players[i].bet\n\t\tend\n\t\treturn @sum\n\tend",
"def total (player=nil, mods=nil)\n player ||= belongs_to_player\n mods ||= modifiers(player)\n base_value + mods\n end",
"def total_runs_by_teams(table_of_teams)\n hash_of_teams = Hash.new(0)\n table_of_teams.each do |table_row|\n hash_of_teams[table_row['batting_team']] += table_row['total_runs'].to_i\n end\n hash_of_teams['Rising Pune Supergiants'] += hash_of_teams['Rising Pune Supergiant']\n hash_of_teams.delete('Rising Pune Supergiant')\n hash_of_teams\nend",
"def goals(player_id)\n Stat.where(player_id: player_id).sum(:goals)\n end",
"def team_points\n return @total if @total\n # This version is implemented as a database sum operation,\n # but it cannot be eager loaded so it results in 5 more\n # database queries:\n #\n # students_projects.select(:points).sum :points\n\n # This version programmatically adds the points:\n total = 0\n students_projects.each { |s| total += s.points }\n @total = total\n total\n end",
"def score_game\n self.score = frames.reduce(0) { |sum, frame| sum + score_frame(frame) } \n end",
"def played_count\n @ole.PlayedCount\n end",
"def goals_against()\n\t self.as_regular_contestants.select{|c| c.opponent.score}.collect{|c| c.opponent.score}.inject{|gf, c| gf + c} || 0\n\tend",
"def games_played\n @games_played = @games_played += 1\n end",
"def average_goals_per_game\n total_goals = @teams.map {|team| team.total_goals_scored}.sum\n total_games = @teams.map {|team| team.home_games}.sum\n (total_goals.to_f / total_games.to_f).round(2)\n end",
"def score\n total = 0\n achievements.each do |a|\n total += a.task.score\n end\n total\n end",
"def game_score\n previous_hands = self.game_player.hand_players.joins(:hand).where(\n \"hands.position <= ?\", self.hand.position\n )\n gs = 0\n for h in previous_hands\n gs += h.hand_score\n end\n return gs\n end",
"def totalWickets\n if (self.bowlingStats.sum(\"wickets\")[self.name.to_s] != nil) then\n self.bowlingStats.sum(\"wickets\")[self.name.to_s]\n else\n \"\"\n end\n end",
"def player_win_percentage\n (games_won/user_games)\n end",
"def total\n tot = 0\n for card in @cards\n tot += card.value\n end\n if has_ace and tot < 12\n tot2 = tot + 10\n if @stand\n return tot2\n else\n return [ tot, tot2 ]\n end\n else\n return tot\n end\n end",
"def games(meeting, record)\n meeting.each do |play|\n if play[:home_score].to_i > play[:away_score].to_i\n record[play[:home_team]][\"W\"] += 1\n record[play[:away_team]][\"L\"] += 1\n else play[:home_score].to_i < play[:away_score].to_i\n record[play[:away_team]][\"W\"] += 1\n record[play[:home_team]][\"L\"] += 1\n end\n end\n record\nend",
"def mot_m_total(params = { season: Date.current.year })\n if params[:season]\n (mot_m_firsts.select { |x| x.match.season == params[:season] }.length * 3) + (mot_m_seconds.select { |x| x.match.season == params[:season] }.length * 2) + (mot_m_thirds.select { |x| x.match.season == params[:season] }.length * 1)\n else\n (mot_m_firsts.select { |x| x.match_id.in? [params[:match_id]].flatten }.length * 3) + (mot_m_seconds.select { |x| x.match_id.in? [params[:match_id]].flatten }.length * 2) + (mot_m_thirds.select { |x| x.match_id.in? [params[:match_id]].flatten }.length * 1)\n end\n end",
"def total_num_assignment_teams\n assignment_team_counts.inject(:+)\n end",
"def hitting_total\n self.rating_19 +\n self.rating_20 +\n self.rating_21 +\n self.rating_22 +\n self.rating_23 +\n self.rating_24 +\n self.rating_25 +\n self.rating_26 +\n self.rating_27\n end",
"def point_calculator(team)\n game_hash[team][:players].reduce(0) { | memo, player |\n memo += player[:points]\n }\nend",
"def power_play_goal_percentage(seasonasstring) # power_play info in game team stat\n #find list of all games in season given by arg\n #sum all power play goals\n #sum all power play oppertunities\n #divide line 146 and line 147\n #return total of above\n end",
"def average_goals_by_season\n goals_by_season = @games.group_by { |game| game.season.to_s }\n goals_by_season.each do |season, games|\n season_goals = games.map { |game| game.home_goals + game.away_goals }.sum\n goals_by_season[season] = (season_goals.to_f / games.count.to_f).round(2)\n end\n end",
"def hitter_totals\n totals = {\"h\" => 0, \"ab\" => 1}\n Hitter.team_view(self).reduce.group_level(2).rows.each do |obj|\n totals[obj[\"key\"][1]] = obj[\"value\"]\n end\n # now correct for the averages\n totals[\"avg\"] = (totals[\"h\"]/totals[\"ab\"].to_f).round(3)\n totals\n end",
"def total_workout_calories\n set_sport_by_user.sum(:burned_calories) || 0\n end",
"def total; end",
"def get_alternative_total_score()\n # TODO The method get_total_score() above does not seem correct. Replace with this method.\n total_score = 0\n\n self.scores.each { |score| total_score = total_score + score.score }\n\n total_score\n end",
"def total_matches_played\n count = 0\n\n matches.each do |match|\n unless match.finalized_date == nil \n count += 1\n end\n end\n\n count\n end",
"def score\n populate_frames.inject(0) {|a,v| a+ v.frame_total}\n end",
"def total_sum()\n return self.work_packets.sum( :worked_hours )\n end",
"def total_team_score(teams_id)\n total_score = 0\n @league_data.each do\n |team| \n # binding.pry\n if team.home_team_id == teams_id\n total_score += team.home_team_score\n elsif team.away_team_id == teams_id\n total_score += team.away_team_score\n end\n end\n return total_score\n end",
"def total\n total_time = 0.0\n each { |record| total_time += record[:time] }\n total_time\n end",
"def add_points(team)\n games_played = Game.where(\"team_one = #{team.id} or team_two = #{team.id}\")\n @rankings[team.name][\"points_for\"] = 0\n @rankings[team.name][\"points_against\"] = 0\n if !games_played.nil?\n games_played.each do |game|\n if !game.winner.nil? && !game.winner_score.nil?\n if team.id == game.winner # if team won, add winner points to PF and losing points to PA\n @rankings[team.name][\"points_for\"] += game.winner_score\n @rankings[team.name][\"points_against\"] += game.loser_score\n else # if team lost, add winner points to PA and losing points to PF\n @rankings[team.name][\"points_for\"] += game.loser_score\n @rankings[team.name][\"points_against\"] += game.winner_score\n end\n end\n end\n end\n end",
"def total_points(competitor)\n scores = competitor.scores.map(&:total).compact\n\n scores.reduce(:+) # sum the values\n end",
"def total\n #use group matches instead of numFound for grouped response\n if response[:numFound].nil? \n self[:grouped][blacklight_config['index']['group']]['matches'].to_s.to_i \n else \n response[:numFound].to_s.to_i\n end\n end",
"def total\n sum(:total)\n end",
"def sum_produits_used\n sum = 0\n self.protofactures.each { |p| sum += p.prix_unit * (p.quantite - p.stock) }\n sum\n end",
"def total\n count = 0\n self.total_time_exercise_workouts.each do |ex|\n count += ex.duration\n end\n count\n end",
"def total_cost\n total = 0\n memberships.each do |membership|\n total += membership.cost\n end\n total\nend",
"def live_bets_total\n (self.live_bets.map {|bet| bet.amount }).sum\n end",
"def get_player_total(player_hand)\n\tplayer_total = 0 \t\t# Total value of player's hand\n\n\tfor i in 0..player_hand.length - 1\n\t\tplayer_total += $cards[player_hand[i]]\n\tend\n\treturn player_total\nend",
"def score_calc\n\t\tif self.saturday.blank?\n\t\t\tscore = 0\n\t\telse\n\t\t\tscore = self.saturday + self.hobby + self.major + self.sleep + self.music\t\n\t\tend\n\t\treturn score\n\tend",
"def total_wins_by_season_by_team_id(passed_id)\n @by_team_id_game_objects.each do |game|\n if helper_for_win_count(passed_id, game)\n @total_wins_by_season[game[\"season\"]] += 1\n elsif helper_for_loss_count(passed_id, game)\n @total_wins_by_season[game[\"season\"]] += 0\n end\n end\n end",
"def battlers_number\n return @battlers_number.sum\n end",
"def its_a_tie game\n game.each do |team|\n team_standings = get_team_by_name(team)\n team_standings[:winnings] += 1\n end\nend",
"def money_total(people)\n count = 0\n people.each do |person|\n count += person[:monies] \nend\nreturn count\nend",
"def total\n sum = 0\n\n @four_result.each do |result|\n sum += result\n end\n @six_result.each do |result|\n sum += result\n end\n @eight_result.each do |result|\n sum += result\n end\n @ten_result.each do |result|\n sum += result\n end\n @twelve_result.each do |result|\n sum += result\n end\n @twenty_result.each do |result|\n sum += result\n end\n @percentile_result.each do |result|\n sum += result\n end\n\n sum\n end",
"def increment_games_played\n self.games_played += 1\n end",
"def combined_lift_total\n clt = 0\n Membership.all.select do |membership_instance|\n if membership_instance.gym == self\n clt += membership_instance.member.lift_total\n end\n end\n clt\n end",
"def total\n roll_all.reduce(&:+)\n end",
"def score\n @cards.map(&:value).inject(:+)\n end",
"def played_games\n Game.joins(:players).where(status: Game::STATUS_ENDED, players: { user_id: self.id }).count\n end",
"def calculate!\n ov = self[:overall]\n ov[:high_night] = {}\n ov[:winners] = {}\n\n self.each do |player_id, st|\n next if player_id == :overall\n\n ## calculate computed stats for player\n st[:nights] += st[:dates].keys.length # if st[:nights] == 0\n st[:high_night] = st[:dates].values.max\n st[:gold_stars] = 1 if st[:nights] == 29\n st[:warps_per_game] = 1.0 * st[:warps] / st[:games] rescue 0\n st[:warps_per_night] = 1.0 * st[:warps] / st[:nights] rescue 0\n st[:games_per_night] = 1.0 * st[:games] / st[:nights] rescue 0\n st[:wins_per_night] = 1.0 * st[:wins] / st[:nights] rescue 0\n st[:wins_per_game] = 1.0 * st[:wins] / st[:games] rescue 0\n\n ## accumulate overall stats\n [:warps, :wins, :cfbs,\n :mystery_factors, :gold_stars]. each do |field|\n ov[field] += st[field]\n end\n [:wimps, :come_ons].each do |field|\n if st[field]\n ov[field] ||= 0\n ov[field] += st[field]\n end\n end\n # nights won calculation\n st[:dates].each do |date,warps|\n ov[:dates][date] += warps\n hnd = ov[:high_night][date] ||= {:players => [], :warps => 0}\n if hnd[:warps] < warps\n hnd[:players] = [player_id]\n hnd[:warps] = warps\n elsif hnd[:warps] == warps\n hnd[:players].push(player_id)\n end\n end\n end\n\n ## update overall computed stats\n st = self[:overall]\n ov[:games] = ov[:wins]\n ov[:nights] = ov[:dates].keys.length\n ov[:nights] = 29 if ov[:nights] == 0 ## provide sane default\n ov[:nights] = ov[:nights_real] if ov[:nights_real]\n ov[:warps_per_game] = 1.0 * ov[:warps] / ov[:games] rescue 0\n ov[:warps_per_night] = 1.0 * ov[:warps] / ov[:nights] rescue 0\n ov[:games_per_night] = 1.0 * ov[:games] / ov[:nights] rescue 0\n ov[:high_night].each do |date,h|\n h[:players].each {|p| self[p][:nights_won] += 1}\n end\n\n ## determine per-stat winners\n # fuck everyone but the top 50 OR those with 50+ warps\n # the 51 below is not a bug\n sorted_players = self.keys.sort{|a,b| self[b][:warps] <=> self[a][:warps]}\n fifty_plus = self.keys.select{|p| self[p][:warps] >= 50}\n eligible = (sorted_players[0..51] | fifty_plus).\n inject(Hash.new(false)) {|acc,p| acc.merge(p => true)}\n [:warps, :games, :nights, :wins, :nights_won, :cfbs,\n :come_ons, :wimps, :warps_per_game, :warps_per_night,\n :games_per_night, :wins_per_game, :high_night].each do |field|\n owf = ov[:winners][field] = {:players => [], :value => 0}\n self.each do |player, st|\n next if player == :overall\n next unless eligible[player]\n if st[field].to_f > owf[:value]\n owf[:players] = [player]\n owf[:value] = st[field]\n elsif st[field] == owf[:value]\n owf[:players].push(player)\n end\n end\n end\n\n ## mark per-stat winners\n ov[:winners].each do |field, win|\n win[:players].each do |player|\n self[player][:winner][field] = true\n end\n end\n\n self\n end",
"def winning_team\n home_team_sum = 0\n away_team_sum = 0\n game_hash.each do |team, team_stats|\n if team_stats[:team_name] == \"Brooklyn Nets\"\n team_stats[:players].each do |player_stats|\n home_team_sum += player_stats[:points]\n end\n elsif team_stats[:team_name] == \"Charlotte Hornets\"\n team_stats[:players].each do |player_stats|\n away_team_sum += player_stats[:points]\n end\n end\n end\n if home_team_sum > away_team_sum\n game_hash[:home][:team_name]\n elsif home_team_sum < away_team_sum\n game_hash[:away][:team_name]\n end\nend",
"def get_total_score\n total_score = 0\n \n self.map.questionnaire.questions.each{\n | question |\n item = Score.find_by_response_id_and_question_id(self.id, question.id)\n if(item != nil)\n total_score += item.score\n end\n } \n return total_score \n end",
"def total_owed\n self.appointments.sum(:cost)\n end",
"def total_value_all_rooms\n total = 0\n rooms.each do |room|\n total = total + room.total_value_in_room() # calling from room.rb\n end\n total # explicit return\n end",
"def total_score\n\t\t@array = []\n\t\tself.attributes.each do |key, value|\n\t\t\tif key.to_s =~ /^score/\n\t\t\t\t@array << value\n\t\t\tend\n\t\tend\n\t\tunless @array ==[]\n\t\t\treturn @array.reduce(:+)\n\t\telse\n\t\t\treturn 0\n\t\tend\n\tend",
"def num_games win_condition\n total_games = 0\n @game_objects.each do |game|\n total_games += 1 if game_meets_win_cond?(win_condition, game)\n end \n total_games\n end",
"def total\n @total ||= (\n tally = 0\n each do |w|\n tally += w.count\n end\n tally\n )\n end",
"def total\n order_pots.sum(&:total)\n end",
"def get_cout_total_passages\n\t sum = 0\n\t self.putoparcelles.each do |putoparcelle|\n \t\tsum += putoparcelle.pulve.get_cout_total_passage_col(self)\n end\n sum\n end",
"def sum_player_hand(player_hand)\n player_hand.reduce(:+)\n end",
"def total_score \n \t\t@scores_array.reduce(0, :+) \n\tend",
"def num_points_scored(player_name)\npoints_scored = 0\ngame_hash.each do |location, team_data|\n team_data.each do |attribute, data|\n if attribute == :players\n data.each do |player, stats|\n if player == player_name\n points_scored = stats[:points]\n end\n end\n end\n end\nend\npoints_scored\nend"
] | [
"0.76981086",
"0.71927625",
"0.7177062",
"0.71528816",
"0.7102181",
"0.6993223",
"0.69243276",
"0.68603474",
"0.6849289",
"0.6842429",
"0.6825658",
"0.682369",
"0.6769944",
"0.675196",
"0.675196",
"0.6735985",
"0.67330164",
"0.67013216",
"0.6686416",
"0.6671171",
"0.66670597",
"0.6661505",
"0.6657555",
"0.6651148",
"0.6646435",
"0.6628534",
"0.6573693",
"0.6570456",
"0.6562948",
"0.65592796",
"0.65267175",
"0.6516479",
"0.6512215",
"0.650836",
"0.6494521",
"0.6488885",
"0.64726025",
"0.6456043",
"0.64540786",
"0.6426316",
"0.6393931",
"0.63914686",
"0.6380973",
"0.6362966",
"0.63621527",
"0.6356233",
"0.63353384",
"0.6323339",
"0.63180286",
"0.6311098",
"0.62966037",
"0.62753975",
"0.6259335",
"0.6249072",
"0.6238508",
"0.62359536",
"0.62358093",
"0.6231462",
"0.62313974",
"0.6223894",
"0.6216797",
"0.61995083",
"0.61906093",
"0.6183614",
"0.6166011",
"0.6162801",
"0.61626536",
"0.61604327",
"0.615691",
"0.61530864",
"0.61487347",
"0.61453253",
"0.61448014",
"0.61431324",
"0.6139293",
"0.6138741",
"0.61384183",
"0.6137465",
"0.6135672",
"0.6131129",
"0.6117917",
"0.6108383",
"0.61077446",
"0.6105827",
"0.60926884",
"0.6091713",
"0.6089366",
"0.6077124",
"0.6075366",
"0.6073677",
"0.60736054",
"0.6072513",
"0.6068808",
"0.6066891",
"0.6061153",
"0.6056698",
"0.6052929",
"0.60459065",
"0.60404015",
"0.6037885",
"0.6030765"
] | 0.0 | -1 |
TODO: Dry this out? | def hashify_attributes(attrs)
Hash.new.tap{ |h| attrs.each{|a| h[a] = self.send(a)} }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def probers; end",
"def schubert; end",
"def formation; end",
"def from; end",
"def from; end",
"def from; end",
"def from; end",
"def terpene; end",
"def suivre; end",
"def refutal()\n end",
"def anchored; end",
"def offences_by; end",
"def berlioz; end",
"def weber; end",
"def next() end",
"def next() end",
"def stderrs; end",
"def identify; end",
"def custom; end",
"def custom; end",
"def r; end",
"def r; end",
"def verdi; end",
"def implementation; end",
"def implementation; end",
"def loc; end",
"def loc; end",
"def loc; end",
"def wrapper; end",
"def intensifier; end",
"def parslet; end",
"def parslet; end",
"def parslet; end",
"def parslet; end",
"def original_result; end",
"def internal; end",
"def probers=(_arg0); end",
"def same; end",
"def first; end",
"def first; end",
"def who_we_are\r\n end",
"def trd; end",
"def returns; end",
"def operations; end",
"def operations; end",
"def internship_passed; end",
"def extra; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def reflector; end",
"def reflector; end",
"def apply\n\t\t\n\tend",
"def apply\n\t\t\n\tend",
"def sitemaps; end",
"def villian; end",
"def isolated; end",
"def isolated; end",
"def used?; end",
"def rassoc(p0) end",
"def malts; end",
"def next!() end",
"def reflection; end",
"def reflection; end",
"def bs; end",
"def getc() end",
"def getc() end",
"def getc() end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def result_of_setting; end",
"def offences_by=(_arg0); end",
"def sld; end",
"def spec; end",
"def spec; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def ibu; end",
"def missing?; end",
"def issn; end",
"def missing; end"
] | [
"0.73693305",
"0.6457921",
"0.6457921",
"0.6457921",
"0.6457921",
"0.6450268",
"0.6258655",
"0.5886513",
"0.58109814",
"0.58109814",
"0.58109814",
"0.58109814",
"0.5784649",
"0.5783519",
"0.5776211",
"0.57637244",
"0.5750126",
"0.5741367",
"0.57211703",
"0.5720632",
"0.5720632",
"0.57093304",
"0.569514",
"0.5692783",
"0.5692783",
"0.5677781",
"0.5677781",
"0.56706333",
"0.56510377",
"0.56510377",
"0.5649611",
"0.5649611",
"0.5649611",
"0.562812",
"0.56256354",
"0.5583225",
"0.5583225",
"0.5583225",
"0.5583225",
"0.5582669",
"0.5578668",
"0.5561062",
"0.55474114",
"0.55449903",
"0.55449903",
"0.5512934",
"0.549924",
"0.5497521",
"0.54953307",
"0.54953307",
"0.5487791",
"0.5472083",
"0.54708976",
"0.54708976",
"0.54708976",
"0.54708976",
"0.54708976",
"0.54708976",
"0.54708976",
"0.54708976",
"0.5467665",
"0.5467665",
"0.5436362",
"0.5436362",
"0.54314977",
"0.5431036",
"0.5427741",
"0.5427741",
"0.54139435",
"0.5413745",
"0.5404559",
"0.5398124",
"0.5395114",
"0.5395114",
"0.5392021",
"0.5387672",
"0.5387672",
"0.5387672",
"0.53868365",
"0.53868365",
"0.53868365",
"0.53868365",
"0.53868365",
"0.53868365",
"0.53868365",
"0.53868365",
"0.53839785",
"0.53836375",
"0.53612053",
"0.5353752",
"0.5353752",
"0.5348692",
"0.5348692",
"0.5348692",
"0.5348692",
"0.5348692",
"0.5348692",
"0.5341923",
"0.532452",
"0.5321386",
"0.53172725"
] | 0.0 | -1 |
Thank you, Euclid of Alexandria. | def prime_factorization(min_div)
list = []
min_div.prime_division.each{|arr| arr[1].times {list << arr[0]}}
powers = list.reverse.map{|i| i - 1}
list = Prime.take(list.size)
list.map.with_index{|_, idx| list[idx] ** powers[idx]}.inject(:*)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def thankyou\n end",
"def thankyou\n end",
"def thank_you\n end",
"def thank_you\n end",
"def thank_you\n end",
"def thanks\n end",
"def congrats\n\t\tp \"Congrats on Guessing the Word\"\n\tend",
"def submission_confirmation(nominee_conf, client_conf, award_level_conf)\n puts \"You have successfully nominated: #{nominee_conf}\"\n puts \"Client: #{client_conf} and Level of Influence: #{award_level_conf}\"\n puts \"If this is incorrect, please refresh and try again.\"\nend",
"def greeting_hello\n answer_with_message(\"Halo bos, ada yang bisa saya bantu ?\")\n end",
"def thanks(email, name)\n @name = name\n @email = email\n mail to: email, subject: \"Uva Guayacanes\"\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 goodbye\n puts \"Goodbye, thankyou for banking with AAB\".yellow\n end",
"def congratulations\n arter = Artii::Base.new\n puts arter.asciify(\"Congratulations!\")\n arter = Artii::Base.new\n puts arter.asciify(\"You have earned #{$wallet.wallet} spa points.\")\nend",
"def thanks\n RequestMailer.thanks\n end",
"def new_completed(questions, user)\n @user = User.last\n @responses = @user.responses\n @questions = questions\n mail( :to => \"[email protected]\",\n :cc => \"[email protected]\",\n :subject => \"Coding Challenge Submission\" )\n end",
"def confirm(user)\n @greeting = \"Hi\"\n @user = user\n\n mail to: user.email, subject: 'Welcome to Hikultura!'\n end",
"def confirm_msg\n amt = CalcTotal::get_amt\n msg = amt && amt > 0 ? \"Your credit card \" : \"Your order \"\n msg += \"will be processed. Would you like to proceed?\"\n end",
"def confirm\n puts \"#{@gre}[ok] #{@lastMsg}. #{@ncl}\"\n end",
"def thank_you\n user = session[:user]\n user.zip = params[:zip]\n \n start_date = Date.today\n start_date += 61\n \n response = create_autorrecuring_subscription(start_date, user, params[:card_number], params[:month], params[:year], \n params[:cvc], params[:card_type], params[:city], params[:state],\n params[:billing_address_1], params[:billing_address_2])\n if response.success?\n session[:errors] = nil\n session[:user] = nil\n user.arb_subscription_id = response.subscription_id\n user.arb_status = AuthorizeNet::ARB::Subscription::Status::ACTIVE\n user.billing_information_id = user.add_billing_information(params[:fullname], params[:billing_address_1] ,\n params[:billing_address_2], params[:city], params[:state],\n params[:zip]).id\n user.save\n else\n puts \"Failed to make purchase. \" + response.response_reason_code + \" - \" + response.response_reason_text\n user.errors.clear()\n user.errors.add(:transaction, response.response_reason_text)\n session[:errors] = user.errors\n redirect_to admin_signup_step3_path\n end \n\n \n end",
"def confirm\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def profile_completion_thankyou(user_id)\n @user = User.find(user_id)\n\n mail :to => recipient(@user.email), :subject => \"25c Profile Completed!\"\n end",
"def thanks\n \t@suggested_article = SuggestedArticle.new(name: 'Emanuel', email: '[email protected]', body: 'Sugestão de artigo')\n SuggestedArticleMailer.thanks(@suggested_article)\n end",
"def confirmacionordenmesexp\n RemisorOrdenesCompraMailer.confirmacionordenmesexp\n end",
"def thats_all\n\t puts \"\"\n\t puts \"\"\n\t puts \"Thanks for using Grocery List 3000!\"\n\t puts \"\"\n puts \"\"\n\tend",
"def pregnancy_to_confirm\n # TODO: add (Just to confirm) . . . if participant known to be pregnant\n \"A\"\n end",
"def thankyou_email(user)\n @user = user\n @url = `http://Sock-o-Rama.com/`\n mail(to: @user.email, subject: `Thank you for shopping at Sock-o-Rama`)\n # mail - The actual email message, we are passing the :to and :subject headers in\n end",
"def response(enquiry)\n @greeting = \"Hi\"\n @enquiry = enquiry\n mail(to:@enquiry.email, subject:\"Thankyou for your enquiry\")\n end",
"def say_goodbye\r\n goodbye = \"Thanks for playing the Virtual Crazy 8-Ball game!\\n\\n\" +\r\n \"By Corey Hicks\\n\" +\r\n \"https://www.bruin.bellevue.edu\"\r\n puts goodbye\r\n end",
"def thanks_email( user_email )\n @greeting = \"Thanks for contacting us!\"\n\n mail to: user_email\n end",
"def goodbye\n puts Rainbow(\"Thanks for visiting. Goodbye...\").indianred.bright.underline\n end",
"def starter_confirm(recipient)\n @starter = recipient\n @url = \"http://www.harpuun.com\"\n mail(:to => \"#{recipient.email}\", :subject => \"Thanks for Signing Up!\" )\n end",
"def show_thank_you\n mail to: @guest.email, subject: \"We hope you enjoyed the show\"\n end",
"def contact()\n\t\t\"Please contact #{full_name()} via #{email}\"\n\tend",
"def coach_answer(your_message)\n # TODO: return coach answer to your_message\n if your_message[-1] == \"?\" then puts \"Silly question, get dressed and go to work !\"\n else puts \"I don't care son, get dressed and go to work !\"\n end\nend",
"def request_for_agreement(name, email, token)\n @token = token\n @name = name\n\n subject = 'Signature request: Columbia Academic Commons participation agreement'\n mail(to: email, subject: subject)\n end",
"def ep_notify(form_answer_id, collaborator_id)\n @form_answer = FormAnswer.find(form_answer_id).decorate\n @user = @form_answer.user.decorate\n collaborator = User.find(collaborator_id)\n\n @current_year = @form_answer.award_year.year\n @subject = \"King's Awards for Enterprise Promotion: Thank you for your nomination\"\n\n send_mail_if_not_bounces ENV['GOV_UK_NOTIFY_API_TEMPLATE_ID'], to: collaborator.email, subject: subject_with_env_prefix(@subject)\n end",
"def tie_with_bj_insurance\n self.chips += 3 * self.bet_chips\n self.is_complete = true\n \"Dealer hit Blackjack. #{name} hit Blackjack too! A push for #{name}.\n #{name} bought an insurance. Pay 2 times of insurance.\"\n end",
"def say_goodbye\r\n\t\tgoodbye = \"Thanks for playing the Virtual Crazy 8-Ball game! \\n\\n\" +\r\n\t\t\"Student: T. J. Flesher \\n\\nhttp://www.bellevue.edu/\"\t\t\r\n\t\tputs goodbye\r\n\tend",
"def contactus\r\n end",
"def thanks\n ContactMailer.thanks\n end",
"def print_welcome_message\n puts \"\\nThank you for using this amazing command line bowling scorecard, good luck!\\n\"\n end",
"def display_credits\r\n \r\n Console_Screen.cls #Clear the display area\r\n \r\n #Thank the player and display game information\r\n puts \"\\t\\tThank you for taking the Trivia QUIZ.\\n\\n\\n\\n\"\r\n \r\n\r\n end",
"def insertCoins (email)\r\n puts \"How many coins do you wish to credit: \"\r\n coins = gets.chomp.to_f\r\n @BetESS.fCreditCoinsTo(email,coins)\r\n puts \"The amount of coins in your account is: #{@BetESS.fGetBetESSCoinsFrom(email)}\"\r\n end",
"def claim_your_reward\n InviteMailer.claim_your_reward\n end",
"def greeting\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\", subject: 'Invitation to Allianz Community'\n end",
"def ask\n if @help_request.valid?\n MyousicaMailer.deliver_help_request(@help_request)\n flash[:notice] = \"Thanks for contacting us! Your question has been sent to our help desk, you'll receive a reply in few hours.\"\n else\n flash[:error] = \"Your help request could not be sent. Please correct the errors and try again!\"\n end \n\n params[:return_to] ? redirect_to(:action => 'show', :id => params[:return_to]) : redirect_to(:action => 'index')\n end",
"def thank_user( from_email, to_email )\n subject = \"Thank you for requesting an invite\"\n mail(\n to: to_email,\n from: from_email,\n subject: subject\n )\n end",
"def welcome_email(payment)\n @payment = payment\n @url = generate_url(User.find_by_email(@payment.email))\n loaner_email = User.find(@payment.user_id).email\n\n mail(:to => @payment.email, :subject => \"Yo, you owe some money!\", :cc => loaner_email)\n end",
"def award; end",
"def approve\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def welcome_confirmation_donor(user)\n if Rails.env.development?\n bcc = \"[email protected], [email protected]\"\n else\n bcc = \"[email protected]\"\n end\n\n @name = \"#{user.first_name}\" + \" #{user.last_name}\"\n @email = user.email\n @host = ActionMailer::Base.default_url_options[:host]\n unless @email.empty?\n mail to: @email, bcc: bcc,subject: \"Welcome To URUUT\"\n end\n end",
"def congrats_champion(champion)\n puts \"Congratulations #{champion}! You are the Rock Paper Scissors Champion!\"\n end",
"def congrats_champion(champion)\n puts \"Congratulations #{champion}! You are the Rock Paper Scissors Champion!\"\n end",
"def confirm(blank)\n @blank = blank\n if @blank.apply_type == \"ex_apply\"\n mail(to: @blank.email,\n subject: \"您的参展申请已经审核通过\",\n from: \"[email protected]\",\n date: Time.now,\n content_type: \"text/html\",\n body: \"亲爱的参展商朋友:<br/>\n 恭喜您,您所提交的参展申请已经审核通过,请携带个人名片、身份证及以下参展确认号至展会现场媒体接待处领取参展证。\n <ul>\n <li><a href='http://121.41.26.127/stores/1'>1号馆 左边部分</a></li>\n <li><a href='http://121.41.26.127/stores/3'>9号馆上半部分</a></li>\n <li><a href='http://121.41.26.127/stores/4'>1号馆 右边部分</a></li>\n <li><a href='http://121.41.26.127/stores/5'>9号馆下半部分</a></li>\n </ul>\n 展览时间:
2015-06-25 至 2015-06-28 <br/>\n 展览地点:
深圳会展中心(1、9号馆)
<br/>\n 如果您需要更多的信息,请您同我们联络,我们希望能够在“2015中国(深圳)国际钟表展览会 ”与您见面。
主办信息:
2015中国(深圳)国际钟表展览会
电话:0755-82945180
传真:0755-82941162
通信地址:深圳市福田保税区市花路福年广场B栋302室
邮箱:[email protected]\"\n )\n else\n mail( to: @blank.email,\n subject: \"您的记者证申请已经审核通过\",\n from: \"[email protected]\",\n date: Time.now,\n body: \"亲爱的媒体朋友:\n恭喜您,您所提交的记者证申请已经审核通过,请携带个人名片、身份证及以下记者证确认号至展会现场媒体接待处领取记者证。\n\n展览时间:
2015-06-25 至 2015-06-28 \n
展览地点:
深圳会展中心(1、9号馆)
\n如果您需要更多的信息,请您同我们联络,我们希望能够在“2015中国(深圳)国际钟表展览会 ”与您见面。
主办信息:
2015中国(深圳)国际钟表展览会
电话:0755-82945180
传真:0755-82941162
通信地址:深圳市福田保税区市花路福年广场B栋302室
邮箱:[email protected]\")\n end\n end",
"def goodbye\n puts \"Thanks for using the Card Seeker. Come back soon.\"\n end",
"def bye_message\n message = \"Panacea's work is done, enjoy!\"\n say \"\\n\\n\\e[34m#{message}\\e[0m\"\n end",
"def self_intro_enquiry(*args)\n self.update_attribute(:bot_response, \"I'm Brian.\")\n return false\n end",
"def show_credits\r\n Console_screen.cls\r\n puts \"\\t\\tThank you for playing the number guessing game.\\n\\n\\n\\n\"\r\n puts \"\\n\\t\\t\\t Developed by Cameron Jordan\\n\\n\"\r\n puts \"\\t\\t\\t\\t Copyright 2020\\n\\n\"\r\n end",
"def feedback\n if correct?\n \"Correct!\"\n else\n \"Incorrect.\"\n end\n end",
"def order_budget()\n \n @greeting = \"Hi\"\n\n mail :to => \"[email protected]\", :subject => 'Pragmatic Store Order Confirmation'\n end",
"def thanks_to_vendor\n\n end",
"def splash_page_confirmation(useremail)\n @useremail = useremail\n @greeting = \"Hi\"\n\n mail(:to => useremail, :bcc => [\"[email protected], [email protected]\"], :subject => \"SpectaFresh - New Splash Page User\")\n end",
"def award\n\tend",
"def enquiry_confirmation(user_name, user_email_address)\n @customer_name = user_name.titleize\n\n mail to: user_email_address, subject: \"Customer Enuiry confirmation from My-Design\"\n end",
"def issued\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def welcome_msg\n puts\n puts \"Welcome to BlackJack (by Luis Perez)!\"\n puts \"For instructions, press i.\"\n puts \"To quit, press q.\"\n puts\n end",
"def signup_confirmation(user_name, user_email)\n @user_name = user_name\n @user_email = user_email\n mail to: user_email, subject: \"Dum dum de dum... get started with Bridled!\"\n end",
"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 all_authorized_message\n %(\n Hi. Your friendly Curry bot here. Just letting you know that all\n commit authors have become authorized to contribute.\n\n I have added the \"#{ENV['CURRY_SUCCESS_LABEL']}\" label to\n this issue so it can easily be found in the\n future.\n ).squish\n end",
"def acceptance_email ucr\n extract_variables ucr\n\n mail to: @user.email\n end",
"def donate\r\n @fund += 25\r\n puts \"Project #{@name} received a generous donation!\"\r\n end",
"def success_case\n\tputs \" - Ok #{@name}, c'est ton choix #{@answer_play}\" \n\tputs \" \"\n end",
"def candidate_updated\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def contact_confirmation(first_name,second_name,email,phone,camp,inquire_type,message)\n @first_name=first_name \n @second_name=second_name\n @email=email\n @phone=phone\n @camp=camp\n @inquire_type=inquire_type\n @message=message\n\n mail to: \"[email protected]\", subject: \"Contact \"\n end",
"def goodbye\n puts \"\", \"Thank you! Goodbye :)\"\n end",
"def contactus\n end",
"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 semiRegistered(user, secret)\n @user = user \n @greeting = \"Hi\"\n ref = \"id=\" + @user.id.to_s + \"&email=\" + @user.email\n encryptor = ::ActiveSupport::MessageEncryptor.new(secret, cipher: 'aes-256-cbc')\n @encrypt_message = encryptor.encrypt_and_sign(ref)\n mail to: @user.email, subject: 'upartner会員仮登録完了'\n end",
"def withdraw_note(addresses, publication_title) \n #send note to publication creator that the pub has been withdrawn\n #they can checkout the comments to see if there is more info about the withdraw\n \n @publication_title= publication_title \n\n mail(:to => addresses, :subject => publication_title + \" has been withdrawn.\")\n \n end",
"def send_signup_email()\n\n\t# @user = user\n\tmail( :to => '[email protected]',\n\t\t :subject => '!Thanks for signing up')\n \nend",
"def response(email)\n @greeting = \"Hi\"\n\n mail(to:email, subject:\"You received a payment\")\n end",
"def host_thank_you\n mail to: @show.host_em, subject: \"Thank you\"\n end",
"def cust_success(temp_final_thx, code, smb, customer, friend, campaign, sent)\n @temp_final_thx = temp_final_thx\n @sent = sent\n @code = code\n @smb = smb\n @customer = customer\n @friend = friend\n @campaign = campaign\n mail(:to => customer.email, :subject => campaign.final_thx_subject.gsub(/\\[Friend Full Name\\]/, friend.fullname), :from => \"#{smb.full_name} <#{smb.email}>\")\n end",
"def confirm_email(user)\n @user = user\n @confirm_url = \"http://www.yscalumni.org/confirm/\" + user.confirmation_code\n mail(:to => user.email, :subject => \"Welcome to yscalumni.org! Please confirm your email!\")\n end",
"def congratulations\n self_clear\n arter = Artii::Base.new\n puts arter.asciify(\"C o n g r a t u l a t i o n s !\")\n arter = Artii::Base.new\n puts arter.asciify(\"Y o u h a v e e a r n e d #{$wallet.wallet} s p a p o i n t s !\")\nend",
"def availableCoins (email)\r\n puts \"The amount of coins in your account is: #{@BetESS.fGetBetESSCoinsFrom(email)}\"\r\n end",
"def activation_confirmation(user)\n user_login_link(user)\n\n @greeting = \"Thank you for choosing Contractor\"\n @name = user.name\n\n mail to: user.email\n end",
"def confirmarCotizMesExp\n GeneradorCorreoMailer.confirmarCotizMesExp\n end",
"def success(user, account)\n @greeting = \"Successfully retrieved data for your account - #{account.inspect}\"\n\n mail to: user.email\n end",
"def accepted(target, question)\n @question = question\n\n mail to: target.email, subject: \"Your answer has been accepted!\"\n end",
"def agree_to_copyright\n # Check whether user agreed to our terms/conditions\n if params[:agree_to_copyright]\n session[:agree_to_copyright] = true\n # Check whether or not UVa user and redirect as appropriate\n if params[:is_uva]\n if params[:is_uva] == 'yes'\n redirect_to uva_requests_url\n else\n redirect_to public_requests_url\n end\n else\n redirect_to requests_path, :notice => 'You must indicate whether or not you are affiliated with U.Va. to continue.'\n end\n else\n redirect_to requests_path, :notice => 'You must agree to the terms and conditions to continue.'\n end\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 error_not_enough_money\n puts \"\\n ERROR: THE AMOUNT YOU REQUESTED CANNOT BE COMPOSED NOT ENOUGH MONEY. PLEASE TRY AGAIN with DIFFERENT AMOUNT\"\n end",
"def subject_for_recommand_friends_stage_1(invited_user)\n return \"#{@referrer.name} vous invite à créer votre profil sur CoursAvenue\"\n end",
"def rate_your_date\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def tanji\n @greeting = \"Hi\"\n\n mail (:to => \"[email protected]\",:subject => \"hello\")\n end",
"def feedback\n # check to see if correct is true\n if correct?\n # if correct is true return \"Correct!\"\n \"Correct!\"\n # or else return \"Incorrect.\"\n else\n \"Incorrect.\"\n end\n end",
"def submitted(talk)\n @talk = talk\n @greeting = \"your talk has been subitted\"\n\n mail to: \"[email protected]\", subject: @greeting\n end",
"def alert(annc, user)\n\t\t@greeting = annc.company.name.upcase + \" (#{annc.company.hk_ticker}) has posted an announcement at #{annc.datetime.to_formatted_s(:short)}: #{annc.message}.\"\n\t\t@url = annc.url\n\n\t\tmail to: user.email, subject: \"HK Equities Alert (#{annc.company.hk_ticker})\"\n\tend",
"def cheap(email, wine)\n @wine = wine\n #@greeting = \"Hi\"\n #@message = \"Thank you for confirmation!\"\n mail to: email, :subject => \"#{@wine}降价至#{@wine.current_price},可以入手了,还不来看看?\"\n end",
"def greet\n 'Ahoy Mateys!'\n end"
] | [
"0.69027114",
"0.69027114",
"0.67912424",
"0.67912424",
"0.67912424",
"0.6444667",
"0.6115785",
"0.6092541",
"0.59275544",
"0.58772016",
"0.5840919",
"0.58395135",
"0.583705",
"0.5804676",
"0.57943267",
"0.57858056",
"0.5777517",
"0.57756627",
"0.5774105",
"0.5761893",
"0.5726769",
"0.5698271",
"0.5684153",
"0.56764567",
"0.5673115",
"0.566378",
"0.56615347",
"0.56564426",
"0.56560796",
"0.5653897",
"0.56518894",
"0.564713",
"0.5639163",
"0.56277514",
"0.5617214",
"0.56152886",
"0.5613827",
"0.56072706",
"0.55967927",
"0.55933446",
"0.55830973",
"0.5579738",
"0.5577512",
"0.5573007",
"0.5567955",
"0.5560724",
"0.55572706",
"0.55521196",
"0.555154",
"0.55412644",
"0.554067",
"0.5537706",
"0.5537706",
"0.5531714",
"0.55239356",
"0.5517833",
"0.5516507",
"0.5515509",
"0.5511201",
"0.55095947",
"0.5503162",
"0.5493607",
"0.5492349",
"0.5491257",
"0.5488013",
"0.5485825",
"0.54724246",
"0.54712635",
"0.5471073",
"0.5465851",
"0.546467",
"0.54593676",
"0.5457452",
"0.5456857",
"0.5455175",
"0.54525846",
"0.54510593",
"0.5449498",
"0.5449488",
"0.54458755",
"0.5445103",
"0.54384816",
"0.5437787",
"0.5428387",
"0.5424181",
"0.54238707",
"0.5421714",
"0.54162127",
"0.54132175",
"0.5410736",
"0.5408069",
"0.5404446",
"0.54020125",
"0.54004943",
"0.53856933",
"0.53825504",
"0.53762424",
"0.5376221",
"0.53708625",
"0.53670067",
"0.53651756"
] | 0.0 | -1 |
PATCH/PUT /comments/1 PATCH/PUT /comments/1.json DELETE /comments/1 DELETE /comments/1.json | def destroy
@article = Article.find(params[:article_id])
@comment.destroy
redirect_to article_path(@article), notice: "Comment was successfully destroyed."
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_comments\n end",
"def destroy\n @comment.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete_comment1\n params[:comment].each { |key, value|\n comment=Comment.find(key)\n if !comment.nil?\n k comment.destroy\n end\n }\n redirect_to requirements_path\n end",
"def destroy\n @comment1 = Comment1.find(params[:id])\n @comment1.destroy\n\n respond_to do |format|\n format.html { redirect_to comment1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment = @commentable.comments.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end",
"def update\n json_update_and_sanitize(comment, comment_params, Comment)\n end",
"def update_comment\n if params[:commit]==\"Save\"\n params[:comment].each { |key, value|\n comment=Comment.find(:all, :conditions=>[\"id=?\", key])\n if !comment.empty?\n comment[0].update_attributes(:title=>value)\n end\n }\n elsif params[:commit]==\"Cancel\"\n params[:comment].each { |key, value|\n comment=Comment.find(key)\n if !comment.nil?\n comment.destroy\n end\n }\n end\n redirect_to requirements_path\n end",
"def update\n respond_to do |format|\n if @comment.update(comment_params)\n# @comment.delete_empty_notes\n @comment.set_flag(params[:flag])\n format.html { redirect_to homework_comments_url(), notice: 'Comment was successfully updated.' }\n format.js {render :index}\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n comment = Comment.find(params[:id])\n if current_user.id == comment.user_id\n post = comment.post\n post.data['comments'] = post.data['comments'] - 1\n if comment.destroy && post.save\n render json: {status: \"success\", data: {id: Integer(params[:id]), comments: post.data['comments']}}, status: :ok\n else\n render json: {status: \"failure\", data: nil}, status: 404\n end\n\n else\n render json: {status: \"failure\", data: nil}, status: 404\n end\n end",
"def update\n user = User.find_by({token: env['HTTP_TOKEN']})\n comment = user.comments.find(params[:id])\n comment.update(comment_params)\n render json: comment\n end",
"def destroy\n\n @comment.destroy\n render json: @comment, status: :ok\n\n end",
"def destroy\n if @commentable.comments.find(params[:id]).destroy\n render json: { success: true }\n end\n end",
"def update\n @comment = Comment.find(params[:id])\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.json { render :json => @comment }\n else\n format.json { render :json => @comment.errors, :status => :unprocessable_entity}\n end\n end\n #respond_with(@post,@post.comments.update(params[:id],params[:comment]))\n end",
"def destroy\n @user = UserSession.user_by_authentication_token(params[:authentication_token])\n @recipe = Recipe.find_by_id(params[:recipe_id])\n\n @comment = Comment.find_by_id(params[:id])\n\n respond_to do |format|\n if @comment.user == @user and @recipe\n @comment.destroy\n @comments = @recipe.fetch_comments\n format.json { render :json => { :comments => @comments, :message => \"success\" }}\n else\n format.json { render :json => { :message => \"failure\"}}\n end \n end\n end",
"def destroy\n\n if @comment.destroy\n\n render json: {comment: {id: params[:id].to_i}},status: :ok\n\n else\n\n render json: {error: true,errors: @comment.errors},status: :unprocessable_entity\n\n end\n\n \t\tend",
"def destroy\n @comments = Comment.where(question_id: @question.id)\n @comments.each do |comment|\n comment.destroy\n end\n @question.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n \n respond_to do |format|\n format.xml { head :ok }\n format.json { head :ok } \n end\n end",
"def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment1.destroy\n respond_to do |format|\n format.html { redirect_to comment1s_url, notice: 'Comment1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @comment = Comment.find(params[:comment_id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end",
"def update\n if @comment.update(comment_params)\n head :no_content\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @comment.update(comment_params)\n head :no_content\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n render json:@comment\n end",
"def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to project_sprint_user_story_comments_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @comment.nil?\n render json: {error: \"Not found\"}, status: :not_found\n else\n @comment.destroy\n render json: @comment, status: :ok\n\n end\n end",
"def delete_comment user\n edit_comment user, nil\n end",
"def update\n\n if @comment.update(comment_params)\n render json: @comment, status: :ok\n else\n render json: @comment.errors, status: :unprocessable_entity\n\n end\n\n\n end",
"def destroy\n @comment_complaint.destroy\n respond_to do |format|\n format.html { redirect_to comment_complaints_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n unless @comment.present?\n @comment.destroy\n end\n\n respond_to do |format|\n format.html { redirect_to admin_comments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment = Comment.find_by(id: params[:id])\n @user = @comment.user\n\n return false unless authorized_user?(@user.id)\n\n if @comment.destroy\n render 'api/comments/destroy.json.jbuilder'\n else\n render json: @comment.errors.full_messages, status: 422\n end\n\n end",
"def update\n @comment = Comment.find(params[:comment_id])\n @comment.update(comment_params)\n render json: @comment\n end",
"def destroy\n @comment.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def update\n #respond_to do |format|\n if @comment.update(comment_params)\n render json: @comment.as_json(except: [:updated_at]), status: :ok\n else\n # format.html { render :edit }\n render json: @comment.errors, status: :unprocessable_entity\n # end\n end\n end",
"def comments\n client.get(\"/#{id}/comments\")\n end",
"def destroy\n @comment = @repository.comments.find(params[:id])\n authorize @comment\n @comment.destroy\n respond_with @comment\n end",
"def update\n comment = Comment.find(params[:id])\n if comment.update(params_comment)\n render json: comment, status: 200\n else\n render json: comment.errors, status: 422\n end\n\n end",
"def comment_aux(action, opts)\n\n unless action == \"destroy\"\n\n data = LibXML::XML::Parser.string(request.raw_post).parse\n\n comment = parse_element(data, :text, '/comment/comment')\n subject = parse_element(data, :resource, '/comment/subject')\n end\n\n # Obtain object\n\n case action\n when 'create';\n return rest_response(401, :reason => \"Not authorised to create a comment\") unless Authorization.check('create', Comment, opts[:user], subject)\n\n ob = Comment.new(:user => opts[:user])\n when 'view', 'edit', 'destroy';\n ob, error = obtain_rest_resource('Comment', opts[:query]['id'], opts[:query]['version'], opts[:user], action)\n else\n raise \"Invalid action '#{action}'\"\n end\n\n return error if ob.nil? # appropriate rest response already given\n\n if action == \"destroy\"\n\n ob.destroy\n\n else\n\n ob.comment = comment if comment\n\n if subject\n return rest_response(400, :reason => \"Specified resource does not support comments\") unless [Blob, Network, Pack, Workflow].include?(subject.class)\n return rest_response(401, :reason => \"Not authorised to add a comment to the specified resource\") unless Authorization.check(action, Comment, opts[:user], subject)\n ob.commentable = subject\n end\n\n # Start of curation hack\n\n def match_tag_name(name)\n\n name.sub!(/^c:/, '')\n\n matches = []\n\n Conf.curation_types.each do |type|\n matches.push type if type.starts_with?(name)\n end\n\n return matches[0] if matches.length == 1\n end\n\n if comment[0..1].downcase == 'c:' && opts[:user] && subject &&\n Conf.curators.include?(opts[:user].username)\n\n comment = comment[2..-1].strip\n\n lines = comment.split(\"\\n\")\n events = []\n failed = false\n\n lines.each do |line|\n\n line.strip!\n\n bits = line.split(\";\")\n\n if bits.length > 1\n details = bits[1..-1].join(\";\")\n else\n details = nil\n end\n\n if bits.length > 0\n bits[0].split(\",\").each do |bit|\n\n bit.downcase!\n bit.strip!\n\n curation_type = match_tag_name(bit)\n\n if curation_type\n events.push(CurationEvent.new(:category => curation_type,\n :object => subject, :user => opts[:user], :details => details))\n else\n failed = true\n end\n end\n end\n end\n\n if failed\n return rest_response(400, :reason => 'Unrecognised curation term')\n end\n\n events.each do |event|\n event.save\n end\n\n subject.solr_index\n\n return rest_get_request(ob, opts[:user], { \"id\" => ob.id.to_s })\n end\n\n # End of curation hack\n\n success = ob.save\n\n if success\n case action\n when \"create\"; Activity.create(:subject => opts[:user], :action => 'create', :objekt => ob)\n when \"edit\"; Activity.create(:subject => opts[:user], :action => 'edit', :objekt => ob)\n end\n end\n\n return rest_response(400, :object => ob) unless success\n end\n\n rest_get_request(ob, opts[:user], { \"id\" => ob.id.to_s })\nend",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n respond_with(@post, @comment)\n end",
"def destroy\n comment_status = @comment.comment_status\n respond_to do |format|\n if [email protected]\n format.json { render :json=>report_error(@comment)}\n format.html { redirect_to @comment, :alert => 'Failure deleting comment.' }\n else\n format.json { render :json=>{}}\n end\n end\n end",
"def destroy\r\n @comment = Comment.find(obfuscate_decrypt(params[:id], session))\r\n\t\t@commentable = @comment.commentable\r\n @comment.comment_options.each do |co|\r\n co.destroy\r\n end\r\n\t\[email protected]\r\n\r\n\t\trespond_to do |format|\r\n @comment_option_lookups = CommentOptionLookup.order\r\n\t\t\tformat.html { redirect_to :back }\r\n\t\t\tformat.json { head :ok }\r\n\t\t\tformat.js\r\n\t\tend\r\n\tend",
"def update\n @comment = Comment.find(params[:id])\n authorize @comment\n if @comment.update(comment_params)\n render 'api/v1/comments/show', status: :success\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end",
"def destroy\n puts \"Inside destroy. Comment id is \"+params[:id].to_s\n #puts \"Post id is \"+params[:postid].to_s\n @comment = Comment.find(params[:id])\n @comment.destroy\n @posts = Post.find_by_id(params[:postid])\n\n respond_to do |format|\n format.html { redirect_to @posts }\n format.json { head :no_content }\n end\n end",
"def update\n authorize [:api, :v1, @requesting_object]\n ticket = ServiceTicket.where(\n client_key: params['avatar_key'],\n id: params['id']\n ).first\n if params['comment_text']\n ticket.comments << Comment.new(author: params['avatar_name'],\n text: params['comment_text'])\n end\n ticket.update(status: params['status']) if params['status']\n render json: { message: 'OK' }, status: :ok\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to post_path(@comment.post) }\n format.json { head :no_content }\n end\n end",
"def update\n @comment = Comment.find(params[:id])\n @comment.user_id = params[:user_id]\n @comment.announcement_id = params[:announcement_id]\n @comment.description = params[:description]\n @comment.save\n render json:@comment\n end",
"def destroy\n @comment10.destroy\n respond_to do |format|\n format.html { redirect_to comment10s_url, notice: 'Comment10 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def update\n if @comment.update(comment_params)\n render json: @comment, status: :ok\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n \[email protected]_recycling = true\n \n if (can? :delete, @comment)\n \tif @comment.save\n \t\trespond_to do |format|\n \t\t format.html { redirect_to it_category_content_url(@comment.content.category.it, \n \t\t @comment.content.category, @comment.content) }\n \t\t format.json { head :ok }\n \t\tend\n \tend\n \tend\n end",
"def bulk_delete_comments\n comment_ids_string = params[:ids]\n comment_ids = eval(comment_ids_string)\n\n comment_ids.each do |id|\n comment = Comment.find(id.to_i)\n if !comment.nil?\n comment.destroy\n\n end\n\n end\n\n head :no_content\n\n end",
"def update\n respond_to do |format|\n if @comment1.update(comment1_params)\n format.html { redirect_to @comment1, notice: 'Comment1 was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment1 }\n else\n format.html { render :edit }\n format.json { render json: @comment1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @comment6.destroy\n respond_to do |format|\n format.html { redirect_to comment6s_url, notice: 'Comment6 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def rm_update path, data, msg\n\n re = rm_request path, data, 'PUT'\n puts re.body\n chk (re.code!='200'), msg + \"\\n#{re.code} #{re.msg}\\n\\n\"\n return true\n\nend",
"def destroy\n @dish_comment = @dish.dish_comments.find(params[:id])\n @dish_comment.destroy\n\n respond_to do |format|\n format.html { redirect_to dish_comments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t@post = Post.find(@comment.post_id)\n\n @comment.destroy\n\[email protected]_attribute(:nComments, @post.comments.count)\n respond_to do |format|\n format.html { redirect_to @comment.post, notice: 'Comment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @doi.updates.each do |update|\n update.destroy\n end\n @doi.comments.each do |comment|\n comment.destroy\n end\n @doi.destroy\n respond_to do |format|\n format.html { redirect_to dois_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n redirect_to \"/home/index\"\n #@comment = Comment.find(params[:id])\n #respond_to do |format|\n #format.html { redirect_to comments_url }\n #format.json { head :ok }\n #end\n end",
"def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to homework_comments_url, notice: 'Comment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t\t@comment = current_user.\n\t\t\tprojects.find(params[:project_id]).\n\t\t\ttasks.find(params[:task_id]).\n\t\t\tcomments.find(params[:id]).destroy\n\n\t\trespond_to do |format|\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to post_url(@comment.post_id) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to_commentable(@comment, false) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @talk_comment = TalkComment.find(params[:id])\n @talk_comment.destroy\n\n respond_to do |format|\n format.html { redirect_to talk_comments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment.destroy\n head :no_content\n end",
"def destroy\n @comment.destroy\n head :no_content\n end",
"def destroy\n @api_v1_answer_comment.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_answer_comments_url, notice: 'Answer comment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { render :json => {:comment => @comment, :status => 200} }\n else\n format.html { render :edit }\n format.json { render :json => {:comment => @comment, :status => 400 } }\n end\n end\n end",
"def update\n @comment1 = Comment1.find(params[:id])\n\n respond_to do |format|\n if @comment1.update_attributes(params[:comment1])\n format.html { redirect_to @comment1, notice: 'Comment1 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n comment = Comment.find(params[:id])\n if comment.destroy\n render json: {destroyed: true}\n end\n end",
"def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.xml { head :ok }\n format.json { head :ok } \n else\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n format.json { render :json => @comment.errors, :status => :unprocessable_entity } \n end\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to post_comments_url, notice: \"Comment was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def refresh!\n body = get(\"/comments/#{id}.json\").body\n @comments = client.object_from_body(body[1])\n deep_merge!(body[0])\n end",
"def update\n respond_to do |format|\n if @api_v1_answer_comment.update(api_v1_answer_comment_params)\n format.html { redirect_to @api_v1_answer_comment, notice: 'Answer comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_answer_comment }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_answer_comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @comment = @posting.comments.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n #@comment.create_activity :destroy, owner: current_user\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end",
"def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to polymorphic_path([@section, @commentable, :comments]), notice: 'Comment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_comments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n\t\trespond_with @comment, :location => @comment.post\n end"
] | [
"0.6488037",
"0.6397911",
"0.63837653",
"0.63505924",
"0.6343776",
"0.6325114",
"0.6309881",
"0.63056713",
"0.62949854",
"0.62704",
"0.6251274",
"0.6248385",
"0.6245801",
"0.6245613",
"0.6227531",
"0.6170549",
"0.61679024",
"0.61625624",
"0.61625624",
"0.61625624",
"0.614001",
"0.6136947",
"0.613413",
"0.613413",
"0.613413",
"0.61211264",
"0.6119942",
"0.6119942",
"0.61190236",
"0.6117314",
"0.6109227",
"0.6107238",
"0.6107238",
"0.6107238",
"0.6107238",
"0.6107238",
"0.6107238",
"0.6107238",
"0.6107238",
"0.6107238",
"0.6107238",
"0.6107238",
"0.6107238",
"0.6107238",
"0.6107238",
"0.6107238",
"0.60966575",
"0.6076483",
"0.60736585",
"0.6063364",
"0.60555667",
"0.60331714",
"0.6030286",
"0.60186535",
"0.60061073",
"0.60046256",
"0.60043514",
"0.599715",
"0.59851277",
"0.5977453",
"0.5975271",
"0.59606504",
"0.59589654",
"0.594255",
"0.5937329",
"0.59368205",
"0.59364575",
"0.5932894",
"0.5929732",
"0.59282917",
"0.59164685",
"0.59141576",
"0.59108603",
"0.5909517",
"0.5908882",
"0.5903958",
"0.58975095",
"0.58964825",
"0.5890338",
"0.5890157",
"0.58857566",
"0.58840746",
"0.5878581",
"0.58747894",
"0.58747894",
"0.5874788",
"0.5870032",
"0.58669937",
"0.5866095",
"0.58642095",
"0.5862351",
"0.58602387",
"0.5858441",
"0.58573383",
"0.58545434",
"0.58545434",
"0.58545434",
"0.5852685",
"0.5852577",
"0.58512634",
"0.58496267"
] | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_comment
@comment = Comment.find(params[:id])
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 comment_params
params.require(:comment).permit(:name, :article_id)
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 filtering_params\n params.permit(:email)\n end",
"def active_code_params\n params[:active_code].permit\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 url_whitelist; 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 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 permit_request_params\n params.permit(:address)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\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 unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\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 user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"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 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.6978086",
"0.6780264",
"0.6742658",
"0.6738813",
"0.67338693",
"0.65908474",
"0.6501793",
"0.6495506",
"0.64796513",
"0.64755446",
"0.6454826",
"0.6437561",
"0.6377127",
"0.63722163",
"0.6364058",
"0.63178706",
"0.62979764",
"0.62968165",
"0.62913024",
"0.6289789",
"0.6289145",
"0.62875307",
"0.6280997",
"0.62420976",
"0.62388235",
"0.6216686",
"0.62122375",
"0.6208949",
"0.619173",
"0.6176307",
"0.6173907",
"0.6170346",
"0.616111",
"0.6150513",
"0.6150023",
"0.61446756",
"0.6120429",
"0.6112975",
"0.6104845",
"0.6102966",
"0.6087884",
"0.6079323",
"0.60699135",
"0.60602236",
"0.60191786",
"0.60170597",
"0.60100305",
"0.6009527",
"0.60052776",
"0.60052776",
"0.600042",
"0.5999317",
"0.59933805",
"0.5991528",
"0.5991221",
"0.5990094",
"0.5979497",
"0.5966058",
"0.5958738",
"0.59579456",
"0.5957759",
"0.5956938",
"0.5951788",
"0.59511644",
"0.59423065",
"0.59373474",
"0.59361076",
"0.59361076",
"0.59331447",
"0.5928005",
"0.5924882",
"0.5924011",
"0.59169155",
"0.5908037",
"0.5907541",
"0.59061426",
"0.59056246",
"0.5897408",
"0.58960444",
"0.58951247",
"0.5893136",
"0.5892312",
"0.5890385",
"0.58853275",
"0.58801144",
"0.58784765",
"0.5872648",
"0.58682626",
"0.5867028",
"0.58661693",
"0.586578",
"0.58643955",
"0.5863193",
"0.58609086",
"0.5859997",
"0.5858935",
"0.5858632",
"0.5853379",
"0.5852741",
"0.584806",
"0.5847703"
] | 0.0 | -1 |
a casino has a plyer and a wallet, so we could say casino.player.wallet.amount | def initialize
puts 'Welcome to the Casino'.colorize(:blue)
@player = Player.new #seeing new here so it means its going to the class listed and runs the initi method
puts "what game do you want to play #{player.name}?"
#show a casino game menu
#let the player choose a game
# initialize the new game, passing the player as a parameter
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pays_players\n self.players.inject(0) {|sum, player| sum += player.pay}\n end",
"def print_player(player)\n puts \"Player #{player.id}: Balance: #{player.money}. \"\n end",
"def current_wallet\n # currency_wallet\n @participant ? betting_pool_wallet : points_wallet\n end",
"def total (player=nil, mods=nil)\n player ||= belongs_to_player\n mods ||= modifiers(player)\n base_value + mods\n end",
"def amount\n self.payout_amount\n end",
"def player_hand_total\n players_hand.inject(0) {|sum, card| sum + card.value}\n end",
"def total_cash(pet_shop)\n return pet_shop[:admin][:total_cash]\nend",
"def total_cash(pet_shop)\n return pet_shop[:admin][:total_cash]\nend",
"def total_cash(pet_shop)\n return pet_shop[:admin][:total_cash]\nend",
"def total_cash(pet_shop)\n return pet_shop[:admin][:total_cash]\nend",
"def total_cash(pet_shop)\n return pet_shop[:admin][:total_cash]\nend",
"def credit_amount\n sum( credits )\n end",
"def balance_hash\n @money\n end",
"def total_owned\n self.shares.map{ |share| share.value }.inject(:+)\n end",
"def total_cash(instance)\n return instance[:admin][:total_cash]\nend",
"def total_cash(petshop)\n return petshop[:admin][:total_cash]\n end",
"def total_cash(pet_shop_total_cash)\n return pet_shop_total_cash[:admin][:total_cash]\nend",
"def total_cash(total)\n return total[:admin][:total_cash]\nend",
"def customer_total_cash(customer)\n return customer[:cash]\nend",
"def amount; end",
"def amount\n bid.amount\n end",
"def total_debt\n self.amount\n end",
"def eth_portfolio\n return @@client.accounts[1].balance.amount.to_f\n end",
"def total_cash(shop)\n return shop[:admin][:total_cash]\nend",
"def getcardbalance\r\n @cardbalance\r\n end",
"def dealer_hand_total\n dealers_hand.inject(0) {|sum, card| sum + card.value}\n end",
"def amount\n @amount\n end",
"def purchase_amount\n if order.present?\n order.total - credits_amount\n else\n credits_amount\n end\n end",
"def get_Amount()\n \t return @outputs[\"Amount\"]\n \tend",
"def total_cash(sum)\n return sum[:admin][:total_cash]\nend",
"def get_asset\n asset = self.money\n sell_hash = {}\n #make has whose key is id of security and value is quantity that user bought\n LineShare.where(user_id: self.id, available: true).each do |lineshare|\n key = lineshare.security_id.to_s.to_sym\n #because this is the hash for selling, qunatity will be negative\n value = - linesecurity.quantity\n sell_hash[key] = value\n end\n asset += Security.get_cost(sell_hash)\n asset.round(4)\n end",
"def saldo\n balance\n end",
"def security_deposit_sum\n @cart.security_deposit\n end",
"def total_cash(shop)\n return shop.dig(:admin, :total_cash)\nend",
"def get_player_total(player_hand)\n\tplayer_total = 0 \t\t# Total value of player's hand\n\n\tfor i in 0..player_hand.length - 1\n\t\tplayer_total += $cards[player_hand[i]]\n\tend\n\treturn player_total\nend",
"def pl_total\n @printer << \"You have #{session[:player].hand_total}\" if !session[:player].blackjack?\n @printer << \"You bust.\" if session[:player].bust?\n if session[:player].blackjack?\n @printer << \"BlackJack!\" \n session[:player].make_lucky\n end\n nil\n end",
"def balance\n @balance\n end",
"def customer_cash(alice_cash)\n return alice_cash[:cash]\nend",
"def account_balance\n @account_balance\n end",
"def booking_amount\n self.charges.booking.inject(0){|sum, charge| sum + charge.amount}\n end",
"def strength\n players.map{|p| p.strength}.reduce{|sum,n| sum + n}\n end",
"def money\n\t\tif @wallet.neg?\n\t\t\t@in_debt = true\n\t\tend\n\t\treturn @wallet.amount\n\tend",
"def value\r\r\n @currency[:amount]\r\r\n end",
"def getwalletinfo\n node.wallet ? node.wallet.to_h : {}\n end",
"def each_driver_money(driver)\n money = driver[:rides].map.sum do |ride|\n ride[:cost]\n end\n return money\nend",
"def get_amount\n\t\t@amount\n\tend",
"def display_total (person)\n puts \"#{person.name}'s total is #{person.hand_value(person.hand)}.\" \n end",
"def balance\n self.ledger_entries.sum(:value)\n end",
"def sell_bonus\n bonus = 0.0\n battle_members.each { |member| bonus += member.sell_bonus }\n bonus\n end",
"def current_total_amount\n\n if calculate_total(session[:player_cards]).to_i == BLACKJACK\n session[:player_pot] += session[:player_bet].to_i \n elsif calculate_total(session[:player_cards]).to_i > BLACKJACK\n session[:player_pot] -= session[:player_bet].to_i\n elsif calculate_total(session[:dealer_cards]).to_i > BLACKJACK\n session[:player_pot] += session[:player_bet].to_i \n elsif calculate_total(session[:dealer_cards]).to_i == BLACKJACK\n session[:player_pot] -= session[:player_bet].to_i\n elsif calculate_total(session[:player_cards]).to_i > calculate_total(session[:dealer_cards]).to_i\n session[:player_pot] += session[:player_bet].to_i \n elsif calculate_total(session[:dealer_cards]).to_i > calculate_total(session[:player_cards]).to_i\n session[:player_pot] -= session[:player_bet].to_i \n else\n session[:player_pot]\n end # ends if statement\n end",
"def wallet\n get 'wallet'\n end",
"def balance\n # accounts.reduce(0){|sum, account| sum + account.balance}\n accounts.sum{|account| account.balance} \n end",
"def total_point(team)\n team[:players].collect { |player| player[:points] }.sum\nend",
"def balance #same as attr_reader :balance\n @balance\n end",
"def net_worth\n result = self.cash_on_hand\n self.holdings.each do |holding|\n share_price = holding.company.share_price\n result += share_price * holding.amount\n end\n @net_worth = result\n end",
"def debit_player(p)\n p.money -= p.bet\n end",
"def amount\n price\n end",
"def balance\n return @balance\n end",
"def cost\n purchase_cost\n end",
"def cost\n purchase_cost\n end",
"def payee\n profile\n end",
"def sugar_amount\n @sugar_amount\n end",
"def member_total(member_name)\n @roster[member_name]\n end",
"def amount\n @percent\n end",
"def amount\n @percent\n end",
"def get_dealer_total(dealer_hand,dealer_turn)\n\tdealer_total = 0\t# Total value of dealer's visible cards\n\n\tif !dealer_turn\n\t\tdealer_total = $cards[dealer_hand[0]]\n\telse\n\t\tfor i in 0 .. dealer_hand.length - 1\n\t\t\tdealer_total += $cards[dealer_hand[i]]\n\t\tend\n\tend\n\treturn dealer_total\nend",
"def test_wallet\n assert_equal(100, @guest1.wallet)\n end",
"def own_amounts\n hash_totals = {}\n\n self.user_currencies.each do |uc|\n if hash_totals[uc.currency.crypto]\n hash_totals[uc.currency.crypto][:amount] = hash_totals[uc.currency.crypto][:amount] + uc.amount.to_i\n else\n hash_totals[uc.currency.crypto] = { amount: uc.amount }\n end\n end\n hash_totals\n end",
"def player_coin\n $game_variables[Yuki::Var::CoinCase]\n end",
"def customer_cash(customer)\n return customer[:cash]\nend",
"def customer_cash(customer)\n return customer[:cash]\nend",
"def customer_cash(customer)\n return customer[:cash]\nend",
"def customer_cash(customer)\n return customer[:cash]\nend",
"def customer_cash(customer)\n return customer[:cash]\nend",
"def customer_cash(customer)\n return customer[:cash]\nend",
"def customer_cash(customer)\n return customer[:cash]\nend",
"def customer_cash(customer)\n return customer[:cash]\nend",
"def find_total_pay(rides)\n moneys = 0\n rides.each do |key, value|\n moneys += key[:cost]\n end\n return moneys\nend",
"def test_guest_pays_entry_charge\n @guest1.spent_money(@room1)\n assert_equal(95, @guest1.wallet)\n end",
"def points_per_player(player, hashketball)\r\n player.capitalize!\r\n if hashketball[:home][:players].include?(player)\r\n hashketball[:home][:players][player][:stats][:points]\r\n elsif hashketball[:away][:players].include?(player)\r\n hashketball[:away][:players][player][:stats][:points]\r\n else\r\n \"No player found.\"\r\n end\r\nend",
"def money; end",
"def get_balance\n\t\treturn @balance.balance\n\tend",
"def total_commission\n @payment.total_commission\n end",
"def get_credits\r\n self.credits\r\n end",
"def get_credits\r\n self.credits\r\n end",
"def total_cash(shops)\n shops[:admin][:total_cash]\nend",
"def num_points_scored(name)\n players = get_all_players # Works!\n player = find_player(players, name) # Up next...\n player[:points]\n \nend",
"def credit_player(p, blackjack = false)\n if blackjack\n p.money += p.bet*1.5\n else\n p.money += p.bet\n end\n end",
"def total_payout\n # calculate children payout\n count = 0\n self.children.each do |child|\n count = count + child.total_payout\n end\n \n # calculate payout of this ativity\n if self.state == COMPLETE\n return count + self.reward\n elsif self.state == EXPIRED\n return count - self.penalty\n else \n return count\n end\n\n end",
"def get_shares_quantity\n quantity = 0\n LineShare.where(user_id: self.id, available: true).each do |lineshare|\n quantity += lineshare.quantity\n end \n quantity\n end",
"def get_cout_total\n return (self.prix)\n end",
"def totalamount\n\t\tcopies * 5\n\tend",
"def balance_for(other_user)\n Money.new(all_balances[other_user.id], 'PLN')\n end",
"def porcentajegrasa\n\t\t1.2 * imc + 0.23 * @edad - 10.8 * @sexo - 5.4\n\tend",
"def amount_owed_from(member, trip = nil)\n purchases_ids = trip ? self.purchases.where(:trip_id => trip.id).collect(&:id) : self.purchases.collect(&:id)\n member_purchases_ids = trip ? member.purchases.where(:trip_id => trip.id).collect(&:id) : member.purchases.collect(&:id)\n [(member.obligations.where(:expense_id => purchases_ids).sum(:amount) - member.contributions.where(:expense_id => purchases_ids).sum(:amount)) - (self.obligations.where(:expense_id => member_purchases_ids).sum(:amount) - self.contributions.where(:expense_id => member_purchases_ids).sum(:amount)), 0].max\n end",
"def owes_amount\n loans=@loans\n net_worth=@net_worth\n @balance = net_worth-loans\n print \"the balance is : \",balance,\"\\n\"\n is_developer_solvent?\n end",
"def distribute_money_internal_2(dealer_total, player , hand_index)\n i = hand_index\n dt = dealer_total\n hv = player.get_value(i)\n bet = player.get_bet(i)\n pn = player.player_number\n\n # instead of modifiying amount directly, should use a function call to increment player amount by payoff factor\n if (hv == 21 and (dt > 21 or dt < 21) )\n #player.amount += (bet * 2.5)\n player.modify_account(bet,2.5)\n puts \"Player #{pn} H#{i} #{hv} Blackjack - Dealer #{dt} , Amount= #{player.amount}\"\n elsif (hv < 21 and dt > 21) or (dt <= 21 and hv <= 21 and hv > dt)\n #player.amount += (bet * 2)\n player.modify_account(bet,2)\n puts \"Player #{pn} H#{i} #{hv} - Dealer #{dt} , Amount= #{player.amount}\"\n elsif (dt > 21 and hv > 21) or ((hv == 21) and dt == 21 ) or (hv == dealer_total and dt <= 21 and hv <= 21)\n #player.amount += (bet * 1)\n player.modify_account(bet,1)\n puts \"Player #{pn} H#{i} #{hv} - Dealer #{dt} , Amount= #{player.amount}\"\n else\n puts \"Player #{pn} H#{i} #{hv} - Dealer #{dt} , Amount= #{player.amount}\"\n end\n\n end",
"def amount_owed_from(member, trip = nil)\n purchases_ids = trip ? self.purchases.where(trip_id: trip.id).collect(&:id) : self.purchases.collect(&:id)\n member_purchases_ids = trip ? member.purchases.where(trip_id: trip.id).collect(&:id) : member.purchases.collect(&:id)\n [(member.obligations.where(expense_id: purchases_ids).sum(:amount) - member.contributions.where(expense_id: purchases_ids).sum(:amount)) - (self.obligations.where(expense_id: member_purchases_ids).sum(:amount) - self.contributions.where(expense_id: member_purchases_ids).sum(:amount)), 0].max\n end",
"def amount_in_cents\r\n read_attribute(:amount) \r\n end",
"def get_deposited_coin(transaction)\n deposited_coin = @user.coins.find(transaction.coin_id) if @user\n return deposited_coin\n end",
"def attr_money\n {\n perceptions_total_cents: 'TotalPercepciones',\n deductions_total_cents: 'TotalDeducciones',\n other_payments_total_cents: 'TotalOtrosPagos'\n }\n end"
] | [
"0.6480014",
"0.6388395",
"0.6231431",
"0.6095648",
"0.6069049",
"0.60579133",
"0.6052946",
"0.6052946",
"0.6052946",
"0.6052946",
"0.6052946",
"0.60171044",
"0.6008469",
"0.60076034",
"0.6006057",
"0.6004349",
"0.60010755",
"0.5940737",
"0.5935169",
"0.5916111",
"0.5904136",
"0.59010655",
"0.58885264",
"0.58867127",
"0.5884556",
"0.5858838",
"0.5856227",
"0.5856226",
"0.58352995",
"0.5834591",
"0.58284515",
"0.58079475",
"0.57634866",
"0.5757439",
"0.5747492",
"0.57458663",
"0.57384765",
"0.5735821",
"0.572567",
"0.57240945",
"0.5721437",
"0.57022446",
"0.5701742",
"0.56990933",
"0.5697034",
"0.5689842",
"0.5680543",
"0.5677476",
"0.5675284",
"0.56743366",
"0.56668663",
"0.56638795",
"0.5661413",
"0.5652351",
"0.56521803",
"0.56323594",
"0.56186914",
"0.56088793",
"0.560508",
"0.560508",
"0.56050605",
"0.559993",
"0.5599561",
"0.5596977",
"0.5596977",
"0.5593592",
"0.5593508",
"0.55923045",
"0.5586561",
"0.55863976",
"0.5584909",
"0.5584909",
"0.5584909",
"0.5584909",
"0.5584909",
"0.5584909",
"0.5584909",
"0.55841196",
"0.55837125",
"0.5581258",
"0.5579557",
"0.5573782",
"0.5567976",
"0.5565795",
"0.5565795",
"0.55626446",
"0.55622476",
"0.5560031",
"0.5557991",
"0.55393815",
"0.5532876",
"0.55313176",
"0.55287063",
"0.5525849",
"0.5519084",
"0.5506651",
"0.5504954",
"0.5502228",
"0.550139",
"0.54968965",
"0.5493432"
] | 0.0 | -1 |
this method will get called after all the other initialize methods get called | def menu # can do custom methods within a method/class
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_init\n end",
"def after_initialize\n end",
"def post_initialize\n end",
"def after_initialize; end",
"def after_initialize; end",
"def after_initialize; end",
"def after_initialize; end",
"def post_init\n end",
"def after_initialize\n end",
"def after_initialize\n end",
"def after_initialize(&block); end",
"def pre_initialize; end",
"def after_initialize\n # noop\n end",
"def pre_initialize\n end",
"def at_init\n\n\t\tend",
"def post_init\n\tend",
"def post_initialize\n # raise NotImplementedError\n end",
"def after_initialize\n end",
"def after_initialized\n end",
"def on_initialization_finished()\n end",
"def after_initialize \n end",
"def after_init\n end",
"def post_init()\n puts \"#{self} post_init done!\"\n end",
"def post_init()\n puts \"#{self} post_init done!\"\n end",
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def after_initialize(opts)\n end",
"def on_initialize\n end",
"def after_initialize(options={}) ; end",
"def before_initialize(&block); end",
"def init\n\n end",
"def init\n end",
"def init\n end",
"def init\n end",
"def on_init; end",
"def on_init; end",
"def after_initialize_blocks\n @after_initialize_blocks ||= []\n end",
"def initialize\n # complete\n end",
"def initialize() end",
"def post_initialize(args = {})\r\n nil\r\n end",
"def post_initialize( *args, & block )\n # call to super in case we extend Class or Module, so we can stack calls to post_initialize\n super if defined?( super )\n # nothing here - subclasses define\n end",
"def initialize\n\n\n\n end",
"def post_initialize\n nil\n end",
"def initialize\n initialize!\n end",
"def initialize\n initialize!\n end",
"def post_initialize\n nil\n end",
"def post_initialize(args)\n nil\n end",
"def initialize\n\t\t\n\tend",
"def initialized?; end",
"def initialized?; end",
"def initialized?; end",
"def initialized?; end",
"def post_setup\n end",
"def post_initialize_fields\n end",
"def init; end",
"def initialize\n reset\n \tend",
"def initialize()\n\t\tend",
"def initialize\n # reset\n end",
"def init\n\nend",
"def post_initialize\n nil \n end",
"def Init()\n end",
"def initialize\n init\n end",
"def after_initialize(&after_initialize_block)\n after_initialize_blocks << after_initialize_block if after_initialize_block\n end",
"def initialize()\r\n\r\n end",
"def initialize\n reset!\n end",
"def initialize\n reset!\n end",
"def initialize()\n end",
"def post_initialize(args)\n nil\n end",
"def bootstrap_init\n end",
"def initialize\n \n end",
"def after_initialize\n @loaded = Set.new\n end",
"def user_init; end",
"def after_initialize(plugins); end",
"def initialize\n reset!\n end",
"def initialize\r\n\r\n end",
"def initialize_after_opts\n end",
"def initialize\r\n reset\r\n end",
"def initialize\n \n end",
"def initialize\n\tinit\n\tsuper\nend",
"def initialize\n\n\tend",
"def initialize\n\n\tend",
"def post_initialize\n # Base class does nothing\n end",
"def initialize()\n reset!\n end",
"def initialize\n reset!\n end",
"def initialize\n reset!\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end"
] | [
"0.83384126",
"0.8261713",
"0.82423884",
"0.8072354",
"0.8072354",
"0.8072354",
"0.8072354",
"0.80179304",
"0.79773587",
"0.79773587",
"0.7905712",
"0.7879241",
"0.78096557",
"0.78069043",
"0.77414155",
"0.7729605",
"0.77178",
"0.7707891",
"0.7687366",
"0.76746684",
"0.7666232",
"0.765672",
"0.7591839",
"0.7591839",
"0.75905",
"0.75905",
"0.75905",
"0.75905",
"0.7554791",
"0.7496778",
"0.7473665",
"0.7468745",
"0.74584126",
"0.7427173",
"0.7427173",
"0.7427173",
"0.7377298",
"0.7377298",
"0.7273235",
"0.72487366",
"0.7216546",
"0.7201211",
"0.719508",
"0.7190588",
"0.7153002",
"0.7129413",
"0.7129413",
"0.7114878",
"0.71136206",
"0.71059245",
"0.7100068",
"0.7100068",
"0.7100068",
"0.7100068",
"0.70962185",
"0.7093318",
"0.70867574",
"0.7079298",
"0.7072046",
"0.7063196",
"0.7060321",
"0.7057517",
"0.70404255",
"0.7039623",
"0.7038943",
"0.7030268",
"0.7027069",
"0.7027069",
"0.7023829",
"0.70184666",
"0.7005572",
"0.70017475",
"0.69722044",
"0.6958158",
"0.6944214",
"0.69329226",
"0.69307417",
"0.69249773",
"0.69106525",
"0.689531",
"0.68946433",
"0.6892901",
"0.6892901",
"0.689282",
"0.6888503",
"0.68799406",
"0.68799406",
"0.6843162",
"0.6843162",
"0.6843162",
"0.6843162",
"0.6843162",
"0.6843162",
"0.6843162",
"0.6843162",
"0.6843162",
"0.6843162",
"0.6843162",
"0.6843162",
"0.6843162",
"0.6843162"
] | 0.0 | -1 |
Edit Params: (str) id (str) extrablank | def edit
params[:extrablank].nil? ? @extrablank = 1 : @extrablank = params[:extrablank].to_i
@items = Item.all
@recipe = Recipe.find(params[:id])
@extrablank.times do
@recipe.quantities.build
end
# @ingredients ? @ingredients << Item.new : @ingredients = [Item.new]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\n id = params[:id].presence || 0 \n @element = @@model.find(id)\n end",
"def replace_id(id)\n item = read\n item['id'] = id.to_s\n @aws.put_item(table_name: 'zold-wallets', item: item)\n end",
"def edit\n @menu = 'accueil'\n id = params[:id].nil? ? params[:cid][0] : params[:id]\n @setup = EsSetup.find(id)\n end",
"def edit(id, params = {})\n self.class.post(\"/paste/#{id}\", :body => params.merge(@base_params)).parsed_response\n end",
"def edit \n # Rails.logger.info(\"------params[:id]--\"+ \" #{params[:id]}\")\n @clearance = Clearance.find(params[:id])\n \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(id)\n @lwidth = '20%'\n @rwidth = '0'\n @account = flash[:form_data] || Account[id]\n @tasks = Task.filter(:account_id => id)\n @opports = Opport.filter(:account_id => id)\n session[:method] = 'edit'\n\n # Make sure the item exists\n if @account.nil?\n flash[:error] = 'The specified Account is invalid'\n redirect_referrer\n end\n @name = \"Edit #{@account.name}\"\n Action.add_record(@account.id, session[:email], 'updated', 'account', @account.name)\n @items = Action.recent_items\n end",
"def sample_for_edit(src = :edit_example)\n current = edit_id && Manifest.find_by(id: edit_id)\n current&.delete\n new_record(src).tap do |record|\n self.edit_id = record.id if record.save!\n end\n end",
"def edit\n \n end",
"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 @id = params[:id]\n begin\n @import = WarehouseImport.find(@id)\n rescue Exception => e\n flash[:error] = 'ID Không Tồn Tại!'\n redirect_to :action => 'index'\n end \n\n begin\n @warehouse_import_items = WarehouseImportItem.get_all_by_import_id(@id)\n rescue Exception => e\n @warehouse_import_items = []\n end \n\n @suppliers = Supplier.get_suppliers\n @products = Product.get_products\n\n unit_pair = {}\n units = Unit.get_units\n units.each do | unit |\n unit_pair[unit[:unit_id]] = unit[:unit_name]\n end \n @units_json = unit_pair.to_json\n\n @page_title = 'Cập Nhật Phiếu Nhập Kho'\n @breadcrumbs = []\n @breadcrumbs[0] = {title: CONTROLLER_TITLE, url: '/warehouse'}\n @breadcrumbs[1] = {title: @page_title, active:1}\n end",
"def edit\n @temp = Temp.find(params[:id])\n end",
"def edit_name\n # p \"-\"* 50\n # p \"edit name\"\n # @name_exercise_id = params[:format]\n end",
"def edit #$$~used\n puts \"xxxxxxx NodesC a:edit xxxxxxx\"\n @node = Node.find(params[:id])\n end",
"def edit\n @inventory = Bus.find(params[:id], :include => :seller)\n @seller = @inventory.seller\n @image = @inventory.images.build\n\n @leads = @inventory.leads\n @bus_type = BusType.new\n @chasis_make = ChasisMake.new\n @body_make = BodyMake.new\n #Chart\n @data = Array.new\n @data = (Date.today-30..Date.today).map { |date| [\"#{date}\", Stat.visits_on(date, params[:id])] }\n end",
"def set_extrato\n @extrato = Extrato.find(params[:id])\n end",
"def id=(id)\n @modified = false\n super\n end",
"def id=(id)\n @modified = false\n super\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 editar\n end",
"def setId(id)\r\n\t\t\t\t\t@id = id\r\n\t\t\t\tend",
"def setId(id)\r\n\t\t\t\t\t@id = id\r\n\t\t\t\tend",
"def setId(id)\r\n\t\t\t\t\t@id = id\r\n\t\t\t\tend",
"def setId(id)\r\n\t\t\t\t\t@id = id\r\n\t\t\t\tend",
"def setId(id)\r\n\t\t\t\t\t@id = id\r\n\t\t\t\tend",
"def setId(id)\r\n\t\t\t\t\t@id = id\r\n\t\t\t\tend",
"def setId(id)\r\n\t\t\t\t\t@id = id\r\n\t\t\t\tend",
"def setId(id)\r\n\t\t\t\t\t@id = id\r\n\t\t\t\tend",
"def setId(id)\r\n\t\t\t\t\t@id = id\r\n\t\t\t\tend",
"def edit\r\n \r\n end",
"def edits\n\nend",
"def edit\n puts \"******* edit *******\"\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 end",
"def edit\n id = params[:id].presence || 0 \n @postit_task = PostitTask.find(id)\n end",
"def edit_object(obj)\r\n puts \"edit object #{obj}\" if VERBOSE\r\n Sketchup.active_model.select_tool EditOpeningTool.new(self, obj)\r\nend",
"def edit\n \tid = params[:id]\n \t@creature = Creature.find(id)\n end",
"def edit # NOT USED\n puts \"xxxxxxx NodeAttr a:edit NNNN NOT USED xxxxxxx\"\n @node_attrb = NodeAttrb.find(params[:id])\n end",
"def do_edit\n @record = find_if_allowed(params[:id], :update)\n end",
"def id=(id)\n end",
"def set_diabetic\n @diabetic = Diabetic.find(params[:id])\n end",
"def edit\n load_data\n end",
"def edit\n @zakaz = Zakaz.find(params[:id])\n end",
"def set_extra\n @extra = Partextra.find(params[:id])\n end",
"def identify(id)\n @id = id\n end",
"def update\n\t\t\t\"update called - updating #{params[:id]}\"\n\t\tend",
"def paramsid\n @order = Order.find_by(params[:id])\n params[:id]= @order.id\n end",
"def edit_assignment_id(id)\n frm.link(:href=>/#{Regexp.escape(id)}/).click\n AssignmentAdd.new(@browser)\n end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n end",
"def edit\n @band = Band.find(params[:id])\n end",
"def sample_for_edit(src = :edit_example)\n current = edit_id && User.find_by(id: edit_id)\n current&.delete\n new_record(src).tap do |record|\n self.edit_id = record.id if record.save!\n end\n end",
"def edit\n id = params[:id]\n @rock = Rock.find(id)\nend",
"def edit(s, id, index, new_data)\n out = [MESSAGE_EDIT, id, index, new_data].pack(\"IIIa*\")\n s.write(out)\n\n receive_code(s, 0x00001004, \"edit\")\nend",
"def set_trank\n @trank = Trank.find(params[:id])\n end",
"def set_fd_itemalterado\n @fd_itemalterado = FdItemalterado.find(params[:id])\n end",
"def edit\n @exam_group = ExamGroup.shod(params[:id])\n @batch = @exam_group.batch\n end",
"def edit\n @order = Order.find_by(id: params[:id])\n end",
"def update(id)\n provides :js, :json\n @edit = Version.first(id) || raise(NotFound)\n if @edit.update_attributes(:moderated => true)\n train_spam_engine(@edit)\n if request.xhr?\n render '', :status => 200 # renders nothing\n else\n redirect url(:edits)\n end\n else\n raise BadRequest\n end\n end",
"def edit \n @airport = Airport.find(params[:id]) \n end",
"def edit\n return unless has_permission :can_manage_aircraft\n @page_title = \"Edit Aircraft Information\"\n @aircraft = Aircraft.find(params[:id])\n end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n end"
] | [
"0.6216398",
"0.58073527",
"0.5750818",
"0.5735728",
"0.5724972",
"0.5681335",
"0.5681335",
"0.5681335",
"0.5681335",
"0.5681335",
"0.5681335",
"0.5681335",
"0.5681335",
"0.5681335",
"0.5681335",
"0.5681335",
"0.5681335",
"0.5681335",
"0.5681335",
"0.5681335",
"0.5681335",
"0.5681335",
"0.5681335",
"0.5681335",
"0.5681335",
"0.5681335",
"0.5578013",
"0.5550396",
"0.5527842",
"0.5494658",
"0.54150563",
"0.5382881",
"0.53781813",
"0.5375076",
"0.5373552",
"0.53460765",
"0.5344747",
"0.5344747",
"0.533964",
"0.5335638",
"0.5329265",
"0.5329265",
"0.5329265",
"0.5329265",
"0.5329265",
"0.5329265",
"0.5329265",
"0.5329265",
"0.5329265",
"0.532492",
"0.5321718",
"0.5319836",
"0.5315909",
"0.5315909",
"0.5315909",
"0.5315909",
"0.5315909",
"0.5315909",
"0.5315909",
"0.53150314",
"0.5314153",
"0.5313678",
"0.52961344",
"0.52927166",
"0.52922684",
"0.5287535",
"0.5283371",
"0.52700806",
"0.52683884",
"0.5265806",
"0.5263758",
"0.5262208",
"0.52530986",
"0.52497184",
"0.5248308",
"0.5248308",
"0.5248308",
"0.5248308",
"0.5248308",
"0.52404594",
"0.5240132",
"0.52382535",
"0.52380687",
"0.5233925",
"0.523336",
"0.52320623",
"0.5226754",
"0.5223347",
"0.52157694",
"0.52141976",
"0.52141833",
"0.52141833",
"0.52141833",
"0.52141833",
"0.52141833",
"0.52141833",
"0.52141833",
"0.52141833",
"0.52141833",
"0.52141833"
] | 0.5382889 | 31 |
Update Params: (str) id (hash) recipe (str) result_id (hash) quantities_attributes (hash) (str) result_id (str) amount (str) item_id Should update a recipe of given ID Should not update a quantity if the amount or item id is null | def update
@recipe = Recipe.find(params[:id])
db_quantities = @recipe.quantities.where("recipe_id = :this_id", {this_id: @recipe.id})
params[:recipe][:quantities_attributes].each do |quantity_raw|
quantity = quantity_raw.to_a.last
if quantity[:item_id].blank?
next
end
#Look to see if the item name is already there and if it is, replace the new amount
if db_quantities.map{|q| q.item_id}.include?(quantity[:item_id].to_i)
(db_quantities.detect{|q| q.item_id == quantity[:item_id].to_i})
.update(amount: quantity[:amount].to_i)
else
@recipe.add_item(quantity[:item_id], quantity[:amount])
end
end
@recipe.attributes = recipe_params
if @recipe.update_attributes(recipe_params)
redirect_to edit_recipe_url, id: @recipe.id
else
render edit
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n rid = params['id']\n name = params['name']\n description = params['description']\n instructions = params['instructions']\n cook_time = params['cook_time']\n quantity = params['quantity']\n serving_size = params['serving_size']\n uid = params['user_id']\n aws_params = Hash.new\n aws_params[:custom_fields] = {\n 'recipe_id' => rid,\n 'name' => name,\n 'description' => description,\n 'instructions' => instructions,\n 'cook_time' => cook_time,\n 'quantity' => quantity,\n 'serving_size' => serving_size,\n 'user_id' => uid\n }\n if Aws.update_recipe(aws_params)\n msg = {:notice => \"Recipe updated!\"}\n render :json => msg\n else\n msg = {:notice => \"Error while save to DynamoDB!\"}\n render :json => msg\n end\n end",
"def update(attributes: {})\n attributes = attributes.with_indifferent_access\n clean_attributes(attributes)\n titleize(attributes)\n sync_tags(attributes)\n parse_ingredients(attributes)\n recipe.update(attributes)\n recipe_response\n rescue StandardError => e\n error_response(e)\n end",
"def update\n begin\n recipe = Recipe.find(params[:id])\n\n if recipe.update_attributes(recipe_params)\n render json: { status: 'SUCCESS', message: 'Recipe updated!', data: recipe }, status: :ok\n else\n render json: { status: 'ERROR', message: 'Error updating recipe', data: recipe.errors }, status: :unprocessable_entity\n end\n rescue\n render json: { status: 'ERROR', message: 'Error finding recipe', data: {} }, status: :not_found\n end\n end",
"def update\n\t\t\t\trecipe = Recipe.find(params[:id])\n\t\t\t\tingredients = params[:ingredients]\n\t\t\t\ttags = params[:tags]\n\n\t\t\t\tif recipe.update_attributes(recipe_params)\n\t\t\t\t\tif !ingredients.blank?\n\t\t\t\t\t\tcreate_ingredient(recipe.id, ingredients)\n\t\t\t\t\tend\n\n\t\t\t\t\tif !tags.blank?\n\t\t\t\t\t\tcreate_tag(recipe.id, tags)\n\t\t\t\t\tend\n\n\t\t\t\t\trender json: {status: 'SUCCESS', message: 'Updated recipe', data: get_recipe_by_id(recipe.id)}, status: :ok\n\t\t\t\telse\n\t\t\t\t\trender json: {status: 'ERROR', message: 'Recipe not updated', data: recipe.errors}, status: :unprocessable_entity\n\t\t\t\tend\n\t\t\tend",
"def update\n #if you query the Recipe db by the id, and the id is present then...\n if (@single_recipe_to_update = Recipe.find_by_id(params[:id])).present?\n # ... run the recipe_params function within the update function. it takes the input values from recipe_params and\n # updates that information the db\n @single_recipe_to_update.update(recipe_params)\n render :json => {\n :response => \"Successfully updated recipe.\",\n :data => @single_recipe_to_update # return the recipe with updated info\n }\n else\n render :json => {\n :response => \"Cannot find this record.\"\n }\n end\n end",
"def update\n @ingredient = Ingredient.find(params[:id])\n @amount = Amount.find(@ingredient)\n\n respond_to do |format|\n if @ingredient.update_attributes(params[:ingredient]) and @amount.update_attributes(params[\"amount\"].merge(:ingredient_id => @ingredient.id, :recipe_id => @recipe.id ))\n flash[:notice] = 'Ingredient was successfully updated.'\n format.html { redirect_to(@recipe) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ingredient.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe_item.update(recipe_item_params)\n format.html { redirect_to @recipe_item, notice: 'Recipe item was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe_item }\n else\n format.html { render :edit }\n format.json { render json: @recipe_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n update_recipe_line_items\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n recipe.update(recipe_params)\n render json: recipe\n end",
"def update\n @recipe = Recipe.find(params[:id])\n @recipe.update(recipe_params)\n redirect_to new_ingredient_path\n end",
"def update\n params[:recipe][:ingredient_ids] ||= []\n @recipe = Recipe.find(params[:id])\n\n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @recipe = current_user.recipes.find(params[:id])\n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n \n unless params[:instructions].nil?\n @recipe.instructions.delete_all\n Instruction.multi_save(params[:instructions], @recipe)\n end\n \n unless params[:ingredients].nil?\n @recipe.ingredients.delete_all\n Ingredient.multi_save(params[:ingredients], @recipe)\n end\n\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render json: {:recipe => @recipe, :tags => @recipe.tag_list} }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @item = @receipt.items.find_by(id: params[:id])\n\n unless @item\n return render_error_code(:not_found,\n :db_failure,\n item: 'was not found')\n end\n\n if @item.update(permitted_params)\n render_ok\n else\n render_error_code(:bad_request, :db_failure, @item.errors)\n end\n end",
"def update(recipe)\n return false unless recipe.valid?\n\n @service.update(recipe)\n end",
"def update\n\t\t@recipe = Recipe.find(params[:id])\n\n \tif @recipe.update(recipe_params)\n \t\tredirect_to recipe_path\n\t end\t\t\n\tend",
"def update\n\n #@recipe.ingredients = params[:recipe_ingredients].map {|k, v|\n #ingredient = @recipe.ingredients.find(k) || @recipe.ingredients.build\n #ingredient.update_attributes(:item => Food.find(v[:item_id]), :quantity => v[:quantity]) unless v[:item_id].blank?\n #ingredient\n #}.compact if params[:ingredients]\n\n @recipe.tags = params[:tags].split(/,/).map { |t|\n Tag.find_or_create_by_name(t.strip.downcase)\n }.compact if params[:tags]\n\n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n format.html { redirect_to @recipe }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @recipe_ingredient = Recipe_ingredient.find(params[:id])\n\n respond_to do |format|\n if @recipe_ingredient.update_attributes(params[:recipe_ingredient])\n format.html { redirect_to @recipe_ingredient, notice: 'Recipe_ingredient was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe_ingredient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n calculate_nutrients \n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @recipe_ingredient = RecipeIngredient.find(params[:id])\n\n respond_to do |format|\n if @recipe_ingredient.update_attributes(params[:recipe_ingredient])\n format.html { redirect_to @recipe_ingredient, notice: 'Recipe ingredient was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe_ingredient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_ingredients(hash)\n hash.each do |h|\n ingredient = Ingredient.find_by!(id: h[:id])\n ingredient.update!(quantity: h[:quantity])\n end\n end",
"def update\n @recipe = current_user.recipes.find(params[:id])\n @obj = @recipe\n if(@recipe.update(recipe_params))\n flash.alert = \"Recipe updated\"\n redirect_to current_user\n return\n else\n flash.now.alert = \"Error\"\n render 'shared/form'\n end\n end",
"def update\n @recipe = Recipe.find(params[:id])\n\n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @recipe = Recipe.find(params[:id])\n\n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @recipe = Recipe.find(params[:id])\n\n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @recipe = Recipe.find(params[:id])\n\n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n params[:recipe][:ingredients].each do |ingredient_id|\n next if ingredient_id.to_i == 0\n ingredient = Ingredient.find(ingredient_id.to_i)\n @recipe.ingredients << ingredient\n end\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @result_item = ResultItem.find(params[:id])\n\n respond_to do |format|\n if @result_item.update_attributes(params[:result_item])\n format.html { redirect_to @result_item, notice: 'Result item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @result_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @item.update_attributes(item_params)\n render json: @item, status: :ok\n else\n render_error(@item, :unprocessable_entity)\n end\n end",
"def update\n @lineitem = Lineitem.find(params[:id])\n @item = Item.find(@lineitem.item_id)\n @lineitem_quantity_temp = @lineitem.quantity\n respond_to do |format|\n if @lineitem.update_attributes(params[:lineitem])\n if @item.amount > 0\n format.html { redirect_to 'http://localhost:3000/carts/show'}\n format.json { head :no_content }\n else\n @lineitem.quantity = @lineitem_quantity_temp\n @lineitem.save\n format.html {redirect_to 'http://localhost:3000/itemnotfound.html/' }\n end\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lineitem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @recipe = Recipe.find(params[:id])\n\n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n format.html { redirect_to edit_recipe_path(@recipe), notice: 'Recipe was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @recipe = current_user.recipes.find(params[:id])\n @obj = @recipe\n if(@recipe.update(recipe_params))\n flash.alert = \"Recipe updated\"\n redirect_to current_user\n else\n flash.now.alert = \"Error\"\n render 'shared/form'\n end\n end",
"def update\n @data = @recipe.update(params[:id], recipe_params)\n render json: @data\n end",
"def update\n @recipe = Recipe.find(params[:id])\n \n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n flash[:notice] = 'Recipe was successfully updated.'\n format.html { redirect_to(@recipe) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @recipe.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n recipe = Recipe.find(params[:id])\n\n if recipe.user == current_user\n recipe.update(recipe_params)\n render json: { recipe: params[:id], deleted: true }\n else\n render json: { recipe: params[:id], deleted: false }\n end\n end",
"def update\n @rentable_item.update(rentable_item_params)\n end",
"def update\n @inventory = Inventory.find(params[:id])\n @inventory.subtotal = (params[:inventory][:qty].to_f*@inventory.unit_price) if params[:inventory][:qty].present?\n if @inventory.update_attributes(params[:inventory])\n @inventories = current_company.inventories\n response_message = {:message => \"Item was updated successfully.\", :inventory => @inventory}\n else\n response_message = {:message => \"Please try again\"}\n end\n respond_to do |format|\n format.xml{render :xml => response_message }\n format.json{ render :json => response_message }\n end\n end",
"def update!(**args)\n @amount = args[:amount] if args.key?(:amount)\n @amount_pretax = args[:amount_pretax] if args.key?(:amount_pretax)\n @amount_tax = args[:amount_tax] if args.key?(:amount_tax)\n @line_item_id = args[:line_item_id] if args.key?(:line_item_id)\n @operation_id = args[:operation_id] if args.key?(:operation_id)\n @product_id = args[:product_id] if args.key?(:product_id)\n @quantity = args[:quantity] if args.key?(:quantity)\n @reason = args[:reason] if args.key?(:reason)\n @reason_text = args[:reason_text] if args.key?(:reason_text)\n end",
"def item_inventory_update\n \n item = Item.find(params[:item_id])\n order= Order.find(params[:id])\n item_order = ItemOrder.where(item_id: item.id, order_id: order.id).first\n new_inventory = item.inventory - item_order.quantity\n item_order.update(status: \"fulfilled\")\n item.update(inventory: new_inventory)\n end",
"def update\n unless logged_in?\n render :file => 'public/401', :status => :unauthorized, :layout => false and return\n end\n\n respond_to do |format|\n if @ingredient.update(ingredient_params)\n format.html { redirect_to Item.find(@recipe.item_id), notice: 'Ingredient was successfully updated.' }\n format.json { render :show, status: :ok, location: [@recipe, @ingredient] }\n else\n format.html { render :edit }\n format.json { render json: @ingredient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe_ingredients_unit.update(recipe_ingredients_unit_params)\n format.html { redirect_to recipe_ingredients_units_path, notice: 'Recipe ingredients unit was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe_ingredients_unit }\n else\n format.html { render :edit }\n format.json { render json: @recipe_ingredients_unit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # recipe_params[:ingredient_lists_attributes].each do |list|\n # list.each do |item|\n # item[:ingredient_attributes] = Ingredient.where(name: item[:ingredient_attributes].name).first_or_create\n # end\n # end\n \n # category_ids = params[:recipe][:categories_attributes].map { |k,v| v[:id] }\n # #pry.debugger\n \n # recipe_params.merge({ category_ids: category_ids })\n \n\n respond_to do |format|\n \n if @recipe.update(recipe_params)\n format.html { redirect_to recipes_url, notice: 'Recipe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @recipe.update(recipe_params)\n redirect_to @recipe, notice: \"Recipe was successfully updated.\"\n else\n render :edit, status: :unprocessable_entity\n end\n end",
"def update_recipe_rating(recipe_id)\n new_rating = prompt.ask(\"what new rating would you like to give?\")\n self.user.recipes.where(id: recipe_id).update(rating: new_rating.to_i)\n recipe_ingredients(recipe_id)\n end",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: \"Recipe was successfully updated.\" }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: \"Recipe was successfully updated.\" }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: \"Recipe was successfully updated.\" }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ingredient_recipe.update(ingredient_recipe_params)\n format.html { redirect_to @ingredient_recipe, notice: 'Ingredient recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @ingredient_recipe }\n else\n format.html { render :edit }\n format.json { render json: @ingredient_recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @recipe = Recipe.find(params[:id])\n if @recipe.update(recipe_params)\n redirect_to recipe_url(@recipe)\n else\n render 'edit'\n end\n end",
"def update!(**args)\n @amount_pretax = args[:amount_pretax] if args.key?(:amount_pretax)\n @amount_tax = args[:amount_tax] if args.key?(:amount_tax)\n @line_item_id = args[:line_item_id] if args.key?(:line_item_id)\n @operation_id = args[:operation_id] if args.key?(:operation_id)\n @product_id = args[:product_id] if args.key?(:product_id)\n @quantity = args[:quantity] if args.key?(:quantity)\n @reason = args[:reason] if args.key?(:reason)\n @reason_text = args[:reason_text] if args.key?(:reason_text)\n end",
"def update!(**args)\n @amount_pretax = args[:amount_pretax] if args.key?(:amount_pretax)\n @amount_tax = args[:amount_tax] if args.key?(:amount_tax)\n @line_item_id = args[:line_item_id] if args.key?(:line_item_id)\n @operation_id = args[:operation_id] if args.key?(:operation_id)\n @product_id = args[:product_id] if args.key?(:product_id)\n @quantity = args[:quantity] if args.key?(:quantity)\n @reason = args[:reason] if args.key?(:reason)\n @reason_text = args[:reason_text] if args.key?(:reason_text)\n end",
"def update\n # @recipe = Recipe.find(params[:id])\n #\n update! do |success, failure|\n # success.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n # success.json { head :ok }\n # failure.html { render action: \"edit\" }\n # failure.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n count = 1\n complete_directions = \"\"\n params[\"directions\"].each do |direction|\n complete_directions += direction + \"\\n\"\n count += 1\n end\n @ingredientnames = []\n @recipe.ingredients.each do |ingredient|\n @ingredientnames << ingredient.name\n end\n params[\"ingredients\"].each_with_index do |ingredient, index|\n if [email protected]? ingredient and ingredient != \"\"\n found = false\n Ingredient.all.each do |db_ingredient|\n if db_ingredient.name == ingredient\n @ingredient = db_ingredient\n Recipeingredient.create({:ingredient_id => @ingredient.id, :recipe_id => @recipe.id, :amount => params[\"amounts\"][index]})\n found = true\n end\n end\n if found == false\n @ingredient = Ingredient.create({:name => ingredient})\n Recipeingredient.create({:ingredient_id => @ingredient.id, :recipe_id => @recipe.id, :amount => params[\"amounts\"][index]})\n end\n else\n if ingredient != \"\"\n @ingredient = Ingredient.find_by_name(ingredient)\n @recipe.recipeingredients.each do |recipeingredient|\n if recipeingredient.ingredient_id == @ingredient.id\n recipeingredient.update({:amount =>params[\"amounts\"][index]})\n recipeingredient.save\n end\n end\n end\n end\n end\n @ingredientnames.each do |ingredient|\n if !params[\"ingredients\"].include?(ingredient)\n @ingredient = Ingredient.find_by_name(ingredient)\n @recipe.recipeingredients.each do |recipeingredient|\n if recipeingredient.ingredient_id == @ingredient.id\n recipeingredient.destroy\n if @ingredient.recipeingredients == nil\n @ingredient.destroy\n end\n end\n end\n end\n end\n tags = []\n if params[\"tags\"] != nil\n params[\"tags\"].each do |tag|\n a = Tag.find_by_name(tag)\n tags << a\n if [email protected]? a\n Recipetag.create({:recipe_id => @recipe.id, :tag_id => a.id })\n end\n end\n end\n @recipe.tags.each do |tag|\n if !tags.include? tag\n @recipe.recipetags.each do |recipetag|\n if recipetag.tag_id == tag.id\n recipetag.destroy\n end\n end\n end\n end\n @recipe.serves = params[\"serves\"]\n @recipe.name =params[\"name\"]\n @recipe.directions = params[\"directions\"].join(\"\\n\")\n @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @amount = args[:amount] if args.key?(:amount)\n @amount_pretax = args[:amount_pretax] if args.key?(:amount_pretax)\n @amount_tax = args[:amount_tax] if args.key?(:amount_tax)\n @line_item_id = args[:line_item_id] if args.key?(:line_item_id)\n @product_id = args[:product_id] if args.key?(:product_id)\n @quantity = args[:quantity] if args.key?(:quantity)\n @reason = args[:reason] if args.key?(:reason)\n @reason_text = args[:reason_text] if args.key?(:reason_text)\n end",
"def update\n @cart_item = CartItem.find(params[:id])\n\n respond_to do |format|\n if @cart_item.update_attributes(params[:cart_item])\n format.html { redirect_to :back, notice: 'Quantity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :back, alert: 'Error, quanity was not updated.' }\n format.json { render json: @cart_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to recipes_path, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n save_relations\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_recipe(db,id,description)\n q = \"UPDATE recipes SET description=#{name} WHERE id=#{id};\"\n return db.execute(q)\nend",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to recipes_url, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(stuff, quantity, options={})\n if stuff.is_a?(MerchantSidekick::ShoppingCart::LineItem)\n self.update_cart_line_item(stuff, quantity, options)\n else\n self.update_product(stuff, quantity, options)\n end\n end",
"def update\n respond_to do |format|\n if @recipe_ingredient.update(recipe_ingredient_params)\n format.html { redirect_to @recipe_ingredient, notice: 'Recipe ingredient was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe_ingredient }\n else\n format.html { render :edit }\n format.json { render json: @recipe_ingredient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipeingredient.update(recipeingredient_params)\n format.html { redirect_to @recipeingredient, notice: 'Recipeingredient was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipeingredient }\n else\n format.html { render :edit }\n format.json { render json: @recipeingredient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(id, attributes)\n # attributes = {name: 'chocolate and peanuts', calories: 10}\nend",
"def update\n @item.update!(item_params)\n end",
"def update!(**args)\n @amount_pretax = args[:amount_pretax] if args.key?(:amount_pretax)\n @amount_tax = args[:amount_tax] if args.key?(:amount_tax)\n @line_item_id = args[:line_item_id] if args.key?(:line_item_id)\n @product_id = args[:product_id] if args.key?(:product_id)\n @quantity = args[:quantity] if args.key?(:quantity)\n @reason = args[:reason] if args.key?(:reason)\n @reason_text = args[:reason_text] if args.key?(:reason_text)\n end",
"def update!(**args)\n @amount_pretax = args[:amount_pretax] if args.key?(:amount_pretax)\n @amount_tax = args[:amount_tax] if args.key?(:amount_tax)\n @line_item_id = args[:line_item_id] if args.key?(:line_item_id)\n @product_id = args[:product_id] if args.key?(:product_id)\n @quantity = args[:quantity] if args.key?(:quantity)\n @reason = args[:reason] if args.key?(:reason)\n @reason_text = args[:reason_text] if args.key?(:reason_text)\n end",
"def update\n if @item.update(item_params)\n render json: @item, status: :ok\n else\n render json: @item.errors, status: :unprocessable_entity\n end\n end",
"def update\n #@recipe = Recipe.find(params[:id])\n \n if @recipe.update(recipe_params)\n flash[:success] = \"Your recipe was updated successfully!\"\n redirect_to recipe_path(@recipe)\n \n else\n render :edit\n \n end\n \n end",
"def update\n @inventoryitem = Inventoryitem.find(params[:id])\n\n respond_to do |format|\n if @inventoryitem.update_attributes(params[:inventoryitem])\n format.html { redirect_to @inventoryitem, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @inventoryitem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe_input.update(recipe_input_params)\n format.html { redirect_to @recipe_input, notice: 'Recipe input was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe_input }\n else\n format.html { render :edit }\n format.json { render json: @recipe_input.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @food_recipe = FoodRecipe.find(params[:id])\n\n respond_to do |format|\n if @food_recipe.update_attributes(params[:food_recipe])\n format.html { redirect_to @food_recipe, notice: 'Food recipe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @food_recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @recipe = Recipe.find(current_recipe)\n @recipe_ingredient = current_recipe.recipe_ingredients.find(params[:id])\n @obj = @recipe_ingredient\n if(@recipe_ingredient.update(ri_params))\n #flash.alert = \"Record Updated\"\n respond_to do |f|\n f.html {redirect_to current_recipe}\n f.js {@recipe}\n end\n else\n #flash.now.alert = \"Error\"\n respond_to do |f|\n f.html {render 'shared/form'}\n f.js {@recipe}\n end\n end\n end",
"def update\n outcome = Transactions::Update.run({ id: params[:id] }, transaction_params)\n\n if outcome.success?\n render_success_response({ transaction: outcome.result })\n else\n render_unprocessable_entity(outcome.errors.symbolic)\n end\n end",
"def update\n respond_to do |format|\n if @recipe.update(update_recipe_params)\n #if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'レシピが更新されました。' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_variation_with_http_info(location_id, item_id, variation_id, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: V1ItemsApi.update_variation ...\"\n end\n # verify the required parameter 'location_id' is set\n fail ArgumentError, \"Missing the required parameter 'location_id' when calling V1ItemsApi.update_variation\" if location_id.nil?\n # verify the required parameter 'item_id' is set\n fail ArgumentError, \"Missing the required parameter 'item_id' when calling V1ItemsApi.update_variation\" if item_id.nil?\n # verify the required parameter 'variation_id' is set\n fail ArgumentError, \"Missing the required parameter 'variation_id' when calling V1ItemsApi.update_variation\" if variation_id.nil?\n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling V1ItemsApi.update_variation\" if body.nil?\n # resource path\n local_var_path = \"/v1/{location_id}/items/{item_id}/variations/{variation_id}\".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s).sub('{' + 'item_id' + '}', item_id.to_s).sub('{' + 'variation_id' + '}', variation_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n \n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:PUT, 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 => 'V1Variation')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: V1ItemsApi#update_variation\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update_item(item_id)\n request_body = {\n 'name' => 'Malted Milkshake'\n }\n\n response = Unirest.put CONNECT_HOST + '/v1/' + LOCATION_ID + '/items/' + item_id,\n headers: REQUEST_HEADERS,\n parameters: request_body.to_json\n\n if response.code == 200\n puts 'Successfully updated item:'\n puts JSON.pretty_generate(response.body)\n return response.body\n else\n puts 'Item update failed'\n puts response.body\n return nil\n end\nend",
"def update\n json_response(@food_item.update!(food_item_params))\n end",
"def update!(**args)\n @line_item_id = args[:line_item_id] if args.key?(:line_item_id)\n @operation_id = args[:operation_id] if args.key?(:operation_id)\n @product_id = args[:product_id] if args.key?(:product_id)\n @quantity = args[:quantity] if args.key?(:quantity)\n @reason = args[:reason] if args.key?(:reason)\n @reason_text = args[:reason_text] if args.key?(:reason_text)\n end",
"def update!(**args)\n @line_item_id = args[:line_item_id] if args.key?(:line_item_id)\n @operation_id = args[:operation_id] if args.key?(:operation_id)\n @product_id = args[:product_id] if args.key?(:product_id)\n @quantity = args[:quantity] if args.key?(:quantity)\n @reason = args[:reason] if args.key?(:reason)\n @reason_text = args[:reason_text] if args.key?(:reason_text)\n end",
"def update\n @cooking_recipe = CookingRecipe.find(params[:id])\n\n respond_to do |format|\n if @cooking_recipe.update_attributes(params[:cooking_recipe])\n format.html { redirect_to(@cooking_recipe, :notice => 'CookingRecipe was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cooking_recipe.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @item_id = args[:item_id] if args.key?(:item_id)\n @question_id = args[:question_id] if args.key?(:question_id)\n end",
"def update!(**args)\n @line_item_id = args[:line_item_id] if args.key?(:line_item_id)\n @product_id = args[:product_id] if args.key?(:product_id)\n @quantity = args[:quantity] if args.key?(:quantity)\n end",
"def update\n @recipe_all = RecipeAll.find(params[:id])\n\n respond_to do |format|\n if @recipe_all.update_attributes(params[:recipe_all])\n format.html { redirect_to @recipe_all, notice: 'Recipe all was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe_all.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @meals_recipe = MealsRecipe.find(params[:id])\n\n respond_to do |format|\n if @meals_recipe.update_attributes(params[:meals_recipe])\n flash[:notice] = 'MealsRecipe was successfully updated.'\n format.html { redirect_to(@meals_recipe) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @meals_recipe.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n ingredient.update(ingredient_params)\n render json: ingredient\n end",
"def update_item\n order = current_user.init_cart.order\n line_item = order.line_items.find(params[:id])\n line_item.attributes = params[:item]\n image = line_item.image\n line_item.price = Product.find(line_item.product_id).price_for_tier(image.tier_id, image.owner?(current_user))\n line_item.tax = line_item.price * PER_TAX\n\n if line_item.save\n render json: line_item, status: :created\n else\n render json: { msg: line_item.errors.full_messages.to_sentence }, status: :bad_request\n end\n end",
"def update\n @item_transaction = ItemTransaction.find(params[:id])\n\n respond_to do |format|\n if @item_transaction.update_attributes(params[:item_transaction])\n format.html { redirect_to @item_transaction, notice: 'Item transaction was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item_transaction.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6818155",
"0.66183865",
"0.6592808",
"0.65405846",
"0.6403329",
"0.6285955",
"0.62290543",
"0.60977983",
"0.60847026",
"0.6070106",
"0.6063127",
"0.6044562",
"0.6005626",
"0.5904145",
"0.58868897",
"0.58843267",
"0.5871014",
"0.587027",
"0.58675855",
"0.5848192",
"0.58443767",
"0.5833168",
"0.5833168",
"0.5833168",
"0.5833168",
"0.5830476",
"0.58225775",
"0.58185667",
"0.5818228",
"0.5810726",
"0.57942927",
"0.57939816",
"0.5788803",
"0.5747491",
"0.5739312",
"0.57372",
"0.57284945",
"0.57278633",
"0.56761223",
"0.5675588",
"0.56740904",
"0.56737155",
"0.56627446",
"0.56612486",
"0.56612486",
"0.56612486",
"0.56544185",
"0.56457597",
"0.5641416",
"0.5641416",
"0.5638718",
"0.56237763",
"0.56231827",
"0.5620178",
"0.5618814",
"0.5602935",
"0.5595802",
"0.55934006",
"0.5580241",
"0.5579856",
"0.5579361",
"0.5575464",
"0.5575064",
"0.5575064",
"0.5575064",
"0.5575064",
"0.5575064",
"0.5575064",
"0.5575064",
"0.5575064",
"0.5575064",
"0.5575064",
"0.5575064",
"0.5575064",
"0.5567832",
"0.5553573",
"0.55523443",
"0.55523443",
"0.555153",
"0.55500424",
"0.55382246",
"0.55313504",
"0.5530629",
"0.552677",
"0.55261695",
"0.5520178",
"0.5511245",
"0.55074257",
"0.55055326",
"0.5505158",
"0.55034655",
"0.55034655",
"0.5493443",
"0.549128",
"0.54771847",
"0.547643",
"0.5472742",
"0.5465217",
"0.5462316",
"0.54596204"
] | 0.7561907 | 0 |
def game_over? return true if none of the cells are hidden false end | def render
@board_array.each_with_index do |row, row_index|
row.each_with_index do |cell, col_index|
if @position_hash[[row_index, col_index]].hidden
print '______'
else
print cell.to_s
end
end
print "\n"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def game_over \n # all the grid's cells are full and different numbers \n end",
"def game_over?\n @blocks.each do |row|\n return false if row.any? { |col| col != @tlc }\n end\n\n true\n end",
"def won?\n @grid.flatten.all? { |el| el.face_down == false }\n end",
"def won?\n board.all_non_mines_cells_revealed?\n end",
"def game_over?\n @board.game_over?\n end",
"def won?\n [email protected]? do |card|\n !card.face_up\n end\n end",
"def won?\n grid.flatten.all?(&:face_up)\n end",
"def gameover?\n winning_row? || winning_column? || winning_diagonal? || full_board?\n end",
"def game_over?\n true\n end",
"def touched_a_mine?\n self.grid.flatten.any?{ |cell| cell.visible && cell.mine }\n end",
"def game_over?\n if $board.has_value?(\"none\") == false then\n puts \"No more turns available\"\n return true\n else\n return false\n end\n end",
"def over?\n\t\t@over = true\n\t\t(0..2).each do |row|\n\t\t\t(0..2).each do |col|\n\t\t\t\t@over = false && break if @board[row][col] == \" \"\n\t\t\tend\n\t\tend\n\t\t@over\n\tend",
"def in_hidden_entrance\r\n\r\n # Determine the tile placement, as integers \r\n tile_x = (@player.get_x/16).to_i\r\n tile_y = (@player.get_y/16).to_i\r\n\r\n # Hidden tile is present, so return true\r\n if @level[1][tile_y-1][tile_x] > 0 then\r\n return true\r\n\r\n # Otherwise the player is no longer hidden\r\n else\r\n return false\r\n end\r\n end",
"def victory?\n self.grid.flatten.select {|space| !space.mine }.\n all? {|space| space.visible }\n end",
"def won?\n safe_tiles = @grid.flatten.select { | tile | tile.value != BOMB }\n safe_tiles.all? { | tile | tile.revealed }\n end",
"def human_lost?\n human_ship_cells = @human_board.cells_containing_ships.map {|key| @human_board.cells[key].fired_upon?}\n if human_ship_cells.all? {|fired_upon_status| fired_upon_status == true} == true\n return true\n end\n end",
"def over?\n won? || board.full? || draw?\n end",
"def game_over?\n @all_ships.empty?\n end",
"def game_is_over?\n (won? || draw? || full?) ? true : false\n end",
"def is_over?\n ((winning_move?) || (spots_filled == 9)) ? (return true) : (return false)\n end",
"def won?\n board.all? do |row|\n row.all?(&:revealed?)\n end\n end",
"def game_over?\n possible_moves(:white).empty? && possible_moves(:black).empty? \n end",
"def game_over?\n @lives == 0\n end",
"def over?(board)\n won?(board) || full?(board)\n end",
"def game_over?\n @game_over\n end",
"def all_cells_cleared?\n @board.each do |row|\n row.each do |cell|\n if !cell.has_bomb && !cell.is_open\n return false\n end\n end\n end\n true\n end",
"def game_over?\n shots_remaining <= 0 || board.boats.all?(&:sunk?)\n end",
"def is_game_over?\n goals_with_boxes = 0\n @list[:Goal].each do |goal|\n @list[:Box].each do |box|\n if are_colliding?(goal, box)\n goals_with_boxes += 1\n end\n end\n end\n goals_with_boxes == @list[:Goal].count\n end",
"def game_over?\n # Write a if condition - true\n if @lives == 0\n true\n end\n end",
"def over?\n draw? || won?\n end",
"def is_over?\n if winner_player1 == true\n return true\n elsif winner_player2 == true\n return true\n elsif @board.boxes.length < 1\n return true\n else\n return false\n end\n end",
"def over?\n \t@game_over = true\n end",
"def game_over?\n return true if victory? || (@turns == 12)\n false\n end",
"def game_over?\n return true if @game_over\n !find_set && @deck.count < 1\n end",
"def over?\n draw? || won?\n end",
"def has_top_cell?\n result = @connected_cells.select { |cell| cell.x == @x && cell.y == @y - 1 }\n !result.empty?\n end",
"def over?(board)\n return won?(board) || draw?(board) ? true : false\nend",
"def over?\n draw? || won? ? true : false\n end",
"def over?\n return draw? || won?\n end",
"def game_over?\n alive_robots.count == 1\n end",
"def over?(board)\n draw?(board) == true || won?(board) != false ? true : false\nend",
"def over?(board)\n return won?(board) || draw?(board)\nend",
"def game_over?\n @board.pieces['black'].empty? || @board.pieces['white'].empty? || (@board.moves(HUMAN_PLAYER).empty? && @board.moves(CPU_PLAYER).empty?)\n end",
"def game_over?\n alive_players.count == 1\n end",
"def over?\n draw? || won?\n end",
"def over?\n draw? || won?\n end",
"def gameover?\n full? or not check_winner.nil?\n end",
"def game_over?\n losing_players != nil ? true: false\n end",
"def draw?\n @grid.each { |columns| columns.each { |cell| return false if cell.color == ' '}}\n return true\n end",
"def cell_cleared?(row, col)\n @board[row][col].is_open\n end",
"def over?(board)\n if draw?(board)\n true\n elsif won?(board) != nil && full?(board) == true\n true\n elsif won?(board) != nil && full?(board) == false\n true\n else\n false\n end\nend",
"def over?(board)\n if draw?(board)\n true\n elsif won?(board) != nil && full?(board) == true\n true\n elsif won?(board) != nil && full?(board) == false\n true\n else\n false\n end\nend",
"def should_die?(row, column)\n num_live_neighbors = @num_live_neighbors_by_live_cells[[row, column]]\n\n # Any live cell with fewer than two live neighbours dies, as if caused by underpopulation.\n \n # Any live cell with more than three live neighbours dies, as if by overpopulation\n return true if (num_live_neighbors < 2 || num_live_neighbors > 3)\n \n # Any live cell with two or three live neighbours lives on to the next generation.\n false\n end",
"def over?\n if draw? == true || won? != false\n return true\n elsif full? == false\n return false\n end\n end",
"def game_over?\n self.lost? || self.won?\n end",
"def over?\n won? || full? || draw?\n end",
"def alive?(x, y)\n @cells.include?([x, y])\n end",
"def cell_alive?(column, row)\n @cell_state[(row % ROWS) * ROWS + (column % COLUMNS)] > 0\n end",
"def over?(board)\n draw?(board) || won?(board)\nend",
"def over?(board)\n draw?(board) || won?(board)\nend",
"def game_over\n @lives == 0\n end",
"def over?(board)\n return won?(board) || draw?(board) || full?(board)\nend",
"def has_cells?\n cells.any?\n end",
"def cell_cleared?(row, col)\n grid[row][col].uncovered\n\n end",
"def over?\r\n won? || draw?\r\n end",
"def over?\n won? || draw? || full?\n end",
"def over?\n won? || draw? || full?\n end",
"def over?\n won? || draw? || full?\n end",
"def over?\r\n won? || draw? ? true : false\r\n end",
"def over?(board)\n full?(board) || won?(board)\nend",
"def tied?\n @grid.all? { |row| row.all? { |el| el != nil } }\n end",
"def over?(board_array)\r\n draw?(board_array) || won?(board_array)\r\nend",
"def is_game_over?\n @guesses_left == 0 ? true : false\n end",
"def over?(board)\n won?(board) || draw?(board)\nend",
"def over?\n if won? || draw? || full?\n true\n end\n end",
"def over?(board)\n if won?(board) || full?(board)\n return true\n end\nend",
"def over?(board)\n if won?(board) || full?(board)\n return true\n end\nend",
"def is_win?\n cell[0] == cell[1] && cell[1] == cell[2] ||\n cell[3] == cell[4] && cell[4] == cell[5] ||\n cell[6] == cell[7] && cell[7] == cell[8] ||\n cell[0] == cell[3] && cell[3] == cell[6] ||\n cell[1] == cell[4] && cell[4] == cell[7] ||\n cell[2] == cell[5] && cell[5] == cell[8] ||\n cell[0] == cell[4] && cell[4] == cell[8] ||\n cell[2] == cell[4] && cell[4] == cell[6]\n end",
"def should_come_alive?(row, column)\n # Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.\n @num_live_neighbors_by_dead_cells[[row, column]] == 3\n end",
"def over?(board)\n if won?(board) || draw?(board) || full?(board)\n true\n else\n false\n end\nend",
"def game_started?\n [email protected]? # count_tiles(WALL) >= 45 + 23 + 23\n end",
"def over?(board)\n won?(board) || draw?(board)\n end",
"def draw?\n if !won?\n board.cells.each do |i|\n if i == \" \"\n return false\n end\n true\n end\n end\n \n end",
"def over?(board)\r\n if ( won?(board) || draw?(board) || full?(board))\r\n return true\r\n else\r\n return false\r\n end\r\nend",
"def cat_game?\n\t\t !(@grid.include?(\" \"))\n\t\tend",
"def isCellAlive(x,y)\n\t\treturn (@cells[y][x] == ALIVE) || (@cells[y][x] == KILL)\n\tend",
"def over?\n if won? or draw? or full?\n return true\n else\n return false\n end\n end",
"def over?\n @board.pieces_coords(@current_color).all? do |coords|\n safe_moves(coords).empty?\n end\n end",
"def any_mines_detonated?\n flag = false\n @grid.each do |row|\n flag = true if row.any? { |cell | cell.uncovered == true && !cell.fill.nil? }\n end\n flag\n end",
"def any_mines_detonated?\n @board.each do |row|\n row.each do |cell|\n if cell.detonated?\n return true\n end\n end\n end\n false\n end",
"def over?(board)\n if won?(board) || draw?(board)\n return true\n else \n return false\n end\n end",
"def over?\n won? || draw? || full?\n end",
"def contains_mine?(row, col)\n @board[row][col].has_bomb\n end",
"def over?(board)\r\n if draw?(board) || won?(board)\r\n true\r\n else\r\n false\r\n end\r\nend",
"def over?(board)\n if draw?(board) == true || full?(board) == true || won?(board)\n return true\n else\n return false\n end\n end",
"def over?\n won? || full? || draw?\n end",
"def over?\n draw? || won? || full?\nend",
"def over?(board)\n (won?(board) || draw?(board)) ? true : false\nend",
"def over?\n won? || draw?\n end",
"def game_over?\n @life <= 0\nend",
"def over?()\n if won?() || draw?()\n return true\n end\n return false\n end"
] | [
"0.790757",
"0.76968473",
"0.76484215",
"0.7528237",
"0.750408",
"0.74070966",
"0.73825234",
"0.7233384",
"0.72134936",
"0.7189672",
"0.7149495",
"0.7140157",
"0.71376646",
"0.7128106",
"0.7099697",
"0.7079078",
"0.70619905",
"0.70439714",
"0.7028678",
"0.7025278",
"0.70092547",
"0.7003289",
"0.6991719",
"0.6986195",
"0.6975474",
"0.69650936",
"0.69577783",
"0.6930403",
"0.6930302",
"0.69244814",
"0.6891839",
"0.6887138",
"0.68864805",
"0.68851054",
"0.68814504",
"0.685344",
"0.68497986",
"0.6849085",
"0.6848911",
"0.6843859",
"0.684356",
"0.68430495",
"0.6840467",
"0.68259794",
"0.68168175",
"0.68168175",
"0.6810499",
"0.6805372",
"0.68053705",
"0.6796507",
"0.67929333",
"0.6792363",
"0.67877537",
"0.6774401",
"0.677051",
"0.6769317",
"0.67689514",
"0.6768748",
"0.6768385",
"0.6768385",
"0.67660505",
"0.67606056",
"0.675862",
"0.67497915",
"0.67486596",
"0.6748631",
"0.6748631",
"0.6748631",
"0.67481977",
"0.6743399",
"0.67427945",
"0.6740465",
"0.67389333",
"0.6737329",
"0.6737255",
"0.6735452",
"0.6735452",
"0.67334425",
"0.67322314",
"0.67291206",
"0.6728593",
"0.67265075",
"0.6719452",
"0.6715569",
"0.6714648",
"0.6707858",
"0.6706548",
"0.6705604",
"0.67050433",
"0.67045707",
"0.67036206",
"0.6702701",
"0.67021334",
"0.6702082",
"0.67008984",
"0.6700122",
"0.6697624",
"0.6697326",
"0.66922635",
"0.6692209",
"0.6690777"
] | 0.0 | -1 |
GET /drgs/1 GET /drgs/1.json | def show
@drg = Drg.find(params[:id],:include => "aliases")
@icd10s = @drg.icd10s
@thetitle = "Compare Medical billing costs for "[email protected]_description+" in U.S. Hospitals"
@count = @drg.costs.count
@costs = @drg.costs.order('average_covered_charges desc').includes(:hospital).limit(10)
@average_covered_charges = @costs.average('average_covered_charges')
@average_total_payments = @costs.average('average_total_payments')
@states = State.find(:all,:order => "name")
@regions = Hospital.select('referral_region').group(:referral_region).count
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @gethotelstaticdatagd = Gethotelstaticdatagd.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gethotelstaticdatagd }\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 @grm_grappt = GrmGrappt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @grm_grappt }\n end\n end",
"def show\n @drug = Drug.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @drug }\n end\n end",
"def index\n @drugs = Drug.all\n # @permitted_drugs = Drug.permitted.alphabetical.all\n # @prohibited_drugs = Drug.prohibited.alphabetical.all\n # @restricted_drugs = Drug.restricted.alphabetical.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @drugs }\n end\n end",
"def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end",
"def show\n @dataload_ga = DataloadGa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dataload_ga }\n end\n end",
"def show\n @grm_dog = GrmDog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @grm_dog }\n end\n end",
"def show\n @grm = Grm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @grm }\n end\n end",
"def index\n @gpsds = Gpsd.all\n #respond_to do |format|\n # format.json { render }\n #end\n end",
"def show\n @gig = Gig.find(params[:id])\n\n respond_to do |format|\n format.html {render json: @gig, status: :ok}\n format.json { render json: @gig, status: :ok }\n end\n end",
"def show\n @gid2name = Gid2name.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gid2name }\n end\n end",
"def index\n @distros = getmydata(\"Distro\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @distros }\n end\n end",
"def show\n @gravity = Gravity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gravity }\n end\n end",
"def show\n @gitem = Gitem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gitem }\n end\n end",
"def show\n @gig_request = GigRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gig_request }\n end\n end",
"def show\n @distro = Distro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @distro }\n end\n end",
"def show\n @distro = Distro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @distro }\n end\n end",
"def show\n @dress = Dress.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dress }\n end\n end",
"def show\n @grumble = Grumble.find(params[:id])\n render status: 200, json: @grumble.to_json\n end",
"def show\n @distraction = Distraction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @distraction }\n end\n end",
"def show\n @golfer = Golfer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @golfer }\n end\n end",
"def show\n @gnode = Gnode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gnode }\n end\n end",
"def show\n @dimgeom = Dimgeom.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dimgeom }\n end\n end",
"def index_by_age\n @age = Age.find(params[:age_id])\n @gifts = @age.gifts\n render json: @gifts, include: :ages, status: :ok\n end",
"def drugbank_get(route, params)\n url = $drugbank_api + route\n res = HTTParty.get(url, :query => params, :headers => $drugbank_headers)\n return res\nend",
"def show\n dog = Dog.find(params[:id])\n render json: dog\n end",
"def index\n @cgvs = Cgv.order('created_at')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cgvs }\n end\n end",
"def show\n @src_gst = SrcGst.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @src_gst }\n end\n end",
"def index\n base_url = 'https://www.googleapis.com/books/v1/volumes?q=fiction&maxResults=20'\n and_key = '&key='\n key = ENV['GOOGLE_BOOKS_API_KEY'] \n googleurl = base_url + and_key + key\n\n response = RestClient.get(googleurl)\n @books = JSON.parse(response)\n\n respond_to do |format|\n format.html\n format.json { render json: @books }\n end\n\nend",
"def index\n @dnas = Dna.all\n\n render json: @dnas\n end",
"def index\n @dolgnosts = Dolgnost.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dolgnosts }\n end\n end",
"def show\n @gastracker = Gastracker.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gastracker }\n end\n end",
"def show\n @sundry_grn = SundryGrn.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @sundry_grn }\n end\n end",
"def show\n @gage = Gage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gage }\n end\n end",
"def show\n if (params[:redirect] == \"on\")\n sql = <<-SQL\n with src AS (SELECT daughters(ear_num)\n FROM kine WHERE id = #{params[:id]})\n select json_agg(src) FROM src;\n SQL\n render json: ActiveRecord::Base.connection.select_value(sql)\n end\n end",
"def show\n @gopy = Gopy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gopy }\n end\n end",
"def index\n @src_gsts = SrcGst.where(hotel_src_id: current_user.hotel_src_id).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @src_gsts }\n end\n end",
"def get_drug_info(client)\n name = self.name.split(\" \")[0]\n drugs = client.call(:get_drugs, message: {name: name}).body[:multi_ref]\n drug_info_hash = drugs.find{|hash| hash.find{|key, value| key != :rx_concept && key == :cui}}\n end",
"def show\n @dolgnost = Dolgnost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dolgnost }\n end\n end",
"def index\n @grcrds = Grcrd.all\n end",
"def gist(id)\n get \"/gists/#{id}\"\n end",
"def dresses\n render json: { collections: Collection.published_dresses }\n end",
"def index\n @dossiers = Dossier.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dossiers }\n end\n end",
"def show\n @gasto = Gasto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gasto }\n end\n end",
"def show\n json = self.as_json(only: [:created_at, :version])\n json['url'] = doi_url\n json\n end",
"def show\n @dc = Dc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @dc }\n end\n end",
"def index\n \n # if params[:dress_id]\n # @dress = Dress.find(params[:dress_id])\n @ratings = Rating.all\n render json: @ratings, except:[:created_at, :updated_at] ,status: 200\n \n # else \n # @ratings= Rating.all\n # binding.pry \n # end\n end",
"def show\n @cgv = Cgv.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cgv }\n end\n end",
"def show\n @grm_pic = GrmPic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @grm_pic }\n end\n end",
"def show\n @gauge = Gauge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gauge }\n end\n end",
"def get_digg\n\nresponse = JSON.parse(RestClient.get 'http://digg.com/api/news/popular.json')\n# puts response['data']['feed'][0]['content']['title']\n\nstories = []\n\nresponse['data']['feed'].each do |story|\n\tstory_hash = {}\n\tstory_hash[:title] = story['content']['title']\n\tstory_hash[:category] = story['content']['tags'][0]['display']\n\tcalculate_upvotes(story_hash)\n\tstories.push(story_hash)\n\tend\n\tshow_all_stories(stories)\nend",
"def show\n @tagg = Tagg.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tagg }\n end\n end",
"def show\n @drip = Drip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @drip }\n end\n end",
"def index\n @breeds = Breed.all\n\n render json: @breeds\n end",
"def show\n @glass = Glass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @glass }\n end\n end",
"def new\n @drug = Drug.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @drug }\n end\n end",
"def show\n @green = Green.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @green }\n end\n end",
"def index\n if (params[:redirect] == \"on\")\n sql = <<-SQL\n WITH src AS (SELECT id, daughters(id)\n FROM kine WHERE owner_id = #{params[:search_owner]})\n SELECT json_agg(src) FROM src;\n SQL\n render json: ActiveRecord::Base.connection.select_value(sql)\n else\n @daughters = Daughter.all\n end\n end",
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n puts JSON.pretty_generate(result)\n result\nend",
"def show\n response = Aws.list_recipe(params[:id])\n render :json => response\n end",
"def series_get(id)\n begin\n api = \"#{$config['sonarr']['api_url']}/series/#{id}\"\n log_debug(api)\n uri = URI(api)\n http = Net::HTTP.new(uri.host, uri.port)\n req = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json', 'X-Api-Key'=> $config['sonarr']['api_key'])\n \n json = {}\n json['id'] = id\n \n req.body = json.to_json\n res = http.request(req) \n json = JSON.parse(res.body)\n debug json\n rescue => e\n puts \"failed #{e}\"\n end\n end",
"def show\n @garbage = Garbage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @garbage }\n end\n end",
"def show\n @generator = Generator.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @generator }\n end\n end",
"def show\n @gist = Gist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gist }\n end\n end",
"def index\n @order = scrub_order(Drug, params[:order], \"drugs.product_ndc\")\n @drugs = Drug.all.search_any_order(params[:search]).order(@order).page(params[:page]).per(40)\n end",
"def index\n @protocol_drugs = ProtocolDrug.all\n end",
"def content id, date = Date.today.to_s, page = 1\n uri = \"#{BASE_URL}/gauges/#{id}/content?date=#{date}&page=#{page}\"\n fetch uri\n end",
"def index\n @dogs = Dog.all\n render json: @dogs, each_serializer: DogSerializer, root: 'dogs'\n end",
"def index\n info = Aws.get_recipes_from_db\n render :json => info\n end",
"def traffic id, date = Date.today.to_s\n uri = \"#{BASE_URL}/gauges/#{id}/traffic?date=#{date}\"\n fetch uri\n end",
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend",
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend",
"def show\n @svgpost = Svgpost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @svgpost }\n end\n end",
"def index\n @generations = Generation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @generations }\n end\n end",
"def show\n @cg_entry = CgEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cg_entry }\n end\n end",
"def show\n @dtest = Dtest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dtest }\n end\n end",
"def index\n @garnishes = Garnish.where(\"LOWER(name) like ?\", \"%#{params[:q] ? params[:q].downcase : ''}%\").paginate(:page => params[:page], :per_page => 198).order(:name)\n respond_to do |format|\n format.html\n format.json {render :json => @garnishes.map(&:attributes)}\n end\n end",
"def index\n\n @dtests = Dtest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dtests }\n end\n end",
"def get\n @research_output = @service.get({type: params[:graph], detail: params[:detail], id: params[:id]},\n host: request.env[\"HTTP_HOST\"], limit: params[:num_results], offset: params[:start_offset], :per_project => params[:per_project], format: params[:format])\n\n respond_with @research_output\n end",
"def get_gdpr_requests_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: GeneralDataProtectionRegulationApi.get_gdpr_requests ...\"\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/gdpr/requests\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size']\n query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'GDPRRequestEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: GeneralDataProtectionRegulationApi#get_gdpr_requests\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @grocery = Grocery.find(params[:id])\n\n render json: @grocery\n end",
"def show\n @galeria = Galeria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @galeria }\n end\n end",
"def index\n @galleries = Gallery.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @galleries }\n end\n end",
"def index\n @galleries = Gallery.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @galleries }\n end\n end",
"def index\n @galleries = Gallery.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @galleries }\n end\n end",
"def new\n # @gethotelstaticdatagd = Gethotelstaticdatagd.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gethotelstaticdatagd }\n end\n end",
"def show\n @gl = Gl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gl }\n end\n end",
"def new\n @dataload_ga = DataloadGa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dataload_ga }\n end\n end",
"def new\n @grm_grappt = GrmGrappt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @grm_grappt }\n end\n end",
"def index\n @cartridges = Cartridge.all\n\n respond_to do |format|\n format.html\n format.json { render json: @cartridges }\n end\n end",
"def get_json(path)\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n #puts \"🤖 GET #{path}\"\n #puts \"HTTP #{response.code}\"\n #puts JSON.pretty_generate(result)\n result\nend",
"def index\n @galleries = Gallery.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @galleries }\n end\n end",
"def index\n @dosages = @drug.dosages\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @dosages }\n end\n end",
"def show\n render json: @gpsd\n end",
"def show\n render json: @dice\n end",
"def show\n params.require(%i[id])\n render json: Ingredient.find_by!(id: params[:id])\n end",
"def search\n render json: Consultation.first(10)\n end",
"def show\n @grm_vetappt = GrmVetappt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @grm_vetappt }\n end\n end",
"def index\n @q = Galaxy.search(params[:q])\n @q.sorts = 'id asc' if @q.sorts.empty?\n if params[:page] != \"false\"\n @galaxies = @q.result(distinct: true).page(params[:page])\n else\n @galaxies = @q.result(distinct: true)\n end\n\n respond_to do |format|\n format.html { render :index }\n format.json { render :json => @galaxies.to_json(\n :only => [:id, :galaxy_name, :galaxy_type, :distance, :luminosity, :scale_length,\n :mass_hydrogen, :mass_disk, :velocities_citation, :luminosity_citation, :mass_hydrogen_citation, :scale_length_citation],\n :methods => [:citation_ids_array, :r_last, :vrot_data_last, :velocities_count]\n )\n }\n end\n end",
"def show\n @generation = Generation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @generation }\n end\n end"
] | [
"0.64504427",
"0.63662064",
"0.6335274",
"0.6268852",
"0.6266955",
"0.6232734",
"0.6201866",
"0.6187148",
"0.61275005",
"0.60485977",
"0.60044855",
"0.5953754",
"0.5940064",
"0.58997643",
"0.58312327",
"0.58120894",
"0.5801566",
"0.5801566",
"0.5789624",
"0.5787138",
"0.5771668",
"0.57669204",
"0.5759847",
"0.5755567",
"0.5747613",
"0.57347935",
"0.57178575",
"0.57144415",
"0.57019717",
"0.5698315",
"0.56981695",
"0.5695506",
"0.56857324",
"0.5685522",
"0.5677456",
"0.5672181",
"0.5666471",
"0.5661337",
"0.56484413",
"0.56424886",
"0.56373614",
"0.5630546",
"0.56278795",
"0.56275177",
"0.562313",
"0.5619401",
"0.560572",
"0.56056225",
"0.5604059",
"0.5600186",
"0.55949676",
"0.55812496",
"0.5580146",
"0.5580015",
"0.55733496",
"0.55713266",
"0.55704206",
"0.55685806",
"0.5564436",
"0.5560394",
"0.555982",
"0.5557349",
"0.55559945",
"0.5554474",
"0.5542645",
"0.5542537",
"0.5540447",
"0.5528814",
"0.55284834",
"0.5526906",
"0.55218613",
"0.5515179",
"0.5515179",
"0.5508169",
"0.55080765",
"0.5507259",
"0.55048025",
"0.55044496",
"0.54888666",
"0.54870987",
"0.5485925",
"0.54777205",
"0.54764616",
"0.54748416",
"0.54748416",
"0.54748416",
"0.5471345",
"0.5468254",
"0.54566103",
"0.545292",
"0.54522014",
"0.5447796",
"0.5447174",
"0.5446332",
"0.5443728",
"0.5442034",
"0.543263",
"0.54290164",
"0.54243845",
"0.5420177",
"0.541858"
] | 0.0 | -1 |
for layout use only maybe a separate obj? | def initialize(contents:)
@contents = contents
@_origin = [0,0]
@_dims = [0,0]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def layout=(_arg0); end",
"def layouts=(_arg0); end",
"def layouts=(_arg0); end",
"def _layout(*_arg0); end",
"def layout; end",
"def place_in_layout?; end",
"def place_in_layout?; end",
"def object_nl()\n #This is a stub, used for indexing\n end",
"def layout_children\n \n end",
"def render_layout(output, layout, info); end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def _implied_layout_name; end",
"def layout_fields\n \n end",
"def rendered=(_arg0); end",
"def layout \n return @layout\n end",
"def no_layout?; end",
"def layouts; end",
"def layouts; end",
"def set_layout\n @layoutme = 1\n end",
"def layout\n\n raise \"Missing bulletin for layout object!\" if (! self.bulletin)\n \n raise \"Missing layout style/name for layout object!\" if (! self.name)\n\n # assume everything prepared if this is already set (caching!)\n return @layout if (@layout)\n\n # Load layout from the database\n while (! @layout)\n @layout = TempletLayout.find(:first, \n :conditions => ['templet_id = ? AND name = ?', self.bulletin.templet_id, self.name ])\n if !@layout and self.name == 'print'\n # set to main, if print layout not found\n self.name = 'main'\n elsif not @layout\n raise \"Invalid layout selected!\" if (! @layout) \n end\n end\n \n \n # copy the details accross for the layout\n self.filetype = @layout.filetype\n self.charset = @layout.charset\n \n return @layout\n end",
"def design\r\n \r\n end",
"def layout\n properties[:layout]\n end",
"def _conditional_layout?; end",
"def getLayoutData\n @layoutData\n end",
"def x______________STRUCTURE\r\nend",
"def x______________STRUCTURE\r\nend",
"def layout(model)\n #Rfm.layout(model.storage_name, options.symbolize_keys) #query.repository.adapter.options.symbolize_keys)\n model.layout\n end",
"def layout(name)\n $stderr.puts \"Overwriting Layout: #{self.class.def_layout.inspect} with #{name}\"\n @_layout = name\n end",
"def objects; end",
"def layout\n nil\n end",
"def displayed?; end",
"def style; end",
"def style; end",
"def style; end",
"def object\n @obj\n end",
"def render(object = T.unsafe(nil)); end",
"def layout\n @layout\n end",
"def display\n # Don't no why i thought i would need that. or if i need this.\n end",
"def render; end",
"def render; end",
"def render; end",
"def render; end",
"def render; end",
"def find\n self.class.find(@view.layout)\n end",
"def private; end",
"def renderer; end",
"def layout_4print\n return '' if @parent.params[:renderer].blank?\n opts = @opts.dup\n opts[:method] = @parent.params[:method]\n klass = (@parent.params[:renderer] + '_renderer').classify\n obj = Kernel.const_get(klass, Class.new).new(@parent, opts)\n# \n html = obj.render_html\n @css << obj.render_css.to_s\n html\nend",
"def rendered_format; end",
"def rendered_format; end",
"def createDisplay _obj, _args\n \"_obj createDisplay _args;\" \n end",
"def rendered; end",
"def display_position\n # Fill this in\n end",
"def display_position\n # Fill this in\n end",
"def __getobj__\n end",
"def layout\n nil\n end",
"def _view; end",
"def display(obj)\n\t\[email protected](@currentObject.gtkObject)\n\t\[email protected](@background)\n\t\t@currentObject = obj\n\t\[email protected](@currentObject.gtkObject, 0, 1, 0,1)\n\t\[email protected](@background,0,1,0,1)\n\t\tshow_all\n\tend",
"def obj\n self\n end",
"def content=(_); end",
"def styles; end",
"def styles; end",
"def styles; end",
"def object\n __getobj__\n end",
"def layouts\n #Struct.new :hi, :there\n return @layouts if @layouts\n @layouts = {}\n @layouts[:fullscreen] = {}\n @layouts[:fullscreen][:map] = {}\n @layouts[:fullscreen][:map][:x] = 0\n @layouts[:fullscreen][:map][:y] = 0\n @layouts[:fullscreen][:map][:width] = @funkygps.screen.width\n @layouts[:fullscreen][:map][:height] = @funkygps.screen.height\n @layouts\n end",
"def parent=(obj); end",
"def render_document; end",
"def render_object(object, direction = nil)\n flow top: (object.y+1)*n, left: object.x*n, width: n, height: n do\n image = image_for_object object, direction\n style background: image if image\n end.tap do |element|\n @elements[object] = element\n end",
"def layout\n self.class.layout || @app.layout\n end",
"def show \r\n end",
"def current_layout\n controller.send :_layout # private method\n end",
"def visibilities=(_arg0); end",
"def view_renderer; end",
"def view_renderer; end",
"def object\n @obj\n end",
"def view_flow; end",
"def rendered_views=(_arg0); end",
"def admin_layout \n @admin_layout\n end",
"def static_layout\n nil\n end",
"def update_widget_from_object(obj)\n\t\t@obj = obj\n\t\tif obj\n\t\t\t#@x1.set_value_silent(obj.x1)\n\t\t\t#@y1.set_value_silent(obj.y1)\n\t\t\t#@x2.set_value_silent(obj.x2)\n\t\t\t#@y2.set_value_silent(obj.y2)\n\t\t\[email protected]_active_silent(obj.color)\n\t\t\tself.update_attributes\n\t\tend\n\tend",
"def display_data_universe\n\n end",
"def create_layout\n self.bitmap = Cache.UI(LayoutImage)\n self.x = Graphics.center_width(self.bitmap.width)\n self.y = Graphics.height - self.bitmap.height - 16\n end",
"def nebula; end",
"def _layout_for_option(name); end",
"def layout\n lookup_layout\n end",
"def _init_layout\n # when user gives a negative value, we recalc and overwrite so the need to save, for a redraw.\n @saved_width ||= @width\n @saved_height ||= @height\n\n lines = Ncurses.LINES - 1\n columns = Ncurses.COLS - 1\n if @height_pc\n @height = ((lines - @top_margin - @bottom_margin) * @height_pc).floor\n elsif @saved_height <= 0\n @height = lines - @saved_height - @top_margin - @bottom_margin\n end\n $log.debug \" layout height = #{@height} \"\n if @width_pc\n @width = ((columns - @left_margin - @right_margin) * width_pc).floor\n elsif @saved_width <= 0\n # if width was -1 we have overwritten it so now we cannot recalc it. it remains the same\n @width = columns - @saved_width - @left_margin - @right_margin\n end\n $log.debug \" layout wid = #{@width} \"\n # if user has not specified, then get all the objects\n @components ||= @form.widgets.select do |w| w.visible != false && !@ignore_list.include?(w.class.to_s.downcase); end\n $log.debug \" components #{@components.count} \"\n end",
"def owner; end",
"def owner; end"
] | [
"0.6929844",
"0.6606015",
"0.6606015",
"0.63749236",
"0.63447165",
"0.6288331",
"0.6288331",
"0.61370885",
"0.60990417",
"0.6093272",
"0.5974332",
"0.5974332",
"0.5974332",
"0.5974332",
"0.5974332",
"0.5974332",
"0.5974332",
"0.5974332",
"0.5974332",
"0.5974332",
"0.5974332",
"0.5974332",
"0.5974332",
"0.5974332",
"0.5974332",
"0.5856903",
"0.5846717",
"0.58255696",
"0.5823148",
"0.5793385",
"0.57755417",
"0.57755417",
"0.5764685",
"0.5760062",
"0.5752095",
"0.573606",
"0.5711929",
"0.56642747",
"0.5661558",
"0.5661558",
"0.56452066",
"0.5624839",
"0.5615471",
"0.56089276",
"0.5601485",
"0.55885774",
"0.55885774",
"0.55885774",
"0.55804694",
"0.5576215",
"0.5568732",
"0.5563405",
"0.5560029",
"0.5560029",
"0.5560029",
"0.5560029",
"0.5560029",
"0.5539226",
"0.55277383",
"0.55227834",
"0.55204034",
"0.55181277",
"0.55181277",
"0.5503924",
"0.5481682",
"0.54757714",
"0.54757714",
"0.5473785",
"0.54644626",
"0.546397",
"0.5457382",
"0.5457058",
"0.54564714",
"0.5444179",
"0.5444179",
"0.5444179",
"0.5441507",
"0.544053",
"0.54387045",
"0.5436698",
"0.543434",
"0.54342103",
"0.543234",
"0.5417109",
"0.5415627",
"0.5412118",
"0.5412118",
"0.53908783",
"0.5389238",
"0.53883016",
"0.536605",
"0.53655887",
"0.536206",
"0.5359292",
"0.5353957",
"0.5353734",
"0.5332238",
"0.53205913",
"0.5319418",
"0.5317825",
"0.5317825"
] | 0.0 | -1 |
Initialize a Predication Partition | def initialize(predicate, left_header, right_header)
@left = @right = @remainder = TAUTOLOGY
@left_header = left_header
@right_header = right_header
partition(predicate)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def partition\n PredicatePartition.new(predicate, operand.left.header, operand.right.header)\n end",
"def initialize(partition_data)\n @partition_data = partition_data\n end",
"def partition(predicate)\n each_operand(predicate) do |operand|\n case operand\n when Axiom::Function::Binary then partition_binary(operand)\n when Axiom::Function::Unary then partition_unary(operand)\n when Axiom::Attribute::Boolean then partition_attribute(operand)\n else\n partition_proposition(operand)\n end\n end\n end",
"def initialize(points=[])\n @iterations = 3\n @cluster_count = 0\n @points = points\n @clusters = []\n @logger = Log4r::Logger.new('Clusterer')\n @logger.add('default')\n \n # Randomly select a few starting documents.\n #build_empty_clusters('crp')\n end",
"def set_partition\n @partition = Partition.find(params[:id])\n end",
"def partition_list()\nend",
"def initialize dataset\n @clustered_dataset = Hash.new\n @array_of_k_means = Array.new\n @working_dataset = dataset\n prepare_dataset\n end",
"def initialize\n @processing_times = Concurrent::Hash.new do |topics_hash, topic|\n topics_hash[topic] = Concurrent::Hash.new do |partitions_hash, partition|\n # This array does not have to be concurrent because we always access single partition\n # data via instrumentation that operates in a single thread via consumer\n partitions_hash[partition] = []\n end\n end\n end",
"def initialize(n_clusters: 2, affinity: 'rbf', gamma: nil, init: 'k-means++', max_iter: 10, tol: 1.0e-8, random_seed: nil)\n super()\n @params = {\n n_clusters: n_clusters,\n affinity: affinity,\n gamma: gamma,\n init: (init == 'random' ? 'random' : 'k-means++'),\n max_iter: max_iter,\n tol: tol,\n random_seed: (random_seed || srand)\n }\n end",
"def initialize(thePredecessor, theSuccessor)\n super(thePredecessor, theSuccessor)\n do_set_key(thePredecessor, theSuccessor)\n end",
"def create\n begin\n # Set the partition (/dev/sdb1), device (/dev/sdb) and alignment (optimal,minimal,none etc.) variables\n partition= resource[:name]\n device=partition[0,(partition.length-1)]\n alignment= resource[:alignment]\n\n # Now we can create the partition\n partitions = parted('-a', resource[:alignment],'--script',device,'mklabel',resource[:part_label],'mkpart', resource[:part_type],resource[:fs_type],resource[:p_begin],resource[:p_end])\n rescue Puppet::ExecutionFailure => e\n false\n end\n end",
"def setup\n @cypher_partition = CypherPartitioner.new\n end",
"def initialize(ptitle, prank=0)\n\t\t@title = ptitle\n\t\t@rank = prank\n\tend",
"def initialize(cfg)\n @scoring = Scoring::Methods[cfg['scoring']]\n @tapecount = cfg['tapecount'].to_i\n @tiebreak = cfg['tiebreak'] # TODO: use\n\n # construct a hill of dummy programs\n\n nprogs = cfg['size'].to_i\n\n @progs = {}\n @hill = Array.new(nprogs)\n\n (0 .. nprogs-1).each do |id|\n prog = \"dummy-#{id}\"\n @progs[prog] = id\n @hill[id] = prog\n end\n\n # construct initial dummy results\n\n @results = ResultMatrix.new(nprogs, @tapecount)\n (0 .. nprogs-2).each do |idA|\n (idA+1 .. nprogs-1).each { |idB| @results[idA, idB] = Array.new(2*@tapecount, 0) }\n end\n end",
"def initialize(competition)\n @competition = competition\n @ident_viol_candidates = false # until proven otherwise\n @partition = partition_by_viols\n end",
"def initialize(topic:, name:, partition: 0, batch_size: 1_000, logger: Logger.new(\"/dev/null\"))\n @topic = topic\n @name = name\n @partition = partition\n @batch_size = batch_size\n @logger = logger\n\n @zk_path = \"/kafka_sync/consumer/#{@topic}/#{@partition}/#{@name}/offset\"\n end",
"def set_predicate\n @predicate = Predicate.find(params[:id])\n end",
"def initialize(k, test_set, database)\n @test_set = test_set\n @database = database\n @count = k\n @predictions = []\n run_test\n @mean = mean_calc\n end",
"def initialize(title, premises, conclusion)\n @title = title\n @premises = premises.map { |p| Proposition.new p }\n @conclusion = Proposition.new conclusion\n end",
"def initialize_with_test_runner\n initialize_without_test_runner\n\n @test_priorities = {}\n @test_filters = Hash.new { |h, k| h[k] = [] }\n end",
"def initialize(rank, begin_, end_, label)\n @rank = rank\n @begin = begin_\n @end = end_\n @label = label\n end",
"def initialize\n\t\t@training_list=Array.new\n\t\t@w = Array.new(FEATURE_SIZE,0)\n\tend",
"def create_with_partition(partition)\n NicView.new(fqdd.gsub(/[-]\\d+$/, \"-#{partition}\"))\n end",
"def pre_initialize; end",
"def initialize\n @rule_name = nil\n @predicate_text = nil\n super()\n end",
"def pre_initialize\n end",
"def initialize()\n #@ch = Concept.init_concept_hash()\n #Indexer.initialize_dict()\n #@ch = Indexer.init_concept_hash\n end",
"def initialize (trials, prob)\n if trials <= 0\n raise ArgumentError.new(\"Error: trials must be greater than 0\")\n end\n @n = trials\n if prob < 0.0 || prob > 1.0\n raise ArgumentError.new(\"prob must be between 0 and 1\")\n end\n @p = prob\n end",
"def partition!(id)\n partition(id) || ErrorCode[:unknown_topic_or_partition].raise\n end",
"def initialize(iName, iPriority, iSizing, iResourcesMap, iSuccessorsList)\n @Name = iName\n @Priority = iPriority\n @Sizing = iSizing\n @ResourcesMap = iResourcesMap\n @Successors = iSuccessorsList\n # Also initialize internal attributes\n @Predecessors = []\n @AccessibleTasks = {}\n @SharingResourcesTasksID = nil\n end",
"def initialize(kernel_type='RBF')\n @training_data_set = Diabetic.pick(538)\n @training = @training_data_set.collect {|d| [d.pregnant,\n d.oral_glucose_tolerance,\n d.blood_pressure,\n d.skin_fold_thickness,\n d.serum_insulin,\n d.body_mass_index,\n d.pedigree_function,\n d.age,\n d.positive]}\n\n\n @problem = Libsvm::Problem.new\n @parameter = Libsvm::SvmParameter.new\n @parameter.kernel_type = \"Libsvm::KernelType::#{kernel_type}\".constantize\n @parameter.cache_size = 100 # in megabytes\n @parameter.eps = 0.001\n @parameter.c = 10\n\n\n @labels = @training.collect {|t| t.pop}\n @examples = @training.map {|ary| Libsvm::Node.features(ary)}\n\n\n @problem.set_examples(@labels, @examples)\n\n @svm = Libsvm::Model.train(@problem, @parameter)\n end",
"def initialize_persistent_state(workflow_state)\n Rails.logger.info workflow_state\n if workflow_state.blank?\n @entry_points = OrderedSet.new\n @nonidempotent_calls = Set.new\n else\n entries_slug, call_slug = workflow_state.split(':')\n @entry_points = OrderedSet.new(entries_slug.try(:split, '/')) || OrderedSet.new\n @nonidempotent_calls = Set.new(call_slug.try(:split, '/')) || Set.new\n end\n end",
"def initialize(subject, predicate, object)\n @subject = subject\n @predicate = predicate\n @object = object\n end",
"def initialize(hosts, shard_count, initial_shard = 0)\n raise(ArgumentError, \"no hosts\") if hosts.empty?\n @hosts = hosts\n @shards = @hosts.inject({}) do |acc, h|\n acc[h] = (initial_shard...(initial_shard + shard_count)).map { |i| \"#{h}:#{i}\" }\n acc\n end\n\n if hosts.length * shard_count % 2 != 0\n @shards[hosts[0]].delete_at(-1)\n end\n\n # poorly named...\n @forward = {} # shard => shard\n @backward = {} # host => host\n @racks = {} # rack => pair_count\n\n shuffle\n end",
"def initialize(task, schema, index)\n super\n\n if task['with_rehearsal'] and @index == 0\n @rehearsaled = false\n end\n end",
"def initialize input, prediction, expected = nil\r\n\t\t@predictionSet\t= prediction.class == Array ? prediction : [prediction]\r\n\t\t@input \t\t\t= input\r\n\t\t@expected\t\t= expected\r\n\tend",
"def partitioned_state\n super\n end",
"def CreatePartition(disk, device, ptype, id, start, len, mby)\n Builtins.y2milestone(\n \"CreatePartition disk:%1 device:%2 ptype:%3 id:%4 start:%5 len:%6 mby:%7\",\n disk,\n device,\n ptype,\n id,\n start,\n len,\n mby\n )\n pt = fromSymbol(@conv_ptype, ptype)\n Builtins.y2milestone(\"CreatePartition type:%1 pt:%2\", ptype, pt)\n ret, cdev = @sint.createPartition(disk, pt, start, len)\n cdev = \"\" if ret<0\n if device != cdev\n Builtins.y2error(\"CreatePartition device:%1 cdev:%2\", device, cdev)\n end\n Builtins.y2error(\"CreatePartition ret %1\", ret) if ret<0\n ret = @sint.changePartitionId(device, id)\n Builtins.y2error(\"CreatePartition ret %1\", ret) if ret<0\n tmp = fromSymbol(@conv_mountby, mby)\n @sint.changeMountBy(device, tmp)\n Builtins.y2milestone(\"CreatePartition sint ret:%1\", ret)\n UpdateTargetMap()\n ret == 0\n end",
"def partition_selector\n @subhash = {}\n @filters = {}\n\n partition_selector_hash @selector, []\n end",
"def initialize\n \tself.seed_data\n end",
"def initialize phenotype_count, orthogroup_count, storage_count\n # Make sure to provide storage_count + phenotype_count as the initial capacity, since otherwise a resize will be needed.\n super([phenotype_count, orthogroup_count], 0, capacity: storage_count+phenotype_count+1, stype: :yale, dtype: :byte)\n @skip_table = {}\n end",
"def initialize\n\t\t# Default values for query expansion\n\t\t@measure = \"jaccard\"\n\t\t@threshold_gap = 0.3 # Uses this to relax the threshold for PostgreSQL search \n\tend",
"def partition(arr, n)\n\nend",
"def pre_initialize(**opts)\n @topic_name = opts[:topic_name]\n @binding_keys = Array(opts[:binding_keys])\n super\n end",
"def initialize(limit, offset, kernel_type='RBF', features=nil)\n @features = features||Diabetic::FEATURES\n\n @test_data_set = Diabetic.limit(limit).offset(offset)\n @training_data_set = Diabetic.excludes(@test_data_set.collect(&:id))\n\n @training = @training_data_set.collect {|d| @features.collect {|f| d.send(f)}}\n\n @problem = Libsvm::Problem.new\n @parameter = Libsvm::SvmParameter.new\n @parameter.kernel_type = \"Libsvm::KernelType::#{kernel_type}\".constantize\n @parameter.cache_size = 200 # in megabytes\n @parameter.eps = 0.001\n @parameter.c = 100\n\n @parameter.svm_type = Libsvm::SvmType::NU_SVC unless ['PRECOMPUTED'].include?(kernel_type)\n @parameter.nu = 0.0001\n @parameter.degree = 1 if ['POLY'].include?(kernel_type)\n @parameter.coef0 = 0.1 if ['SIGMOID', 'POLY'].include?(kernel_type)\n @parameter.gamma = 0.1 if ['RBF', 'SIGMOID', 'POLY'].include?(kernel_type)\n\n @labels = @training.collect {|t| t.pop}\n @examples = @training.map {|ary| Libsvm::Node.features(ary)}\n\n\n @problem.set_examples(@labels, @examples)\n\n @svm = Libsvm::Model.train(@problem, @parameter)\n end",
"def create(key_hash)\n # TODO: Raise if a key missing\n @model.transaction do\n partition = partition_class.create!(key_hash)\n @keys.create_partition_tables(@model, :key_hash => key_hash)\n # TODO: Indexes\n partition\n end\n end",
"def find_or_create(topic, partition, parallel_key)\n ktopic = find_topic(topic)\n\n @buffer[ktopic][partition][parallel_key] ||= Executor.new(\n @subscription_group.id,\n @client,\n ktopic\n )\n end",
"def initialize(n_clusters: 8, metric: 'euclidean', init: 'k-means++', max_iter: 50, tol: 1.0e-4, random_seed: nil)\n super()\n @params = {\n n_clusters: n_clusters,\n metric: (metric == 'precomputed' ? 'precomputed' : 'euclidean'),\n init: (init == 'random' ? 'random' : 'k-means++'),\n max_iter: max_iter,\n tol: tol,\n random_seed: (random_seed || srand)\n }\n @rng = Random.new(@params[:random_seed])\n end",
"def initialize_probabilities\n @probabilities = (0..9).map{Array.new(16, @default_probability)}\n end",
"def create_partitions\n info(\"Creating disk with #{PARTITION_TABLE_TYPE} parition table\")\n execute!(\"parted -s #{@dev} mklabel #{PARTITION_TABLE_TYPE}\")\n\n start_size = FIRST_PARTITION_OFFSET\n end_size = FIRST_PARTITION_OFFSET\n\n unspec_part = nil\n\n # Create the partitions\n @partition_layout.each_with_index do |part, index|\n # Deal with any \"open ended\" partitions last\n if not part.size_mb.is_a?(Integer)\n unspec_part = part\n next\n end\n\n start_size = end_size\n end_size += part.size_mb\n\n info(\"Creating partition #{part.label} (#{part.fs}, #{part.size_mb}MiB)\")\n execute!(\"parted #{@dev} mkpart #{part.label} #{part.fs} #{start_size}MiB #{end_size}MiB\")\n\n (part.flags || {}).each_pair { |k, v|\n info(\"Setting partition flag #{k} to #{v}\")\n execute!(\"parted #{@dev} set #{index + 1} #{k} #{v}\")\n }\n\n label_path = \"/dev/disk/by-partlabel/#{part.label}\"\n self.wait_for_device(label_path)\n\n if not part.fs\n warn(\"No filesystem specified for #{part.label}. Skipping FS\")\n else\n create_filesystem(part.fs, label_path, part.label)\n end\n\n if part.lvm\n notice(\"Setting up LVM on #{part.label}\")\n setup_lvm_on_partition(part)\n end\n end\n\n # Deal with any \"open ended\" partitions (that have an unspecified size_mb)\n if unspec_part\n part = unspec_part\n info(\"Creating partition #{part.label} (#{part.fs}, 100% remaining)\")\n execute!(\"parted #{@dev} mkpart #{part.label} #{part.fs} #{end_size}MiB 100%\")\n\n (part.flags || {}).each_pair { |k, v|\n info(\"Setting partition flag #{k} to #{v}\")\n execute!(\"parted #{@dev} set #{@partition_layout.length} #{k} #{v}\")\n }\n\n label_path = \"/dev/disk/by-partlabel/#{part.label}\"\n self.wait_for_device(label_path)\n create_filesystem(part.fs, label_path, part.label) if part.fs\n\n if part.lvm\n notice(\"Setting up LVM on #{part.label}\")\n setup_lvm_on_partition(part)\n end\n end\n\n nil\n end",
"def initialize(mode,metadata,required_metadata=DEFAULT_METADATA)\n\t\t@logger=Logger.new(mode,\"metadata_scorer\")\n\t\t@metadata=metadata\n\t\t@required_metadata=required_metadata\n\t\t@score=0\n\tend",
"def initialize(n_splits: 5, test_size: 0.2, train_size: nil, random_seed: nil)\n @n_splits = n_splits\n @test_size = test_size\n @train_size = train_size\n @random_seed = random_seed\n @random_seed ||= srand\n @rng = Random.new(@random_seed)\n end",
"def initialize(dimensions, pov, row_dims, col_dims, row_count, col_count, vals, types)\n @dimensions = dimensions\n @pov = pov\n @row_dims = row_dims\n @col_dims = col_dims\n @row_count = row_count\n @col_count = col_count\n @vals = vals\n @types = types\n end",
"def init\n\t# Sequence of observations (Given from file)\n\t@observations = Array.new\n\n\t# Probabilities\n\t@b_b = @l_b = @b_l = @l_l = @h_b = @t_b = @h_l = @t_l = 0.5\n\n\t@f_B = Array.new\n\t@f_L = Array.new\n\t@b_B = Array.new\n\t@b_L = Array.new\n\n\t# Not Normalized Probabilities\n\t@nn_B_B = Array.new\n\t@nn_B_L = Array.new\n\t@nn_L_B = Array.new\n\t@nn_L_L = Array.new\n\n\t# Normalized Probabilities\n\t@n_B_B = Array.new\n\t@n_B_L = Array.new\n\t@n_L_B = Array.new\n\t@n_L_L = Array.new\nend",
"def initialize(p)\n _initialize(p)\n end",
"def initialize( kernel, index )\n @index = index\n @kernel = kernel\n end",
"def addPartition(ptStr)\n pts_array = ptStr.split(',')\n sqlstr = \"ALTER TABLE \" + @mProjectName + \".\" + @mTableName\n sqlstr = sqlstr + \" ADD IF NOT EXISTS\" + \" PARTITION (\"\n pts_array.each { |pt|\n ptkv = pt.split('=')\n if ptkv.size != 2\n raise \"invalid partition spec\" + pt\n end\n sqlstr += ptkv[0] + '=' + \"'\" + ptkv[1] + \"'\" + ','\n }\n sqlstr = sqlstr[0..-2] + \");\"\n taskName = \"SQLAddPartitionTask\"\n runSQL(taskName, sqlstr)\n end",
"def initialize(input_name, input_cohort) # initialize is a ruby\n @name = input_name\n @cohort = input_cohort\n end",
"def initialize(_seedParam, _conductor, _nofRun)\n @id = @@maxId ;\n @@maxId += 1 ;\n \n createAndRun(_seedParam, _conductor, _nofRun) ;\n end",
"def init_scrap_topic(title, user_id)\n @scrap_topic = ScrapTopic.find_or_create_by_title(:title => title, :user_id => user_id, :parent_id => 0)\n end",
"def initialize(n_splits: 5)\n @n_splits = n_splits\n end",
"def initialize(protname_length_pairs, condition_to_count_array)\n @protname_length_pairs = protname_length_pairs\n @condition_to_count_array = condition_to_count_array\n end",
"def add_partition_key(name, type)\n PartitionKey.new(name, type(type)).tap do |column|\n @partition_key_columns << add_column(column)\n end\n end",
"def initialize( kernel, index )\n @index = index\n @kernel = kernel\n end",
"def initialize\n\t\t@numpkt = 0\n\t\t@pktdrops = 0\n\tend",
"def partitions( partition_count, &proc )\n Enumerable.partition_sizes( self.size, partition_count ) do |partition|\n partitioned_collection = []\n consumed_so_far = 0\n partition.each do |partition_size|\n partitioned_collection << self[ consumed_so_far, partition_size ]\n consumed_so_far += partition_size\n end\n yield partitioned_collection\n end\n end",
"def addPartition(ptStr)\n @mOdpsTable.addPartition(ptStr)\n end",
"def initialize(presenter)\n super(presenter)\n preload if relation.is_a?(ActiveRecord::Relation) && policy_associations.present?\n end",
"def park(parcel_code, parcel_weight)\n @parcel.create_parcel(parcel_code, parcel_weight, @slot_numbers, @max_key) unless @parcel.nil? \nend",
"def initialize(p0, *rest) end",
"def initialize(resource=4, indria_resource=4)\n @buckets = []\n @bucketCounts = []\n @bucketsCount = 0\n @resource = resource\n @indria_resource = indria_resource\n end",
"def initialize(dataset)\n @dataset = dataset\n end",
"def add!(partition, dirty = false)\n if @list[partition.name].nil?\n @list[partition.name] = partition\n else\n @list[partition.name].merge!(partition, simulate = false, dirty)\n end\n self\n end",
"def create_partition device, partition_type = 'primary', start_unit, end_unit\n command = 'parted'\n params = \"#{device.path} -s -a optimal unit MB mkpart #{partition_type} ext3 #{start_unit} -- #{end_unit}\"\n parted = CommandsExecutor.new command, params\n parted.execute\n raise \"Command execution error: #{parted.stderr.read}\" if not parted.success?\n probe_kernal device\n end",
"def fetch(topic, partition)\n @pauses[topic][partition] ||= TimeTrackers::Pause.new(\n timeout: Karafka::App.config.pause_timeout,\n max_timeout: Karafka::App.config.pause_max_timeout,\n exponential_backoff: Karafka::App.config.pause_with_exponential_backoff\n )\n end",
"def initialize(n_components: 2, whiten: true, fun: 'logcosh', alpha: 1.0, max_iter: 200, tol: 1e-4, random_seed: nil)\n super()\n @params = {\n n_components: n_components,\n whiten: whiten,\n fun: fun,\n alpha: alpha,\n max_iter: max_iter,\n tol: tol,\n random_seed: (random_seed || srand)\n }\n @rng = Random.new(@params[:random_seed])\n end",
"def initialize(core_concept_node, constraint, &action)\n @action = action\n @core_instances = []\n @root = core_concept_node\n core_concept_rsc = RDFS::Resource.new(core_concept_node.value)\n @query = Query\n q = @query.new.extend(Pbuilder::Query)\n q = q.search_by_concept(core_concept_rsc, constraint)\n @pass = false\n q.execute do |i|\n @core_instances << @action.call(i, 0, 0, nil, nil)\n @pass = true\n end\n end",
"def on_partitions_assigned(_, partitions)\n @assigned_partitions = partitions.to_h.transform_values { |part| part.map(&:partition) }\n @changed = true\n end",
"def initialize(entry_xpath, section_name)\n @entry_xpath = entry_xpath\n @section_name = section_name\n @check_for_usable = true # Pilot tools will set this to false\n end",
"def initialize(batch_state = {})\n @batch_state = batch_state\n end",
"def initialize(num_prefix_words)\n @num_prefix_words = num_prefix_words\n @markov = {}\n end",
"def create_proposal\n @logger.debug(\"hadoop create_proposal: entering\")\n base = super\n\n # Compute the hadoop cluster node distribution.\n # You need at least 3 nodes (secondary name node, master name node\n # and slave node) to implement a baseline hadoop framework. The edge\n # node is added if the node count is 4 or higher.\n secondary = []\n master = []\n edge = []\n slaves = []\n\n # Get the node list, find the admin node, put the hadoop secondary name node\n # on the crowbar admin node (as specified by the RA) and delete the admin\n # node from the array.\n nodes = NodeObject.all\n nodes.each do |n|\n if n.nil?\n nodes.delete(n)\n next\n end\n if n.admin?\n secondary << n[:fqdn] if n[:fqdn]\n nodes.delete(n)\n end\n end\n\n # Add the master, slave and edge nodes.\n if nodes.size == 1\n master << nodes[0][:fqdn] if nodes[0][:fqdn]\n elsif nodes.size == 2\n master << nodes[0][:fqdn] if nodes[0][:fqdn]\n slaves << nodes[1][:fqdn] if nodes[1][:fqdn]\n elsif nodes.size == 3\n master << nodes[0][:fqdn] if nodes[0][:fqdn]\n slaves << nodes[1][:fqdn] if nodes[1][:fqdn]\n edge << nodes[2][:fqdn] if nodes[2][:fqdn]\n elsif nodes.size > 3\n master << nodes[0][:fqdn] if nodes[0][:fqdn]\n slaves << nodes[1][:fqdn] if nodes[1][:fqdn]\n edge << nodes[2][:fqdn] if nodes[2][:fqdn]\n nodes[3 .. nodes.size].each { |n|\n slaves << n[:fqdn] if n[:fqdn]\n }\n end\n\n # Add the proposal deployment elements\n base[\"deployment\"][\"hadoop\"][\"elements\"] = { }\n base[\"deployment\"][\"hadoop\"][\"elements\"][\"hadoop-masternamenode\"] = master if master && !master.empty?\n base[\"deployment\"][\"hadoop\"][\"elements\"][\"hadoop-secondarynamenode\"] = secondary if secondary && !secondary.empty?\n base[\"deployment\"][\"hadoop\"][\"elements\"][\"hadoop-edgenode\"] = edge if edge && !edge.empty?\n base[\"deployment\"][\"hadoop\"][\"elements\"][\"hadoop-slavenode\"] = slaves if slaves && !slaves.empty?\n\n # @logger.debug(\"hadoop create_proposal: #{base.to_json}\")\n @logger.debug(\"hadoop create_proposal: exiting\")\n base\n end",
"def initialize(label)\n\n # pass a new engine with name :knowledge_base_engine to the super class\n super KnowledgeBase::engine label\n\n # instantiate variables\n @engine_has_matched = false\n @yml_locations = nil\n\n @question_rules = Array.new\n @result_rules = Array.new\n @fact_rules = Array.new\n @triggered_rules = Array.new\n @start_rules = Array.new\n @rules = {}\n\n end",
"def initialize(data, k=1)\n @data = data\n @k = k\n end",
"def initialize(person, likes_of, liked)\n @person = person\n @likes_of = likes_of\n @liked = liked\n @items = liked.keys\n @people = likes_of.keys\n @similarity_limit = INFINITY\n end",
"def initialize(name, opts={})\n super(name, opts)\n @weight = opts[:weight] || 1.0\n @assumed_probability = opts[:assumed_probability] || 0.1\n\n end",
"def initialize(schema_identifier = nil, parts = _default_parts)\n @schema_identifier = schema_identifier\n super(parts)\n @insert_order = [:logical, :physical]\n end",
"def initialize_reviewers\n reviewers = MinHeap.new\n course.get_real_students.shuffle.each do |r|\n reviews = evaluations.forUser(r)\n # Don't assign new reviews to someone who as completed all their reviews\n unless reviews.length > 0 and reviews.length == reviews.select{|e| e.finished }.length\n # Create a bias towards assigning reviewers who have not yet submitted so as avoid entrapment by the self-review prohibition\n bias = submissions.any?{|s| s.user_id == getTeamID(r)} ? 1 : 0\n reviewers.push(2 * reviews.length + bias, r)\n end\n end\n reviewers\n end",
"def partition_for!(key)\n if leader_available?\n # Use the configured partitioner\n partition_id = partitioner.call(key, available_partitions.count, partitions.count)\n partition!(partition_id)\n else\n error_code.raise\n end\n end",
"def initialize(pivot_table)\n @pivot_table = pivot_table\n end",
"def initialize(leaf_count, nodes)\n @leaf_count = leaf_count\n @nodes = nodes\n end",
"def initialize to_check, expected, label=nil, solution=nil, father_cat=nil\n @to_check=to_check\n @expected = expected\n @label = label\n @solution=solution\n @id = NumerationFactory.create father_cat\n @status= -1\n\n @father_cat = father_cat\n if father_cat != nil\n @display_offset=father_cat.display_offset+1\n else\n @display_offset=0\n end\n\n end",
"def initialize( floating_points: false )\n @weights = []\n @max_weight = BASE_WEIGHT\n @floating_points = floating_points\n end",
"def partition\n return enum_for(:partition) if not block_given?\n a,b = super\n [self.class.new(a), self.class.new(b)].freeze\n end",
"def initialize proportional_by=nil, &block\n @prop = if proportional_by.nil?\n block\n else\n proc { |individual| individual.send(proportional_by) }\n end\n @proportional_by = proportional_by \n @random = Kernel\n @population = nil \n @wheel = nil\n end",
"def run_test(k=nil)\n k ||= @testSet.data.length\n arr = (@testSet.data[0..k-1]).collect do |item|\n @resaults.new(item[@USER_ID].to_i, item[@MOVIE_ID].to_i, item[@RATING].to_i, predict(item[@USER_ID].to_i, item[@MOVIE_ID].to_i))\n end \n MovieTest.new(arr) \n end",
"def initialize(plan)\n @scope = :global\n\t @plan = plan\n\t super()\n\t @plan_predicates = Array.new\n\t @neg_plan_predicates = Array.new\n\tend",
"def initialize (params = {})\n @p1 = params.fetch(:p1,'Unknown P2')\n @p2 = params.fetch(:p2,'Unknown P1')\n @f2_wild = params.fetch(:f2_wild, \"0\").to_f\n @f2_p1 = params.fetch(:f2_p1,\"0\").to_f\n @f2_p2 = params.fetch(:f2_p2,\"0\").to_f\n @f2_p1p2 = params.fetch(:f2_p1p2,\"0\").to_f\n \n #Assign the SeedStocks object with the same name as parent to the variable @seed.\n #If there is no SeedStocks object with that name the code stops\n @seed1 = SeedStocks.all_stocks.find { |seed| seed.seed_stock == @p1 }\n if @seed1 == nil\n abort (\"The seed stock #{@p1} is not registered\")\n end\n \n @seed2 = SeedStocks.all_stocks.find { |seed| seed.seed_stock == @p2 }\n if @seed2 == nil\n abort (\"The seed stock #{@p2} is not registered\")\n end\n \n @chi = nil\n \n @@my_crosses << self #Add the new object to the array\n \n end",
"def initialize(*)\n super\n @predicate = Function.optimize_operand(operation.predicate)\n end",
"def initialize(name, pairwise: false, prioritized: false)\n self.name = name\n self.users = { }\n self.pairwise = !!pairwise\n self.prioritized = !!prioritized\n self.subjects ||= set_klass.new\n self.state = :initializing\n end"
] | [
"0.6743185",
"0.666282",
"0.5734743",
"0.5588928",
"0.5528576",
"0.54569924",
"0.54460746",
"0.53995633",
"0.5395927",
"0.537839",
"0.53401124",
"0.53322625",
"0.5287079",
"0.5219724",
"0.51885074",
"0.51552945",
"0.51430625",
"0.51233506",
"0.5063135",
"0.50583196",
"0.50577766",
"0.50564903",
"0.5055556",
"0.50508535",
"0.5035095",
"0.5026896",
"0.50256646",
"0.50223285",
"0.5018551",
"0.4984991",
"0.49805716",
"0.49705908",
"0.49683455",
"0.49670592",
"0.49657863",
"0.4965773",
"0.49602327",
"0.49573922",
"0.49457473",
"0.49439192",
"0.4930801",
"0.49162346",
"0.48967135",
"0.4883587",
"0.48606688",
"0.48487183",
"0.48480916",
"0.48128936",
"0.48045474",
"0.4800578",
"0.47933426",
"0.47815496",
"0.4779208",
"0.47560227",
"0.47471336",
"0.47364455",
"0.47324473",
"0.47121814",
"0.47099102",
"0.4705271",
"0.46992007",
"0.46979603",
"0.4696699",
"0.469097",
"0.4683666",
"0.46804446",
"0.467996",
"0.46797496",
"0.46781003",
"0.46753952",
"0.465742",
"0.46569964",
"0.4656253",
"0.4648194",
"0.46432897",
"0.4641329",
"0.4641021",
"0.46381366",
"0.46303532",
"0.46285248",
"0.46282688",
"0.46266276",
"0.46239343",
"0.46230638",
"0.46229395",
"0.4617279",
"0.46134397",
"0.46112636",
"0.46070904",
"0.46047482",
"0.46045893",
"0.46034405",
"0.4596798",
"0.45935977",
"0.45934576",
"0.4591488",
"0.45895213",
"0.45795384",
"0.45785707",
"0.45785186"
] | 0.62051183 | 2 |
Partition the predicate into a left, right and remainder predicates | def partition(predicate)
each_operand(predicate) do |operand|
case operand
when Axiom::Function::Binary then partition_binary(operand)
when Axiom::Function::Unary then partition_unary(operand)
when Axiom::Attribute::Boolean then partition_attribute(operand)
else
partition_proposition(operand)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def partition_binary(function)\n operands = [function.left, function.right].grep(Axiom::Attribute)\n left_operands = @left_header & operands\n right_operands = @right_header & operands\n\n if (left_operands - right_operands).empty? || (right_operands - left_operands).empty?\n @left &= function if left_operands.any?\n @right &= function if right_operands.any?\n else\n @remainder &= function\n end\n end",
"def partition\n PredicatePartition.new(predicate, operand.left.header, operand.right.header)\n end",
"def partition_proposition(proposition)\n @remainder &= proposition\n @left &= proposition\n @right &= proposition\n end",
"def partition_unary(function)\n operand = function.operand\n @left &= function if @left_header.include?(operand)\n @right &= function if @right_header.include?(operand)\n end",
"def initialize(predicate, left_header, right_header)\n @left = @right = @remainder = TAUTOLOGY\n\n @left_header = left_header\n @right_header = right_header\n\n partition(predicate)\n end",
"def partition(array, left, right)\n pivot = right\n right -= 1\n puts \"left: #{left}, right: #{right}\"\n while true do\n while array[left] <= array[pivot] && left < pivot do\n left += 1\n end\n\n while array[right] > array[pivot] do\n right -= 1\n end\n\n\n\n if left >= right\n temp = array[left]\n array[left] = array[pivot]\n array[pivot] = temp\n break\n else\n temp = array[left]\n array[left] = array[right]\n array[right] = temp\n end\n end\n\n\n left\nend",
"def my_array_splitting_method(source)\n divide = source.sort_by{|x| x.to_s}\n total = divide.find_all{|item| item % 1 == 0 }.count \n total -= 1\n divide.partition.with_index { |_, index| index <= total }\nend",
"def partition_array(array,x,left=0,right=(array.length-1))\n # end condition: when the markers pass each other\n # we're done, so then return the array \n if right < left\n return array\n end\n\n # when the left value is wrong\n wrong_left = array[left] > x\n # when the right value is wrong\n wrong_right = array[right] < x\n \n #if both are wrong, swap the pair\n if wrong_left && wrong_right\n array[left], array[right] = array[right], array[left]\n left = left + 1\n right = right - 1\n partition_array(array,x,left,right)\n #else if only the left is wrong, increment just the right\n elsif wrong_left\n right = right - 1\n partition_array(array,x,left,right)\n #else if the only the right is wrong, increment the left\n elsif wrong_right\n left = left + 1\n partition_array(array,x,left,right)\n end\n\n #return the array\n return array\nend",
"def partition1(arr, left, right)\n pele = arr[left]\n pindex = right\n i = right\n while(i > left)\n if(arr[i] > pele)\n arr[i], arr[pindex] = arr[pindex], arr[i]\n pindex -= 1\n end\n i -= 1\n end\n arr[left], arr[pindex] = arr[pindex], arr[left]\n pindex\nend",
"def flatten_predicates(pred)\n return pred unless pred.is_a? Array\n\n pred = [ pred[0] ] + pred[1 .. -1].map { |x| flatten_predicates(x) }\n\n op = pred[0]\n return pred unless op.is_a? String\n\n return flatten_predicates(pred[1]) if pred.length == 2\n\n rest = pred[1 .. -1]\n\n if rest.any? { |x| x[0] == op } &&\n rest.all? { |x| x[0] == op || x[0] == :field } then\n\n newlist = pred[1 .. -1].map { |x| x[0] == :field ? [x] : x[1 .. -1] } \\\n .inject([]) { |full,p| full + p }\n return flatten_predicates([ op ] + newlist)\n end\n pred.find_all { |x| !x.is_a?(Array) || x.length > 1 }\nend",
"def partition_if\r\n pass, fail = [], []\r\n each do |value|\r\n result = yield(value)\r\n if result then pass.push(value)\r\n else fail.push(value)\r\n end\r\n end\r\n return pass, fail\r\n end",
"def partition(arr, left, right)\n pivot = arr[right]\n pindex = left\n for i in (left...right) do\n if(arr[i] <= pivot)\n arr[pindex], arr[i] = arr[i], arr[pindex]\n pindex += 1\n end\n end\n arr[pindex], arr[right] = arr[right], arr[pindex]\n pindex\nend",
"def partition(list, left, right)\n pivot = list[right]\n previous_left = left-1\n left.upto(right-1) { |value|\n previous_left = previous_left + 1 if list[value] <= pivot\n list[previous_left], list[value] = list[value], list[previous_left] if list[value] <= pivot\n }\n list[previous_left+1], list[right] = list[right], list[previous_left+1]\n return previous_left + 1\nend",
"def divide_and_conquer(instructions, lower, upper)\n range = upper - lower\n instruction = instructions[0]\n tail = instructions[1..-1]\n\n case instruction\n when 'F', 'L'\n\n upper -= ((range + 1) / 2)\n return lower if tail.empty?\n when 'B', 'R'\n\n lower += ((range + 1) / 2)\n return upper if tail.empty?\n end\n\n divide_and_conquer(tail, lower, upper)\n end",
"def partition(arr, left, right, pivot)\n pivot_val = arr[pivot]\n arr[pivot] = arr[right]\n arr[right] = pivot_val\n\n storage = left\n\n (left..right-1).each do |i|\n if arr[i] < pivot_val\n storage_val = arr[storage]\n arr[storage] = arr[i]\n arr[i] = storage_val\n storage += 1\n end\n end\n\n storage_val = arr[storage]\n arr[storage] = arr[right]\n arr[right] = storage_val\n\n storage\nend",
"def partition(arr, p, r, ord)\n\t# for empty array\n\treturn [] if r < 0\n\tx = arr[r]\n\ti = p - 1\n\tj = p\n\tfor j in p..r-1\n\t\t# USE OF LAMBDA FROM ABOVE\n\t\tif ord.call(arr[j], x)\n\t\t\ti += 1\n\t\t\ttemp = arr[i]\n\t\t\tarr[i] = arr[j]\n\t\t\tarr[j] = temp\n\t\tend\n\tend\n\ttemp = arr[i+1]\n\tarr[i+1] = arr[r]\n\tarr[r] = temp\n\treturn i + 1\nend",
"def self_dividing_numbers(left, right)\n ans = []\n for i in left..right do \n if is_self_divided(i)\n ans << i\n end\n end\n ans\nend",
"def evens_and_odds(arr)\r\n arr.partition{ |num| num.odd?}\r\nend",
"def matrix_partitioner(mat)\n n = mat.size-1\n n_half = mat.size/2\n\n m11 = (0..n_half-1).map { |x| mat[x][0..n_half-1] }\n m12 = (0..n_half-1).map { |x| mat[x][n_half..n] }\n\n m21 = (n_half..n).map { |x| mat[x][0..n_half-1] }\n m22 = (n_half..n).map { |x| mat[x][n_half..n] }\n [m11, m12, m21, m22]\nend",
"def partition(array)\n # write your code here\n\n left = []\n right = []\n pivot = array.shift\n array.each do |int|\n if int <= pivot\n left << int\n else\n right << int\n end\n end\n\n left << pivot\n left + right\nend",
"def partition_array(array, pivot)\n left_i = 0\n right_i = (last_i = array.length - 1)\n\n # haven't crossed/met yet...\n while left_i < right_i\n while array[left_i] <= pivot && left_i < last_i\n left_i += 1\n end\n\n while array[right_i] >= pivot && right_i > 0\n right_i -= 1\n end\n\n # four possibilities (extract this part)\n if left_i < right_i # stopped but not crossed\n # swap left and right values\n tmp = array[left_i]\n array[left_i] = array[right_i]\n array[right_i] = tmp\n # repeat loop\n else\n if left_i > right_i # # crossed, midpoint found\n midpoint = left_i #left_i is to right of midpoint after cross\n left = array\n right = left.slice!(midpoint..-1)\n elsif right_i == 0 # right marker came all the way over: ALL GREATER THAN\n left, right = [], array\n else left_i == last_i # left marker came all the way right: ALL LESS THEN\n left, right = array, []\n end\n break\n end\n\n end\n\n return left, right\n end",
"def even_split?(num, by)\n num % by == 0\nend",
"def test_0260_partition\n @@log.debug \"test_0260_partition starts\" if @@log.debug?\n assert_respond_to(@list, :partition, \"test_0260_partition_respond\")\n # Basic partition\n ta = @list.partition {|obj| obj.ndata >= 3 }\n assert_equal(2, ta.size,\"test_0260_partition_basic_01\")\n # First array: block evaluated to true\n assert_equal([@aen, @bsb], ta[0], \"test_0260_partition_basic_02\")\n # Second array: block evaluated to false\n assert_equal([@cab, @dad], ta[1], \"test_0260_partition_basic_03\")\n # Check Enumerator or Enumerable::Enumerator return, no block given\n # This form not documented by the 1.8 Pickaxe.\n new_list = @list.partition\nif RUBY_VERSION >= \"1.9\"\n result = new_list.is_a? Enumerator\n assert(result, \"test_0260_partition_enumcheck\")\nelse\n # Note: the author's version of the 1.8 Pickaxe documents this\n # as an Array, however does not document this form of code at all.\n # YMMV.\n result = new_list.is_a? Enumerable::Enumerator\n assert(result, \"test_0260_partition_enumenumcheck\")\nend\n\n @@log.debug \"test_0260_partition ends\" if @@log.debug?\n end",
"def partition(list, left, right, pivotIndex)\n pivotValue = list[pivotIndex]\n list[pivotIndex], list[right] = list[right], list[pivotIndex]\n storeIndex = left\n for i in (left...right) do\n if list[i] < pivotValue\n list[storeIndex], list[i] = list[i], list[storeIndex]\n storeIndex += 1\n end\n end\n list[right], list[storeIndex] = list[storeIndex], list[right]\n storeIndex\nend",
"def Partition(array, left, right, comparisons)\n\n puts \"partitioning #{array.to_s}... #{comparisons} comparisons done already.\"\n \n pivot = array[left]\n #puts \"choosing pivot of #{pivot} for array starting with #{array[0..1]}\"\n i = left + 1\n \n for j in (left + 1)..right\n #print \" #{j} \"\n comparisons = comparisons + 1\n if array[j] < pivot\n #puts \"#{array[j]} is less than pivot\"\n #swap A[i] and A[j]\n temp = array[i]\n array[i] = array[j]\n array[j] = temp\n i = i + 1\n \n end\n end\n # swap A[l] and A[i - 1]\n temp = array[left]\n array[left] = array[i - 1]\n array[i-1] = temp\n \n puts \"done partitioning #{array.to_s}... #{comparisons} comparisons done now.\"\n return [array, i, j, comparisons]\nend",
"def quick_sort (arr, left, right)\n arr_index = partition(arr, left, right)\n if left < arr_index - 1 # sort left half\n quick_sort(arr, left, arr_index - 1)\n end\n\n if arr_index < right # sort right half\n quick_sort(arr, arr_index, right)\n end\n\n # if left < arr_index && arr_index < right\n # puts \"arr: #{arr}\"\n # arr\n # end\n\nend",
"def self_dividing_numbers(left, right)\n result_array = []\n\n (left..right).each do |i|\n arr = array_of_digits(i)\n\n self_dividing = true\n arr.length.times do |digit|\n if arr[digit] == 0\n self_dividing = false\n else\n self_dividing = false if i % arr[digit] != 0\n end\n end\n result_array << i if self_dividing\n end\n\n result_array\nend",
"def partition(filters={})\n input, output = self.input, self.output\n filters.each_pair do |filter_key, f|\n if f.call(input, output)\n return filter_key\n end\n end\n nil\n end",
"def partition(list, left, right, pindex)\n pvalue = list[pindex]\n swap(list, pindex, right)\n sindex = left\n for i in left .. right-1\n\tif list[i] <= pvalue\n\t swap(list, sindex, i)\n\t sindex = sindex + 1\n\tend\n end\n swap(list, right, sindex)\n return sindex\n end",
"def numbers_divisible_filter(numbers, dividers)\n numbers.map do |number|\n number_divisible_filter(number, dividers)\n end\nend",
"def partition_method(list)\n #names of both arrays....\n #partition method is called on list\n #block if number is positive it goes in positive array\n #else it goes to negative array\n positive, negative = list.partition { |number| number.positive?}\n #call length of positive array and sum of negative array\n [positive.length, negative.sum]\nend",
"def matrix_partitioner(mat)\n n = mat.size-1\n n_half = mat.size/2\n\n m11 = (0..n_half-1).map { |x| mat[x][0..n_half-1] }\n m12 = (0..n_half-1).map { |x| mat[x][n_half..n] }\n\n m21 = (n_half..n).map { |x| mat[x][0..n_half-1] }\n m22 = (n_half..n).map { |x| mat[x][n_half..n] }\n [m11, m12, m21, m22]\n end",
"def partition(arr, left, right)\r\n pivot = arr[right]['id']\r\n brk_pt = left\r\n\r\n (left..right-1).each do |i|\r\n if arr[i]['id'] < pivot\r\n arr[i], arr[brk_pt] = arr[brk_pt], arr[i]\r\n brk_pt = brk_pt + 1\r\n end\r\n end\r\n\r\n arr[brk_pt], arr[right] = arr[right], arr[brk_pt]\r\n return brk_pt\r\nend",
"def even_odd_half_of(splits)\n odd = splits.select.with_index{|_,i| (i+1) % 2 == 1}\n even = splits.select.with_index{|_,i| (i+1) % 2 == 0}\n # necessary to reverse order of 2nd half\n # otherwise someone would have to manually reverse\n # all the printed pages after having printed\n # the first half of the document.\n even.reverse!\n [odd, even]\n end",
"def merge(left, right, &predicate)\n result = []\n while !left.empty? && !right.empty?\n if predicate.call(left.first, right.first) <= 0\n result << left.shift\n else\n result << right.shift\n end\n end\n result.concat left.empty? ? right : left\nend",
"def quickSortHelper(ia, left, h)\n if (left < h)\n p = partition(ia, left, h) #get partition index of the array\n quickSortHelper(ia, left, p - 1) #sort from low to partition index -1\n quickSortHelper(ia, p + 1, h) #sort from p + 1 to high\n end\nend",
"def calc_poss_partitions(root_partition, rd, md)\n root_partition = normalize_partition(root_partition)\n # puts \"root_partition = \" + root_partition.to_s\n r = rd[:r_num_cells].length\n poss_partitions = Array.new\n # poss_partitions.push(root_partition)\n xxs = create_r_arrays_from_partition(rd[:r_num_cells], root_partition)\n\n i_j_combinations = (0...xxs.length).to_a.combination(2).to_a\n i_j_combinations.each do |ij|\n xx_i_combinations = (1...xxs[ij[0]].length).flat_map{|size| xxs[ij[0]].combination(size).to_a}\n xx_j_combinations = (1...xxs[ij[1]].length).flat_map{|size| xxs[ij[1]].combination(size).to_a}\n xx_i_combinations.each do |xx_i_combination|\n xx_i_sum = xx_i_combination.inject(0, :+)\n xx_j_combinations.each do |xx_j_combination|\n xx_j_sum = xx_j_combination.inject(0, :+)\n # This part is horribly inefficient. I already know some ways\n # it could be improved, but I just want a proof of concept for\n # the time being, so maybe I'll come back and optimize later.\n if xx_i_sum == xx_j_sum\n new_partition = create_new_partition(root_partition, xx_i_combination, xx_j_combination)\n new_partition = normalize_partition(new_partition)\n # Originally, I had this part cut down the number of partitions it returned by\n # making it only return VALID partitions. Now that I'm essentially using this\n # as a method of EXPANDING from a given partition, I should allow it to return\n # invalid partitions, as they could still have valid children which would not\n # be reachable otherwise.\n # if (not poss_partitions.include? new_partition) and validate_partition(new_partition, rd, md)\n if not poss_partitions.include? new_partition\n poss_partitions.push(new_partition)\n # puts \"poss_partition[\" + (poss_partitions.length-1).to_s + \"] = \" + new_partition.to_s\n end\n end\n end\n end\n end\n return poss_partitions\nend",
"def divide(ary)\n left = ary.take(ary.count/2)\n right = ary - left\n if left.count > 1\n divide(left)\n divide(right) \n end\n\n if left.count == 1\n @final_ary.push(left)\n end\n\n if right.count == 1\n @final_ary.push(right)\n end\n\n if @final_ary.count == ary.count * 2\n merge(@final_ary, 0)\n p @final_ary\n end\n\n end",
"def each_preorder(proc)\n proc.call(@value1)\n proc.call(@value2) if @type == 3\n @left.each_preorder(proc) if @left\n @mid.each_preorder(proc) if @mid\n @right.each_preorder(proc) if @type == 3 && @right\n end",
"def partition(array)\n # write your code here\n first = array[0]\n right = []\n left = []\n \n for i in 1..(array.length - 1)\n if first > array[i] \n left << array[i] \n else \n right << array[i]\n end\n end\n left + [first] + right\n \n end",
"def self_dividing_numbers(left, right)\n result = []\n i = left\n while i <= right #while i is smaller than right bound\n str = i.to_s #converts all int to string\n j = 0\n c = 0\n while j < str.length\n if str[j].to_i == 0\n break\n elsif i % str[j].to_i == 0\n c += 1\n end\n j+= 1\n end\n if c == str.length\n result.push(i)\n end\n i += 1\n end\n return result\nend",
"def partition(array, testValue)\r\n\r\n\r\n\tleft_index = 0\r\n\tright_index = array.length-1\r\n\r\n\t# While markers have not crossed each other\r\n\twhile(left_index < right_index)\r\n\r\n\t\tl_value = array[left_index]\r\n\t\tr_value = array[right_index]\r\n\t\tif(l_value > testValue and r_value < testValue)\t\r\n\t\t\t# Swap\r\n\t\t\ttemp = array[left_index]\r\n\t\t\tarray[left_index] = array[right_index]\r\n\t\t\tarray[right_index] = temp\r\n\t\tend\r\n\r\n\t\t#Move left_index forward\r\n\t\twhile(array[left_index]<testValue)\r\n\t\t\tleft_index = left_index+1\r\n\t\tend\r\n\r\n\t\t#Move right_index back\r\n\t\twhile(array[right_index]>testValue)\r\n\t\t\tright_index = right_index-1\r\n\t\tend\r\n\tend\r\n\r\n\t#returns the point where the test value divides the array\r\n\tif(array[left_index]>testValue)\r\n\t\tleft_index -= 1\r\n\tend\r\n\treturn left_index, array\r\nend",
"def partition(array, p, r)\n x = array[r]\n i = p - 1\n j = p\n\n while j < r\n if array[j] <= x\n i = i + 1\n array[i], array[j] = array[j], array[i]\n end\n j = j + 1\n end\n\n array[i + 1], array[r] = array[r], array[i + 1]\n\n return (i + 1)\nend",
"def separate_array_into_even_and_odd_numbers(array)\n array.partition {|x| x.even?}\nend",
"def quick_sort(array, &prc)\n return array if array.length <= 1\n prc ||= Proc.new { |el1, el2| el1 - el2 }\n\n part_idx = array.length / 2\n part_val = array[part_idx]\n\n left = []\n right = []\n\n array.each_with_index do |el, idx|\n next if idx == part_idx\n prc.call(el, part_val) <= 0 ? left << el : right << el\n end\n\n quick_sort(left, &prc) + [part_val] + quick_sort(right, &prc)\nend",
"def fold_left_into_mid\n @mid.shift_right\n @mid.type, @mid.value1, @mid.left = 3, @value1, @left.left\n shift_left\n @type = 2\n end",
"def partition(*paths)\n t = []; f = []\n traverse(*paths){|x| next t << f if yield f; f << x }\n [t, f]\n end",
"def quicksort(list, left, right)\n # Checks if the left array item is bigger than the right array item\n if left < right\n # Sends the items for inspection and splitting them up in 2 arrays\n switch = partition(list, left, right)\n # Recursive function to make sure it does all the elements\n quicksort(list, left, switch-1)\n quicksort(list, switch+1, right)\n end\nend",
"def partition(array, p, r)\n q = p\n (p .. r - 1).each do |u|\n if array[u] <= array[r]\n array[q], array[u] = array[u], array[q]\n q += 1\n end\n end\n array[q], array[r] = array[r], array[q]\n q\nend",
"def split_and_evaluate\n self.split(true)\n end",
"def partition(a,p,r)\n i = p-1\n key = a[r]\n for j in p..r-1\n if(a[j]<=key)\n i = i + 1\n temp = a[i]\n a[i] = a[j]\n a[j] = temp\n end\n end\n temp = a[i+1]\n a[i+1] = a[r]\n a[r] = temp\n return i+1\nend",
"def simple_partition(input, key)\n input.sort_by! { |info| info[key] }.reverse!\n return input.partition.with_index { |_, i| i.even? }\nend",
"def partition(array, num)\n less = []\n more = []\n array.each do |n|\n if n >= num\n more << n\n else\n less << n\n end\n end\n \n [less, more]\nend",
"def partition\n return enum_for(:partition) if not block_given?\n a,b = super\n [self.class.new(a), self.class.new(b)].freeze\n end",
"def partition_list()\nend",
"def sortById(arr, left, right)\r\n if left < right\r\n \r\n pi = partition(arr, left, right)\r\n sortById(arr, left, pi - 1)\r\n sortById(arr, pi + 1, right)\r\n end\r\n\r\n return arr\r\nend",
"def split_by(arr, divider)\n arr.inject([[]]) {|results, element|\n (divider == element) ? (results << []) : (results.last << element)\n results\n }\n end",
"def partition_using_sub_arrays(array, lower, higher)\n pivot = array[higher]\n p_index = lower\n \n i = lower\n while i < higher\n if array[i] <= pivot\n swap(array, i, p_index)\n p_index += 1\n end\n i += 1\n end\n swap(array, p_index, higher)\n\n return p_index\nend",
"def partition(a,l,r)\n pivot = a[r]\n i = l\n p_index = l\n\n while i < r\n if a[i] <= pivot\n temp = a[i]\n a[i] = a[p_index]\n a[p_index] = temp\n p_index += 1\n end\n i += 1\n end\n temp = a[p_index]\n a[p_index] = a[r]\n a[r] = temp\n return p_index\nend",
"def partition(ary, left, right, pivot_i)\n\n left = 0\n right = ary.length - 1\n\n pivot = ary[pivot_i]\n\n # Move pivot to the end of ary\n ary[pivot_i], ary[right] = ary[right], ary[pivot_i]\n\n # All values <= pivot moved to front of ary\n # Pivot inserted after them\n store = left\n (left...right).each do |i|\n if ary[i] <= pivot\n ary[i], ary[store] = ary[store], ary[i]\n store += 1\n end\n end\n\n ary[store], ary[right] = ary[right], ary[store]\n store\n end",
"def partition(arr, n)\n\nend",
"def expand_predicate(predicate)\n case predicate\n when String\n predicate[0] == '/' ? build_regexp_from_string(predicate) : predicate\n when Regexp, Proc, Range\n predicate\n when Symbol, Integer\n ->(v) { predicate.to_s == v.to_s }\n when NilClass\n nil\n else\n predicate\n end\n end",
"def query(\n query_l, query_r, # left and right bounds of the query.\n # right inclusive.\n segment_l = 1,\n segment_r = @n_leaves,\n i = 1\n )\n if (query_l <= segment_l) && (segment_r <= query_r)\n # current segment is subsumed by the query segment.\n @internal_arr[i]\n elsif (segment_r < query_l) || (query_r < segment_l)\n # disjoint segments.\n @fallback\n else\n mid = (segment_l + segment_r) >> 1\n @func.call(\n query(\n query_l, query_r,\n segment_l, mid,\n i << 1\n ),\n query(\n query_l, query_r,\n mid + 1, segment_r,\n (i << 1) | 1\n )\n )\n end\n end",
"def partition(&block)\n return to_enum :partition unless block\n\n ary_T = []\n ary_F = []\n self.each{|*val|\n if block.call(*val)\n ary_T.push(val.__svalue)\n else\n ary_F.push(val.__svalue)\n end\n }\n [ary_T, ary_F]\n end",
"def optimize\n left_restriction.send(relation_method, right_restriction).restrict(partition.remainder)\n end",
"def equal_split?(nums)\n total = nums.inject(0, :+)\n return unless total % 2 == 0\n i = 0\n potential_half = 0\n while i < nums.length\n potential_half += nums[i]\n total -= nums[i]\n break if total == potential_half\n i += 1\n end\n if total == potential_half\n # Array.take returns the first x values of an array, whereas Array.drop\n # returns the rest of an array, after removing x values. We use i + 1\n # due to zero-indexing.\n print [nums.take(i + 1), nums.drop(i + 1)]\n else\n print 'Not possible to split'\n end\nend",
"def split\n\t\t\tcond = pop\n\t\t\tarray = pop\n\t\t\traise ArgumentError, \"SPLIT: first element is not an Array.\" unless cond.is_a? Array\n\t\t\traise ArgumentError, \"SPLIT: second element is not an Array.\" unless array.is_a? Array\n\t\t\tyes, no = [], []\n\t\t\tarray.each do |e|\n\t\t\t\tsave_stack\n\t\t\t\tpush e\n\t\t\t\t~cond.dup\n\t\t\t\tpop ? yes << e : no << e\n\t\t\t\trestore_stack\n\t\t\tend\n\t\t\tpush yes\n\t\t\tpush no\n\t\tend",
"def test_e2111_shell_sort_increment\n verify_method :e2111_shell_sort_increment,\n :with => [\n {\n param: 3,\n predicate: Proc.new { |seq| check_shell_sort_sequence(3, seq) }\n },\n {\n param: 4,\n predicate: Proc.new { |seq| check_shell_sort_sequence(4, seq) }\n },\n {\n param: 10,\n predicate: Proc.new { |seq| check_shell_sort_sequence(10, seq) }\n },\n {\n param: 100,\n predicate: Proc.new { |seq| check_shell_sort_sequence(100, seq) }\n },\n ]\n end",
"def partition(array, p, r)\n q = p\n for j in p..r-1\n if array[j] <= array[r]\n swap(array, j, q)\n q = q + 1\n end\n end\n swap(array, r, q)\n return q\nend",
"def partitionx(array, start, fin, pivot_index)\n le_count = 0\n pivot_value = array[pivot_index]\n puts \"Partitioning for value: #{pivot_value}: #{array}\"\n puts \"Start:Fin #{start}:: #{fin}:: #{pivot_index}\"\n array[start..fin].each do |element|\n le_count += 1 if element <= pivot_value\n end\n\n new_array = []\n puts \"LE count: #{le_count}\"\n new_array[le_count - 1] = pivot_value\n left_index = 0 # 5\n right_index = le_count # 1\n index = start\n array[start..fin].each do |element|\n puts \"Element: #{element}: #{index}:: #{pivot_index}\"\n if index == pivot_index\n index += 1\n next\n end\n\n if element <= pivot_value\n puts \"Copying to left #{element} to #{left_index}\"\n new_array[left_index] = element\n left_index += 1\n else\n puts \"Copying #{element} to #{right_index}\"\n new_array[right_index] = element\n right_index += 1\n end\n end\n puts \"before replacing: #{array} : #{array[start..fin]}:: #{new_array}\"\n j = 0\n (start..fin).each do |index|\n puts \"index: #{index}\"\n array[index] = new_array[j]\n j += 1\n end\n\n puts \"New array: #{array}\"\n puts \"new pivot index: #{array.index(pivot_value)}\"\n array.index(pivot_value)\n end",
"def slice(*args, &block)\n sort_if_needed\n @rules.slice(*args, &block)\n end",
"def each_predicate(&block)\n grouped_predicates_attributes.each do |namespace, predicates|\n predicates.each do |predicate, objects|\n block.call(namespace, predicate, objects.flatten)\n end\n end\n end",
"def predicate(&block)\n @predicate = block unless block.nil?\n @predicate\n end",
"def partition(head, x)\n less = ListNode.new(:less)\n less_last = less\n more = ListNode.new(:more)\n more_last = more\n while head\n next_head = head.next\n head.next = nil\n if head.val < x\n less_last.next = head\n less_last = head\n else\n more_last.next = head\n more_last = head\n end\n \n head = next_head\n end\n \n less_last.next = more.next\n return less.next\nend",
"def caculate_part left, right\n # don't use ellipsis if there's no spaces between them\n ellipsis = !left.empty? && (left.last + 1) == right.first ?\n [] : [setting[:ellipsis]]\n\n part = left + ellipsis + right\n\n # clean up overlap and remove '...' if\n part.delete(setting[:ellipsis]) if\n part.uniq! || # there's overlap\n part.size == 1 # no pages there\n\n part\n end",
"def partition_selector\n @subhash = {}\n @filters = {}\n\n partition_selector_hash @selector, []\n end",
"def partition_private(leftmost_index, rightmost_index)\n i = leftmost_index + 1\n pivot = self[leftmost_index] # the pivot can be chosen a number of different ways\n j = i\n while j <= rightmost_index\n # if the value is less than the pivot value, go search\n if self[j] < pivot\n self[i], self[j] = self[j], self[i]\n i += 1\n end\n j += 1\n end\n # puts the pivot into the correctly sorted area\n self[leftmost_index], self[i - 1] = self[i - 1], self[leftmost_index]\n i - 1\n end",
"def divisible_by_remaining_odd_numbers?(n)\n potential_divisors = (3..Math.sqrt(n)).step(2).to_a\n divisible = false\n potential_divisors.each do |x|\n if n % x != 0\n potential_divisors.delete_if { |y| y % x == 0 }\n else\n divisible = true\n potential_divisors = []\n end\n end\n\n divisible\n\nend",
"def each_operand(predicate, &block)\n case predicate\n when Axiom::Function::Connective::Disjunction then each_operand(predicate.inverse.optimize, &block)\n when Axiom::Function::Connective::Conjunction then each_conjunction(predicate, &block)\n else\n block.call(predicate)\n end\n end",
"def partition(a, p, r)\n\n\t# assume last position\n\tpivot = a[r]\n\ti = p-1\n\tp.upto(r-1) do |j|\n\t\tif a[j] <= pivot\n\t\t\ti+=1\n\t\t\ta[i], a[j] = a[j], a[i]\n\t\tend \n\tend\n\ta[i+1],a[r] = a[r],a[i+1]\n i+1\nend",
"def divisible_numbers(arr)\n n = arr.size\n (0...n).each do |x|\n a = arr[x]\n ((x+1)...n).each do |y|\n b = arr[y]\n z = [a,b].sort\n return z if z[1] % z[0] == 0\n end\n end\nend",
"def partition(tracks)\n track_count = tracks.size\n track_numbers = (0...track_count).to_a\n half = track_count / 2.0\n half_rounded = half.round\n range_one = 0...(half_rounded.pred)\n range_two = (half_rounded.pred)...(track_count.pred)\n [tracks.slice(range_one), tracks.slice(range_two)].reject(&:nil?)\n end",
"def each_predicate(&block) # :nodoc:\n grouped_predicates_attributes.each do |namespace, predicates|\n predicates.each do |predicate, objects|\n block.call(namespace, predicate, objects.flatten)\n end\n end\n end",
"def partition(linked_list, x)\n left_partition = LinkedList.new\n right_partition = LinkedList.new\n\n current_node = linked_list.head.next\n\n until current_node == linked_list.tail\n if current_node.value < x\n next_node = current_node.next\n linked_list.delete(current_node)\n left_partition.append(current_node)\n else\n next_node = current_node.next\n linked_list.delete(current_node)\n right_partition.append(current_node)\n end\n\n current_node = next_node\n end\n\n right_head = right_partition.head.next\n left_tail = left_partition.tail.prev\n\n left_tail.next = right_head\n right_head.prev = left_tail\n\n left_partition\nend",
"def partitionize(array)\r\n p = Array.new\r\n\r\n array.each_with_index do |x, i|\r\n if i == 0 || x.exercise_id != array[i-1].exercise_id\r\n p << Array.new\r\n end\r\n p.last << x\r\n end\r\n p\r\n end",
"def partition_points(points)\n points.sort_by! {|x| x[0]} #why I think my algorithm needs to be nlogn\n return points.in_groups(2)\nend",
"def partition(array, first, last)\n pivot = array[last]\n pIndex = first\n i = first\n while i < last\n if array[i].to_i <= pivot.to_i\n array[i], array[pIndex] = array[pIndex], array[i]\n pIndex += 1\n end\n i += 1\n end\n array[pIndex], array[last] = array[last], array[pIndex]\n return pIndex\n end",
"def divisible_by(numbers, divisor)\n numbers.find_all { |i| (i % divisor).zero? }\nend",
"def mergesort(array)\n # Base case\n if array.count <= 1\n return array\n end\n\n # Apply \"Divide & Conquer\" strategy\n # 1. Divide\n mid = array.count / 2\n left_partition = mergesort array.slice(0, mid)\n right_partition = mergesort array.slice(mid, array.count - mid)\n\n # 2. Conquer\n array = []\n left_lead = 0\n right_lead = 0\n while left_lead < left_partition.count && right_lead < right_partition.count\n a = left_partition[left_lead]\n b = right_partition[right_lead]\n\n # Take the smallest of the two, and push it on our array\n if a <= b\n array << a\n left_lead += 1\n else\n array << b\n right_lead += 1\n end\n end\n\n # Either left or right may have elements left; consume them.\n # (Only one of the following loops will actually be entered.)\n while left_lead < left_partition.count\n array << left_partition[left_lead]\n left_lead += 1\n end\n\n while right_lead < right_partition.count\n array << right_partition[right_lead]\n right_lead += 1\n end\n\n return array\nend",
"def divisible_by(numbers, divisor)\n numbers.select { |num| num % divisor == 0 }\nend",
"def quicksort!(left_index, right_index)\r\n # Base case: the subarray has 0 or 1 elements:\r\n if right_index - left_index <= 0\r\n return\r\n end\r\n\r\n # Partition the range of elements and grab the index of the pivot:\r\n pivot_index = partition!(left_index, right_index)\r\n\r\n # Recursively call this quicksort! method on whatever \r\n # is to the left of the pivot:\r\n quicksort!(left_index, pivot_index - 1)\r\n\r\n # Recursively call this quicksort! method on whatever \r\n # is to the right of the pivot:\r\n quicksort!(pivot_index + 1, right_index)\r\nend",
"def self_dividing_numbers(left, right)\n (left..right).select{|x| x.digits.all?{|y| y!=0 && x%y == 0}}\nend",
"def left_restriction\n operand.left.restrict(partition.left)\n end",
"def preslice_filter filter\n slices = []\n steps = filter.shape[0] / 2\n steps.times do |i|\n f_start = steps-i\n f_end = -1-i\n if filter.rank == 2\n slices << filter[f_start..f_end, true]\n else\n slices << filter[f_start..f_end]\n end\n end\n slices\n end",
"def partition(ia, left, h)\n piv = ia[h] #choose the pivot as the furthest value\n i = left - 1 #set i to the index of the lowest value\n temp = 0 #temporary swapping variable\n\n for j in left..(h-1) #for j goes from low to high index..\n if(ia[j] < piv) #if the current value that we are looking at is les than the pivot...\n i += 1 #add one to the lowest position counter...\n\n #swap those two values\n ia[i],ia[j] = ia[j],ia[i]\n\tend\n end\n #swap so partition is in the middle\n ia[i+1],ia[h] = ia[h],ia[i+1]\n\n return (i+1)\nend",
"def remainder(p0) end",
"def divider sorted_arr, i=0, j=sorted_arr.size-1, left_sum = 0, right_sum = 0\n\n\t\n\treturn 'No' if j<=i\n\t\n\tright_sum += sorted_arr[j]\n\n\twhile left_sum < right_sum\n\t\tleft_sum += sorted_arr[i]\n\t\ti +=1\n\tend\n\tif left_sum == right_sum\n\t\treturn 'Yes' if( sorted_arr[i] == sorted_arr[j-1] || (i == j && sorted_arr[i-1]+1<sorted_arr[j])) \t\n\tend\n\n\tdivider(sorted_arr, i, j-1, left_sum, right_sum)\n\nend",
"def split_number_in_sets_one_below_500_and_ones_above(array)\n\tarray.partition{|x| x < 500}\nend",
"def partition(array, low, high)\n middle = (high + low ) / 2\n pivot = array[middle] # choose middle element as pivot\n # SWAP MIDDLE TO END\n array[middle], array[high] = array[high], array[middle]\n\n pivot_index = high # store index of pivot\n i = low\n\n while i < pivot_index\n if array[i] <= pivot\n i += 1\n next\n end\n\n before_pivot = pivot_index - 1\n array[i], array[before_pivot] = array[before_pivot], array[i]\n pivot_index -= 1\n end\n # SWAP ONCE AT END OF LOOP TO PUT PIVOT IN CORRECT LOCATION\n array[pivot_index], array[high] = array[high], array[pivot_index]\n pivot_index\nend",
"def quicksort(xs, &prc)\n return [] unless xs\n\n pivot = MaglevUndefined\n xs.each { |o| pivot = o; break }\n return xs if pivot._equal?( MaglevUndefined)\n\n lmr = xs.group_by do |o|\n if o._equal?(pivot)\n 0\n else\n yield(o, pivot)\n end\n end\n quicksort(lmr[-1], &prc) + lmr[0] + quicksort(lmr[1], &prc)\n end"
] | [
"0.6627197",
"0.64619684",
"0.61369145",
"0.604758",
"0.59564954",
"0.5624403",
"0.55235165",
"0.5490219",
"0.5412623",
"0.5379851",
"0.5365013",
"0.53573745",
"0.53485274",
"0.5328039",
"0.5322694",
"0.53205055",
"0.5297593",
"0.5287832",
"0.524956",
"0.52120787",
"0.5210271",
"0.52046645",
"0.5191991",
"0.5170952",
"0.5163399",
"0.51538736",
"0.5121749",
"0.50836664",
"0.5077201",
"0.5073501",
"0.5066193",
"0.50602716",
"0.5039845",
"0.5033662",
"0.5023921",
"0.5008428",
"0.49703962",
"0.49435845",
"0.49402374",
"0.49388012",
"0.49284035",
"0.4917938",
"0.48747227",
"0.48613942",
"0.48412684",
"0.48355713",
"0.48300335",
"0.4821319",
"0.48199615",
"0.48133808",
"0.48021975",
"0.47915387",
"0.47887626",
"0.4780854",
"0.47793767",
"0.47667205",
"0.47568712",
"0.47513774",
"0.47401032",
"0.47386876",
"0.47304076",
"0.47281736",
"0.47258368",
"0.47223833",
"0.4717189",
"0.4711398",
"0.47110674",
"0.46963692",
"0.4691107",
"0.4682526",
"0.46821764",
"0.46607083",
"0.46400556",
"0.46361095",
"0.46356097",
"0.4634747",
"0.46317628",
"0.46044907",
"0.46002424",
"0.45970815",
"0.4595623",
"0.4594746",
"0.45924148",
"0.45879886",
"0.45850086",
"0.45759204",
"0.45629713",
"0.45592827",
"0.45496008",
"0.45428622",
"0.4537496",
"0.45352453",
"0.4532572",
"0.45214462",
"0.4521341",
"0.45109805",
"0.4503702",
"0.45015556",
"0.45003602",
"0.449921"
] | 0.7046975 | 0 |
Partition the binary function up into a left, right and remainder predicates | def partition_binary(function)
operands = [function.left, function.right].grep(Axiom::Attribute)
left_operands = @left_header & operands
right_operands = @right_header & operands
if (left_operands - right_operands).empty? || (right_operands - left_operands).empty?
@left &= function if left_operands.any?
@right &= function if right_operands.any?
else
@remainder &= function
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def partition_unary(function)\n operand = function.operand\n @left &= function if @left_header.include?(operand)\n @right &= function if @right_header.include?(operand)\n end",
"def partition(predicate)\n each_operand(predicate) do |operand|\n case operand\n when Axiom::Function::Binary then partition_binary(operand)\n when Axiom::Function::Unary then partition_unary(operand)\n when Axiom::Attribute::Boolean then partition_attribute(operand)\n else\n partition_proposition(operand)\n end\n end\n end",
"def divide_and_conquer(instructions, lower, upper)\n range = upper - lower\n instruction = instructions[0]\n tail = instructions[1..-1]\n\n case instruction\n when 'F', 'L'\n\n upper -= ((range + 1) / 2)\n return lower if tail.empty?\n when 'B', 'R'\n\n lower += ((range + 1) / 2)\n return upper if tail.empty?\n end\n\n divide_and_conquer(tail, lower, upper)\n end",
"def partition_proposition(proposition)\n @remainder &= proposition\n @left &= proposition\n @right &= proposition\n end",
"def self_dividing_numbers(left, right)\n result_array = []\n\n (left..right).each do |i|\n arr = array_of_digits(i)\n\n self_dividing = true\n arr.length.times do |digit|\n if arr[digit] == 0\n self_dividing = false\n else\n self_dividing = false if i % arr[digit] != 0\n end\n end\n result_array << i if self_dividing\n end\n\n result_array\nend",
"def self_dividing_numbers(left, right)\n ans = []\n for i in left..right do \n if is_self_divided(i)\n ans << i\n end\n end\n ans\nend",
"def even_split?(num, by)\n num % by == 0\nend",
"def partition(array, left, right)\n pivot = right\n right -= 1\n puts \"left: #{left}, right: #{right}\"\n while true do\n while array[left] <= array[pivot] && left < pivot do\n left += 1\n end\n\n while array[right] > array[pivot] do\n right -= 1\n end\n\n\n\n if left >= right\n temp = array[left]\n array[left] = array[pivot]\n array[pivot] = temp\n break\n else\n temp = array[left]\n array[left] = array[right]\n array[right] = temp\n end\n end\n\n\n left\nend",
"def remainder(p0) end",
"def partition_array(array,x,left=0,right=(array.length-1))\n # end condition: when the markers pass each other\n # we're done, so then return the array \n if right < left\n return array\n end\n\n # when the left value is wrong\n wrong_left = array[left] > x\n # when the right value is wrong\n wrong_right = array[right] < x\n \n #if both are wrong, swap the pair\n if wrong_left && wrong_right\n array[left], array[right] = array[right], array[left]\n left = left + 1\n right = right - 1\n partition_array(array,x,left,right)\n #else if only the left is wrong, increment just the right\n elsif wrong_left\n right = right - 1\n partition_array(array,x,left,right)\n #else if the only the right is wrong, increment the left\n elsif wrong_right\n left = left + 1\n partition_array(array,x,left,right)\n end\n\n #return the array\n return array\nend",
"def get_remainder(num1,num2)\n num1%num2\nend",
"def self_dividing_numbers(left, right)\n result = []\n i = left\n while i <= right #while i is smaller than right bound\n str = i.to_s #converts all int to string\n j = 0\n c = 0\n while j < str.length\n if str[j].to_i == 0\n break\n elsif i % str[j].to_i == 0\n c += 1\n end\n j+= 1\n end\n if c == str.length\n result.push(i)\n end\n i += 1\n end\n return result\nend",
"def is_divisible_by(divisor)\n -> n { (n % divisor).zero? }\nend",
"def fold_left_into_mid\n @mid.shift_right\n @mid.type, @mid.value1, @mid.left = 3, @value1, @left.left\n shift_left\n @type = 2\n end",
"def remainder(val); end",
"def partition(array)\n # write your code here\n\n left = []\n right = []\n pivot = array.shift\n array.each do |int|\n if int <= pivot\n left << int\n else\n right << int\n end\n end\n\n left << pivot\n left + right\nend",
"def self_dividing_numbers(left, right)\n (left..right).select{|x| x.digits.all?{|y| y!=0 && x%y == 0}}\nend",
"def divisible_by(number, div_by)\n number % div_by == 0\nend",
"def partition(list, left, right)\n pivot = list[right]\n previous_left = left-1\n left.upto(right-1) { |value|\n previous_left = previous_left + 1 if list[value] <= pivot\n list[previous_left], list[value] = list[value], list[previous_left] if list[value] <= pivot\n }\n list[previous_left+1], list[right] = list[right], list[previous_left+1]\n return previous_left + 1\nend",
"def my_array_splitting_method(source)\n divide = source.sort_by{|x| x.to_s}\n total = divide.find_all{|item| item % 1 == 0 }.count \n total -= 1\n divide.partition.with_index { |_, index| index <= total }\nend",
"def divisor_plus_remainder(big_int, small_int)\n big_int / small_int + big_int % small_int\nend",
"def left_to_right(number)\n arr = number.to_s.split(//)\n length = arr.length\n\n (length-1).times do\n arr.shift\n return false if !is_prime?(arr.join.to_i)\n end\n\n return true\nend",
"def left_to_right(x)\r\n string = x.to_s\r\n len = string.length\r\n index = 1\r\n while index < len\r\n if is_prime?(string[index...len].to_i) == false\r\n return false\r\n end\r\n index += 1\r\n end\r\n return true\r\nend",
"def left(side, num)\n return num % side == 1 ? num : num - 1\nend",
"def modular_function\n num_1 % num_2\n return num_1 % num_2\nend",
"def partition\n PredicatePartition.new(predicate, operand.left.header, operand.right.header)\n end",
"def mod(first_number, second_number)\n first_number % second_number\nend",
"def right_to_left(number)\n arr = number.to_s.split(//)\n length = arr.length\n\n (length-1).times do\n arr.pop\n return false if !is_prime?(arr.join.to_i)\n end\n\n return true\nend",
"def modulo(p0) end",
"def my_modulo(dividend, divisor)\r\n # your code goes here\r\n # use of modulo operator\r\n\r\n dividend % divisor\r\nend",
"def partition1(arr, left, right)\n pele = arr[left]\n pindex = right\n i = right\n while(i > left)\n if(arr[i] > pele)\n arr[i], arr[pindex] = arr[pindex], arr[i]\n pindex -= 1\n end\n i -= 1\n end\n arr[left], arr[pindex] = arr[pindex], arr[left]\n pindex\nend",
"def binary(lo, hi, key)\n return lo if lo > hi\n mid = lo + (hi - lo)/2\n cmp = key <=> @keys[mid]\n return binary(lo, mid-1, key) if cmp < 0\n return binary(mid+1, hi, key) if cmp > 0\n return mid\n end",
"def right_to_left(x)\r\n string = x.to_s\r\n index = string.length - 1\r\n while index > 0\r\n if is_prime?(string[0...index].to_i) == false\r\n return false\r\n end\r\n index -= 1\r\n end\r\n return true\r\nend",
"def odd_even(number)\n # Modulo Operator\n return number % 2\nend",
"def is_odd_using_remainder(int)\n int.remainder(2).abs == 1\nend",
"def my_remainder(a, b)\n\treturn nil if a == 0 || b == 0\n\treturn a.abs % b.abs if a.abs >= b.abs\n\treturn b.abs % a.abs if b.abs > a.abs\nend",
"def quick_sort (arr, left, right)\n arr_index = partition(arr, left, right)\n if left < arr_index - 1 # sort left half\n quick_sort(arr, left, arr_index - 1)\n end\n\n if arr_index < right # sort right half\n quick_sort(arr, arr_index, right)\n end\n\n # if left < arr_index && arr_index < right\n # puts \"arr: #{arr}\"\n # arr\n # end\n\nend",
"def mod(n, m)\n return ((n % m) + m) % m\nend",
"def division_plus_remainder(big_number, small_number)\n (big_number / small_number) + (big_number % small_number)\n end",
"def quickSortHelper(ia, left, h)\n if (left < h)\n p = partition(ia, left, h) #get partition index of the array\n quickSortHelper(ia, left, p - 1) #sort from low to partition index -1\n quickSortHelper(ia, p + 1, h) #sort from p + 1 to high\n end\nend",
"def partition(arr, left, right, pivot)\n pivot_val = arr[pivot]\n arr[pivot] = arr[right]\n arr[right] = pivot_val\n\n storage = left\n\n (left..right-1).each do |i|\n if arr[i] < pivot_val\n storage_val = arr[storage]\n arr[storage] = arr[i]\n arr[i] = storage_val\n storage += 1\n end\n end\n\n storage_val = arr[storage]\n arr[storage] = arr[right]\n arr[right] = storage_val\n\n storage\nend",
"def this_is_also_odd?(param_integer)\n param_integer.remainder(2) != 0\nend",
"def partition_array(array, pivot)\n left_i = 0\n right_i = (last_i = array.length - 1)\n\n # haven't crossed/met yet...\n while left_i < right_i\n while array[left_i] <= pivot && left_i < last_i\n left_i += 1\n end\n\n while array[right_i] >= pivot && right_i > 0\n right_i -= 1\n end\n\n # four possibilities (extract this part)\n if left_i < right_i # stopped but not crossed\n # swap left and right values\n tmp = array[left_i]\n array[left_i] = array[right_i]\n array[right_i] = tmp\n # repeat loop\n else\n if left_i > right_i # # crossed, midpoint found\n midpoint = left_i #left_i is to right of midpoint after cross\n left = array\n right = left.slice!(midpoint..-1)\n elsif right_i == 0 # right marker came all the way over: ALL GREATER THAN\n left, right = [], array\n else left_i == last_i # left marker came all the way right: ALL LESS THEN\n left, right = array, []\n end\n break\n end\n\n end\n\n return left, right\n end",
"def divmod(p0) end",
"def numbers_divisible_filter(numbers, dividers)\n numbers.map do |number|\n number_divisible_filter(number, dividers)\n end\nend",
"def par(x)\r\n\t(x % 2 ==0) ? (return true):(return false)\r\nend",
"def splitInteger(num, parts)\n results = []\n remainder = num % parts\n parts.times do\n results << num / parts\n end\n \n results.reverse!.map! do |num|\n break if remainder == 0 \n remainder -= 1\n num += 1\n end\n \n results.reverse!\n \nend",
"def partition(arr, p, r, ord)\n\t# for empty array\n\treturn [] if r < 0\n\tx = arr[r]\n\ti = p - 1\n\tj = p\n\tfor j in p..r-1\n\t\t# USE OF LAMBDA FROM ABOVE\n\t\tif ord.call(arr[j], x)\n\t\t\ti += 1\n\t\t\ttemp = arr[i]\n\t\t\tarr[i] = arr[j]\n\t\t\tarr[j] = temp\n\t\tend\n\tend\n\ttemp = arr[i+1]\n\tarr[i+1] = arr[r]\n\tarr[r] = temp\n\treturn i + 1\nend",
"def remainder(arg0)\n end",
"def initialize(predicate, left_header, right_header)\n @left = @right = @remainder = TAUTOLOGY\n\n @left_header = left_header\n @right_header = right_header\n\n partition(predicate)\n end",
"def inv_mod x,n\n d,r,s = gcd2 x,n\n if d==1\n r % n\n else\n 0\n end\nend",
"def partition(arr, left, right)\n pivot = arr[right]\n pindex = left\n for i in (left...right) do\n if(arr[i] <= pivot)\n arr[pindex], arr[i] = arr[i], arr[pindex]\n pindex += 1\n end\n end\n arr[pindex], arr[right] = arr[right], arr[pindex]\n pindex\nend",
"def right(side, num)\n return num % side == 0 ? num : num + 1\nend",
"def binary(array, low, high, num)\n if array.empty?\n nil\n else\n # low=0\n # high=array.length\n sorted_array = array.sort\n if low == high\n array[low]==num ? array[low] : nil\n else\n mid = (low+high)/2\n if array[mid]>num\n binary(array,low,mid-1,num)\n else\n binary(array,mid,high,num)\n end\n end\n end\nend",
"def Partition(array, left, right, comparisons)\n\n puts \"partitioning #{array.to_s}... #{comparisons} comparisons done already.\"\n \n pivot = array[left]\n #puts \"choosing pivot of #{pivot} for array starting with #{array[0..1]}\"\n i = left + 1\n \n for j in (left + 1)..right\n #print \" #{j} \"\n comparisons = comparisons + 1\n if array[j] < pivot\n #puts \"#{array[j]} is less than pivot\"\n #swap A[i] and A[j]\n temp = array[i]\n array[i] = array[j]\n array[j] = temp\n i = i + 1\n \n end\n end\n # swap A[l] and A[i - 1]\n temp = array[left]\n array[left] = array[i - 1]\n array[i-1] = temp\n \n puts \"done partitioning #{array.to_s}... #{comparisons} comparisons done now.\"\n return [array, i, j, comparisons]\nend",
"def divisible_numbers(arr)\n n = arr.size\n (0...n).each do |x|\n a = arr[x]\n ((x+1)...n).each do |y|\n b = arr[y]\n z = [a,b].sort\n return z if z[1] % z[0] == 0\n end\n end\nend",
"def binaryDivide(dividend, divisor)\n inverse = findInverse(divisor)\n multiply([dividend, inverse])\n end",
"def is_odd1?(integer)\n integer.remainder(2) != 0\nend",
"def f(n,m)\n array = [*1..n]\n array.inject(0) do |result, int|\n result += int % m\n end\nend",
"def divisible_by_remaining_odd_numbers?(n)\n potential_divisors = (3..Math.sqrt(n)).step(2).to_a\n divisible = false\n potential_divisors.each do |x|\n if n % x != 0\n potential_divisors.delete_if { |y| y % x == 0 }\n else\n divisible = true\n potential_divisors = []\n end\n end\n\n divisible\n\nend",
"def evens_and_odds(arr)\r\n arr.partition{ |num| num.odd?}\r\nend",
"def is_divisible(n,x,y)\r\n (n%x == 0 && n%y == 0) ? 1==1 : 1==2\r\nend",
"def left(i)\n return 2*i\nend",
"def div_h_p_nr(a,b)\n p = 0\n\n @bits.times do\n if p < 0\n # (i-a) shift combined pa register left one bit\n pa = ((p<<@bits)|a)<<1\n # (ii-a) p=p+b\n a = pa & @mA\n p = signed((pa & @mP) >> @bits)\n p += b\n else\n # (i-b) shift combined pa register left one bit\n pa = ((p<<@bits)|a)<<1\n # (ii-b) p=p-b\n a = pa & @mA\n p = signed((pa & @mP) >> @bits)\n p -= b\n if (p < 0)\n# Tests pass if the following is uncommented\n# # (iv) restore p\n# p += b\n else\n # (iii) if p >= 0\n a |= 1\n end\n end\n end\n # FIXME - need a test case that exercises this last step\n if p < 0\n p += b\n end\n [lo(a),lo(p)]\n end",
"def d(n)\n return [true, 0] if n.nil?\n return [true, 1] if n.right.nil? && n.left.nil?\n\n rb, rh = n.right ? d(n.right) : [true, 0]\n lb, lh = n.left ? d(n.left) : [true, 0]\n\n [\n rb && lb && (rh - lh).abs <= 1,\n [rh, lh].max + 1\n ]\nend",
"def div_h_p_r(a,b)\n p = 0\n\n @bits.times do\n # (i) shift combined pa register left one bit\n pa = ((p<<@bits)|a)<<1\n # (ii) p=p-b\n a = pa & @mA\n p = signed((pa & @mP) >> @bits)\n p -= b\n if (p < 0)\n # (iv) restore p\n p += b\n else\n # (iii) if p >= 0\n a |= 1\n end\n end\n [lo(a),lo(p)]\n end",
"def is_divisible(n,x,y)\n (n % x == 0) && (n % y == 0)\nend",
"def bitonic_recurse(arr, low, count, direction)\n return if count <= 1\n\n mid = count / 2\n bitonic_recurse(arr, low, mid, 1)\n bitonic_recurse(arr, low + mid, mid, -1)\n bitonic_merge(arr, low, count, direction)\n arr\nend",
"def left(i); 2*i+1; end",
"def partition(list, left, right, pivotIndex)\n pivotValue = list[pivotIndex]\n list[pivotIndex], list[right] = list[right], list[pivotIndex]\n storeIndex = left\n for i in (left...right) do\n if list[i] < pivotValue\n list[storeIndex], list[i] = list[i], list[storeIndex]\n storeIndex += 1\n end\n end\n list[right], list[storeIndex] = list[storeIndex], list[right]\n storeIndex\nend",
"def part_of_left_x?(x, y)\n x == y\n end",
"def partition(array, testValue)\r\n\r\n\r\n\tleft_index = 0\r\n\tright_index = array.length-1\r\n\r\n\t# While markers have not crossed each other\r\n\twhile(left_index < right_index)\r\n\r\n\t\tl_value = array[left_index]\r\n\t\tr_value = array[right_index]\r\n\t\tif(l_value > testValue and r_value < testValue)\t\r\n\t\t\t# Swap\r\n\t\t\ttemp = array[left_index]\r\n\t\t\tarray[left_index] = array[right_index]\r\n\t\t\tarray[right_index] = temp\r\n\t\tend\r\n\r\n\t\t#Move left_index forward\r\n\t\twhile(array[left_index]<testValue)\r\n\t\t\tleft_index = left_index+1\r\n\t\tend\r\n\r\n\t\t#Move right_index back\r\n\t\twhile(array[right_index]>testValue)\r\n\t\t\tright_index = right_index-1\r\n\t\tend\r\n\tend\r\n\r\n\t#returns the point where the test value divides the array\r\n\tif(array[left_index]>testValue)\r\n\t\tleft_index -= 1\r\n\tend\r\n\treturn left_index, array\r\nend",
"def mod_half_even(arr, k)\n mod_half_even = 0\n mod_half_even = arr.delete_at(k / 2 - 1) if k.even?\n mod_half_even = 1 if mod_half_even.positive?\n mod_half_even\nend",
"def quicksort!(left_index, right_index)\r\n # Base case: the subarray has 0 or 1 elements:\r\n if right_index - left_index <= 0\r\n return\r\n end\r\n\r\n # Partition the range of elements and grab the index of the pivot:\r\n pivot_index = partition!(left_index, right_index)\r\n\r\n # Recursively call this quicksort! method on whatever \r\n # is to the left of the pivot:\r\n quicksort!(left_index, pivot_index - 1)\r\n\r\n # Recursively call this quicksort! method on whatever \r\n # is to the right of the pivot:\r\n quicksort!(pivot_index + 1, right_index)\r\nend",
"def binary_serach_all_zero_col(left, right)\n mid_index = left + (right - left) / 2\n all_zeros = true\n\n if right < left\n right = left\n end\n\n if left > right\n left = right\n end\n\n if left == right\n mid_index = left\n end\n\n if @not_all_zero_col_index[mid_index]\n all_zeros = false\n else\n unless @all_zero_col_index[mid_index]\n lower, upper = get_optimized_row_bounds\n\n (lower..upper).each do |i|\n cell = @matrix[i][mid_index]\n\n if cell != 0\n all_zeros = false\n @not_all_zero_row_index[i] = true\n @not_all_zero_col_index[mid_index] = true\n @number_of_cell_visited += 1\n break\n end\n\n @number_of_cell_visited += 1\n end\n\n @all_zero_col_index[mid_index] = true\n end\n end\n\n if all_zeros\n return mid_index\n elsif left == right\n return nil\n else\n new_left = mid_index + 1\n new_right = right\n result = binary_serach_all_zero_col(new_left, new_right)\n return result if result\n\n new_left = left\n new_right = mid_index - 1\n return binary_serach_all_zero_col(new_left, new_right)\n end\n end",
"def quicksort(list, left, right)\n # Checks if the left array item is bigger than the right array item\n if left < right\n # Sends the items for inspection and splitting them up in 2 arrays\n switch = partition(list, left, right)\n # Recursive function to make sure it does all the elements\n quicksort(list, left, switch-1)\n quicksort(list, switch+1, right)\n end\nend",
"def divisible_by(numbers, divisor)\n arr = []\n numbers.each do |x|\n if (x % divisor) == 0\n x >> arr\n end\n end \n return arr\nend",
"def divisor_game(n)\n n%2==0\nend",
"def splitNumberifOdd(val)\n\tresArr = []\n\tx = 0\n\twhile(val >= 1)\n\t\tx = val % 10\n\t\tif(x % 2 == 0)\n\t\t\treturn false\n\t\tend\n\t\tresArr.push(x)\n\t\tval = val / 10\n\tend\n\tresArr\nend",
"def n_mod_m x, y\n\tif x < y \n\t\treturn x\n\tend\n\tuntil x < y do\n\t\tx = x - y \n\tend\n\tx\nend",
"def div_h_p_r2(a,b)\n p = 0\n\n @bits.times do\n # (i) shift combined pa register left one bit\n pa = ((p<<@bits)|a)<<1\n # (ii) p=p-b\n a = pa & @mA\n p = signed((pa & @mP) >> @bits)\n x = p - b\n if (x >= 0)\n # (iii) if p >= 0\n p = x\n a |= 1\n end\n end\n [lo(a),lo(p)]\n end",
"def divisible_by number, divisor\n number % divisor == 0\n end",
"def partition_method(list)\n #names of both arrays....\n #partition method is called on list\n #block if number is positive it goes in positive array\n #else it goes to negative array\n positive, negative = list.partition { |number| number.positive?}\n #call length of positive array and sum of negative array\n [positive.length, negative.sum]\nend",
"def Division(num1,num2)\n\n arr_1 = []\n arr_2 = []\n \n (1..num1).each do |val_1|\n if num1 % val_1 == 0 \n arr_1 << val_1\n end\n end\n \n (1..num2).each do |val_2|\n if num2 % val_2 == 0 \n arr_2 << val_2\n end\n end\n \n \n \n # code goes here\n return (arr_2 & arr_1).last \n \nend",
"def divides?(a,b)\n return b%a == 0\nend",
"def even_odd_half_of(splits)\n odd = splits.select.with_index{|_,i| (i+1) % 2 == 1}\n even = splits.select.with_index{|_,i| (i+1) % 2 == 0}\n # necessary to reverse order of 2nd half\n # otherwise someone would have to manually reverse\n # all the printed pages after having printed\n # the first half of the document.\n even.reverse!\n [odd, even]\n end",
"def mod\n x, y = stack.pop(2)\n push x % y\n end",
"def quick_sort(array, &prc)\n return array if array.length <= 1\n prc ||= Proc.new { |el1, el2| el1 - el2 }\n\n part_idx = array.length / 2\n part_val = array[part_idx]\n\n left = []\n right = []\n\n array.each_with_index do |el, idx|\n next if idx == part_idx\n prc.call(el, part_val) <= 0 ? left << el : right << el\n end\n\n quick_sort(left, &prc) + [part_val] + quick_sort(right, &prc)\nend",
"def partition(arr, left, right)\r\n pivot = arr[right]['id']\r\n brk_pt = left\r\n\r\n (left..right-1).each do |i|\r\n if arr[i]['id'] < pivot\r\n arr[i], arr[brk_pt] = arr[brk_pt], arr[i]\r\n brk_pt = brk_pt + 1\r\n end\r\n end\r\n\r\n arr[brk_pt], arr[right] = arr[right], arr[brk_pt]\r\n return brk_pt\r\nend",
"def fold_mid_into_right\n @right.shift_right\n @right.type, @right.value1, @right.left = 3, @value2, @mid.left\n @type, @mid, @value2, @right = 2, @right, nil, nil\n end",
"def divisible_by(numbers, divisor)\n numbers.find_all { |i| (i % divisor).zero? }\nend",
"def is_odd?(integer)\n integer.abs.remainder\nend",
"def modulo(other)\n self % other\n end",
"def each_preorder(proc)\n proc.call(@value1)\n proc.call(@value2) if @type == 3\n @left.each_preorder(proc) if @left\n @mid.each_preorder(proc) if @mid\n @right.each_preorder(proc) if @type == 3 && @right\n end",
"def divide(ary)\n left = ary.take(ary.count/2)\n right = ary - left\n if left.count > 1\n divide(left)\n divide(right) \n end\n\n if left.count == 1\n @final_ary.push(left)\n end\n\n if right.count == 1\n @final_ary.push(right)\n end\n\n if @final_ary.count == ary.count * 2\n merge(@final_ary, 0)\n p @final_ary\n end\n\n end",
"def divisible_by(numbers, divisor)\n numbers.select { |num| num % divisor == 0 }\nend",
"def sortById(arr, left, right)\r\n if left < right\r\n \r\n pi = partition(arr, left, right)\r\n sortById(arr, left, pi - 1)\r\n sortById(arr, pi + 1, right)\r\n end\r\n\r\n return arr\r\nend",
"def is_odd_remainder?(num)\n num.abs.remainder(2) == 1\n # x.remainder(y) means x-y*(x/y).truncate.\nend",
"def is_odd(x)\n # Use the logical results provided to you by Ruby already..\n x % 2 != 0\nend",
"def binary_search_internal(value)\n return [false, 0] if @inner.size == 0\n left = 0\n right = @inner.size - 1\n return [false, 0] if value < @inner[left]\n return [false, right + 1] if value > @inner[right]\n while left <= right\n middle = (left + right) / 2\n if @inner[middle] == value\n return [true, middle]\n elsif value < @inner[middle]\n right = middle - 1\n else\n left = middle + 1\n end\n end\n return [false, left]\n end"
] | [
"0.6903475",
"0.61425763",
"0.5961565",
"0.5954488",
"0.5931534",
"0.5870276",
"0.5863014",
"0.58573604",
"0.57634336",
"0.570229",
"0.5677765",
"0.562439",
"0.5543262",
"0.5473078",
"0.5472757",
"0.5459017",
"0.5433321",
"0.54316014",
"0.5429458",
"0.53976506",
"0.53886014",
"0.53737384",
"0.5369264",
"0.5366528",
"0.53651613",
"0.53444177",
"0.5340952",
"0.53351724",
"0.5324873",
"0.532246",
"0.53189325",
"0.53042305",
"0.5275027",
"0.52699155",
"0.525936",
"0.52501404",
"0.52472544",
"0.5228856",
"0.5225108",
"0.5224591",
"0.5197489",
"0.51969564",
"0.519347",
"0.51917297",
"0.5166937",
"0.5153482",
"0.51497406",
"0.5146026",
"0.51356137",
"0.5132031",
"0.51312965",
"0.51303303",
"0.512853",
"0.5127293",
"0.51271445",
"0.51244414",
"0.5098978",
"0.5096534",
"0.5074607",
"0.50729185",
"0.507127",
"0.507105",
"0.50621265",
"0.5040842",
"0.50346655",
"0.50259715",
"0.5024748",
"0.50178784",
"0.50139415",
"0.50082046",
"0.50079507",
"0.50052583",
"0.4989818",
"0.49828455",
"0.498022",
"0.49790722",
"0.49674097",
"0.49598232",
"0.49581593",
"0.49576223",
"0.49535078",
"0.49529716",
"0.49450457",
"0.4942984",
"0.49399108",
"0.49389184",
"0.49355823",
"0.49355227",
"0.49270892",
"0.4925294",
"0.49244636",
"0.49238974",
"0.49230802",
"0.4921525",
"0.49206704",
"0.49156946",
"0.49097934",
"0.49092984",
"0.49092856",
"0.49088046"
] | 0.7962595 | 0 |
Partition the unary function up into the left and right predicates | def partition_unary(function)
operand = function.operand
@left &= function if @left_header.include?(operand)
@right &= function if @right_header.include?(operand)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def partition_binary(function)\n operands = [function.left, function.right].grep(Axiom::Attribute)\n left_operands = @left_header & operands\n right_operands = @right_header & operands\n\n if (left_operands - right_operands).empty? || (right_operands - left_operands).empty?\n @left &= function if left_operands.any?\n @right &= function if right_operands.any?\n else\n @remainder &= function\n end\n end",
"def partition(predicate)\n each_operand(predicate) do |operand|\n case operand\n when Axiom::Function::Binary then partition_binary(operand)\n when Axiom::Function::Unary then partition_unary(operand)\n when Axiom::Attribute::Boolean then partition_attribute(operand)\n else\n partition_proposition(operand)\n end\n end\n end",
"def unary\r\n if consume(\"+\")\r\n unary()\r\n elsif consume(\"-\")\r\n new_binary(ND_SUB, new_num(0), unary())\r\n else\r\n primary()\r\n end\r\nend",
"def each_preorder(proc)\n proc.call(@value1)\n proc.call(@value2) if @type == 3\n @left.each_preorder(proc) if @left\n @mid.each_preorder(proc) if @mid\n @right.each_preorder(proc) if @type == 3 && @right\n end",
"def eval_unary_operation(node, env, stack_trace)\n\n\tcase node.operator.value\n\twhen \"!\"\n\t\tvalue, _ = eval_node_under(node.right, env, stack_trace)\n\t\tcase value\n\t\tin Boolean\n\t\t\treturn Boolean.new(value.line, value.col, !value.value), env\n\t\telse\n\t\t\tthrow_error(\"UnaryOperator '#{node.operator.value}' not implemented for: #{value.type}.\", node, stack_trace) \n\t\t\treturn nil, env\n\t\tend\n\twhen \"-\"\n\t\tvalue, _ = eval_node_under(node.right, env, stack_trace)\n\t\tcase value\n\t\tin Term\n\t\t\treturn flip_sign_on_term(value), env\n\t\tin TermList\n\t\t\treturn flip_sign_on_term_list(value), env\n\t\tin Fraction\n\t\t\treturn flip_sign_on_fraction(value), env\n\t\tin Matrix\n\t\t\treturn multiply_matrix_and_term(value, Term.new(-1,-1, magnitude: -1))\n\t\telse\n\t\t\tthrow_error(\"UnaryOperator '#{node.operator.value}' not implemented for: #{value.type}.\", node, stack_trace) \n\t\t\treturn nil, env\n\t\tend\n\twhen \"~\"\n\t\tvalue, _ = eval_node_under(node.right, env, stack_trace)\n\t\tcase value\n\t\tin Matrix\n\t\t\treturn transpose_of_matrix(value), env\n\t\telse\n\t\t\tthrow_error(\"UnaryOperator '#{node.operator.value}' not implemented for: #{value.type}.\", node, stack_trace) \n\t\t\treturn nil, env\n\t\tend\n\telse\n\t\tthrow_error(\"UnaryOperator '#{node.operator.value}' is not implemented.\", node, stack_trace)\n\tend\n\nend",
"def predecessor_ops(item_id, row = nil, col = nil, ignore_ids = [])\n ops = output_fvs(item_id, row, col).map(&:operation)\n ops.reject { |op| ignore_ids.include?(op.id) }\n end",
"def left_tri(tri)\n\nend",
"def flatten_predicates(pred)\n return pred unless pred.is_a? Array\n\n pred = [ pred[0] ] + pred[1 .. -1].map { |x| flatten_predicates(x) }\n\n op = pred[0]\n return pred unless op.is_a? String\n\n return flatten_predicates(pred[1]) if pred.length == 2\n\n rest = pred[1 .. -1]\n\n if rest.any? { |x| x[0] == op } &&\n rest.all? { |x| x[0] == op || x[0] == :field } then\n\n newlist = pred[1 .. -1].map { |x| x[0] == :field ? [x] : x[1 .. -1] } \\\n .inject([]) { |full,p| full + p }\n return flatten_predicates([ op ] + newlist)\n end\n pred.find_all { |x| !x.is_a?(Array) || x.length > 1 }\nend",
"def partition\n PredicatePartition.new(predicate, operand.left.header, operand.right.header)\n end",
"def fold_left_into_mid\n @mid.shift_right\n @mid.type, @mid.value1, @mid.left = 3, @value1, @left.left\n shift_left\n @type = 2\n end",
"def left_restriction\n operand.left.restrict(partition.left)\n end",
"def visit_unary_node(node)\n visit(node.value) unless node.terminal?\n end",
"def op_unfold\n pop.each do |elm|\n push elm\n end\n end",
"def g_(acc,elt)\n elt/acc\nend",
"def partition_proposition(proposition)\n @remainder &= proposition\n @left &= proposition\n @right &= proposition\n end",
"def partition_array(array,x,left=0,right=(array.length-1))\n # end condition: when the markers pass each other\n # we're done, so then return the array \n if right < left\n return array\n end\n\n # when the left value is wrong\n wrong_left = array[left] > x\n # when the right value is wrong\n wrong_right = array[right] < x\n \n #if both are wrong, swap the pair\n if wrong_left && wrong_right\n array[left], array[right] = array[right], array[left]\n left = left + 1\n right = right - 1\n partition_array(array,x,left,right)\n #else if only the left is wrong, increment just the right\n elsif wrong_left\n right = right - 1\n partition_array(array,x,left,right)\n #else if the only the right is wrong, increment the left\n elsif wrong_right\n left = left + 1\n partition_array(array,x,left,right)\n end\n\n #return the array\n return array\nend",
"def interpret_unary_operator(unary_op)\n case unary_op.operator\n when :'-'\n -(interpret_node(unary_op.operand))\n else # :'!'\n !(interpret_node(unary_op.operand))\n end\n end",
"def optimize_left\n Function.optimize_operand(operation.left)\n end",
"def merge(left, right, &predicate)\n result = []\n while !left.empty? && !right.empty?\n if predicate.call(left.first, right.first) <= 0\n result << left.shift\n else\n result << right.shift\n end\n end\n result.concat left.empty? ? right : left\nend",
"def sh4LowerShiftOps(list)\n newList = []\n list.each {\n | node |\n if node.is_a? Instruction\n case node.opcode\n when \"ulshifti\", \"ulshiftp\", \"urshifti\", \"urshiftp\", \"lshifti\", \"lshiftp\", \"rshifti\", \"rshiftp\"\n if node.opcode[0, 1] == \"u\"\n type = \"l\"\n direction = node.opcode[1, 1]\n else\n type = \"a\"\n direction = node.opcode[0, 1]\n end\n if node.operands[0].is_a? Immediate\n maskedImm = Immediate.new(node.operands[0].codeOrigin, node.operands[0].value & 31)\n if maskedImm.value == 0\n # There is nothing to do here.\n elsif maskedImm.value == 1 or (type == \"l\" and [2, 8, 16].include? maskedImm.value)\n newList << Instruction.new(node.codeOrigin, \"sh#{type}#{direction}x\", [maskedImm, node.operands[1]])\n else\n tmp = Tmp.new(node.codeOrigin, :gpr)\n if direction == \"l\"\n newList << Instruction.new(node.codeOrigin, \"move\", [maskedImm, tmp])\n else\n newList << Instruction.new(node.codeOrigin, \"move\", [Immediate.new(node.operands[0].codeOrigin, -1 * maskedImm.value), tmp])\n end\n newList << Instruction.new(node.codeOrigin, \"sh#{type}d\", [tmp, node.operands[1]])\n end\n else\n tmp = Tmp.new(node.codeOrigin, :gpr)\n newList << Instruction.new(node.codeOrigin, \"move\", [Immediate.new(node.operands[0].codeOrigin, 31), tmp])\n newList << Instruction.new(node.codeOrigin, \"andi\", [node.operands[0], tmp])\n if direction == \"r\"\n newList << Instruction.new(node.codeOrigin, \"negi\", [tmp, tmp])\n end\n newList << Instruction.new(node.codeOrigin, \"sh#{type}d\", [tmp, node.operands[1]])\n end\n else\n newList << node\n end\n else\n newList << node\n end\n }\n newList\nend",
"def /\n a = pop\n b = pop\n push b / a\n end",
"def g(acc,elt)\n acc/elt\nend",
"def unary\n if match?(:bang, :minus)\n operator = previous\n right = unary\n return Ringo::Unary.new(operator, right)\n end\n\n return call\n end",
"def accept(evaluator)\n evaluator.unary(self)\n end",
"def partition(array, left, right)\n pivot = right\n right -= 1\n puts \"left: #{left}, right: #{right}\"\n while true do\n while array[left] <= array[pivot] && left < pivot do\n left += 1\n end\n\n while array[right] > array[pivot] do\n right -= 1\n end\n\n\n\n if left >= right\n temp = array[left]\n array[left] = array[pivot]\n array[pivot] = temp\n break\n else\n temp = array[left]\n array[left] = array[right]\n array[right] = temp\n end\n end\n\n\n left\nend",
"def partition(list, left, right)\n pivot = list[right]\n previous_left = left-1\n left.upto(right-1) { |value|\n previous_left = previous_left + 1 if list[value] <= pivot\n list[previous_left], list[value] = list[value], list[previous_left] if list[value] <= pivot\n }\n list[previous_left+1], list[right] = list[right], list[previous_left+1]\n return previous_left + 1\nend",
"def elementwise_op(op,left_val,right_val)\n\n end",
"def ops(node)\n if node.left.nil? || node.right.nil?\n return 1 if /[\\+\\-\\*\\%\\/\\.]/.match(node.value)\n else\n return (ops(node.left) + ops(node.right))\n end\nend",
"def partition(array)\n # write your code here\n\n left = []\n right = []\n pivot = array.shift\n array.each do |int|\n if int <= pivot\n left << int\n else\n right << int\n end\n end\n\n left << pivot\n left + right\nend",
"def right_to_left\n @buckets[0] = @buckets[0] + @buckets[1]\n @buckets[1] = if @buckets[0] > @first\n @buckets[0] - @first\n else\n @buckets[1] = 0\n end\n @buckets[0] = @first if @buckets[0] > @first\n @path.push([@buckets[0], @buckets[1]])\n end",
"def partition1(arr, left, right)\n pele = arr[left]\n pindex = right\n i = right\n while(i > left)\n if(arr[i] > pele)\n arr[i], arr[pindex] = arr[pindex], arr[i]\n pindex -= 1\n end\n i -= 1\n end\n arr[left], arr[pindex] = arr[pindex], arr[left]\n pindex\nend",
"def functionalise(a)\n\n a.map do |x|\n\n if x =~ /\\w+\\[/ then\n epath, predicate = x.match(/^([^\\[]+)\\[([^\\]]+)\\]/).captures\n epath.split('/').map {|e| [:select, e]} + [:predicate, predicate]\n elsif x =~ /\\|/\n [:union] \n elsif x =~ /\\w+\\(/\n [x.chop.to_sym]\n elsif x =~ /\\d+/\n [:index, x[1..-2]]\n elsif x =~ /[\\w\\/]+/\n x.split('/').map {|e| [:select, e]}\n elsif x.is_a? Array\n functionalise(x)\n end\n \n end\n\n end",
"def divide_and_conquer(instructions, lower, upper)\n range = upper - lower\n instruction = instructions[0]\n tail = instructions[1..-1]\n\n case instruction\n when 'F', 'L'\n\n upper -= ((range + 1) / 2)\n return lower if tail.empty?\n when 'B', 'R'\n\n lower += ((range + 1) / 2)\n return upper if tail.empty?\n end\n\n divide_and_conquer(tail, lower, upper)\n end",
"def initialize(predicate, left_header, right_header)\n @left = @right = @remainder = TAUTOLOGY\n\n @left_header = left_header\n @right_header = right_header\n\n partition(predicate)\n end",
"def unionXWithFunction_PiecewiseLinear(iOtherFunction)\n lPoints = @Function[:Points]\n lOtherPoints = iOtherFunction.function_data[:Points]\n # Get all the abscisses sorted\n lXList = (lPoints.map { |iPoint| next iPoint[0] } + lOtherPoints.map { |iPoint| next iPoint[0] }).sort.uniq\n # Read segments abscisse by abscisse\n lIdxSegment = 0\n lIdxOtherSegment = 0\n lXList.each do |iX|\n if (lPoints[lIdxSegment] == nil)\n # No abscisse on lPoints for this iX\n # Forcefully we have lOtherPoints[lIdxOtherSegment][0] == iX\n yield(iX, nil, lOtherPoints[lIdxOtherSegment][1])\n lIdxOtherSegment += 1\n elsif (lOtherPoints[lIdxOtherSegment] == nil)\n # No abscisse on lOtherPoints for this iX\n # Forcefully we have lPoints[lIdxSegment][0] == iX\n yield(iX, lPoints[lIdxSegment][1], nil)\n lIdxSegment += 1\n elsif (lPoints[lIdxSegment][0] == iX)\n # lPoints has this abscisse\n if (lOtherPoints[lIdxOtherSegment][0] == iX)\n # If both functions have a point here, it's easy.\n yield(iX, lPoints[lIdxSegment][1], lOtherPoints[lIdxOtherSegment][1])\n lIdxOtherSegment += 1\n else\n # Compute the Y value for the other function\n yield(iX, lPoints[lIdxSegment][1], lOtherPoints[lIdxOtherSegment-1][1] + ((lOtherPoints[lIdxOtherSegment][1] - lOtherPoints[lIdxOtherSegment-1][1])*(iX - lOtherPoints[lIdxOtherSegment-1][0]))/(lOtherPoints[lIdxOtherSegment][0] - lOtherPoints[lIdxOtherSegment-1][0]))\n end\n lIdxSegment += 1\n else\n # We have forcefully lOtherPoints[lIdxOtherSegment][0] == iX\n # Compute the Y value for this function\n yield(iX, lPoints[lIdxSegment-1][1] + ((lPoints[lIdxSegment][1] - lPoints[lIdxSegment-1][1])*(iX - lPoints[lIdxSegment-1][0]))/(lPoints[lIdxSegment][0] - lPoints[lIdxSegment-1][0]), lOtherPoints[lIdxOtherSegment][1])\n lIdxOtherSegment += 1\n end\n end\n end",
"def foldl(left, &block)\n self.each { |elt| left = block.call(left, elt) }\n left\n end",
"def left(i); 2*i+1; end",
"def left_eliminate!\n # inv = Algebra.SquareMatrix(ground, rsize).unity\n k = ground.unity\n pi = 0\n each_j do |j|\n next unless i = (pi...rsize).find { |i1| !self[i1, j].zero? }\n if i != pi\n swap_r!(pi, i) # ; inv.swap_r!(pi, i)\n k = -k\n end\n c = ground.unity / self[pi, j] # this lets the entries be in ground\n multiply_r!(pi, c) # ; inv.multiply_r!(pi, c)\n k *= c\n each_i do |i0|\n next if i0 == pi\n d = self[i0, j] # / self[pi, j]\n mix_r!(i0, pi, -d) # ; inv.mix_r!(i0, pi, -d)\n end\n pi += 1\n end\n [left, k]\n end",
"def each_inorder(proc)\n @left.each_inorder(proc) if @left\n proc.call(@value1)\n @mid.each_inorder(proc) if @mid\n if @type == 3\n proc.call(@value2)\n @right.each_inorder(proc) if @right\n end\n end",
"def partial_eval\n item = nil\n loop do\n item = @iterator.next\n break unless item\n @stack << item\n if ['+', '-', '*', '/'].include?(item.to_s)\n left, right, op = @stack.pop(3)\n result = left.send(op, right)\n @stack << result\n return result\n end\n end\n end",
"def parse_unary\n if consume(:bang)\n Node.new(:unary, op: :not, lhs: parse_unary)\n elsif consume(:plus)\n Node.new(:unary, op: :plus, lhs: parse_term)\n elsif consume(:minus)\n Node.new(:unary, op: :minus, lhs: parse_term)\n else\n parse_term\n end\n end",
"def quickSortHelper(ia, left, h)\n if (left < h)\n p = partition(ia, left, h) #get partition index of the array\n quickSortHelper(ia, left, p - 1) #sort from low to partition index -1\n quickSortHelper(ia, p + 1, h) #sort from p + 1 to high\n end\nend",
"def right_tri(tri)\n\nend",
"def left_optimizable?\n !left.equal?(operation.left)\n end",
"def shift_out_left\n # This is functionally equivalent to reverse_shift_out\n reverse_each { |bit| yield bit }\n end",
"def fold_left(state)\n new_state = []\n state.row_vectors.each_index {|i|\n values = state.row_vectors[i].to_a\n values = @line_folder.fold(values)\n new_state << values\n }\n Matrix.rows(new_state)\n end",
"def method_preOrder(node,myLambda)\n if node != nil\n myLambda.call(node)\n method_preOrder(node.getLeft,myLambda)\n method_preOrder(node.getRight,myLambda)\n end\n end",
"def partition_method(list)\n #names of both arrays....\n #partition method is called on list\n #block if number is positive it goes in positive array\n #else it goes to negative array\n positive, negative = list.partition { |number| number.positive?}\n #call length of positive array and sum of negative array\n [positive.length, negative.sum]\nend",
"def left(i)\n return 2*i\nend",
"def partition(arr, p, r, ord)\n\t# for empty array\n\treturn [] if r < 0\n\tx = arr[r]\n\ti = p - 1\n\tj = p\n\tfor j in p..r-1\n\t\t# USE OF LAMBDA FROM ABOVE\n\t\tif ord.call(arr[j], x)\n\t\t\ti += 1\n\t\t\ttemp = arr[i]\n\t\t\tarr[i] = arr[j]\n\t\t\tarr[j] = temp\n\t\tend\n\tend\n\ttemp = arr[i+1]\n\tarr[i+1] = arr[r]\n\tarr[r] = temp\n\treturn i + 1\nend",
"def partition(linked_list, x)\n left_partition = LinkedList.new\n right_partition = LinkedList.new\n\n current_node = linked_list.head.next\n\n until current_node == linked_list.tail\n if current_node.value < x\n next_node = current_node.next\n linked_list.delete(current_node)\n left_partition.append(current_node)\n else\n next_node = current_node.next\n linked_list.delete(current_node)\n right_partition.append(current_node)\n end\n\n current_node = next_node\n end\n\n right_head = right_partition.head.next\n left_tail = left_partition.tail.prev\n\n left_tail.next = right_head\n right_head.prev = left_tail\n\n left_partition\nend",
"def evaluate_operator(left, right)\n left < right\n end",
"def stray(numbers)\n numbers.reduce(&:^)\nend",
"def preorder(node)\n visit node \n left = preorder node.left_node if node.left_node \n right = preorder node.right_node if node.right_node\n p left ? left.value : nil \n p right ? right.value : nil\n p node.value\n puts '----'\n node\n end",
"def xnor_select(arr, proc_1, proc_2)\n new_arr = []\n arr.each do |ele|\n new_arr << ele if ( proc_1.call(ele) && proc_2.call(ele) ) || ( !proc_1.call(ele) && !proc_2.call(ele) )\n end\n new_arr\nend",
"def self_dividing_numbers(left, right)\n ans = []\n for i in left..right do \n if is_self_divided(i)\n ans << i\n end\n end\n ans\nend",
"def unary\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 25 )\n\n\n value = nil\n\n\n type = nil\n a = nil\n\n\n begin\n # at line 161:3: (type= ( '+' | '-' ) a= unary |a= negation )\n alt_41 = 2\n look_41_0 = @input.peek( 1 )\n\n if ( look_41_0 == T__38 || look_41_0 == T__41 )\n alt_41 = 1\n elsif ( look_41_0.between?( BOOLEAN, CHAR ) || look_41_0.between?( FLOAT, IDENT ) || look_41_0 == INTEGER || look_41_0 == STRING || look_41_0 == T__30 || look_41_0 == T__34 )\n alt_41 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n\n\n raise NoViableAlternative( \"\", 41, 0 )\n\n end\n case alt_41\n when 1\n # at line 161:5: type= ( '+' | '-' ) a= unary\n type = @input.look\n\n if @input.peek(1) == T__38 || @input.peek(1) == T__41\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 @state.following.push( TOKENS_FOLLOWING_unary_IN_unary_1189 )\n a = unary\n @state.following.pop\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n value = SingleOperandExpressionEval.new(type.text, a) \n # <-- action\n end\n\n\n when 2\n # at line 162:5: a= negation\n @state.following.push( TOKENS_FOLLOWING_negation_IN_unary_1199 )\n a = negation\n @state.following.pop\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n value=a \n # <-- action\n end\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__, 25 )\n\n\n end\n\n return value\n end",
"def tr!(p0, p1) end",
"def pre_order_traversal_aux(current_node)\n @accumulator << current_node.data\n pre_order_traversal_aux(current_node.left_child) unless current_node.left_child.nil?\n pre_order_traversal_aux(current_node.right_child) unless current_node.right_child.nil?\n end",
"def from_left; end",
"def from_left; end",
"def functional_interactions\n (1..9).to_a.inject(FunctionalNoOp) { |interaction, _| interaction | FunctionalNoOp }\nend",
"def quick_sort(array, &prc)\n return array if array.length <= 1\n prc ||= Proc.new { |el1, el2| el1 - el2 }\n\n part_idx = array.length / 2\n part_val = array[part_idx]\n\n left = []\n right = []\n\n array.each_with_index do |el, idx|\n next if idx == part_idx\n prc.call(el, part_val) <= 0 ? left << el : right << el\n end\n\n quick_sort(left, &prc) + [part_val] + quick_sort(right, &prc)\nend",
"def preorder_iterative(&block)\n stack = []\n\n stack.push(@root)\n until stack.empty?\n node = stack.pop\n yield node\n\n stack.push(node.right) if node.right\n stack.push(node.left) if node.left\n end\n end",
"def evaluate_operator(left, right)\n left <= right\n end",
"def fold_mid_into_right\n @right.shift_right\n @right.type, @right.value1, @right.left = 3, @value2, @mid.left\n @type, @mid, @value2, @right = 2, @right, nil, nil\n end",
"def predecessors\n return @predecessors if @predecessors\n @predecessors = (data['predecessors']||[]).map { |s| function.blocks.by_name(s) }.uniq.freeze\n end",
"def remove_preceding(node_or_range, size); end",
"def my_quick_sort(&prc)\n prc ||= Proc.new{|a,b| a <=> b}\n return self if self.length <= 1\n mdix = self.length()/2\n left = []\n right = []\n # debugger\n self.each_with_index do |item, idx|\n case prc.call(item,self[mdix])\n when -1 #a smaller\n left << item\n when 0\n left << item if idx != mdix\n when 1\n right << item\n end\n end\n # debugger\n left.my_quick_sort(&prc) + [self[mdix]] + right.my_quick_sort(&prc)\n end",
"def partition(list, left, right, pivotIndex)\n pivotValue = list[pivotIndex]\n list[pivotIndex], list[right] = list[right], list[pivotIndex]\n storeIndex = left\n for i in (left...right) do\n if list[i] < pivotValue\n list[storeIndex], list[i] = list[i], list[storeIndex]\n storeIndex += 1\n end\n end\n list[right], list[storeIndex] = list[storeIndex], list[right]\n storeIndex\nend",
"def fold f,g\n case self\n when Left then f.(get)\n when Right then g.(get)\n end\n end",
"def quicksort!(left_index, right_index)\r\n # Base case: the subarray has 0 or 1 elements:\r\n if right_index - left_index <= 0\r\n return\r\n end\r\n\r\n # Partition the range of elements and grab the index of the pivot:\r\n pivot_index = partition!(left_index, right_index)\r\n\r\n # Recursively call this quicksort! method on whatever \r\n # is to the left of the pivot:\r\n quicksort!(left_index, pivot_index - 1)\r\n\r\n # Recursively call this quicksort! method on whatever \r\n # is to the right of the pivot:\r\n quicksort!(pivot_index + 1, right_index)\r\nend",
"def preorder(&block)\n yield item\n @left_subtree.preorder(&block) if @left_subtree != nil\n @right_subtree.preorder(&block) if @right_subtree != nil\n end",
"def unary\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 60 )\n return_value = UnaryReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n string_literal272 = nil\n string_literal274 = nil\n string_literal276 = nil\n string_literal278 = nil\n string_literal280 = nil\n string_literal282 = nil\n string_literal284 = nil\n char_literal286 = nil\n char_literal288 = nil\n char_literal290 = nil\n char_literal292 = nil\n unary273 = nil\n unary275 = nil\n unary277 = nil\n unary279 = nil\n unary281 = nil\n unary283 = nil\n unary285 = nil\n unary287 = nil\n unary289 = nil\n unary291 = nil\n unary293 = nil\n postfix294 = nil\n\n tree_for_string_literal272 = nil\n tree_for_string_literal274 = nil\n tree_for_string_literal276 = nil\n tree_for_string_literal278 = nil\n tree_for_string_literal280 = nil\n tree_for_string_literal282 = nil\n tree_for_string_literal284 = nil\n tree_for_char_literal286 = nil\n tree_for_char_literal288 = nil\n tree_for_char_literal290 = nil\n tree_for_char_literal292 = nil\n stream_DECR = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token DECR\" )\n stream_PLUS = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token PLUS\" )\n stream_IS_DEFINED = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token IS_DEFINED\" )\n stream_VOID = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token VOID\" )\n stream_DELETE = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token DELETE\" )\n stream_NOT = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token NOT\" )\n stream_MINUS = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token MINUS\" )\n stream_INCR = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token INCR\" )\n stream_TYPEOF = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token TYPEOF\" )\n stream_IS_UNDEFINED = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token IS_UNDEFINED\" )\n stream_TILDE = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token TILDE\" )\n stream_unary = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule unary\" )\n stream_postfix = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule postfix\" )\n begin\n # at line 634:3: ( 'delete' unary -> ^( 'delete' unary ) | 'void' unary -> ^( 'void' unary ) | 'typeof' unary -> ^( 'typeof' unary ) | 'defined?' unary -> ^( 'defined?' unary ) | 'undefined?' unary -> ^( 'undefined?' unary ) | '++' unary -> ^( '++' unary ) | '--' unary -> ^( '--' unary ) | '+' unary -> ^( UPLUS[ '+' ] unary ) | '-' unary -> ^( UMINUS[ '-' ] unary ) | '~' unary -> ^( '~' unary ) | '!' unary -> ^( '!' unary ) | postfix -> postfix )\n alt_67 = 12\n alt_67 = @dfa67.predict( @input )\n case alt_67\n when 1\n # at line 634:5: 'delete' unary\n string_literal272 = match( DELETE, TOKENS_FOLLOWING_DELETE_IN_unary_4218 )\n if @state.backtracking == 0\n stream_DELETE.add( string_literal272 )\n end\n @state.following.push( TOKENS_FOLLOWING_unary_IN_unary_4224 )\n unary273 = unary\n @state.following.pop\n if @state.backtracking == 0\n stream_unary.add( unary273.tree )\n end\n # AST Rewrite\n # elements: unary, DELETE\n # token labels: \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_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 # 634:24: -> ^( 'delete' unary )\n # at line 634:27: ^( 'delete' unary )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( stream_DELETE.next_node, root_1 )\n\n @adaptor.add_child( root_1, stream_unary.next_tree )\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 # at line 635:5: 'void' unary\n string_literal274 = match( VOID, TOKENS_FOLLOWING_VOID_IN_unary_4240 )\n if @state.backtracking == 0\n stream_VOID.add( string_literal274 )\n end\n @state.following.push( TOKENS_FOLLOWING_unary_IN_unary_4248 )\n unary275 = unary\n @state.following.pop\n if @state.backtracking == 0\n stream_unary.add( unary275.tree )\n end\n # AST Rewrite\n # elements: VOID, unary\n # token labels: \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_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 # 635:24: -> ^( 'void' unary )\n # at line 635:27: ^( 'void' unary )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( stream_VOID.next_node, root_1 )\n\n @adaptor.add_child( root_1, stream_unary.next_tree )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\n when 3\n # at line 636:5: 'typeof' unary\n string_literal276 = match( TYPEOF, TOKENS_FOLLOWING_TYPEOF_IN_unary_4264 )\n if @state.backtracking == 0\n stream_TYPEOF.add( string_literal276 )\n end\n @state.following.push( TOKENS_FOLLOWING_unary_IN_unary_4270 )\n unary277 = unary\n @state.following.pop\n if @state.backtracking == 0\n stream_unary.add( unary277.tree )\n end\n # AST Rewrite\n # elements: unary, TYPEOF\n # token labels: \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_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 # 636:24: -> ^( 'typeof' unary )\n # at line 636:27: ^( 'typeof' unary )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( stream_TYPEOF.next_node, root_1 )\n\n @adaptor.add_child( root_1, stream_unary.next_tree )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\n when 4\n # at line 637:5: 'defined?' unary\n string_literal278 = match( IS_DEFINED, TOKENS_FOLLOWING_IS_DEFINED_IN_unary_4286 )\n if @state.backtracking == 0\n stream_IS_DEFINED.add( string_literal278 )\n end\n @state.following.push( TOKENS_FOLLOWING_unary_IN_unary_4290 )\n unary279 = unary\n @state.following.pop\n if @state.backtracking == 0\n stream_unary.add( unary279.tree )\n end\n # AST Rewrite\n # elements: unary, IS_DEFINED\n # token labels: \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_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 # 637:24: -> ^( 'defined?' unary )\n # at line 637:27: ^( 'defined?' unary )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( stream_IS_DEFINED.next_node, root_1 )\n\n @adaptor.add_child( root_1, stream_unary.next_tree )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\n when 5\n # at line 638:5: 'undefined?' unary\n string_literal280 = match( IS_UNDEFINED, TOKENS_FOLLOWING_IS_UNDEFINED_IN_unary_4306 )\n if @state.backtracking == 0\n stream_IS_UNDEFINED.add( string_literal280 )\n end\n @state.following.push( TOKENS_FOLLOWING_unary_IN_unary_4308 )\n unary281 = unary\n @state.following.pop\n if @state.backtracking == 0\n stream_unary.add( unary281.tree )\n end\n # AST Rewrite\n # elements: IS_UNDEFINED, unary\n # token labels: \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_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 # 638:24: -> ^( 'undefined?' unary )\n # at line 638:27: ^( 'undefined?' unary )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( stream_IS_UNDEFINED.next_node, root_1 )\n\n @adaptor.add_child( root_1, stream_unary.next_tree )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\n when 6\n # at line 639:5: '++' unary\n string_literal282 = match( INCR, TOKENS_FOLLOWING_INCR_IN_unary_4324 )\n if @state.backtracking == 0\n stream_INCR.add( string_literal282 )\n end\n @state.following.push( TOKENS_FOLLOWING_unary_IN_unary_4334 )\n unary283 = unary\n @state.following.pop\n if @state.backtracking == 0\n stream_unary.add( unary283.tree )\n end\n # AST Rewrite\n # elements: INCR, unary\n # token labels: \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_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 # 639:24: -> ^( '++' unary )\n # at line 639:27: ^( '++' unary )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( stream_INCR.next_node, root_1 )\n\n @adaptor.add_child( root_1, stream_unary.next_tree )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\n when 7\n # at line 640:5: '--' unary\n string_literal284 = match( DECR, TOKENS_FOLLOWING_DECR_IN_unary_4350 )\n if @state.backtracking == 0\n stream_DECR.add( string_literal284 )\n end\n @state.following.push( TOKENS_FOLLOWING_unary_IN_unary_4360 )\n unary285 = unary\n @state.following.pop\n if @state.backtracking == 0\n stream_unary.add( unary285.tree )\n end\n # AST Rewrite\n # elements: DECR, unary\n # token labels: \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_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 # 640:24: -> ^( '--' unary )\n # at line 640:27: ^( '--' unary )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( stream_DECR.next_node, root_1 )\n\n @adaptor.add_child( root_1, stream_unary.next_tree )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\n when 8\n # at line 641:5: '+' unary\n char_literal286 = match( PLUS, TOKENS_FOLLOWING_PLUS_IN_unary_4376 )\n if @state.backtracking == 0\n stream_PLUS.add( char_literal286 )\n end\n @state.following.push( TOKENS_FOLLOWING_unary_IN_unary_4387 )\n unary287 = unary\n @state.following.pop\n if @state.backtracking == 0\n stream_unary.add( unary287.tree )\n end\n # AST Rewrite\n # elements: unary\n # token labels: \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_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 # 641:24: -> ^( UPLUS[ '+' ] unary )\n # at line 641:27: ^( UPLUS[ '+' ] unary )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( @adaptor.create( UPLUS, '+' ), root_1 )\n\n @adaptor.add_child( root_1, stream_unary.next_tree )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\n when 9\n # at line 642:5: '-' unary\n char_literal288 = match( MINUS, TOKENS_FOLLOWING_MINUS_IN_unary_4404 )\n if @state.backtracking == 0\n stream_MINUS.add( char_literal288 )\n end\n @state.following.push( TOKENS_FOLLOWING_unary_IN_unary_4415 )\n unary289 = unary\n @state.following.pop\n if @state.backtracking == 0\n stream_unary.add( unary289.tree )\n end\n # AST Rewrite\n # elements: unary\n # token labels: \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_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 # 642:24: -> ^( UMINUS[ '-' ] unary )\n # at line 642:27: ^( UMINUS[ '-' ] unary )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( @adaptor.create( UMINUS, '-' ), root_1 )\n\n @adaptor.add_child( root_1, stream_unary.next_tree )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\n when 10\n # at line 643:5: '~' unary\n char_literal290 = match( TILDE, TOKENS_FOLLOWING_TILDE_IN_unary_4432 )\n if @state.backtracking == 0\n stream_TILDE.add( char_literal290 )\n end\n @state.following.push( TOKENS_FOLLOWING_unary_IN_unary_4443 )\n unary291 = unary\n @state.following.pop\n if @state.backtracking == 0\n stream_unary.add( unary291.tree )\n end\n # AST Rewrite\n # elements: TILDE, unary\n # token labels: \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_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 # 643:24: -> ^( '~' unary )\n # at line 643:27: ^( '~' unary )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( stream_TILDE.next_node, root_1 )\n\n @adaptor.add_child( root_1, stream_unary.next_tree )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\n when 11\n # at line 644:5: '!' unary\n char_literal292 = match( NOT, TOKENS_FOLLOWING_NOT_IN_unary_4459 )\n if @state.backtracking == 0\n stream_NOT.add( char_literal292 )\n end\n @state.following.push( TOKENS_FOLLOWING_unary_IN_unary_4470 )\n unary293 = unary\n @state.following.pop\n if @state.backtracking == 0\n stream_unary.add( unary293.tree )\n end\n # AST Rewrite\n # elements: unary, NOT\n # token labels: \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_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 # 644:24: -> ^( '!' unary )\n # at line 644:27: ^( '!' unary )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( stream_NOT.next_node, root_1 )\n\n @adaptor.add_child( root_1, stream_unary.next_tree )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\n when 12\n # at line 645:5: postfix\n @state.following.push( TOKENS_FOLLOWING_postfix_IN_unary_4486 )\n postfix294 = postfix\n @state.following.pop\n if @state.backtracking == 0\n stream_postfix.add( postfix294.tree )\n end\n # AST Rewrite\n # elements: postfix\n # token labels: \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_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 # 645:24: -> postfix\n @adaptor.add_child( root_0, stream_postfix.next_tree )\n\n\n\n return_value.tree = root_0\n\n end\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__, 60 )\n\n end\n \n return return_value\n end",
"def partition(array)\n # write your code here\n first = array[0]\n right = []\n left = []\n \n for i in 1..(array.length - 1)\n if first > array[i] \n left << array[i] \n else \n right << array[i]\n end\n end\n left + [first] + right\n \n end",
"def reduce\n _reduce = ->(acc, f, xs){\n xs == [] ? acc : _reduce.(f.(acc, xs[0]), f, xs[1..-1])\n }\n\n curry.(->(f, xs) {\n _reduce.(xs[0], f, xs[1..-1])\n })\n end",
"def quicksort(xs, &prc)\n return [] unless xs\n\n pivot = MaglevUndefined\n xs.each { |o| pivot = o; break }\n return xs if pivot._equal?( MaglevUndefined)\n\n lmr = xs.group_by do |o|\n if o._equal?(pivot)\n 0\n else\n yield(o, pivot)\n end\n end\n quicksort(lmr[-1], &prc) + lmr[0] + quicksort(lmr[1], &prc)\n end",
"def merge(left, right, &prc)\nmerged_array = []\nprc ||= Proc.new { |num1, num2| num1 <=> num2 }\nuntil left.empty? || right.empty?\n case prc.call(left.first, right.first)\n when -1\n merged_array << left.shift\n when 0\n merged_array << left.shift\n when 1\n merged_array << right.shift\n end\nend\n\nmerged_array + left + right\nend",
"def quick_sort (arr, left, right)\n arr_index = partition(arr, left, right)\n if left < arr_index - 1 # sort left half\n quick_sort(arr, left, arr_index - 1)\n end\n\n if arr_index < right # sort right half\n quick_sort(arr, arr_index, right)\n end\n\n # if left < arr_index && arr_index < right\n # puts \"arr: #{arr}\"\n # arr\n # end\n\nend",
"def reduce_term_1(_production, _range, _tokens, theChildren)\n reduce_binary_operator(theChildren)\n end",
"def each_operand(predicate, &block)\n case predicate\n when Axiom::Function::Connective::Disjunction then each_operand(predicate.inverse.optimize, &block)\n when Axiom::Function::Connective::Conjunction then each_conjunction(predicate, &block)\n else\n block.call(predicate)\n end\n end",
"def partition_if\r\n pass, fail = [], []\r\n each do |value|\r\n result = yield(value)\r\n if result then pass.push(value)\r\n else fail.push(value)\r\n end\r\n end\r\n return pass, fail\r\n end",
"def reduce_simple_expression_1(_production, _range, _tokens, theChildren)\n reduce_binary_operator(theChildren)\n end",
"def successor_ops(item_id, row = nil, col = nil, ignore_ids = [])\n ops = input_fvs(item_id, row, col).map(&:operation)\n ops.reject { |op| ignore_ids.include?(op.id) }\n end",
"def optimize\n left_restriction.send(relation_method, right_restriction).restrict(partition.remainder)\n end",
"def apply( nodes )\n nodes = nodes.to_a\n results = nodes\n difference = nodes\n until difference.empty?\n step_results = @selector.apply( difference )\n difference = step_results - results\n results.concat( difference )\n end\n \n return results.reverse\n end",
"def left; end",
"def left; end",
"def left; end",
"def _reduce_247(val, _values, result)\n result = @builder.binary_op(val[0], val[1], val[2])\n \n result\nend",
"def unary?\n ancestors.include?(Operator::Unary)\n end",
"def _reduce_57(val, _values, result)\n @lexer.cond.push(true)\n \n result\nend",
"def _reduce_57(val, _values, result)\n @lexer.cond.push(true)\n \n result\nend",
"def xnor_select(arr, prc1, prc2)\n new_arr = []\n arr.each do |ele|\n new_arr << ele if prc1.call(ele) && prc2.call(ele) \n new_arr << ele if !prc1.call(ele) && !prc2.call(ele)\n end\n new_arr\nend",
"def shift_out_left\n size.times do |i|\n yield(bit_at_position(size - i - 1), i)\n end\n end",
"def unshift(token); end",
"def take_before(node, source_part); end",
"def _reduce_263(val, _values, result)\n result = @builder.binary_op(val[0], val[1], val[2])\n \n result\nend",
"def succ!() end",
"def _reduce_53(val, _values, result)\n lhs, _, rhs = val\n result = logical_op :and, lhs, rhs\n\n result\nend"
] | [
"0.6483279",
"0.6085995",
"0.591588",
"0.5650922",
"0.5642326",
"0.5426558",
"0.5387498",
"0.538662",
"0.535344",
"0.5283616",
"0.5263046",
"0.52392644",
"0.5176646",
"0.51692957",
"0.50687015",
"0.505274",
"0.50509167",
"0.50322783",
"0.50206465",
"0.49924505",
"0.499143",
"0.49423262",
"0.49401847",
"0.49302676",
"0.4930004",
"0.4912173",
"0.49093968",
"0.49009177",
"0.48959094",
"0.4884942",
"0.48644182",
"0.48459795",
"0.48427996",
"0.47956115",
"0.47901124",
"0.4775199",
"0.47714582",
"0.47709152",
"0.4768882",
"0.47550827",
"0.47502422",
"0.47279477",
"0.4724759",
"0.4721079",
"0.47207355",
"0.4718357",
"0.4715711",
"0.47098607",
"0.47094512",
"0.4677244",
"0.46766773",
"0.46721464",
"0.4671292",
"0.4665471",
"0.4660928",
"0.4660349",
"0.46498278",
"0.46496782",
"0.46382338",
"0.4633131",
"0.4633131",
"0.46266535",
"0.46223667",
"0.46213087",
"0.46205142",
"0.4617488",
"0.46167427",
"0.4608704",
"0.46054918",
"0.4599643",
"0.45962095",
"0.4595973",
"0.4589777",
"0.45736948",
"0.45685604",
"0.4565396",
"0.45622486",
"0.45585343",
"0.4558357",
"0.4549543",
"0.45452565",
"0.45439738",
"0.45401615",
"0.45334992",
"0.4530581",
"0.4528262",
"0.45193776",
"0.45193776",
"0.45193776",
"0.45190278",
"0.45156717",
"0.45131028",
"0.45131028",
"0.4512615",
"0.45116374",
"0.45109415",
"0.45106435",
"0.45083123",
"0.45074612",
"0.45058554"
] | 0.7855663 | 0 |
Partition the attribute up into the left and right predicates | def partition_attribute(attribute)
@left &= attribute if @left_header.include?(attribute)
@right &= attribute if @right_header.include?(attribute)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def partition_binary(function)\n operands = [function.left, function.right].grep(Axiom::Attribute)\n left_operands = @left_header & operands\n right_operands = @right_header & operands\n\n if (left_operands - right_operands).empty? || (right_operands - left_operands).empty?\n @left &= function if left_operands.any?\n @right &= function if right_operands.any?\n else\n @remainder &= function\n end\n end",
"def partition(predicate)\n each_operand(predicate) do |operand|\n case operand\n when Axiom::Function::Binary then partition_binary(operand)\n when Axiom::Function::Unary then partition_unary(operand)\n when Axiom::Attribute::Boolean then partition_attribute(operand)\n else\n partition_proposition(operand)\n end\n end\n end",
"def attr_split\n expr.attr_split.each_pair.each_with_object({}) do |(k,v),h|\n h[k] = Predicate.new(v)\n end\n end",
"def partition_proposition(proposition)\n @remainder &= proposition\n @left &= proposition\n @right &= proposition\n end",
"def partition_unary(function)\n operand = function.operand\n @left &= function if @left_header.include?(operand)\n @right &= function if @right_header.include?(operand)\n end",
"def partition\n PredicatePartition.new(predicate, operand.left.header, operand.right.header)\n end",
"def filter_down element\n left_child_is_less_than_element = element.left && element.left.rating < element.rating\n right_child_is_less_than_element = element.right && element.right.rating < element.rating\n\n while left_child_is_less_than_element or right_child_is_less_than_element\n lower_rated_element = nil\n if left_child_is_less_than_element\n lower_rated_element = element.left\n elsif right_child_is_less_than_element\n lower_rated_element = element.right\n end\n element = swap_node_position(element, lower_rated_element)\n left_child_is_less_than_element = element.left && element.left.rating < element.rating\n right_child_is_less_than_element = element.right && element.right.rating < element.rating\n end\n end",
"def optimize\n left_restriction.send(relation_method, right_restriction).restrict(partition.remainder)\n end",
"def initialize(predicate, left_header, right_header)\n @left = @right = @remainder = TAUTOLOGY\n\n @left_header = left_header\n @right_header = right_header\n\n partition(predicate)\n end",
"def left_restriction\n operand.left.restrict(partition.left)\n end",
"def and_split(attr_list)\n expr.and_split(attr_list).map{|e| Predicate.new(e)}\n end",
"def partition_array(array,x,left=0,right=(array.length-1))\n # end condition: when the markers pass each other\n # we're done, so then return the array \n if right < left\n return array\n end\n\n # when the left value is wrong\n wrong_left = array[left] > x\n # when the right value is wrong\n wrong_right = array[right] < x\n \n #if both are wrong, swap the pair\n if wrong_left && wrong_right\n array[left], array[right] = array[right], array[left]\n left = left + 1\n right = right - 1\n partition_array(array,x,left,right)\n #else if only the left is wrong, increment just the right\n elsif wrong_left\n right = right - 1\n partition_array(array,x,left,right)\n #else if the only the right is wrong, increment the left\n elsif wrong_right\n left = left + 1\n partition_array(array,x,left,right)\n end\n\n #return the array\n return array\nend",
"def partition(arr, left, right)\r\n pivot = arr[right]['id']\r\n brk_pt = left\r\n\r\n (left..right-1).each do |i|\r\n if arr[i]['id'] < pivot\r\n arr[i], arr[brk_pt] = arr[brk_pt], arr[i]\r\n brk_pt = brk_pt + 1\r\n end\r\n end\r\n\r\n arr[brk_pt], arr[right] = arr[right], arr[brk_pt]\r\n return brk_pt\r\nend",
"def take_before(node, source_part); end",
"def each_preorder(proc)\n proc.call(@value1)\n proc.call(@value2) if @type == 3\n @left.each_preorder(proc) if @left\n @mid.each_preorder(proc) if @mid\n @right.each_preorder(proc) if @type == 3 && @right\n end",
"def self_and_descendants\n dataset.nested.filter((self.class.qualified_left_column >= left) & (self.class.qualified_right_column <= right))\n end",
"def filter_up(element)\n element_index = @tree.index(element)\n parent = element_index / 2\n element_is_greater_than_child = @tree[parent] && @tree[parent].rating > element.rating\n while element_is_greater_than_child\n swap_node_position(@tree[parent], element)\n parent = element_index / 2\n element_is_greater_than_child = @tree[parent] && @tree[parent].rating > element.rating\n end\n end",
"def right_to_left\n @buckets[0] = @buckets[0] + @buckets[1]\n @buckets[1] = if @buckets[0] > @first\n @buckets[0] - @first\n else\n @buckets[1] = 0\n end\n @buckets[0] = @first if @buckets[0] > @first\n @path.push([@buckets[0], @buckets[1]])\n end",
"def id3_perform(data, attributes, attribute)\n values = data.collect { |d| d[attributes.index(attribute)] }.uniq.sort\n partitions = values.collect { |val| data.select { |d| d[attributes.index(attribute)] == val } }\n remainder = partitions.collect {|p| (p.size.to_f / data.size) * p.classification.entropy}.inject(0) {|i,s| s+=i }\n\n [data.classification.entropy - remainder, attributes.index(attribute)]\n end",
"def partition_method(list)\n #names of both arrays....\n #partition method is called on list\n #block if number is positive it goes in positive array\n #else it goes to negative array\n positive, negative = list.partition { |number| number.positive?}\n #call length of positive array and sum of negative array\n [positive.length, negative.sum]\nend",
"def flatten_predicates(pred)\n return pred unless pred.is_a? Array\n\n pred = [ pred[0] ] + pred[1 .. -1].map { |x| flatten_predicates(x) }\n\n op = pred[0]\n return pred unless op.is_a? String\n\n return flatten_predicates(pred[1]) if pred.length == 2\n\n rest = pred[1 .. -1]\n\n if rest.any? { |x| x[0] == op } &&\n rest.all? { |x| x[0] == op || x[0] == :field } then\n\n newlist = pred[1 .. -1].map { |x| x[0] == :field ? [x] : x[1 .. -1] } \\\n .inject([]) { |full,p| full + p }\n return flatten_predicates([ op ] + newlist)\n end\n pred.find_all { |x| !x.is_a?(Array) || x.length > 1 }\nend",
"def partition1(arr, left, right)\n pele = arr[left]\n pindex = right\n i = right\n while(i > left)\n if(arr[i] > pele)\n arr[i], arr[pindex] = arr[pindex], arr[i]\n pindex -= 1\n end\n i -= 1\n end\n arr[left], arr[pindex] = arr[pindex], arr[left]\n pindex\nend",
"def visit_unfold(attribute, preprocess = false)\n return unless preprocess\n\n name = attribute.name\n header = attribute.header\n keys = attribute.pop_keys\n key = keys.first\n\n others = header.postprocessed\n\n compose do |ops|\n ops << others.map { |attr|\n t(:map_array, t(:map_value, name, visit(attr, true)))\n }\n ops << t(:map_array, t(:map_value, name, t(:insert_key, key)))\n ops << t(:map_array, t(:reject_keys, [key] - [name]))\n ops << t(:ungroup, name, [key])\n end\n end",
"def right_restriction\n operand.right.restrict(partition.right)\n end",
"def predicate_attr_reader(*attrs)\n attrs.each do |attr|\n define_predicate_method(attr)\n end\n end",
"def heapify_down(custom_start_index = 0)\n current_index = custom_start_index\n next_index = nil\n while(self.has_left_child(current_index))\n if(\n self.has_right_child(current_index) && \n self.pair_is_in_correct_order(self.get_right_child_index(current_index), self.get_left_child_index(current_index)))\n \n next_index = self.get_right_child_index(current_index)\n else\n next_index = self.get_left_child_index(current_index)\n end\n \n break if(self.pair_is_in_correct_order(current_index, next_index))\n self.swap(current_index, next_index)\n current_index = next_index\n end\n end",
"def match_maker(opposites_attract, *elements)\n to_return = []\n elements.each_slice 2 do |first, last|\n first = !!first\n last = !!last\n result = if opposites_attract\n first != last\n else\n first == last\n end\n to_return << result\n end\n to_return\nend",
"def process_data(attributes)\n meta_data_from_parent = Hash[*attributes.first]\n attributes.shift\n attributes.each do |element_array|\n column_name_and_obj_id = element_array.first.split(\",\")\n column_name = column_name_and_obj_id.first\n obj_id = column_name_and_obj_id.last.strip\n element_array.shift\n meta_data_hash = Hash[*element_array.first.flatten(1)]\n obj = identify_the_object(obj_id)\n insert_meta_data([meta_data_hash[\"LEFT\"].to_f, meta_data_hash[\"TOP\"].to_f, meta_data_hash[\"BOTTOM\"].to_f, meta_data_hash[\"RIGHT\"].to_f], meta_data_from_parent[\"Page\"], column_name, meta_data_hash[\"WORD\"], meta_data_from_parent[\"Valid\"], obj, meta_data_from_parent[\"Score\"])\n end\n end",
"def partition(arr, left, right, pivot)\n pivot_val = arr[pivot]\n arr[pivot] = arr[right]\n arr[right] = pivot_val\n\n storage = left\n\n (left..right-1).each do |i|\n if arr[i] < pivot_val\n storage_val = arr[storage]\n arr[storage] = arr[i]\n arr[i] = storage_val\n storage += 1\n end\n end\n\n storage_val = arr[storage]\n arr[storage] = arr[right]\n arr[right] = storage_val\n\n storage\nend",
"def self_and_ancestors\n dataset.filter((self.class.qualified_left_column <= left) & (self.class.qualified_right_column >= right))\n end",
"def split_on_attribute(attribute)\n index = find_index_of_attribute(attribute)\n\n splitted_stuff = {}\n @attributes[index][:nominal_attributes].each do |attribute_value|\n splitted_stuff[attribute_value] = []\n end\n\n #then remove that attribute?\n @data.each do |data|\n splitted_stuff[data[attribute]] << data.clone\n end\n\n ret = {}\n splitted_stuff.each do |key, value|\n ret[key] = ArffFile.new(@relation_name.clone, @attributes.clone, value.clone, @class_attribute.clone).remove_attribute(attribute)\n end\n ret\n end",
"def partition(array, left, right)\n pivot = right\n right -= 1\n puts \"left: #{left}, right: #{right}\"\n while true do\n while array[left] <= array[pivot] && left < pivot do\n left += 1\n end\n\n while array[right] > array[pivot] do\n right -= 1\n end\n\n\n\n if left >= right\n temp = array[left]\n array[left] = array[pivot]\n array[pivot] = temp\n break\n else\n temp = array[left]\n array[left] = array[right]\n array[right] = temp\n end\n end\n\n\n left\nend",
"def divide_and_conquer(instructions, lower, upper)\n range = upper - lower\n instruction = instructions[0]\n tail = instructions[1..-1]\n\n case instruction\n when 'F', 'L'\n\n upper -= ((range + 1) / 2)\n return lower if tail.empty?\n when 'B', 'R'\n\n lower += ((range + 1) / 2)\n return upper if tail.empty?\n end\n\n divide_and_conquer(tail, lower, upper)\n end",
"def partition_list()\nend",
"def Partition(array, left, right, comparisons)\n\n puts \"partitioning #{array.to_s}... #{comparisons} comparisons done already.\"\n \n pivot = array[left]\n #puts \"choosing pivot of #{pivot} for array starting with #{array[0..1]}\"\n i = left + 1\n \n for j in (left + 1)..right\n #print \" #{j} \"\n comparisons = comparisons + 1\n if array[j] < pivot\n #puts \"#{array[j]} is less than pivot\"\n #swap A[i] and A[j]\n temp = array[i]\n array[i] = array[j]\n array[j] = temp\n i = i + 1\n \n end\n end\n # swap A[l] and A[i - 1]\n temp = array[left]\n array[left] = array[i - 1]\n array[i-1] = temp\n \n puts \"done partitioning #{array.to_s}... #{comparisons} comparisons done now.\"\n return [array, i, j, comparisons]\nend",
"def fold_left_into_mid\n @mid.shift_right\n @mid.type, @mid.value1, @mid.left = 3, @value1, @left.left\n shift_left\n @type = 2\n end",
"def remove_preceding(node_or_range, size); end",
"def pre_order(node, attribute, node_list)\n unless node.nil?\n node_list << (attribute ? node.data.send(attribute) : node.data)\n pre_order(node.left, attribute, node_list)\n pre_order(node.right, attribute, node_list)\n end\n return node_list\n end",
"def match_maker(opposites_attract, *elements)\n to_return = []\n elements.each_slice 2 do |first, last|\n first = !!first\n last = !!last\n result = if opposites_attract\n first != last\n else\n first == last\n end\n to_return << result\n end\n to_return\n end",
"def partition_if\r\n pass, fail = [], []\r\n each do |value|\r\n result = yield(value)\r\n if result then pass.push(value)\r\n else fail.push(value)\r\n end\r\n end\r\n return pass, fail\r\n end",
"def split!(side)\n raise ArgumentError, \"bad split\" unless int?(side)\n i = self[side]\n self[side] = Pair.new.tap do |child|\n child.depth = depth + 1\n child.parent = self\n child.parent_side = side\n child.left = i/2\n child.right = i - child.left\n end\n nil\n end",
"def relation\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 55 )\n return_value = RelationReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n shift249 = nil\n relation_op250 = nil\n shift251 = nil\n\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 609:5: shift ( relation_op shift )*\n @state.following.push( TOKENS_FOLLOWING_shift_IN_relation_4033 )\n shift249 = shift\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, shift249.tree )\n end\n # at line 609:11: ( relation_op shift )*\n while true # decision 59\n alt_59 = 2\n look_59_0 = @input.peek( 1 )\n\n if ( look_59_0 == GEQ || look_59_0 == GREATER || look_59_0 == INSTANCEOF || look_59_0 == LEQ || look_59_0 == LESS )\n alt_59 = 1\n elsif ( look_59_0 == IN ) and ( ( !( @InFor_stack.last && @InFor_stack.last.active ) ) )\n alt_59 = 1\n\n end\n case alt_59\n when 1\n # at line 609:14: relation_op shift\n @state.following.push( TOKENS_FOLLOWING_relation_op_IN_relation_4038 )\n relation_op250 = relation_op\n @state.following.pop\n if @state.backtracking == 0\n root_0 = @adaptor.become_root( relation_op250.tree, root_0 )\n end\n @state.following.push( TOKENS_FOLLOWING_shift_IN_relation_4042 )\n shift251 = shift\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, shift251.tree )\n end\n\n else\n break # out of loop for decision 59\n end\n end # loop for decision 59\n # - - - - - - - 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__, 55 )\n\n end\n \n return return_value\n end",
"def split_old_bin(table, new_table, i, node, node_hash, forwarder); end",
"def partition(array)\n # write your code here\n\n left = []\n right = []\n pivot = array.shift\n array.each do |int|\n if int <= pivot\n left << int\n else\n right << int\n end\n end\n\n left << pivot\n left + right\nend",
"def match_maker(opposites_attract, *elements) #method takes a boolean, and any number of booleans\n to_return = [] #creating an empty array\n elements.each_slice 2 do |first, last| #splits the array into an array of pairs\n first = !!first #conversion to boolean\n last = !! last\n result = if opposites_attract\n first != last #first does not equal last\n else\n first ==last #or they equal\n end\n to_return << result #append result \nend \nto_return\nend",
"def from_left; end",
"def from_left; end",
"def visit_fold(attribute, preprocess = false)\n if preprocess\n name = attribute.name\n keys = attribute.tuple_keys\n\n compose do |ops|\n ops << t(:group, name, keys)\n ops << t(:map_array, t(:map_value, name, t(:filter_empty)))\n ops << t(:map_array, t(:fold, name, keys.first))\n end\n end\n end",
"def partition(arr, left, right)\n pivot = arr[right]\n pindex = left\n for i in (left...right) do\n if(arr[i] <= pivot)\n arr[pindex], arr[i] = arr[i], arr[pindex]\n pindex += 1\n end\n end\n arr[pindex], arr[right] = arr[right], arr[pindex]\n pindex\nend",
"def each_predicate(&block)\n grouped_predicates_attributes.each do |namespace, predicates|\n predicates.each do |predicate, objects|\n block.call(namespace, predicate, objects.flatten)\n end\n end\n end",
"def mid_borrows_from_left\n @mid.type, @mid.mid, @mid.value1, @mid.left = 2, @mid.left, @value1, @left.right\n @left.type, @value1 = 2, @left.value2\n end",
"def quickSortHelper(ia, left, h)\n if (left < h)\n p = partition(ia, left, h) #get partition index of the array\n quickSortHelper(ia, left, p - 1) #sort from low to partition index -1\n quickSortHelper(ia, p + 1, h) #sort from p + 1 to high\n end\nend",
"def partition(ia, left, h)\n piv = ia[h] #choose the pivot as the furthest value\n i = left - 1 #set i to the index of the lowest value\n temp = 0 #temporary swapping variable\n\n for j in left..(h-1) #for j goes from low to high index..\n if(ia[j] < piv) #if the current value that we are looking at is les than the pivot...\n i += 1 #add one to the lowest position counter...\n\n #swap those two values\n ia[i],ia[j] = ia[j],ia[i]\n\tend\n end\n #swap so partition is in the middle\n ia[i+1],ia[h] = ia[h],ia[i+1]\n\n return (i+1)\nend",
"def order_attributes(xfold = false)\n\n @ignore_list = Array.new\n @max_result_array = Array.new\n @max_class_count_array = Array.new\n @tree = Hash.new\n\n\n attr_results_array = Array.new\n attr_length = @p.attributes.size\n gain_ratio_array = Array.new\n class_count_array = Array.new\n\n puts \"Reading in attributes\"\n # read in all attributes counts and store the results\n (0..13).each do |x|\n puts \"On #{x} out of 13\"\n if xfold then\n result = @p.alternate_read_attribute_values(x, 'decision_tree_model', true)\n attr_results_array.push(result)\n\n class_count = @p.class_count\n class_count_array.push(class_count)\n\n gain_ratio = @e.gain_ratio(result, class_count).abs\n gain_ratio_array.push(gain_ratio)\n else\n result = @p.alternate_read_attribute_values(x, 'descrete', true)\n attr_results_array.push(result)\n\n class_count = @p.class_count\n class_count_array.push(class_count)\n\n gain_ratio = @e.gain_ratio(result, class_count).abs\n gain_ratio_array.push(gain_ratio)\n\n end\n end\n puts \"Done reading\"\n\n (0..13).each do |x| \n max = -10000000\n max_class = nil \n max_result = nil\n max_class_count = nil\n (0..13).each do |i| \n class_label = @p.attributes[i]['name'].chomp\n if @ignore_list.include?(class_label) then next end\n #puts class_label\n# if xfold then\n# result = @p.alternate_read_attribute_values(i, 'decision_tree_model', true)\n# else\n# result = @p.alternate_read_attribute_values(i, 'descrete', true)\n# end\n #puts result\n# class_count = @p.class_count\n #puts class_count\n #puts '-'*100\n# gain_ratio = @e.gain_ratio(result, class_count).abs\n# if gain_ratio > max then \n if gain_ratio_array[i] > max then \n# max = gain_ratio \n# max_class = class_label\n# max_result = result\n# max_class_count = class_count\n\n max = gain_ratio_array[i]\n max_class = class_label\n max_result = attr_results_array[i]\n max_class_count = class_count_array[i]\n\n end\n #puts '-'*100\n end\n #puts max\n #puts max_class\n #puts max_result\n #puts max_class_count\n @max_result_array.push(max_result)\n @max_class_count_array.push(max_class_count)\n @ignore_list.push(max_class)\n end\n\n return @ignore_list\n end",
"def test_0260_partition\n @@log.debug \"test_0260_partition starts\" if @@log.debug?\n assert_respond_to(@list, :partition, \"test_0260_partition_respond\")\n # Basic partition\n ta = @list.partition {|obj| obj.ndata >= 3 }\n assert_equal(2, ta.size,\"test_0260_partition_basic_01\")\n # First array: block evaluated to true\n assert_equal([@aen, @bsb], ta[0], \"test_0260_partition_basic_02\")\n # Second array: block evaluated to false\n assert_equal([@cab, @dad], ta[1], \"test_0260_partition_basic_03\")\n # Check Enumerator or Enumerable::Enumerator return, no block given\n # This form not documented by the 1.8 Pickaxe.\n new_list = @list.partition\nif RUBY_VERSION >= \"1.9\"\n result = new_list.is_a? Enumerator\n assert(result, \"test_0260_partition_enumcheck\")\nelse\n # Note: the author's version of the 1.8 Pickaxe documents this\n # as an Array, however does not document this form of code at all.\n # YMMV.\n result = new_list.is_a? Enumerable::Enumerator\n assert(result, \"test_0260_partition_enumenumcheck\")\nend\n\n @@log.debug \"test_0260_partition ends\" if @@log.debug?\n end",
"def partition(array)\n # write your code here\n first = array[0]\n right = []\n left = []\n \n for i in 1..(array.length - 1)\n if first > array[i] \n left << array[i] \n else \n right << array[i]\n end\n end\n left + [first] + right\n \n end",
"def partition_array(array, pivot)\n left_i = 0\n right_i = (last_i = array.length - 1)\n\n # haven't crossed/met yet...\n while left_i < right_i\n while array[left_i] <= pivot && left_i < last_i\n left_i += 1\n end\n\n while array[right_i] >= pivot && right_i > 0\n right_i -= 1\n end\n\n # four possibilities (extract this part)\n if left_i < right_i # stopped but not crossed\n # swap left and right values\n tmp = array[left_i]\n array[left_i] = array[right_i]\n array[right_i] = tmp\n # repeat loop\n else\n if left_i > right_i # # crossed, midpoint found\n midpoint = left_i #left_i is to right of midpoint after cross\n left = array\n right = left.slice!(midpoint..-1)\n elsif right_i == 0 # right marker came all the way over: ALL GREATER THAN\n left, right = [], array\n else left_i == last_i # left marker came all the way right: ALL LESS THEN\n left, right = array, []\n end\n break\n end\n\n end\n\n return left, right\n end",
"def partition\n return enum_for(:partition) if not block_given?\n a,b = super\n [self.class.new(a), self.class.new(b)].freeze\n end",
"def partition(a,p,r)\n i = p-1\n key = a[r]\n for j in p..r-1\n if(a[j]<=key)\n i = i + 1\n temp = a[i]\n a[i] = a[j]\n a[j] = temp\n end\n end\n temp = a[i+1]\n a[i+1] = a[r]\n a[r] = temp\n return i+1\nend",
"def each_predicate(&block) # :nodoc:\n grouped_predicates_attributes.each do |namespace, predicates|\n predicates.each do |predicate, objects|\n block.call(namespace, predicate, objects.flatten)\n end\n end\n end",
"def test_predicates\n assert_equal \"12\", XPath::first(@@doc, \"a/e/f[3]\").attributes[\"id\"]\n assert_equal \"13\", XPath::first(@@doc, \"a/e/f[3]/g\").attributes[\"id\"]\n assert_equal \"14\", XPath::first(@@doc, \"a/e/f[@a='d'][2]\").attributes[\"id\"]\n assert_equal \"14\", XPath::first(@@doc, \"a/e/f[@a='d'][@id='14']\").attributes[\"id\"]\n assert_equal \"a\", XPath::first( @@doc, \"*[name()='a' and @id='1']\" ).name\n c=each_test( @@doc, \"//*[name()='f' and @a='d']\") { |i|\n assert_equal \"f\", i.name\n }\n assert_equal 2, c\n c=each_test( @@doc, \"//*[name()='m' or @a='d']\") { |i|\n assert [\"m\",\"f\"].include?(i.name)\n }\n assert_equal 3, c\n\n assert_equal \"b\", XPath::first( @@doc, \"//b[@x]\" ).name\n end",
"def apply_attribute(attr_key, attr_data, offsetx, offsety)\n\t\t\n\t\t# avoid edges with minimums\n\t\t(offsetx...[@tiles.length,attr_data.length].min).each do |x|\n\t\t\t(offsety...[@tiles[x].length, attr_data[x].length].min).each do |y|\n\t\t\t\t@tiles[x][y].attributes[attr_key] = attr_data[x - offsetx][y-offsety]\n\t\t\tend\n\t\tend\n\tend",
"def partition(array, testValue)\r\n\r\n\r\n\tleft_index = 0\r\n\tright_index = array.length-1\r\n\r\n\t# While markers have not crossed each other\r\n\twhile(left_index < right_index)\r\n\r\n\t\tl_value = array[left_index]\r\n\t\tr_value = array[right_index]\r\n\t\tif(l_value > testValue and r_value < testValue)\t\r\n\t\t\t# Swap\r\n\t\t\ttemp = array[left_index]\r\n\t\t\tarray[left_index] = array[right_index]\r\n\t\t\tarray[right_index] = temp\r\n\t\tend\r\n\r\n\t\t#Move left_index forward\r\n\t\twhile(array[left_index]<testValue)\r\n\t\t\tleft_index = left_index+1\r\n\t\tend\r\n\r\n\t\t#Move right_index back\r\n\t\twhile(array[right_index]>testValue)\r\n\t\t\tright_index = right_index-1\r\n\t\tend\r\n\tend\r\n\r\n\t#returns the point where the test value divides the array\r\n\tif(array[left_index]>testValue)\r\n\t\tleft_index -= 1\r\n\tend\r\n\treturn left_index, array\r\nend",
"def partition(list, left, right)\n pivot = list[right]\n previous_left = left-1\n left.upto(right-1) { |value|\n previous_left = previous_left + 1 if list[value] <= pivot\n list[previous_left], list[value] = list[value], list[previous_left] if list[value] <= pivot\n }\n list[previous_left+1], list[right] = list[right], list[previous_left+1]\n return previous_left + 1\nend",
"def cut_white_space_edges\n x1_array = Array.new\n x2_array = Array.new\n y1_array = Array.new\n y2_array = Array.new\n \n @groups.each do |g|\n x1_array << g.x_pos\n x2_array << g.x_pos + g.width\n y1_array << g.y_pos\n y2_array << g.y_pos + g.height\n end\n \n if @vertical\n #Normal position of the image (up)\n if values_bits[Constants::V_Image_position]< 4.5 \n @height = y2_array.max + @upper_margin\n #Alternative position(down)\n else \n new_height = @height - (y1_array.min-@upper_margin)\n \n @groups.each do |g|\n g.y_pos -= (@height - new_height)\n end\n @main_image.y_pos -= (@height - new_height)\n \n @height = new_height\n end\n else\n #Normal position of the image (left)\n if values_bits[Constants::V_Image_position]< 4.5\n @width = x2_array.max + @sides_margin\n #Alternative position of the image (right)\n else \n new_width = @width - (x1_array.min-@sides_margin)\n \n @groups.each do |g|\n g.x_pos -= (@width - new_width)\n end\n @main_image.x_pos -= (@width - new_width)\n \n @width = new_width\n end\n end\n end",
"def low_ent_cols_with_bases leaves, leaf2attrs, entropy_cutoff\n low_ent_cols = []\n alns = leaf2attrs.attrs leaves, :aln\n aln_cols = alns.transpose\n\n aln_cols.each_with_index do |aln_col, aln_col_idx|\n has_gaps = aln_col.any? { |aa| aa == \"-\" }\n low_entropy =\n Shannon::entropy(aln_col.join.upcase) <= entropy_cutoff\n\n if !has_gaps && low_entropy\n low_ent_cols << [(aln_col_idx + 1), aln_col.map(&:upcase).uniq.sort]\n end\n end\n\n Set.new low_ent_cols\n end",
"def rearrange\n yield\n other = Tag.where(id: self.other_id).first\n operation = self.operation\n self.operation = self.other_id = nil\n\n begin\n case operation\n when 'nest_under'\n self.update_attribute :parent_id, other.id\n self.update_attribute :siblings_position, 0\n raise 'Cyclic nesting!' if other.parent_id == id\n when 'move_above'\n self.update_attribute :parent_id, other.parent_id\n self.update_attribute :siblings_position, other.calculated_siblings_position - 1\n when 'move_below'\n self.update_attribute :parent_id, other.parent_id\n self.update_attribute :siblings_position, other.calculated_siblings_position + 1\n end\n rescue\n self.errors.add :other_id, INVALID_TAG_OPERATION\n raise ActiveRecord::Rollback\n end\n end",
"def partition_edges\n\n par = RangePartition.new\n\n stateSet = @start_state.reachable_states\n\n stateSet.each do |s|\n s.edges.each {|lbl,dest| par.addSet(lbl) }\n end\n\n par.prepare\n\n stateSet.each do |s|\n newEdges = []\n s.edges.each do |lbl, dest|\n newLbls = par.apply(lbl)\n newLbls.each {|x| newEdges.push([x, dest]) }\n end\n s.clearEdges()\n\n newEdges.each do |lbl,dest|\n s.addEdge(lbl,dest)\n end\n end\n\n end",
"def partition(array, p, r)\n q = p\n (p .. r - 1).each do |u|\n if array[u] <= array[r]\n array[q], array[u] = array[u], array[q]\n q += 1\n end\n end\n array[q], array[r] = array[r], array[q]\n q\nend",
"def partition(&block) # :nodoc:\n resolve\n result = @items.partition(&block)\n [\n PropertyGroup::PathList.new.import(result[0]),\n PropertyGroup::PathList.new.import(result[1]),\n ]\n end",
"def partition(list, left, right, pivotIndex)\n pivotValue = list[pivotIndex]\n list[pivotIndex], list[right] = list[right], list[pivotIndex]\n storeIndex = left\n for i in (left...right) do\n if list[i] < pivotValue\n list[storeIndex], list[i] = list[i], list[storeIndex]\n storeIndex += 1\n end\n end\n list[right], list[storeIndex] = list[storeIndex], list[right]\n storeIndex\nend",
"def three_way_partition(array)\n lo = 0\n mid = 0\n hi = array.size - 1\n while mid <= hi\n val = array[mid]\n case val\n when 0\n array[lo], array[mid] = array[mid],array[lo]\n lo += 1\n mid += 1\n when 1\n mid += 1\n when 2\n array[mid], array[hi] = array[hi], array[mid] \n hi -= 1\n end\n end\n array\nend",
"def partitionize(array)\r\n p = Array.new\r\n\r\n array.each_with_index do |x, i|\r\n if i == 0 || x.exercise_id != array[i-1].exercise_id\r\n p << Array.new\r\n end\r\n p.last << x\r\n end\r\n p\r\n end",
"def partition(arr, p, r, ord)\n\t# for empty array\n\treturn [] if r < 0\n\tx = arr[r]\n\ti = p - 1\n\tj = p\n\tfor j in p..r-1\n\t\t# USE OF LAMBDA FROM ABOVE\n\t\tif ord.call(arr[j], x)\n\t\t\ti += 1\n\t\t\ttemp = arr[i]\n\t\t\tarr[i] = arr[j]\n\t\t\tarr[j] = temp\n\t\tend\n\tend\n\ttemp = arr[i+1]\n\tarr[i+1] = arr[r]\n\tarr[r] = temp\n\treturn i + 1\nend",
"def partition(ary, left, right, pivot_i)\n\n left = 0\n right = ary.length - 1\n\n pivot = ary[pivot_i]\n\n # Move pivot to the end of ary\n ary[pivot_i], ary[right] = ary[right], ary[pivot_i]\n\n # All values <= pivot moved to front of ary\n # Pivot inserted after them\n store = left\n (left...right).each do |i|\n if ary[i] <= pivot\n ary[i], ary[store] = ary[store], ary[i]\n store += 1\n end\n end\n\n ary[store], ary[right] = ary[right], ary[store]\n store\n end",
"def partition(linkedlist, x)\n # Use select block function to create arrays with correct values\n lessThanX = linkedlist.select { |val| val < x }\n moreThanX = linkedlist.select { |val| val >= x }\n # Return values greater than or equal to x appended to values lesser than x\n return lessThanX + moreThanX\nend",
"def apply( nodes )\n nodes = nodes.to_a\n results = nodes\n difference = nodes\n until difference.empty?\n step_results = @selector.apply( difference )\n difference = step_results - results\n results.concat( difference )\n end\n \n return results.reverse\n end",
"def attr_reader(*attrs)\n attrs.each do |attr|\n define_attribute_method(attr)\n define_predicate_method(attr)\n end\n end",
"def partitionx(array, start, fin, pivot_index)\n le_count = 0\n pivot_value = array[pivot_index]\n puts \"Partitioning for value: #{pivot_value}: #{array}\"\n puts \"Start:Fin #{start}:: #{fin}:: #{pivot_index}\"\n array[start..fin].each do |element|\n le_count += 1 if element <= pivot_value\n end\n\n new_array = []\n puts \"LE count: #{le_count}\"\n new_array[le_count - 1] = pivot_value\n left_index = 0 # 5\n right_index = le_count # 1\n index = start\n array[start..fin].each do |element|\n puts \"Element: #{element}: #{index}:: #{pivot_index}\"\n if index == pivot_index\n index += 1\n next\n end\n\n if element <= pivot_value\n puts \"Copying to left #{element} to #{left_index}\"\n new_array[left_index] = element\n left_index += 1\n else\n puts \"Copying #{element} to #{right_index}\"\n new_array[right_index] = element\n right_index += 1\n end\n end\n puts \"before replacing: #{array} : #{array[start..fin]}:: #{new_array}\"\n j = 0\n (start..fin).each do |index|\n puts \"index: #{index}\"\n array[index] = new_array[j]\n j += 1\n end\n\n puts \"New array: #{array}\"\n puts \"new pivot index: #{array.index(pivot_value)}\"\n array.index(pivot_value)\n end",
"def dominant_octopus(fish)\n #sorted = []\n return fish if fish.length < 2\n pivot = fish.first\n left = fish[1..-1].select { |feesh| feesh.length <= pivot.length }\n #p left\n right = fish[1..-1].select { |feesh| feesh.length > pivot.length }\n\n dominant_octopus(left) + [pivot] + dominant_octopus(right)\n \n\n\nend",
"def normalize(set, attributes)\n\t\tnew_set = []\n\t\ti = 0\n\t\twhile i < set.count\n\t\t\texample_aux = set[i]\n\t\t\tattributes.each do |a|\n\t\t\t\t# only if the attribute is continuous\n\t\t\t\tif a.type == \"continuous\"\n #puts \"example_aux.attributes[a.name] = \"+((set[i].attributes[a.name]).to_f / (a.max.to_f - a.min.to_f).to_f).to_s\n example_aux.attributes[a.name] = (set[i].attributes[a.name]).to_f / (a.max.to_f - a.min.to_f).to_f # normalization: (attribute.value)/(attribute max - attribute.min)\n end\n\t\t\tend\n\t\t\tnew_set << example_aux\n\t\t\ti += 1\n\t\tend\n\t\treturn new_set\n\tend",
"def prune_from_tree\n return if self.right.nil? || self.left.nil?\n diff = self.right - self.left + 1\n\n #TODO: implemente :dependent option\n # delete_method = acts_as_nested_set_options[:dependent] == :destroy ?\n # :destroy_all : :delete_all\n\n #TODO: implement prune method\n # self.class.base_class.transaction do\n # nested_set_scope.send(delete_method,\n # [\"#{quoted_left_column_name} > ? AND #{quoted_right_column_name} < ?\",\n # left, right]\n # )\n # nested_set_scope.update_all(\n # [\"#{quoted_left_column_name} = (#{quoted_left_column_name} - ?)\", diff],\n # [\"#{quoted_left_column_name} >= ?\", right]\n # )\n # nested_set_scope.update_all(\n # [\"#{quoted_right_column_name} = (#{quoted_right_column_name} - ?)\", diff],\n # [\"#{quoted_right_column_name} >= ?\", right]\n # )\n # end\n end",
"def visit_without_hash_context_shift(k, v, parent)\n # Short-circuit for stuff like `where(:author => User.first)`\n # This filthy hack emulates similar behavior in AR PredicateBuilder\n\n if ActiveRecord::Base === v &&\n association = classify(parent).reflect_on_association(k.to_sym)\n return expand_belongs_to(Nodes::Predicate.new(k, :eq, v), parent, association)\n end\n\n case v\n when Nodes::Stub, Symbol\n v = contextualize(parent)[v.to_s]\n when Nodes::KeyPath # If we could visit the endpoint, we wouldn't be here\n v = contextualize(traverse(v, parent))[v.endpoint.to_s]\n end\n\n case k\n when Nodes::Predicate\n visit(k % quote_for_node(k.expr, v), parent)\n when Nodes::Function, Nodes::Literal\n arel_predicate_for(visit(k, parent), quote(v), parent)\n when Nodes::KeyPath\n visit(k % quote_for_node(k.endpoint, v), parent)\n else\n attr_name = k.to_s\n attribute = if !hash_context_shifted? && attr_name.include?('.')\n table_name, attr_name = attr_name.split(/\\./, 2)\n Arel::Table.new(table_name.to_s, :engine => engine)[attr_name.to_s]\n else\n contextualize(parent)[attr_name]\n end\n arel_predicate_for(attribute, v, parent)\n end\n end",
"def sortById(arr, left, right)\r\n if left < right\r\n \r\n pi = partition(arr, left, right)\r\n sortById(arr, left, pi - 1)\r\n sortById(arr, pi + 1, right)\r\n end\r\n\r\n return arr\r\nend",
"def left_sibling\n base_class.first scoped(parent_column_name => _parent_id, left_column_name => { '$lt' => left }, :order => \"#{left_column_name} DESC\")\n end",
"def get_splits\n @logical_splits\n end",
"def partition(array, p, r)\n x = array[r]\n i = p - 1\n j = p\n\n while j < r\n if array[j] <= x\n i = i + 1\n array[i], array[j] = array[j], array[i]\n end\n j = j + 1\n end\n\n array[i + 1], array[r] = array[r], array[i + 1]\n\n return (i + 1)\nend",
"def partition(cv, fv, bs, cp)\n # best cut point\n cp_best = nil\n \n # binary subset at the best cut point\n cv1_best, cv2_best = nil, nil\n fv1_best, fv2_best = nil, nil\n bs1_best, bs2_best = nil, nil\n \n # best information gain\n gain_best = -100.0\n ent_best = -100.0\n ent1_best = -100.0\n ent2_best = -100.0\n \n # try each potential cut point\n bs.each do |b|\n # binary split\n cv1_try, cv2_try, fv1_try, fv2_try, bs1_try, bs2_try = \n binary_split(cv, fv, bs, b)\n \n # gain for this cut point\n ent_try = get_marginal_entropy(cv)\n ent1_try = get_marginal_entropy(cv1_try)\n ent2_try = get_marginal_entropy(cv2_try)\n gain_try = ent_try - \n (cv1_try.size.to_f/cv.size) * ent1_try - \n (cv2_try.size.to_f/cv.size) * ent2_try\n \n #pp gain_try\n if gain_try > gain_best\n cp_best = b\n cv1_best, cv2_best = cv1_try, cv2_try\n fv1_best, fv2_best = fv1_try, fv2_try\n bs1_best, bs2_best = bs1_try, bs2_try\n \n gain_best = gain_try\n ent_best = ent_try\n ent1_best, ent2_best = ent1_try, ent2_try\n end\n end \n \n # to cut or not to cut?\n #\n # Gain(A,T;S) > 1/N * log2(N-1) + 1/N * delta(A,T;S)\n if cp_best\n n = cv.size.to_f\n k = cv.uniq.size.to_f\n k1 = cv1_best.uniq.size.to_f\n k2 = cv2_best.uniq.size.to_f\n delta = Math.log2(3**k-2)-(k*ent_best - k1*ent1_best - k2*ent2_best)\n \n # accept cut point\n if gain_best > (Math.log2(n-1)/n + delta/n)\n # a: record cut point\n cp << cp_best\n \n # b: recursively call on subset\n partition(cv1_best, fv1_best, bs1_best, cp)\n partition(cv2_best, fv2_best, bs2_best, cp)\n end\n end\n end",
"def my_array_splitting_method(source)\n divide = source.sort_by{|x| x.to_s}\n total = divide.find_all{|item| item % 1 == 0 }.count \n total -= 1\n divide.partition.with_index { |_, index| index <= total }\nend",
"def partition(filters={})\n input, output = self.input, self.output\n filters.each_pair do |filter_key, f|\n if f.call(input, output)\n return filter_key\n end\n end\n nil\n end",
"def op_unfold\n pop.each do |elm|\n push elm\n end\n end",
"def preoder_tree_walk(x)\n unless x.nil?\n p x.key\n preoder_tree_walk(x.left)\n preoder_tree_walk(x.right)\n end\n end",
"def discretize_by_MID! \n # determine the final boundaries\n f2cp = {} # cut points for each feature\n each_feature do |f|\n cv = get_class_labels\n fv = get_feature_values(f)\n \n n = cv.size\n abort \"[#{__FILE__}@#{__LINE__}]: \\n\"+\n \" missing feature value is not allowed!\" if n != fv.size\n \n # sort cv and fv according to ascending order of fv\n sis = (0...n).to_a.sort { |i,j| fv[i] <=> fv[j] }\n cv = cv.values_at(*sis)\n fv = fv.values_at(*sis)\n \n # get initial boundaries\n bs = []\n fv.each_with_index do |v, i|\n # cut point (Ta) for feature A must always be a value between\n # two examples of different classes in the sequence of sorted examples\n # see orginal reference\n if i < n-1 and cv[i] != cv[i+1]\n bs << v\n end\n end\n bs.uniq! # remove duplicates\n \n # main algorithm, iteratively determine cut point\n cp = []\n partition(cv, fv, bs, cp)\n \n # record cut points for feature (f)\n f2cp[f] = cp.sort # sorted cut points\n end\n \n # discretize based on cut points\n discretize_at_cutpoints!(f2cp)\n end",
"def heapify(index)\n item = @items[index]\n parent = parent(index)\n left_child = left_child(index)\n right_child = right_child(index)\n if (parent && parent.attrib > item.attrib)\n swap(parent.index, index)\n elsif (left_child && right_child && left_child.attrib < item.attrib &&\n right_child.attrib < item.attrib)\n if (left_child.attrib < right_child.attrib)\n swap(index, left_child.index)\n else\n swap(index, right_child.index)\n end\n elsif (left_child && left_child.attrib < item.attrib)\n swap(index, left_child.index)\n elsif (right_child && right_child.attrib < item.attrib)\n swap(index, right_child.index)\n end\n end",
"def attr_predicate_accessor( attrname )\n\t\t\tattrname = attrname.to_s.chomp( '?' )\n\t\t\tattr_writer( attrname )\n\t\t\tattr_predicate( attrname )\n\t\tend",
"def ml_operations!\n @list.each_value do |partition|\n partition.ml_operations!\n end\n self\n end",
"def predecessor_ops(item_id, row = nil, col = nil, ignore_ids = [])\n ops = output_fvs(item_id, row, col).map(&:operation)\n ops.reject { |op| ignore_ids.include?(op.id) }\n end",
"def testReorderingChangingCrossPartition\n executeSimpleTest(\n [ [ 'T1', 'R1', 900, 5, ['T2'], '==== ='],\n [ 'T2', 'R2', 800, 2, [], ' =='],\n [ 'T3', 'R2', 700, 2, ['T4'], ' =='],\n [ 'T4', 'R1', 600, 2, ['T5'], ' =='],\n [ 'T5', 'R3', 1000, 2, [], ' =='],\n [ 'T6', 'R4', 100, 5, ['T5'], '====='],\n [ 'T7', 'R2', 200, 2, ['T8'], '=='],\n [ 'T8', 'R5', 2000, 2, [], ' =='],\n [ 'T9', 'R6', 300, 3, ['T8'], '==='] ] )\n end",
"def prune\n return true if [email protected]? && down.prune \n return true if [email protected]? && left.prune \n return true if [email protected]? && right.prune \n return true unless @value.nil?\n up.down = nil if !up.nil? && left.nil? && right.nil?\n false\n end",
"def test_preordered_each\n j = Tree::TreeNode.new(\"j\")\n f = Tree::TreeNode.new(\"f\")\n k = Tree::TreeNode.new(\"k\")\n a = Tree::TreeNode.new(\"a\")\n d = Tree::TreeNode.new(\"d\")\n h = Tree::TreeNode.new(\"h\")\n z = Tree::TreeNode.new(\"z\")\n\n # The expected order of response\n expected_array = [j, f, a, d, h, k, z]\n\n # Create the following Tree\n # j <-- level 0 (Root)\n # / \\\n # f k <-- level 1\n # / \\ \\\n # a h z <-- level 2\n # \\\n # d <-- level 3\n j << f << a << d\n f << h\n j << k << z\n\n result_array = []\n j.preordered_each { |node| result_array << node.detached_copy}\n\n expected_array.each_index do |i|\n # Match only the names.\n assert_equal(expected_array[i].name, result_array[i].name)\n end\n end"
] | [
"0.60609305",
"0.60413665",
"0.59011686",
"0.5671281",
"0.5655303",
"0.55238914",
"0.52749443",
"0.5191218",
"0.50731915",
"0.5024346",
"0.5024236",
"0.49520996",
"0.4930246",
"0.49284413",
"0.49147603",
"0.48967564",
"0.48872867",
"0.488236",
"0.48467207",
"0.48349288",
"0.4828429",
"0.48276517",
"0.47889107",
"0.47755614",
"0.47716326",
"0.47589204",
"0.4748595",
"0.47349066",
"0.47228166",
"0.4707675",
"0.4680634",
"0.46616477",
"0.46575066",
"0.46450174",
"0.4635412",
"0.46310645",
"0.46183908",
"0.4614296",
"0.4607637",
"0.46063292",
"0.46002036",
"0.45940536",
"0.4576098",
"0.45592234",
"0.45589802",
"0.45557472",
"0.45557472",
"0.45542982",
"0.4521731",
"0.4519655",
"0.45180714",
"0.4507886",
"0.44975775",
"0.44964567",
"0.44939432",
"0.44852546",
"0.44834718",
"0.44787747",
"0.44758224",
"0.44753486",
"0.4469492",
"0.44511637",
"0.44408032",
"0.4439573",
"0.4426054",
"0.44242686",
"0.4423444",
"0.44129646",
"0.4405805",
"0.43990624",
"0.43986064",
"0.43981227",
"0.43884942",
"0.4384361",
"0.43822876",
"0.4382219",
"0.43760332",
"0.43570626",
"0.43523756",
"0.43500385",
"0.43440515",
"0.43355262",
"0.43308264",
"0.43293294",
"0.4326814",
"0.43251905",
"0.43234026",
"0.4322181",
"0.43197608",
"0.43102598",
"0.4305411",
"0.4302295",
"0.43007708",
"0.43007362",
"0.4299415",
"0.4297402",
"0.4295802",
"0.42884427",
"0.42879117",
"0.4274697"
] | 0.69205546 | 0 |
Partition the proposition up into the left, right and remainder predicates | def partition_proposition(proposition)
@remainder &= proposition
@left &= proposition
@right &= proposition
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def partition(array, left, right)\n pivot = right\n right -= 1\n puts \"left: #{left}, right: #{right}\"\n while true do\n while array[left] <= array[pivot] && left < pivot do\n left += 1\n end\n\n while array[right] > array[pivot] do\n right -= 1\n end\n\n\n\n if left >= right\n temp = array[left]\n array[left] = array[pivot]\n array[pivot] = temp\n break\n else\n temp = array[left]\n array[left] = array[right]\n array[right] = temp\n end\n end\n\n\n left\nend",
"def partition(predicate)\n each_operand(predicate) do |operand|\n case operand\n when Axiom::Function::Binary then partition_binary(operand)\n when Axiom::Function::Unary then partition_unary(operand)\n when Axiom::Attribute::Boolean then partition_attribute(operand)\n else\n partition_proposition(operand)\n end\n end\n end",
"def partition_binary(function)\n operands = [function.left, function.right].grep(Axiom::Attribute)\n left_operands = @left_header & operands\n right_operands = @right_header & operands\n\n if (left_operands - right_operands).empty? || (right_operands - left_operands).empty?\n @left &= function if left_operands.any?\n @right &= function if right_operands.any?\n else\n @remainder &= function\n end\n end",
"def partition_array(array,x,left=0,right=(array.length-1))\n # end condition: when the markers pass each other\n # we're done, so then return the array \n if right < left\n return array\n end\n\n # when the left value is wrong\n wrong_left = array[left] > x\n # when the right value is wrong\n wrong_right = array[right] < x\n \n #if both are wrong, swap the pair\n if wrong_left && wrong_right\n array[left], array[right] = array[right], array[left]\n left = left + 1\n right = right - 1\n partition_array(array,x,left,right)\n #else if only the left is wrong, increment just the right\n elsif wrong_left\n right = right - 1\n partition_array(array,x,left,right)\n #else if the only the right is wrong, increment the left\n elsif wrong_right\n left = left + 1\n partition_array(array,x,left,right)\n end\n\n #return the array\n return array\nend",
"def partition(arr, left, right, pivot)\n pivot_val = arr[pivot]\n arr[pivot] = arr[right]\n arr[right] = pivot_val\n\n storage = left\n\n (left..right-1).each do |i|\n if arr[i] < pivot_val\n storage_val = arr[storage]\n arr[storage] = arr[i]\n arr[i] = storage_val\n storage += 1\n end\n end\n\n storage_val = arr[storage]\n arr[storage] = arr[right]\n arr[right] = storage_val\n\n storage\nend",
"def Partition(array, left, right, comparisons)\n\n puts \"partitioning #{array.to_s}... #{comparisons} comparisons done already.\"\n \n pivot = array[left]\n #puts \"choosing pivot of #{pivot} for array starting with #{array[0..1]}\"\n i = left + 1\n \n for j in (left + 1)..right\n #print \" #{j} \"\n comparisons = comparisons + 1\n if array[j] < pivot\n #puts \"#{array[j]} is less than pivot\"\n #swap A[i] and A[j]\n temp = array[i]\n array[i] = array[j]\n array[j] = temp\n i = i + 1\n \n end\n end\n # swap A[l] and A[i - 1]\n temp = array[left]\n array[left] = array[i - 1]\n array[i-1] = temp\n \n puts \"done partitioning #{array.to_s}... #{comparisons} comparisons done now.\"\n return [array, i, j, comparisons]\nend",
"def partition1(arr, left, right)\n pele = arr[left]\n pindex = right\n i = right\n while(i > left)\n if(arr[i] > pele)\n arr[i], arr[pindex] = arr[pindex], arr[i]\n pindex -= 1\n end\n i -= 1\n end\n arr[left], arr[pindex] = arr[pindex], arr[left]\n pindex\nend",
"def partition(list, left, right)\n pivot = list[right]\n previous_left = left-1\n left.upto(right-1) { |value|\n previous_left = previous_left + 1 if list[value] <= pivot\n list[previous_left], list[value] = list[value], list[previous_left] if list[value] <= pivot\n }\n list[previous_left+1], list[right] = list[right], list[previous_left+1]\n return previous_left + 1\nend",
"def calc_poss_partitions(root_partition, rd, md)\n root_partition = normalize_partition(root_partition)\n # puts \"root_partition = \" + root_partition.to_s\n r = rd[:r_num_cells].length\n poss_partitions = Array.new\n # poss_partitions.push(root_partition)\n xxs = create_r_arrays_from_partition(rd[:r_num_cells], root_partition)\n\n i_j_combinations = (0...xxs.length).to_a.combination(2).to_a\n i_j_combinations.each do |ij|\n xx_i_combinations = (1...xxs[ij[0]].length).flat_map{|size| xxs[ij[0]].combination(size).to_a}\n xx_j_combinations = (1...xxs[ij[1]].length).flat_map{|size| xxs[ij[1]].combination(size).to_a}\n xx_i_combinations.each do |xx_i_combination|\n xx_i_sum = xx_i_combination.inject(0, :+)\n xx_j_combinations.each do |xx_j_combination|\n xx_j_sum = xx_j_combination.inject(0, :+)\n # This part is horribly inefficient. I already know some ways\n # it could be improved, but I just want a proof of concept for\n # the time being, so maybe I'll come back and optimize later.\n if xx_i_sum == xx_j_sum\n new_partition = create_new_partition(root_partition, xx_i_combination, xx_j_combination)\n new_partition = normalize_partition(new_partition)\n # Originally, I had this part cut down the number of partitions it returned by\n # making it only return VALID partitions. Now that I'm essentially using this\n # as a method of EXPANDING from a given partition, I should allow it to return\n # invalid partitions, as they could still have valid children which would not\n # be reachable otherwise.\n # if (not poss_partitions.include? new_partition) and validate_partition(new_partition, rd, md)\n if not poss_partitions.include? new_partition\n poss_partitions.push(new_partition)\n # puts \"poss_partition[\" + (poss_partitions.length-1).to_s + \"] = \" + new_partition.to_s\n end\n end\n end\n end\n end\n return poss_partitions\nend",
"def partition(arr, left, right)\n pivot = arr[right]\n pindex = left\n for i in (left...right) do\n if(arr[i] <= pivot)\n arr[pindex], arr[i] = arr[i], arr[pindex]\n pindex += 1\n end\n end\n arr[pindex], arr[right] = arr[right], arr[pindex]\n pindex\nend",
"def partition(array)\n # write your code here\n\n left = []\n right = []\n pivot = array.shift\n array.each do |int|\n if int <= pivot\n left << int\n else\n right << int\n end\n end\n\n left << pivot\n left + right\nend",
"def partition(array, p, r)\n q = p\n (p .. r - 1).each do |u|\n if array[u] <= array[r]\n array[q], array[u] = array[u], array[q]\n q += 1\n end\n end\n array[q], array[r] = array[r], array[q]\n q\nend",
"def partition(arr, left, right)\r\n pivot = arr[right]['id']\r\n brk_pt = left\r\n\r\n (left..right-1).each do |i|\r\n if arr[i]['id'] < pivot\r\n arr[i], arr[brk_pt] = arr[brk_pt], arr[i]\r\n brk_pt = brk_pt + 1\r\n end\r\n end\r\n\r\n arr[brk_pt], arr[right] = arr[right], arr[brk_pt]\r\n return brk_pt\r\nend",
"def test_0260_partition\n @@log.debug \"test_0260_partition starts\" if @@log.debug?\n assert_respond_to(@list, :partition, \"test_0260_partition_respond\")\n # Basic partition\n ta = @list.partition {|obj| obj.ndata >= 3 }\n assert_equal(2, ta.size,\"test_0260_partition_basic_01\")\n # First array: block evaluated to true\n assert_equal([@aen, @bsb], ta[0], \"test_0260_partition_basic_02\")\n # Second array: block evaluated to false\n assert_equal([@cab, @dad], ta[1], \"test_0260_partition_basic_03\")\n # Check Enumerator or Enumerable::Enumerator return, no block given\n # This form not documented by the 1.8 Pickaxe.\n new_list = @list.partition\nif RUBY_VERSION >= \"1.9\"\n result = new_list.is_a? Enumerator\n assert(result, \"test_0260_partition_enumcheck\")\nelse\n # Note: the author's version of the 1.8 Pickaxe documents this\n # as an Array, however does not document this form of code at all.\n # YMMV.\n result = new_list.is_a? Enumerable::Enumerator\n assert(result, \"test_0260_partition_enumenumcheck\")\nend\n\n @@log.debug \"test_0260_partition ends\" if @@log.debug?\n end",
"def partition_array(array, pivot)\n left_i = 0\n right_i = (last_i = array.length - 1)\n\n # haven't crossed/met yet...\n while left_i < right_i\n while array[left_i] <= pivot && left_i < last_i\n left_i += 1\n end\n\n while array[right_i] >= pivot && right_i > 0\n right_i -= 1\n end\n\n # four possibilities (extract this part)\n if left_i < right_i # stopped but not crossed\n # swap left and right values\n tmp = array[left_i]\n array[left_i] = array[right_i]\n array[right_i] = tmp\n # repeat loop\n else\n if left_i > right_i # # crossed, midpoint found\n midpoint = left_i #left_i is to right of midpoint after cross\n left = array\n right = left.slice!(midpoint..-1)\n elsif right_i == 0 # right marker came all the way over: ALL GREATER THAN\n left, right = [], array\n else left_i == last_i # left marker came all the way right: ALL LESS THEN\n left, right = array, []\n end\n break\n end\n\n end\n\n return left, right\n end",
"def partition(list, left, right, pivotIndex)\n pivotValue = list[pivotIndex]\n list[pivotIndex], list[right] = list[right], list[pivotIndex]\n storeIndex = left\n for i in (left...right) do\n if list[i] < pivotValue\n list[storeIndex], list[i] = list[i], list[storeIndex]\n storeIndex += 1\n end\n end\n list[right], list[storeIndex] = list[storeIndex], list[right]\n storeIndex\nend",
"def partition\n PredicatePartition.new(predicate, operand.left.header, operand.right.header)\n end",
"def partition(array, p, r)\n x = array[r]\n i = p - 1\n j = p\n\n while j < r\n if array[j] <= x\n i = i + 1\n array[i], array[j] = array[j], array[i]\n end\n j = j + 1\n end\n\n array[i + 1], array[r] = array[r], array[i + 1]\n\n return (i + 1)\nend",
"def partition(array, testValue)\r\n\r\n\r\n\tleft_index = 0\r\n\tright_index = array.length-1\r\n\r\n\t# While markers have not crossed each other\r\n\twhile(left_index < right_index)\r\n\r\n\t\tl_value = array[left_index]\r\n\t\tr_value = array[right_index]\r\n\t\tif(l_value > testValue and r_value < testValue)\t\r\n\t\t\t# Swap\r\n\t\t\ttemp = array[left_index]\r\n\t\t\tarray[left_index] = array[right_index]\r\n\t\t\tarray[right_index] = temp\r\n\t\tend\r\n\r\n\t\t#Move left_index forward\r\n\t\twhile(array[left_index]<testValue)\r\n\t\t\tleft_index = left_index+1\r\n\t\tend\r\n\r\n\t\t#Move right_index back\r\n\t\twhile(array[right_index]>testValue)\r\n\t\t\tright_index = right_index-1\r\n\t\tend\r\n\tend\r\n\r\n\t#returns the point where the test value divides the array\r\n\tif(array[left_index]>testValue)\r\n\t\tleft_index -= 1\r\n\tend\r\n\treturn left_index, array\r\nend",
"def my_array_splitting_method(source)\n divide = source.sort_by{|x| x.to_s}\n total = divide.find_all{|item| item % 1 == 0 }.count \n total -= 1\n divide.partition.with_index { |_, index| index <= total }\nend",
"def partition(arr, p, r, ord)\n\t# for empty array\n\treturn [] if r < 0\n\tx = arr[r]\n\ti = p - 1\n\tj = p\n\tfor j in p..r-1\n\t\t# USE OF LAMBDA FROM ABOVE\n\t\tif ord.call(arr[j], x)\n\t\t\ti += 1\n\t\t\ttemp = arr[i]\n\t\t\tarr[i] = arr[j]\n\t\t\tarr[j] = temp\n\t\tend\n\tend\n\ttemp = arr[i+1]\n\tarr[i+1] = arr[r]\n\tarr[r] = temp\n\treturn i + 1\nend",
"def partition(a, p, r)\n\n\t# assume last position\n\tpivot = a[r]\n\ti = p-1\n\tp.upto(r-1) do |j|\n\t\tif a[j] <= pivot\n\t\t\ti+=1\n\t\t\ta[i], a[j] = a[j], a[i]\n\t\tend \n\tend\n\ta[i+1],a[r] = a[r],a[i+1]\n i+1\nend",
"def partition(a,p,r)\n i = p-1\n key = a[r]\n for j in p..r-1\n if(a[j]<=key)\n i = i + 1\n temp = a[i]\n a[i] = a[j]\n a[j] = temp\n end\n end\n temp = a[i+1]\n a[i+1] = a[r]\n a[r] = temp\n return i+1\nend",
"def partition(array, p, r)\n q = p\n for j in p..r-1\n if array[j] <= array[r]\n swap(array, j, q)\n q = q + 1\n end\n end\n swap(array, r, q)\n return q\nend",
"def partition_method(list)\n #names of both arrays....\n #partition method is called on list\n #block if number is positive it goes in positive array\n #else it goes to negative array\n positive, negative = list.partition { |number| number.positive?}\n #call length of positive array and sum of negative array\n [positive.length, negative.sum]\nend",
"def partitionx(array, start, fin, pivot_index)\n le_count = 0\n pivot_value = array[pivot_index]\n puts \"Partitioning for value: #{pivot_value}: #{array}\"\n puts \"Start:Fin #{start}:: #{fin}:: #{pivot_index}\"\n array[start..fin].each do |element|\n le_count += 1 if element <= pivot_value\n end\n\n new_array = []\n puts \"LE count: #{le_count}\"\n new_array[le_count - 1] = pivot_value\n left_index = 0 # 5\n right_index = le_count # 1\n index = start\n array[start..fin].each do |element|\n puts \"Element: #{element}: #{index}:: #{pivot_index}\"\n if index == pivot_index\n index += 1\n next\n end\n\n if element <= pivot_value\n puts \"Copying to left #{element} to #{left_index}\"\n new_array[left_index] = element\n left_index += 1\n else\n puts \"Copying #{element} to #{right_index}\"\n new_array[right_index] = element\n right_index += 1\n end\n end\n puts \"before replacing: #{array} : #{array[start..fin]}:: #{new_array}\"\n j = 0\n (start..fin).each do |index|\n puts \"index: #{index}\"\n array[index] = new_array[j]\n j += 1\n end\n\n puts \"New array: #{array}\"\n puts \"new pivot index: #{array.index(pivot_value)}\"\n array.index(pivot_value)\n end",
"def divide_and_conquer(instructions, lower, upper)\n range = upper - lower\n instruction = instructions[0]\n tail = instructions[1..-1]\n\n case instruction\n when 'F', 'L'\n\n upper -= ((range + 1) / 2)\n return lower if tail.empty?\n when 'B', 'R'\n\n lower += ((range + 1) / 2)\n return upper if tail.empty?\n end\n\n divide_and_conquer(tail, lower, upper)\n end",
"def self_dividing_numbers(left, right)\n ans = []\n for i in left..right do \n if is_self_divided(i)\n ans << i\n end\n end\n ans\nend",
"def partition(ia, left, h)\n piv = ia[h] #choose the pivot as the furthest value\n i = left - 1 #set i to the index of the lowest value\n temp = 0 #temporary swapping variable\n\n for j in left..(h-1) #for j goes from low to high index..\n if(ia[j] < piv) #if the current value that we are looking at is les than the pivot...\n i += 1 #add one to the lowest position counter...\n\n #swap those two values\n ia[i],ia[j] = ia[j],ia[i]\n\tend\n end\n #swap so partition is in the middle\n ia[i+1],ia[h] = ia[h],ia[i+1]\n\n return (i+1)\nend",
"def quickSortHelper(ia, left, h)\n if (left < h)\n p = partition(ia, left, h) #get partition index of the array\n quickSortHelper(ia, left, p - 1) #sort from low to partition index -1\n quickSortHelper(ia, p + 1, h) #sort from p + 1 to high\n end\nend",
"def partition(a,l,r)\n pivot = a[r]\n i = l\n p_index = l\n\n while i < r\n if a[i] <= pivot\n temp = a[i]\n a[i] = a[p_index]\n a[p_index] = temp\n p_index += 1\n end\n i += 1\n end\n temp = a[p_index]\n a[p_index] = a[r]\n a[r] = temp\n return p_index\nend",
"def each_preorder(proc)\n proc.call(@value1)\n proc.call(@value2) if @type == 3\n @left.each_preorder(proc) if @left\n @mid.each_preorder(proc) if @mid\n @right.each_preorder(proc) if @type == 3 && @right\n end",
"def self_dividing_numbers(left, right)\n result_array = []\n\n (left..right).each do |i|\n arr = array_of_digits(i)\n\n self_dividing = true\n arr.length.times do |digit|\n if arr[digit] == 0\n self_dividing = false\n else\n self_dividing = false if i % arr[digit] != 0\n end\n end\n result_array << i if self_dividing\n end\n\n result_array\nend",
"def remainder(p0) end",
"def partition(arr, start, e)\n pivot = arr[e - 1]\n p_index = i = start\n \n while i < e - 1\n if arr[i] < pivot\n arr[i], arr[p_index] = arr[p_index], arr[i]\n p_index += 1\n end\n i += 1\n end\n arr[p_index], arr[e - 1] = arr[e - 1], arr[p_index]\n p_index\nend",
"def partition_unary(function)\n operand = function.operand\n @left &= function if @left_header.include?(operand)\n @right &= function if @right_header.include?(operand)\n end",
"def partition(arr, n)\n\nend",
"def divide(ary)\n left = ary.take(ary.count/2)\n right = ary - left\n if left.count > 1\n divide(left)\n divide(right) \n end\n\n if left.count == 1\n @final_ary.push(left)\n end\n\n if right.count == 1\n @final_ary.push(right)\n end\n\n if @final_ary.count == ary.count * 2\n merge(@final_ary, 0)\n p @final_ary\n end\n\n end",
"def partition_private(leftmost_index, rightmost_index)\n i = leftmost_index + 1\n pivot = self[leftmost_index] # the pivot can be chosen a number of different ways\n j = i\n while j <= rightmost_index\n # if the value is less than the pivot value, go search\n if self[j] < pivot\n self[i], self[j] = self[j], self[i]\n i += 1\n end\n j += 1\n end\n # puts the pivot into the correctly sorted area\n self[leftmost_index], self[i - 1] = self[i - 1], self[leftmost_index]\n i - 1\n end",
"def matrix_partitioner(mat)\n n = mat.size-1\n n_half = mat.size/2\n\n m11 = (0..n_half-1).map { |x| mat[x][0..n_half-1] }\n m12 = (0..n_half-1).map { |x| mat[x][n_half..n] }\n\n m21 = (n_half..n).map { |x| mat[x][0..n_half-1] }\n m22 = (n_half..n).map { |x| mat[x][n_half..n] }\n [m11, m12, m21, m22]\nend",
"def partition(collection, pivot)\n index = 0\n\n while index < pivot\n if collection[index] > collection[pivot]\n temp = collection[index]\n collection = shift(index, pivot, collection)\n collection[pivot] = temp\n pivot -= 1\n next\n end\n index += 1\n end\nend",
"def partition_using_sub_arrays(array, lower, higher)\n pivot = array[higher]\n p_index = lower\n \n i = lower\n while i < higher\n if array[i] <= pivot\n swap(array, i, p_index)\n p_index += 1\n end\n i += 1\n end\n swap(array, p_index, higher)\n\n return p_index\nend",
"def partition_if\r\n pass, fail = [], []\r\n each do |value|\r\n result = yield(value)\r\n if result then pass.push(value)\r\n else fail.push(value)\r\n end\r\n end\r\n return pass, fail\r\n end",
"def self_dividing_numbers(left, right)\n result = []\n i = left\n while i <= right #while i is smaller than right bound\n str = i.to_s #converts all int to string\n j = 0\n c = 0\n while j < str.length\n if str[j].to_i == 0\n break\n elsif i % str[j].to_i == 0\n c += 1\n end\n j+= 1\n end\n if c == str.length\n result.push(i)\n end\n i += 1\n end\n return result\nend",
"def partition(list, left, right, pindex)\n pvalue = list[pindex]\n swap(list, pindex, right)\n sindex = left\n for i in left .. right-1\n\tif list[i] <= pvalue\n\t swap(list, sindex, i)\n\t sindex = sindex + 1\n\tend\n end\n swap(list, right, sindex)\n return sindex\n end",
"def quick_sort (arr, left, right)\n arr_index = partition(arr, left, right)\n if left < arr_index - 1 # sort left half\n quick_sort(arr, left, arr_index - 1)\n end\n\n if arr_index < right # sort right half\n quick_sort(arr, arr_index, right)\n end\n\n # if left < arr_index && arr_index < right\n # puts \"arr: #{arr}\"\n # arr\n # end\n\nend",
"def partitionize(array)\r\n p = Array.new\r\n\r\n array.each_with_index do |x, i|\r\n if i == 0 || x.exercise_id != array[i-1].exercise_id\r\n p << Array.new\r\n end\r\n p.last << x\r\n end\r\n p\r\n end",
"def quicksort(list, left, right)\n # Checks if the left array item is bigger than the right array item\n if left < right\n # Sends the items for inspection and splitting them up in 2 arrays\n switch = partition(list, left, right)\n # Recursive function to make sure it does all the elements\n quicksort(list, left, switch-1)\n quicksort(list, switch+1, right)\n end\nend",
"def integer_partitions(pArray, p=0)\n if p==pArray.length-1\n 1\n else\n self >= 0 ? (self - pArray[p]).integer_partitions(pArray ,p) + self.integer_partitions(pArray,p+1) : 0\n end\n end",
"def partition(array, low, high)\n middle = (high + low ) / 2\n pivot = array[middle] # choose middle element as pivot\n # SWAP MIDDLE TO END\n array[middle], array[high] = array[high], array[middle]\n\n pivot_index = high # store index of pivot\n i = low\n\n while i < pivot_index\n if array[i] <= pivot\n i += 1\n next\n end\n\n before_pivot = pivot_index - 1\n array[i], array[before_pivot] = array[before_pivot], array[i]\n pivot_index -= 1\n end\n # SWAP ONCE AT END OF LOOP TO PUT PIVOT IN CORRECT LOCATION\n array[pivot_index], array[high] = array[high], array[pivot_index]\n pivot_index\nend",
"def partition(array)\n # write your code here\n first = array[0]\n right = []\n left = []\n \n for i in 1..(array.length - 1)\n if first > array[i] \n left << array[i] \n else \n right << array[i]\n end\n end\n left + [first] + right\n \n end",
"def partition_list()\nend",
"def findPermutationsBefore(noToPermutate, availablePrecedingLetters,\n multiLetterDivisor) \n return (getFactorial(noToPermutate-1) * availablePrecedingLetters) / (multiLetterDivisor)\n end",
"def qs_partition(array, beg_index, end_index)\n # current_index starts the subarray with larger numbers than the pivot\n current_index = beg_index\n i = beg_index\n while i < end_index\n if array[i] <= array[end_index]\n qs_swap(array, i, current_index)\n current_index += 1\n end\n i += 1\n end\n # after this qs_swap all of the elements before the pivot will be smaller and\n # after the pivot larger\n qs_swap(array, end_index, current_index)\n\n return current_index\n end",
"def initialize(predicate, left_header, right_header)\n @left = @right = @remainder = TAUTOLOGY\n\n @left_header = left_header\n @right_header = right_header\n\n partition(predicate)\n end",
"def partition(array, num)\n less = []\n more = []\n array.each do |n|\n if n >= num\n more << n\n else\n less << n\n end\n end\n \n [less, more]\nend",
"def even_split?(num, by)\n num % by == 0\nend",
"def matrix_partitioner(mat)\n n = mat.size-1\n n_half = mat.size/2\n\n m11 = (0..n_half-1).map { |x| mat[x][0..n_half-1] }\n m12 = (0..n_half-1).map { |x| mat[x][n_half..n] }\n\n m21 = (n_half..n).map { |x| mat[x][0..n_half-1] }\n m22 = (n_half..n).map { |x| mat[x][n_half..n] }\n [m11, m12, m21, m22]\n end",
"def partition(ary, left, right, pivot_i)\n\n left = 0\n right = ary.length - 1\n\n pivot = ary[pivot_i]\n\n # Move pivot to the end of ary\n ary[pivot_i], ary[right] = ary[right], ary[pivot_i]\n\n # All values <= pivot moved to front of ary\n # Pivot inserted after them\n store = left\n (left...right).each do |i|\n if ary[i] <= pivot\n ary[i], ary[store] = ary[store], ary[i]\n store += 1\n end\n end\n\n ary[store], ary[right] = ary[right], ary[store]\n store\n end",
"def div_h_p_nr(a,b)\n p = 0\n\n @bits.times do\n if p < 0\n # (i-a) shift combined pa register left one bit\n pa = ((p<<@bits)|a)<<1\n # (ii-a) p=p+b\n a = pa & @mA\n p = signed((pa & @mP) >> @bits)\n p += b\n else\n # (i-b) shift combined pa register left one bit\n pa = ((p<<@bits)|a)<<1\n # (ii-b) p=p-b\n a = pa & @mA\n p = signed((pa & @mP) >> @bits)\n p -= b\n if (p < 0)\n# Tests pass if the following is uncommented\n# # (iv) restore p\n# p += b\n else\n # (iii) if p >= 0\n a |= 1\n end\n end\n end\n # FIXME - need a test case that exercises this last step\n if p < 0\n p += b\n end\n [lo(a),lo(p)]\n end",
"def kochleft\n v = finish - start\n v /= 3\n v + start\n end",
"def sortById(arr, left, right)\r\n if left < right\r\n \r\n pi = partition(arr, left, right)\r\n sortById(arr, left, pi - 1)\r\n sortById(arr, pi + 1, right)\r\n end\r\n\r\n return arr\r\nend",
"def partition (array, from, to)\n\t#set pivot to end of array\n\tpivot = array[to]\n\t#set pIndex to beginning of array\n\tpIndex = from\n\t#loop through from the beginning of array\n\tfor i in from..to-1\n\t\t#if element at i < pivot then swap \n\t\tif array[i] <= pivot\n\t\t\t#swap element at index i with pIndex\n\t\t\tarray[i], array[pIndex] = array[pIndex], array[i]\n\t\t\tpIndex += 1\n\t\tend\n\tend\n\t#last swap pivot with element at pIndex (dividing an array into two arrays for quicksort recursion)\n\tarray[to], array[pIndex] = array[pIndex], array[to]\n\treturn pIndex\nend",
"def spec_prob prob, num_probs\n count = 0\n pages = []\n\n num_probs.each do |x|\n num = x / prob\n leftover = x % prob\n if x >= prob\n num.times{ pages.push(prob) }\n end\n if leftover != 0\n pages.push(leftover)\n end\n end\n\n # p num_probs\n # p pages\n\n the_pages = []\n num_probs.each do |x|\n pr = (1..x).to_a\n the_pages.push(pr)\n end\n\n the_pages.flatten!.reverse!\n # p the_pages\n\n pages_to_probs = []\n\n pages.each_with_index do |x, i|\n page = the_pages.pop(x)\n pages_to_probs << page\n end\n\n # p pages_to_probs\n\n pages_to_probs.each_with_index do |x,i|\n if x.include?(i+1)\n count += 1\n end\n end\n\n p count\n\nend",
"def saveThePrisoner(n, m, s)\n mod = (m % n == 0) ? n : (m % n)\n return ((mod + s -1) % n == 0) ? n : (mod + s -1) % n\n\nend",
"def divmod(p0) end",
"def saveThePrisoner(n, m, s)\n res = ((m - 1) + s) % n\n res == 0 ? n : res \nend",
"def divisible_numbers(arr)\n n = arr.size\n (0...n).each do |x|\n a = arr[x]\n ((x+1)...n).each do |y|\n b = arr[y]\n z = [a,b].sort\n return z if z[1] % z[0] == 0\n end\n end\nend",
"def process(n)\n foundpart = 0\n parts = []\n for i in 0..n-1 do # init participants ary\n parts.push 1\n end\n infolog {\"Starting, num-parts=#{n}\"}\n round = 0\n finished = false\n while !finished and round < @maxrounds\n round += 1\n numparts = parts.select{|it| it>0}.size\n infolog {\"ROUND ##{round}: num-parts=#{numparts}\"}\n deblog {\" parts=#{parts}\"}\n for i in 0..n-1 do\n if parts[i] > 0 and !finished\n for j in i+1..i+n do\n k = j % n\n #tracelog {\"k=#{k}\"}\n if parts[k] > 0\n parts[i] += parts[k]\n deblog {\"part##{i} steals from part#{k}: #{parts[k]} => #{parts[i]}\"}\n parts[k] = 0\n if parts[i] == n\n infolog {\"FINISHED at round##{round}, participant=#{i+1}\"}\n foundpart = i+1\n finished = true\n end\n break\n end\n end\n else\n tracelog {\"part##{i} has nothing, is skipped.\"} unless finished\n end\n end\n end\n foundpart\nend",
"def partition_points(points)\n points.sort_by! {|x| x[0]} #why I think my algorithm needs to be nlogn\n return points.in_groups(2)\nend",
"def problem_76\n return 100.partitions - 1\nend",
"def partition(cv, fv, bs, cp)\n # best cut point\n cp_best = nil\n \n # binary subset at the best cut point\n cv1_best, cv2_best = nil, nil\n fv1_best, fv2_best = nil, nil\n bs1_best, bs2_best = nil, nil\n \n # best information gain\n gain_best = -100.0\n ent_best = -100.0\n ent1_best = -100.0\n ent2_best = -100.0\n \n # try each potential cut point\n bs.each do |b|\n # binary split\n cv1_try, cv2_try, fv1_try, fv2_try, bs1_try, bs2_try = \n binary_split(cv, fv, bs, b)\n \n # gain for this cut point\n ent_try = get_marginal_entropy(cv)\n ent1_try = get_marginal_entropy(cv1_try)\n ent2_try = get_marginal_entropy(cv2_try)\n gain_try = ent_try - \n (cv1_try.size.to_f/cv.size) * ent1_try - \n (cv2_try.size.to_f/cv.size) * ent2_try\n \n #pp gain_try\n if gain_try > gain_best\n cp_best = b\n cv1_best, cv2_best = cv1_try, cv2_try\n fv1_best, fv2_best = fv1_try, fv2_try\n bs1_best, bs2_best = bs1_try, bs2_try\n \n gain_best = gain_try\n ent_best = ent_try\n ent1_best, ent2_best = ent1_try, ent2_try\n end\n end \n \n # to cut or not to cut?\n #\n # Gain(A,T;S) > 1/N * log2(N-1) + 1/N * delta(A,T;S)\n if cp_best\n n = cv.size.to_f\n k = cv.uniq.size.to_f\n k1 = cv1_best.uniq.size.to_f\n k2 = cv2_best.uniq.size.to_f\n delta = Math.log2(3**k-2)-(k*ent_best - k1*ent1_best - k2*ent2_best)\n \n # accept cut point\n if gain_best > (Math.log2(n-1)/n + delta/n)\n # a: record cut point\n cp << cp_best\n \n # b: recursively call on subset\n partition(cv1_best, fv1_best, bs1_best, cp)\n partition(cv2_best, fv2_best, bs2_best, cp)\n end\n end\n end",
"def three_way_partition(array)\n lo = 0\n mid = 0\n hi = array.size - 1\n while mid <= hi\n val = array[mid]\n case val\n when 0\n array[lo], array[mid] = array[mid],array[lo]\n lo += 1\n mid += 1\n when 1\n mid += 1\n when 2\n array[mid], array[hi] = array[hi], array[mid] \n hi -= 1\n end\n end\n array\nend",
"def fold_left_into_mid\n @mid.shift_right\n @mid.type, @mid.value1, @mid.left = 3, @value1, @left.left\n shift_left\n @type = 2\n end",
"def greedy1_initial_alt2!(remaining_partitions)\n\n virtual_remaining_partitions = DeepClone.clone remaining_partitions\n\n sites_in_current_partition = 0\n # Fill each bin starting with the least filled\n self.each_with_index do |bin, bin_index|\n\n free_space = (@operations_lower_bound - bin.size)\n\n # condition can be equal since the first remaining partition might be split\n dropped_partitions = if virtual_remaining_partitions.first.op_optimized == free_space || (virtual_remaining_partitions.size == 1 && virtual_remaining_partitions.first.op_optimized <= free_space)\n virtual_remaining_partitions.drop!(1)\n sites_in_current_partition = 0\n elsif virtual_remaining_partitions.first.op_optimized < free_space\n partition = virtual_remaining_partitions.drop!(1).first\n sites_in_current_partition = virtual_remaining_partitions.first.sites.size\n space_per_site = (virtual_remaining_partitions.first.op_optimized / sites_in_current_partition).floor\n [partition,\n virtual_remaining_partitions.drop_sites!(((free_space - partition.op_optimized).to_f/space_per_site).ceil, compute = false)]\n else\n sites_in_current_partition = virtual_remaining_partitions.first.sites.size if sites_in_current_partition == 0\n space_per_site = (virtual_remaining_partitions.first.op_optimized / sites_in_current_partition).floor\n virtual_remaining_partitions.drop_sites!((free_space.to_f/space_per_site).ceil, compute = false)\n end\n\n # Phase 2: Add site in the middle of each partition to the bin\n dropped_partitions.each do |partition|\n # Get site in the middle of partition\n mid_site = partition.sites[partition.sites.size / 2]\n\n # Actual assignment of site\n dropped_partition = remaining_partitions.list[partition.name].drop_specific_site!(mid_site)\n bin.add!([dropped_partition])\n end\n end\n\n remaining_partitions\n end",
"def partition(tracks)\n track_count = tracks.size\n track_numbers = (0...track_count).to_a\n half = track_count / 2.0\n half_rounded = half.round\n range_one = 0...(half_rounded.pred)\n range_two = (half_rounded.pred)...(track_count.pred)\n [tracks.slice(range_one), tracks.slice(range_two)].reject(&:nil?)\n end",
"def divisible_by_remaining_odd_numbers?(n)\n potential_divisors = (3..Math.sqrt(n)).step(2).to_a\n divisible = false\n potential_divisors.each do |x|\n if n % x != 0\n potential_divisors.delete_if { |y| y % x == 0 }\n else\n divisible = true\n potential_divisors = []\n end\n end\n\n divisible\n\nend",
"def recursive_pentomino(grid, piece_holder, placed_pieces, check_ptr_addr)\n tmp = find_first_empty_cell(grid, check_ptr_addr)\n checkX = tmp % grid.width\n checkY = tmp / grid.width\n insX = checkX\n insY = checkY\n pieces = piece_holder.pieces\n \n while(insX < grid.width)\n pieces.each do |piece|\n if(!piece.placed)\n piece.variants.each do |variant|\n #puts \"--------\"\n #variant.printVariant\n #puts \"can_place_to(#{insX}, #{insY})? #{grid.can_place?(variant,insX,insY)}\"\n \n if(grid.can_place?(variant, insX, insY))\n g1 = grid.clone\n g1.place(variant, insX, insY)\n piece_holder.set_used(piece)\n return g1 if(placed_pieces + 1 == pieces.count)\n result = recursive_pentomino(g1, piece_holder, placed_pieces + 1, checkY * grid.width + checkX)\n if(result == nil)\n piece_holder.set_unused(piece)\n else\n return result\n end\n end #end if\n end #end variants.each\n end #end if\n end #end pieces.each\n insX = insX + 1\n return nil if(insX - checkX > piece_holder.max_width) # there is no piece, which could cover the gap between insX and checkX.\n end #end while\n return nil\n end",
"def step\n newHead = [head.first,head.last]\n case direction\n when :left\n newHead[1] -= 1\n when :right\n newHead[1] += 1\n when :up\n newHead[0] -= 1\n when :down\n newHead[0] += 1\n end\n parts.unshift(newHead)\n parts.pop\n end",
"def partition(arr,low,high)\n left = low\n right = high\n iPivot = low+(high-low)/2\n pivot = arr[iPivot]\n # puts \"iPivot: #{iPivot} pivot: #{pivot}\"\n while left < right do\n while arr[left] < pivot do\n left += 1\n end \n while arr[right] > pivot do\n right -= 1\n end\n # puts \"left: #{left} right: #{right}\"\n if arr[left] > arr[right] then\n arr[left],arr[right] = arr[right],arr[left]\n end\n end\n # p arr\n return arr.index(pivot)\n end",
"def quick_sort(array, &prc)\n return array if array.length <= 1\n prc ||= Proc.new { |el1, el2| el1 - el2 }\n\n part_idx = array.length / 2\n part_val = array[part_idx]\n\n left = []\n right = []\n\n array.each_with_index do |el, idx|\n next if idx == part_idx\n prc.call(el, part_val) <= 0 ? left << el : right << el\n end\n\n quick_sort(left, &prc) + [part_val] + quick_sort(right, &prc)\nend",
"def pre_divide; end",
"def partition(array, first, last)\n pivot = array[last]\n pIndex = first\n i = first\n while i < last\n if array[i].to_i <= pivot.to_i\n array[i], array[pIndex] = array[pIndex], array[i]\n pIndex += 1\n end\n i += 1\n end\n array[pIndex], array[last] = array[last], array[pIndex]\n return pIndex\n end",
"def partition(array, start_index = 0, finish_index = (array.size - 1))\n # if there is no subarray to sort, return\n return if start_index >= finish_index\n\n # choose the pivot to be the last element of the array\n pivot = array[finish_index]\n # left and right are going to be indices,\n # left for the element at the left of the pivot,\n # and right for the element at the right of the\n # pivot by the moment the pivot is placed where it should be\n left, right = nil, nil\n\n # iterate from the start index to the finish index\n (start_index...finish_index).each do |i|\n # if the element is less than the pivot value\n if array[i] < pivot\n # if there is a right index\n if right\n # swap the elements at the right index and the\n # current index\n array[right], array[i] = array[i], array[right]\n # the left index is now the right index\n left = right\n # the right index is the next element after itself\n right += 1\n else\n # if there is no right index, left is going to be the\n # current index\n left = i\n end\n else\n # if the element's value is greater than or equal to\n # the pivot's value\n if !right\n # if there is no right index, the right index is\n # the current index\n right = i\n end\n end\n end\n # if there is a right index, swap the pivot with the element at the\n # right index\n array[finish_index], array[right] = array[right], array[finish_index] if right\n # if the median was found, return\n return if array[0...(array.size / 2)].all? {|n| n < array[array.size / 2]}\n # partition the from the start index to the left index if there is a left\n # index\n partition(array, start_index, left) if left\n # partition from right's next index to the finish index if there is a right\n # index\n partition(array, right + 1, finish_index) if right\nend",
"def candidates(p)\n 1.upto(p-1) do |x|\n yield x if (x*x % p) == (x+1)\n end\nend",
"def evens_and_odds(arr)\r\n arr.partition{ |num| num.odd?}\r\nend",
"def possible_bipartition(dislikes)\n total_puppies = dislikes.length\n groups = {}\n queue = []\n\n total_puppies.times do |i|\n if !groups[i]\n queue.push(i)\n groups[i] = 1\n end\n\n while !queue.empty?\n current = queue.shift \n neighbors = dislikes[current]\n\n neighbors.each do |puppy|\n if !groups[puppy]\n queue.push(puppy)\n groups[puppy] = groups[current] * (-1)\n else\n if groups[puppy] == groups[current]\n return false\n end\n end\n end\n end\n end\n\n return true\nend",
"def possible_bipartition(dislikes)\n total_puppies = dislikes.length\n groups = {}\n stack = []\n\n total_puppies.times do |i|\n if !groups[i]\n stack.push(i)\n groups[i] = 1\n end\n\n while !stack.empty?\n current = stack.pop \n neighbors = dislikes[current]\n\n neighbors.each do |puppy|\n if !groups[puppy]\n stack.push(puppy)\n groups[puppy] = groups[current] * (-1)\n else\n if groups[puppy] == groups[current]\n return false\n end\n end\n end\n end\n end\n\n return true\nend",
"def modulo(p0) end",
"def equal_split?(nums)\n total = nums.inject(0, :+)\n return unless total % 2 == 0\n i = 0\n potential_half = 0\n while i < nums.length\n potential_half += nums[i]\n total -= nums[i]\n break if total == potential_half\n i += 1\n end\n if total == potential_half\n # Array.take returns the first x values of an array, whereas Array.drop\n # returns the rest of an array, after removing x values. We use i + 1\n # due to zero-indexing.\n print [nums.take(i + 1), nums.drop(i + 1)]\n else\n print 'Not possible to split'\n end\nend",
"def caculate_part left, right\n # don't use ellipsis if there's no spaces between them\n ellipsis = !left.empty? && (left.last + 1) == right.first ?\n [] : [setting[:ellipsis]]\n\n part = left + ellipsis + right\n\n # clean up overlap and remove '...' if\n part.delete(setting[:ellipsis]) if\n part.uniq! || # there's overlap\n part.size == 1 # no pages there\n\n part\n end",
"def optimize\n left_restriction.send(relation_method, right_restriction).restrict(partition.remainder)\n end",
"def run_til_none_left_to_run(test_number, start_set)\n r = run_recursive_loop { divide_and_find_prime_results(test_number,start_set) }\n puts \"#{@count.to_s} Wave TEST_NUMBER: #{test_number.to_s}\\nRESULTS SET: #{r['set'].inspect}\\nPrime Factors: #{r['prime_factors'].inspect}\"\nend",
"def partition list, x\n # TODO implement size property in list class\n cur = list.head\n size = 0\n while cur != nil\n size += 1\n cur = cur.nxt\n end\n\n cur = list.head\n i = 0\n while i < size\n mv = cur\n list.remove(i)\n if mv.node < x\n list.insert(mv.node, 0)\n else\n list.insert(mv.node, size - 1)\n end\n cur = cur.nxt\n i += 1\n end\n\n return list\nend",
"def divider sorted_arr, i=0, j=sorted_arr.size-1, left_sum = 0, right_sum = 0\n\n\t\n\treturn 'No' if j<=i\n\t\n\tright_sum += sorted_arr[j]\n\n\twhile left_sum < right_sum\n\t\tleft_sum += sorted_arr[i]\n\t\ti +=1\n\tend\n\tif left_sum == right_sum\n\t\treturn 'Yes' if( sorted_arr[i] == sorted_arr[j-1] || (i == j && sorted_arr[i-1]+1<sorted_arr[j])) \t\n\tend\n\n\tdivider(sorted_arr, i, j-1, left_sum, right_sum)\n\nend",
"def quicksort!(left_index, right_index)\r\n # Base case: the subarray has 0 or 1 elements:\r\n if right_index - left_index <= 0\r\n return\r\n end\r\n\r\n # Partition the range of elements and grab the index of the pivot:\r\n pivot_index = partition!(left_index, right_index)\r\n\r\n # Recursively call this quicksort! method on whatever \r\n # is to the left of the pivot:\r\n quicksort!(left_index, pivot_index - 1)\r\n\r\n # Recursively call this quicksort! method on whatever \r\n # is to the right of the pivot:\r\n quicksort!(pivot_index + 1, right_index)\r\nend",
"def partition q, optimal_length=10\n #debug \"searching for #{optimal_length}\"\n len = q.length\n index = i = j = len - 1\n m = (len/2).floor\n begin\n index = i\n #m = ((j+1)/2).floor\n to_crawl = get_uncrawled_list(q[0..i])\n #debug \"#{i} #{j} #{index} to_crawl: #{to_crawl.length} optimal: #{optimal_length}\"\n if to_crawl.length < optimal_length\n i = i + m\n elsif to_crawl.length > optimal_length\n j = i\n i = i - m\n else\n j = i\n end\n m = ((j-i+1)/2).floor\n end while i < j\n info \"Found ya! #{index}\"\n index + 1 # Array index starts from 0\n end",
"def part2(line)\n numbers_str = line.chomp.split()\n numbers = numbers_str.map(&:to_i).sort\n\n # Start from the end\n i = numbers.size - 1\n\n while i > 0\n j = 0\n while j < i\n return numbers[i] / numbers[j] if numbers[i] % numbers[j] == 0\n j = j + 1\n end\n i = i - 1\n end\n return 0\nend",
"def mof(i, p)\n arr = []\n x_swap = []\n (0..(p-2)).each do |x|\n arr.push((i**x) % p)\n end\n (1..(p-1)).each do |n|\n x_swap.push((arr.index {|item| n == item }) % 12 )\n end\n return x_swap\nend",
"def preparation\n return unless inspect_duplicates(@hidden + @open)\n @hidden = my_split(@hidden)\n @open = my_split(@open)\n end"
] | [
"0.61993235",
"0.6025713",
"0.5974142",
"0.5973679",
"0.59536797",
"0.5898489",
"0.5894226",
"0.58745766",
"0.57803893",
"0.5762215",
"0.5727054",
"0.5710884",
"0.56745017",
"0.5642036",
"0.5634182",
"0.5609777",
"0.5576813",
"0.55484533",
"0.5542833",
"0.55409503",
"0.553086",
"0.5485839",
"0.54844266",
"0.5467965",
"0.5466034",
"0.54525375",
"0.5451537",
"0.54407984",
"0.54177594",
"0.5395133",
"0.53688943",
"0.53652215",
"0.5332919",
"0.5308769",
"0.5299717",
"0.52963555",
"0.529543",
"0.52790457",
"0.52735156",
"0.5247712",
"0.523968",
"0.5235322",
"0.5229199",
"0.52127355",
"0.52001077",
"0.5195448",
"0.51527405",
"0.5151314",
"0.5149075",
"0.51437706",
"0.5137785",
"0.5133386",
"0.51086617",
"0.50932425",
"0.5087405",
"0.5066092",
"0.504704",
"0.50339925",
"0.50201535",
"0.5017461",
"0.5013264",
"0.50066483",
"0.49995226",
"0.49981508",
"0.49952874",
"0.49913788",
"0.49908534",
"0.49899724",
"0.49855602",
"0.49848852",
"0.4983423",
"0.49752158",
"0.49673328",
"0.49557796",
"0.49519897",
"0.49504828",
"0.49469805",
"0.49432442",
"0.49277547",
"0.4922106",
"0.49216038",
"0.49202845",
"0.49196687",
"0.4918763",
"0.48997697",
"0.48885256",
"0.48665512",
"0.48650008",
"0.48596948",
"0.48522833",
"0.48408574",
"0.48372313",
"0.48321855",
"0.4830086",
"0.48266584",
"0.48167893",
"0.48163354",
"0.4815906",
"0.4811306",
"0.48079014"
] | 0.7598666 | 0 |
Yield each operand in the predicate recursively | def each_operand(predicate, &block)
case predicate
when Axiom::Function::Connective::Disjunction then each_operand(predicate.inverse.optimize, &block)
when Axiom::Function::Connective::Conjunction then each_conjunction(predicate, &block)
else
block.call(predicate)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each\n [@lval,@rval,@operator].each { |child| yield child }\n end",
"def generate_expressions(digits, allow_permutations, stats) \n digit_sets = allow_permutations ? digits.permutation : [digits]\n digit_sets_examined = 0\n stats.setProgressMax(digit_sets.count) if allow_permutations\n\n digit_sets.each do |operands|\n\n # These generators are hard to understand.\n # There really should be a more compact notation for this, which then gets intepreted to generate\n # the loop structure. And some systematic way of ensuring we generate all types of tree.\n # I *think* I have them all.\n\n # I expect to generate 25,000,000 expressions. \n # For each digit there are (typically) 5 monadic expressions\n # so the set of all binary expressions over two digits is about 4 * 5 * 5^2 ==> 500\n # binary expressions on those binary expressions: 4 * 5 * 500**2\n # 5 shapes of trees, thus\n # 5 * (4 * 5 * (4 * 5 * 5**2)**2)\n # The real count is higher, since monadic repeating decimal operator applies to digit 9\n\n d = operands.map{|digit| monadic_expressions_over(Digit.new(digit))}\n\n expressions_over(d[0], d[1]).each {|b01|\n # ((0 1) (2 3))\n expressions_over(d[2], d[3]).each {|b23|\n expressions_over(b01, b23).each {|expr| yield(expr)}}\n \n # (((0 1) 2) 3)\n expressions_over(b01, d[2]).each {|b012|\n expressions_over(b012, d[3]).each {|expr| yield(expr)}}\n }\n\n expressions_over(d[1], d[2]).each {|b12|\n\n # ((0 (1 2)) 3)\n expressions_over(d[0], b12).each {|b012|\n expressions_over(b012, d[3]).each {|expr| yield(expr)}}\n\n # (0 ((1 2) 3))\n expressions_over(b12, d[3]).each {|b123|\n expressions_over(d[0], b123).each {|expr| yield(expr)}}\n }\n\n # (0 (1 (2 3)))\n expressions_over(d[2], d[3]).each {|b23|\n expressions_over(d[1], b23).each {|b123|\n expressions_over(d[0], b123).each {|expr| yield(expr)}}}\n\n if allow_permutations\n digit_sets_examined += 1\n stats.setProgress(digit_sets_examined)\n end\n end\nend",
"def each_term(start_instr = nil) \n cur_expr = @parse_tree\n \n if start_instr\n cur_expr = start_instr\n end\n \n while true\n if cur_expr[:term]\n yield cur_expr[:term]\n end\n if cur_expr[:rhs]\n cur_expr = cur_expr[:rhs]\n else\n break\n end\n end\n end",
"def each_logical_path(*args, &block)\n return to_enum(__method__, *args) unless block_given?\n\n filters = args.flatten.map { |arg| Manifest.compile_match_filter(arg) }\n logical_paths.each do |a, b|\n if filters.any? { |f| f.call(a, b) }\n if block.arity == 2\n yield a, b\n else\n yield a\n end\n end\n end\n\n nil\n end",
"def each_logical_path(*args, &block)\n return to_enum(__method__, *args) unless block_given?\n\n filters = args.flatten.map { |arg| Manifest.compile_match_filter(arg) }\n logical_paths.each do |a, b|\n if filters.any? { |f| f.call(a, b) }\n if block.arity == 2\n yield a, b\n else\n yield a\n end\n end\n end\n\n nil\n end",
"def process_iter(exp)\n if exp.first.last == :lambda\n process_lambda_iter exp\n else\n process_regular_iter exp\n end\n end",
"def each\n return enum_for(__method__) unless block_given?\n return if @head.nil?\n\n traverser = @head\n\n until traverser.nil?\n yield traverser\n traverser = traverser.next_node\n end\n end",
"def each\n return enum_for(__method__) unless block_given?\n return if @head.nil?\n\n traverser = @head\n\n until traverser.nil?\n yield traverser\n traverser = traverser.next_node\n end\n end",
"def each &block\n return enum_for(:each) unless block_given?\n @left.each(&block) if @left\n yield @value\n @right.each(&block) if @right\n nil\n end",
"def monadic_expressions_over(operand)\n [operand] + \n MONADIC_OPERATORS\n .select { |op| op.applies_to?(operand)}\n .map { |op| begin\n MonadicExpression.new(op, operand) \n rescue Noop\n nil\n rescue RangeError\n nil\n end \n }\n .reject(&:nil?)\nend",
"def walk\n 1.upto( self.map(&:abs).max ) do |mult|\n yield [ basis[0] * mult, basis[1] * mult ]\n end\n end",
"def each(&p)\n @left.each(&p)\n\tyield(@value)\n\[email protected](&p)\n end",
"def each_sexp\n self.each do |sexp|\n next unless Sexp === sexp\n\n yield sexp\n end\n end",
"def process_for(exp)\n receiver = exp.shift\n asgn = exp.shift\n block = exp.shift\n\n new_exp = [:iter,\n [:call, receiver, :each],\n asgn,\n block]\n\n process(new_exp)\n end",
"def expander\n Enumerator.new do |y|\n @elements.each do |elt|\n elt.kind_of?(AndExpr) ? elt.expander.each {|e| y << e } : y << elt\n end\n end\n end",
"def each\n return to_enum(:each) unless block_given?\n\n iter = from\n while iter <= to\n yield(op.call(iter))\n\n iter = unit.advance(iter)\n end\n end",
"def dereference operand\n @fisk.with_register do |tmp|\n @fisk.mov(tmp, operand)\n yield tmp\n end\n end",
"def children\n [@operand]\n end",
"def dfs\n yield self\n self.children.each do |child|\n next unless is_sexp?(child)\n case child[0]\n when Array\n child.each { |x| x.dfs { |y| yield y}}\n when ::Symbol\n child.dfs { |y| yield y }\n end\n end\n end",
"def deep_each(&block)\n self.each_sexp do |sexp|\n block[sexp]\n sexp.deep_each(&block)\n end\n end",
"def partial_eval\n item = nil\n loop do\n item = @iterator.next\n break unless item\n @stack << item\n if ['+', '-', '*', '/'].include?(item.to_s)\n left, right, op = @stack.pop(3)\n result = left.send(op, right)\n @stack << result\n return result\n end\n end\n end",
"def choose_concrete_expr(y, orig, list, fiber, i)\n if orig.size == i\n # when reach the terminateion of elements, yield a concrete expression\n y << AndExpr.new(*convert_cons_list_into_array(list))\n else\n # or-clause\n if orig[i].kind_of?(Enumerator)\n # create a new fiber\n _fiber = Fiber.new do\n loop do\n # rewind unreached enumerators\n orig.each_with_index do |e, ii|\n e.rewind if ii > i && e.kind_of?(Enumerator)\n end\n # choose next\n choose_concrete_expr(y, orig, [orig[i].next, list], _fiber, i+1)\n # retrun fiber loop\n Fiber.yield\n end\n end\n # fiber loop\n begin\n _fiber.transfer while true\n rescue FiberError => e\n fiber.transfer if fiber\n end\n else\n # other elements\n choose_concrete_expr(y, orig, [orig[i], list], fiber, i+1)\n end\n end\n end",
"def process_yield(exp)\n value = exp.shift\n\n str = without_result do\n want_expression do\n block_name() + \"(\" + (value ? process(value) : '') + \")\"\n end\n end\n resultify(str)\n end",
"def each(*args)\n current = @head\n index = 0\n if args.length.positive?\n until current.nil?\n args[0].call(current.value, index)\n current = current.next\n index += 1\n end\n else\n until current.nil?\n yield(current.value, index)\n current = current.next\n index += 1\n end\n end\n end",
"def each\n aux = @head\n while aux!=nil\n yield aux.value\n aux=aux.nest\n end\n end",
"def iterate(itr)\n @left.iterate(itr)\n @right.iterate(itr)\n end",
"def each_node(&block)\n block.call(@value)\n @left.each_node(&block) if @left\n @right.each_node(&block) if @right\n end",
"def iterate(itr)\n itr.call(@leaf)\n end",
"def print_operators(node)\n return if node == nil\n print_operators(node.left) #starts recursion -- go left\n if node.value.match(/\\+|\\-|\\/|\\%|\\*/) #if operators included\n print node.value + \" \" #print value of this node\n end\n print_operators(node.right) #recursion -- go right\nend",
"def run_recursive_loop &block\n results = yield\n return results\nend",
"def each_leaf!\n raise \"Method not yet written.\"\n\n self.each do |leaf|\n yield(leaf)\n end\n end",
"def each_condition_node\n @elements.each do |e|\n if e.condition_node?\n yield e\n else\n e.each_condition_node do |e_child|\n yield e_child\n end\n end\n end\n end",
"def each\n\n return unless block_given?\n\n exps = DataMapper.repository(@dm_repository) { DmExpression.all }\n\n exps.each do |de|\n fe = de.as_owfe_expression(self.application_context)\n yield(fe.fei, fe)\n end\n end",
"def reduce_simple_expression_1(_production, _range, _tokens, theChildren)\n reduce_binary_operator(theChildren)\n end",
"def each_nonterm(nonterm=nil)\n @rules.each do |_, rhs|\n nodes = rhs.select { |node| nonterm.nil? || node.value == nonterm }\n nodes.each { |node| yield node }\n end\n end",
"def each_descendant(include_self = false, &block)\n if block_given?\n\n block.call(self) if include_self\n\n operands.each do |operand|\n case operand\n when Array\n operand.each do |op|\n op.each_descendant(true, &block) if op.respond_to?(:each_descendant)\n end\n else\n operand.each_descendant(true, &block) if operand.respond_to?(:each_descendant)\n end\n end\n end\n enum_for(:each_descendant)\n end",
"def operators(node)\n return if node == nil\n operators(node.left)\n if node.left != nil || node.right != nil\n print node.value + \" \"\n end\n operators(node.right)\nend",
"def process_regular_iter(exp)\n iter = process exp.shift\n args = exp.shift\n body = exp.empty? ? nil : process(exp.shift)\n\n args = case args\n when 0 then\n ' ||'\n else\n a = process(args)[1..-2]\n a = \"|#{a}|\" unless a.empty?\n a\n end\n\n b, e = if iter == \"END\" then\n [ \"{\", \"}\" ]\n else\n [ \"do\", \"end\" ]\n end\n\n iter.sub!(/\\(\\)$/, '')\n\n # REFACTOR: ugh\n result = []\n # CUSTOM\n result << \"#{iter}{\"\n result << args\n if body then\n # CUSTOM\n result << body.strip\n else\n # CUSTOM\n result << ''\n end\n result << \"}\"\n result = result.join\n return result if result !~ /\\n/ and result.size < LINE_LENGTH\n\n result = []\n result << \"#{iter} #{b}\"\n result << args\n result << \"\\n\"\n if body then\n result << indent(body.strip)\n result << \"\\n\"\n end\n result << e\n result.join\n end",
"def process_iter exp\n process_default exp\n\n call = exp.block_call\n\n if call? call\n target = call.target\n method = call.method\n arg = exp.block_args.first_param\n block = exp.block\n\n # Check for e.g. Model.find.each do ... end\n if method == :each and arg and block and model = get_model_target(target)\n if arg.is_a? Symbol\n if model == target.target\n env[Sexp.new(:lvar, arg)] = Sexp.new(:call, model, :new)\n else\n env[Sexp.new(:lvar, arg)] = UNKNOWN_MODEL_CALL\n end\n\n process block if sexp? block\n end\n elsif FORM_METHODS.include? method\n if arg.is_a? Symbol\n env[Sexp.new(:lvar, arg)] = FORM_BUILDER_CALL\n\n process block if sexp? block\n end\n end\n end\n\n exp\n end",
"def each_predicate(&block)\n grouped_predicates_attributes.each do |namespace, predicates|\n predicates.each do |predicate, objects|\n block.call(namespace, predicate, objects.flatten)\n end\n end\n end",
"def each\n self.traverse_down { |node| yield(node) }\n end",
"def each\n return enum_for(:each) unless block_given?\n n = @head\n while n\n yield n.value\n n = n.next\n end\n end",
"def each\n return to_enum(__callee__) unless block_given?\n\n node = self\n loop do\n yield node\n break unless (node = node.next_node)\n end\n end",
"def each_subexp(include_root = true, &block)\n yield self if include_root\n each do |child|\n if child.is_a?(Sexp)\n child.each_subexp(&block)\n end\n end\n end",
"def each\n \n nodo = @head\n while nodo != nil\n \n yield nodo.value\n nodo = nodo.next\n \n end\n \n end",
"def process_iter(exp)\n call = exp.shift # the method call to which the iterator is passed\n params = exp.shift # arguments of the block\n code = exp.shift # the code block\n\n old_iter_dvars = @current_iter_dvars\n @current_iter_dvars = Set.new \n @block_whileloop_stack.push(:iter)\n \n # Get an argument name for the iterator function signature.\n arg_name = @model.encode_fresh_local_variable()\n\n fun_str = \"\"\n asgn_str = \"\"\n \n if params.nil? \n # Case 1: {}: Any number of arguments may be passed\n arity = -1\n fun_str << \"function(){\"\n elsif params == 0\n # Case 2: {||}: Zero arguments\n arity = 0\n fun_str << \"function(){\"\n elsif params.first == :masgn\n # Case 3: {|i,j|}: Multiple arguments (multiple assignment)\n arity = nil # |arity| >= 2 \n fun_str << \"function(#{arg_name}){\"\n\n # TODO: remove masgn_iter and instead put the corresponding logic\n # into yield!\n masgn_iter = @model.encode_globalattr(\"masgn_iter\")\n params << [:to_ary, [:special_to_ary, \"#{masgn_iter}(#{arg_name})\"]]\n want_expression(false) do\n without_result do\n asgn_str << process(params) \n end\n end\n else\n # Case 4: {|i|}: Single argument\n # TODO: warning if not exactly one argument is passed \n arity = 1\n fun_str << \"function(#{arg_name}){\"\n\n # we convert a single argument into a multiple assignment clause\n # with one argument.\n\n sasgn_iter = @model.encode_globalattr(\"sasgn_iter\")\n params << [:special_inline_js_value, \"#{arg_name}==null?#{@model.encode_nil}:#{arg_name}\"]\n\n want_expression(false) do\n without_result do\n asgn_str << process(params) \n end\n end\n end\n\n old_result_name = @result_name\n @result_name = nil\n\n block_str = \"\"\n want_expression(false) do\n want_result do\n block_str << process(code) if code\n end\n end\n\n # generate code for the variable declarations\n var_str = \"\"\n unless @current_iter_dvars.empty?\n var_str << \"var \"\n var_str << @current_iter_dvars.to_a.join(\",\")\n var_str << sep()\n end\n\n # declare and initialize the return value\n if @result_name\n var_str << \"var #{@result_name}=#{@model.encode_nil}#{sep()}\"\n end\n\n # NOTE: we don't need to initialize any dvar to nil, as \n # they can't be used before being assigned to (because\n # otherwise they are vcall's and not dynamic variables). \n\n str = fun_str + var_str + asgn_str + sep() + block_str\n str << \"#{sep()}return #{@result_name}\" if @result_name\n str << \"}\"\n\n put_iter(str)\n\n @result_name = old_result_name\n @current_iter_dvars = old_iter_dvars\n @block_whileloop_stack.pop || raise\n\n return process(call)\n end",
"def ops(node)\n if node.left.nil? || node.right.nil?\n return 1 if /[\\+\\-\\*\\%\\/\\.]/.match(node.value)\n else\n return (ops(node.left) + ops(node.right))\n end\nend",
"def process_iter(exp)\n begin\n type_sexp, call_sexp, arg_list_sexp, block_sexp = exp.map { |inner| \n process_inner_expr(inner) \n }\n if arg_list_sexp.nil? and (anaphor = direct_anaphor_reference_contained(prune(block_sexp)))\n #puts anaphor\n arg_list_sexp = s(:lasgn, anaphor)\n block_sexp = convert_anaphor_references(block_sexp, anaphor)\n end\n s(\n *[type_sexp, call_sexp, arg_list_sexp, block_sexp].map { |inner| \n process_inner_expr(inner) \n }\n )\n rescue Exception\n puts \"Exception for #{[type_sexp, call_sexp, arg_list_sexp, block_sexp].to_a.inspect}\"\n ensure\n exp.clear\n end\n end",
"def each(solutions: RDF::Query::Solutions(RDF::Query::Solution.new), &block)\n log_debug(\"(formula each)\") {SXP::Generator.string([self, solutions].to_sxp_bin)}\n\n # Yield statements by binding variables\n solutions.each do |solution|\n # Bind blank nodes to the solution when it doesn't contain a solution for an existential variable\n existential_vars.each do |var|\n solution[var.name] ||= RDF::Node.intern(var.name.to_s.sub(/^\\$+/, ''))\n end\n\n log_debug(\"(formula apply)\") {solution.to_sxp}\n # Yield each variable statement which is constant after applying solution\n log_depth do\n n3statements.each do |statement|\n terms = {}\n [:subject, :predicate, :object].each do |part|\n terms[part] = case o = statement.send(part)\n when RDF::Query::Variable\n if solution[o] && solution[o].formula?\n log_info(\"(formula from var form)\") {solution[o].graph_name.to_sxp}\n form_statements(solution[o], solution: solution, &block)\n else\n solution[o] || o\n end\n when RDF::N3::List\n o.variable? ? o.evaluate(solution.bindings, formulae: formulae) : o\n when RDF::N3::Algebra::Formula\n # uses the graph_name of the formula, and yields statements from the formula. No solutions are passed in.\n log_info(\"(formula from form)\") {o.graph_name.to_sxp}\n form_statements(o, solution: solution, &block)\n else\n o\n end\n end\n\n statement = RDF::Statement.from(terms)\n log_debug(\"(formula add)\") {statement.to_sxp}\n\n block.call(statement)\n end\n\n # statements from sub-operands\n sub_ops.each do |op|\n log_debug(\"(formula sub_op)\") {SXP::Generator.string [op, solution].to_sxp_bin}\n op.each(solutions: RDF::Query::Solutions(solution)) do |stmt|\n log_debug(\"(formula add from sub_op)\") {stmt.to_sxp}\n block.call(stmt)\n # Add statements for any term which is a formula\n stmt.to_a.select(&:node?).map {|n| formulae[n]}.compact.each do |ef|\n log_debug(\"(formula from form)\") {ef.graph_name.to_sxp}\n form_statements(ef, solution: solution, &block) \n end\n end\n end\n end\n end\n end",
"def multiply\n yield 10\n yield 75\n yield 879\nend",
"def each\n nodo=@tail\n while nodo != nil\n yield nodo.value\n nodo = nodo.next\n end\n end",
"def each(&proc)\n @subtrees.each(&proc)\n end",
"def foreach_filter\n curr_filter = @root_filter\n until curr_filter.nil?\n yield curr_filter\n curr_filter = curr_filter.next_filter\n end\n end",
"def each_conjunction(conjunction, &block)\n each_operand(conjunction.left, &block)\n each_operand(conjunction.right, &block)\n end",
"def process_iter(exp)\n Sexp.from_array([:iter, process(exp.shift), process(exp.shift), process(exp.shift)])\n end",
"def each(&block)\n return enum_for(:each) unless block_given?\n visit { |node| yield node }\n self\n end",
"def g_(acc,elt)\n elt/acc\nend",
"def each_recursive(&block)\n tree.each_recursive(&block)\n end",
"def Y\n lambda { |f| f.call(f) }.call(\n lambda do |g|\n yield(lambda {|*n| g.call(g).call(*n) })\n end)\nend",
"def each\n current_node = @head\n while current_node\n yield(current_node.value) if block_given?\n current_node = current_node.next\n end\n end",
"def process_iter(exp)\n call = exp.shift\n args = exp.shift\n block_method = exp.shift\n\n iterable = process call[1] # t(:call, lhs, :iterable, rhs)\n\n # t(:args, t(:array, of frees), t(:array, of statics))\n free_arg_exps = args[1]\n static_arg_exps = args[2]\n free_arg_exps.shift # :array\n static_arg_exps.shift # :array\n\n free_args = free_arg_exps.zip(static_arg_exps).map { |f,s| [process(f), process(s)] }\n\n out = []\n\n # save\n out.push(*free_args.map { |free,static| \"#{static} = #{free};\" })\n\n out << \"rb_iterate(rb_each, #{iterable}, #{block_method}, Qnil);\"\n\n # restore\n free_args.each do |free, static|\n out << \"#{free} = #{static};\"\n statics << \"static VALUE #{static};\"\n end\n\n return out.join(\"\\n\")\n end",
"def each_inorder(proc)\n @left.each_inorder(proc) if @left\n proc.call(@value1)\n @mid.each_inorder(proc) if @mid\n if @type == 3\n proc.call(@value2)\n @right.each_inorder(proc) if @right\n end\n end",
"def yield_statement\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 25 )\n return_value = YieldStatementReturnValue.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_literal99 = nil\n expression100 = nil\n\n tree_for_string_literal99 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 134:5: ^( 'yield' ( expression )? )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal99 = match( YIELD, TOKENS_FOLLOWING_YIELD_IN_yield_statement_745 )\n\n tree_for_string_literal99 = @adaptor.copy_node( string_literal99 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal99, root_1 )\n\n\n\n if @input.peek == DOWN\n match( DOWN, nil )\n # at line 134:16: ( expression )?\n alt_28 = 2\n look_28_0 = @input.peek( 1 )\n\n if ( look_28_0.between?( AMP, AMP_ASGN ) || look_28_0 == POST_DECR || look_28_0.between?( GEQ, AREF ) || look_28_0.between?( GREATER, HAT ) || look_28_0.between?( ARROW, HAT_ASGN ) || look_28_0 == ASGN || look_28_0 == REGEX || look_28_0 == IN || look_28_0 == INCR || look_28_0.between?( INSTANCEOF, RSHIFT3 ) || look_28_0 == RSHIFT3_ASGN || look_28_0 == RSHIFT_ASGN || look_28_0 == LEQ || look_28_0.between?( LESS, SLASH ) || look_28_0 == SLASH_ASGN || look_28_0.between?( STAR, DECR ) || look_28_0 == STAR_ASGN || look_28_0 == LSHIFT || look_28_0.between?( DELETE, THIS ) || look_28_0.between?( MINUS, TILDE ) || look_28_0.between?( MINUS_ASGN, MOD ) || look_28_0.between?( MOD_ASGN, TYPEOF ) || look_28_0.between?( NEQ, UMINUS ) || look_28_0.between?( NEQQ, UNDEFINED ) || look_28_0 == NEW || look_28_0 == NOT || look_28_0.between?( NULL, UPLUS ) || look_28_0 == OBJECT || look_28_0.between?( EQ, OR_ASGN ) || look_28_0 == FALSE || look_28_0 == PIPE || look_28_0 == PIPE_ASGN || look_28_0 == PLUS || look_28_0.between?( ID, DOC ) )\n alt_28 = 1\n end\n case alt_28\n when 1\n # at line 134:16: expression\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_yield_statement_747 )\n expression100 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression100.tree )\n\n\n end\n\n match( UP, nil )\n end\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__, 25 )\n\n end\n \n return return_value\n end",
"def traverse(include_self = false, &block)\n return enum_for(__method__, include_self) unless block_given?\n\n block.call(:enter, self, 0) if include_self\n\n each_with_index do |exp, index|\n if exp.terminal?\n block.call(:visit, exp, index)\n else\n block.call(:enter, exp, index)\n exp.traverse(&block)\n block.call(:exit, exp, index)\n end\n end\n\n block.call(:exit, self, 0) if include_self\n\n self\n end",
"def traverse(flag=nil,&op)\n\t\top.call(self)\n\t\tall_children_deep(flag).each do |c|\n\t\t\top.call(c)\n\t\tend\n\tend",
"def expr( path_stack, nodeset, context=nil )\n enter(:expr, path_stack, nodeset) if @debug\n return nodeset if path_stack.length == 0 || nodeset.length == 0\n while path_stack.length > 0\n trace(:while, path_stack, nodeset) if @debug\n if nodeset.length == 0\n path_stack.clear\n return []\n end\n op = path_stack.shift\n case op\n when :document\n first_raw_node = nodeset.first.raw_node\n nodeset = [XPathNode.new(first_raw_node.root_node, position: 1)]\n when :self\n nodeset = step(path_stack) do\n [nodeset]\n end\n when :child\n nodeset = step(path_stack) do\n child(nodeset)\n end\n when :literal\n trace(:literal, path_stack, nodeset) if @debug\n return path_stack.shift\n when :attribute\n nodeset = step(path_stack, any_type: :attribute) do\n nodesets = []\n nodeset.each do |node|\n raw_node = node.raw_node\n next unless raw_node.node_type == :element\n attributes = raw_node.attributes\n next if attributes.empty?\n nodesets << attributes.each_attribute.collect.with_index do |attribute, i|\n XPathNode.new(attribute, position: i + 1)\n end\n end\n nodesets\n end\n when :namespace\n pre_defined_namespaces = {\n \"xml\" => \"http://www.w3.org/XML/1998/namespace\",\n }\n nodeset = step(path_stack, any_type: :namespace) do\n nodesets = []\n nodeset.each do |node|\n raw_node = node.raw_node\n case raw_node.node_type\n when :element\n if @namespaces\n nodesets << pre_defined_namespaces.merge(@namespaces)\n else\n nodesets << pre_defined_namespaces.merge(raw_node.namespaces)\n end\n when :attribute\n if @namespaces\n nodesets << pre_defined_namespaces.merge(@namespaces)\n else\n nodesets << pre_defined_namespaces.merge(raw_node.element.namespaces)\n end\n end\n end\n nodesets\n end\n when :parent\n nodeset = step(path_stack) do\n nodesets = []\n nodeset.each do |node|\n raw_node = node.raw_node\n if raw_node.node_type == :attribute\n parent = raw_node.element\n else\n parent = raw_node.parent\n end\n nodesets << [XPathNode.new(parent, position: 1)] if parent\n end\n nodesets\n end\n when :ancestor\n nodeset = step(path_stack) do\n nodesets = []\n # new_nodes = {}\n nodeset.each do |node|\n raw_node = node.raw_node\n new_nodeset = []\n while raw_node.parent\n raw_node = raw_node.parent\n # next if new_nodes.key?(node)\n new_nodeset << XPathNode.new(raw_node,\n position: new_nodeset.size + 1)\n # new_nodes[node] = true\n end\n nodesets << new_nodeset unless new_nodeset.empty?\n end\n nodesets\n end\n when :ancestor_or_self\n nodeset = step(path_stack) do\n nodesets = []\n # new_nodes = {}\n nodeset.each do |node|\n raw_node = node.raw_node\n next unless raw_node.node_type == :element\n new_nodeset = [XPathNode.new(raw_node, position: 1)]\n # new_nodes[node] = true\n while raw_node.parent\n raw_node = raw_node.parent\n # next if new_nodes.key?(node)\n new_nodeset << XPathNode.new(raw_node,\n position: new_nodeset.size + 1)\n # new_nodes[node] = true\n end\n nodesets << new_nodeset unless new_nodeset.empty?\n end\n nodesets\n end\n when :descendant_or_self\n nodeset = step(path_stack) do\n descendant(nodeset, true)\n end\n when :descendant\n nodeset = step(path_stack) do\n descendant(nodeset, false)\n end\n when :following_sibling\n nodeset = step(path_stack) do\n nodesets = []\n nodeset.each do |node|\n raw_node = node.raw_node\n next unless raw_node.respond_to?(:parent)\n next if raw_node.parent.nil?\n all_siblings = raw_node.parent.children\n current_index = all_siblings.index(raw_node)\n following_siblings = all_siblings[(current_index + 1)..-1]\n next if following_siblings.empty?\n nodesets << following_siblings.collect.with_index do |sibling, i|\n XPathNode.new(sibling, position: i + 1)\n end\n end\n nodesets\n end\n when :preceding_sibling\n nodeset = step(path_stack, order: :reverse) do\n nodesets = []\n nodeset.each do |node|\n raw_node = node.raw_node\n next unless raw_node.respond_to?(:parent)\n next if raw_node.parent.nil?\n all_siblings = raw_node.parent.children\n current_index = all_siblings.index(raw_node)\n preceding_siblings = all_siblings[0, current_index].reverse\n next if preceding_siblings.empty?\n nodesets << preceding_siblings.collect.with_index do |sibling, i|\n XPathNode.new(sibling, position: i + 1)\n end\n end\n nodesets\n end\n when :preceding\n nodeset = step(path_stack, order: :reverse) do\n unnode(nodeset) do |node|\n preceding(node)\n end\n end\n when :following\n nodeset = step(path_stack) do\n unnode(nodeset) do |node|\n following(node)\n end\n end\n when :variable\n var_name = path_stack.shift\n return [@variables[var_name]]\n\n when :eq, :neq, :lt, :lteq, :gt, :gteq\n left = expr( path_stack.shift, nodeset.dup, context )\n right = expr( path_stack.shift, nodeset.dup, context )\n res = equality_relational_compare( left, op, right )\n trace(op, left, right, res) if @debug\n return res\n\n when :or\n left = expr(path_stack.shift, nodeset.dup, context)\n return true if Functions.boolean(left)\n right = expr(path_stack.shift, nodeset.dup, context)\n return Functions.boolean(right)\n\n when :and\n left = expr(path_stack.shift, nodeset.dup, context)\n return false unless Functions.boolean(left)\n right = expr(path_stack.shift, nodeset.dup, context)\n return Functions.boolean(right)\n\n when :div, :mod, :mult, :plus, :minus\n left = expr(path_stack.shift, nodeset, context)\n right = expr(path_stack.shift, nodeset, context)\n left = unnode(left) if left.is_a?(Array)\n right = unnode(right) if right.is_a?(Array)\n left = Functions::number(left)\n right = Functions::number(right)\n case op\n when :div\n return left / right\n when :mod\n return left % right\n when :mult\n return left * right\n when :plus\n return left + right\n when :minus\n return left - right\n else\n raise \"[BUG] Unexpected operator: <#{op.inspect}>\"\n end\n when :union\n left = expr( path_stack.shift, nodeset, context )\n right = expr( path_stack.shift, nodeset, context )\n left = unnode(left) if left.is_a?(Array)\n right = unnode(right) if right.is_a?(Array)\n return (left | right)\n when :neg\n res = expr( path_stack, nodeset, context )\n res = unnode(res) if res.is_a?(Array)\n return -Functions.number(res)\n when :not\n when :function\n func_name = path_stack.shift.tr('-','_')\n arguments = path_stack.shift\n\n if nodeset.size != 1\n message = \"[BUG] Node set size must be 1 for function call: \"\n message += \"<#{func_name}>: <#{nodeset.inspect}>: \"\n message += \"<#{arguments.inspect}>\"\n raise message\n end\n\n node = nodeset.first\n if context\n target_context = context\n else\n target_context = {:size => nodeset.size}\n if node.is_a?(XPathNode)\n target_context[:node] = node.raw_node\n target_context[:index] = node.position\n else\n target_context[:node] = node\n target_context[:index] = 1\n end\n end\n args = arguments.dclone.collect do |arg|\n result = expr(arg, nodeset, target_context)\n result = unnode(result) if result.is_a?(Array)\n result\n end\n Functions.context = target_context\n return Functions.send(func_name, *args)\n\n else\n raise \"[BUG] Unexpected path: <#{op.inspect}>: <#{path_stack.inspect}>\"\n end\n end # while\n return nodeset\n ensure\n leave(:expr, path_stack, nodeset) if @debug\n end",
"def each(&block)\n old_raw = @raw\n yield self unless self.nil?\n self.left_sentence.each{|el|block.call el} if self.left_sentence\n while (not old_raw.eql?(@raw)) && (not old_raw.nil?)\n old_raw = @raw\n yield self unless self.nil?\n end\n self.right_sentence.each{|el|block.call el} if (self.right_sentence) && (not @operator.is_negation?)\n while (not old_raw.eql?(self.raw)) && (not old_raw.nil?)\n old_raw = self.raw\n yield self unless self.nil?\n end\n end",
"def each(&block)\n left.each(&block)\n yield value\n right.each(&block)\n end",
"def star(reg)\n return opt(plus(reg))\nend",
"def each_leaf#:yields: leaf\n leafs.compact!\n \n leafs.each do |leaf|\n yield leaf\n end\n end",
"def each\r\n head = @node[:head]\r\n tail = @node[:tail]\r\n if !head.nil?\r\n while !tail.empty?\r\n yield head\r\n x_xs = tail.x_xs()\r\n head = x_xs[:x]\r\n tail = x_xs[:xs]\r\n end\r\n yield head\r\n end\r\n end",
"def each(&blk)\n @trees.each_value(&blk)\n end",
"def math(a, b)\n yield(a, b)\nend",
"def math(a, b)\n yield(a, b)\nend",
"def traverse(operator,match)\n ParseNodeSet.new(self).traverse(operator,match)\n end",
"def each &block\n return enum_for(:each) unless block_given?\n ptr = @head\n while ptr\n yield ptr.value\n ptr = ptr.nxt\n end\n nil\n end",
"def deep_each\n \n end",
"def next_operator(expr)\n return '*' if expr.index('*')\n return '/' if expr.index('/')\n return '+' if expr.index('+')\n return '-' if expr.index('-')\n end",
"def test_traversal_post_2x_each_entry\n expected = [ 1, 4, 7, 6, 3, 12, 14, 10, 8 ].map {|x| x * 2}\n actual = @tree.traversal(:post, ->(x) { x * 2 })\n assert_equal expected,\n actual,\n \"actual: #{actual.inspect} should be #{expected.inspect}\"\n end",
"def reduce_term_1(_production, _range, _tokens, theChildren)\n reduce_binary_operator(theChildren)\n end",
"def and_yield(*args)\n yield eval_context = Object.new if block_given?\n @plan = Proc.new do |&block|\n eval_context.instance_exec(*args, &block)\n end\n self\n end",
"def each(&b)\n if self.range.respond_to?(:each_by_step)\n self.range.each do |sub|\n each_by_step(sub, &b)\n end\n else\n each_by_step do |sub|\n # puts \"self.range = #{self.range} yielded: #{sub}\"\n yield sub\n end\n end\n end",
"def each &block\n return enum_for(:each) unless block_given?\n return if !@root\n @root.each &block\n end",
"def process_and(exp)\n a = exp.shift\n b = exp.shift\n\n res = without_result do\n want_expression do\n with_temporary_variable do |tmp|\n @local_variables_need_no_initialization.add(tmp)\n \"(#{tmp}=#{process(a)}, (#{tmp}!==false&&#{tmp}!==nil) ? (#{process(b)}) : #{tmp})\"\n end\n end\n end\n\n return resultify(res)\n end",
"def flat_map(include_self = false, &block)\n case block && block.arity\n when nil then each_expression(include_self).to_a\n when 2 then each_expression(include_self).map(&block)\n else each_expression(include_self).map { |exp| block.call(exp) }\n end\n end",
"def parse_additive\n tree = parse_multiply()\n\n while additive?\n operator, multiply = parse_additive_tail()\n tree = [operator, tree, multiply]\n end\n\n tree\n end",
"def traverse(&block); end",
"def traverse(&block); end",
"def each\n @inputs.each do |inny|\n inny.each do |i|\n yield i\n end\n end\n end",
"def process_iter(exp) # :nodoc:\n iter = process exp.shift\n args = exp.shift\n body = exp.empty? ? nil : process(exp.shift)\n\n args = case args\n when 0 then\n iter = '->' # no args? let's use a stubby\n ''\n else\n a = process(args)[1..-2]\n a = \" |#{a}|\" unless a.empty?\n a\n end\n \n b, e = if iter == \"END\" then\n [ \"{\", \"}\" ]\n else\n [ \"do\", \"end\" ]\n end\n\n iter.sub!(/\\(\\)$/, '')\n\n # REFACTOR: ugh\n result = []\n result << \"#{iter} {\"\n result << args\n if body then\n result << \" #{body.strip} \"\n else\n result << ' '\n end\n result << \"}\"\n result = result.join\n return result if result !~ /\\n/ and result.size < LINE_LENGTH\n\n result = []\n result << \"#{iter} #{b}\"\n result << args\n result << \"\\n\"\n if body then\n result << indent(body.strip)\n result << \"\\n\"\n end\n result << e\n result.join\n end",
"def each\n if @cypher_block || @cypher_query_hash\n query(@cypher_query_hash, &@cypher_block).each { |i| yield i }\n else\n @decl_rel.each_node(@node) { |n| yield n } # Should use yield here as passing &block through doesn't always work (why?)\n end\n end",
"def evaluate(exp, env)\n # exp: A current node of AST\n # env: An environment (explained later)\n\n case exp[0]\n\n#\n## Problem 1: Arithmetics\n#\n\n when \"lit\"\n exp[1] # return the immediate value as is\n when \"*\"\n evaluate(exp[1], env) * evaluate(exp[2], env)\n when \"/\"\n evaluate(exp[1], env) / evaluate(exp[2], env)\n when \"%\"\n evaluate(exp[1], env) % evaluate(exp[2], env)\n when \"+\"\n evaluate(exp[1], env) + evaluate(exp[2], env)\n when \"-\"\n evaluate(exp[1], env) - evaluate(exp[2], env)\n# ... Implement other operators that you need\n when \"<\"\n lhs, rhs = exp[1..-1].map { |v| evaluate(v, env) }\n lhs < rhs\n when \">\"\n lhs, rhs = exp[1..-1].map { |v| evaluate(v, env) }\n lhs > rhs\n when \"<=\"\n lhs, rhs = exp[1..-1].map { |v| evaluate(v, env) }\n lhs <= rhs\n when \"==\"\n lhs, rhs = exp[1..-1].map { |v| evaluate(v, env) }\n lhs == rhs\n when \">=\"\n lhs, rhs = exp[1..-1].map { |v| evaluate(v, env) }\n lhs >= rhs\n when \"==\"\n lhs, rhs = exp[1..-1].map { |v| evaluate(v, env) }\n lhs == rhs\n when \"!=\"\n lhs, rhs = exp[1..-1].map { |v| evaluate(v, env) }\n lhs != rhs\n\n\n#\n## Problem 2: Statements and variables\n#\n\n when \"stmts\"\n # Statements: sequential evaluation of one or more expressions.\n #\n # Advice 1: Insert `pp(exp)` and observe the AST first.\n # Advice 2: Apply `evaluate` to each child of this node.\n statements = exp[1..-1]\n statements.each do |v|\n evaluate(v, env)\n end\n\n# The second argument of this method, `env`, is an \"environement\" that\n# keeps track of the values stored to variables.\n# It is a Hash object whose key is a variable name and whose value is a\n# value stored to the corresponded variable.\n\n when \"var_ref\"\n var_name = exp.last\n env[var_name]\n\n when \"var_assign\"\n name, inner_exp = exp[1..-1]\n env[name] = evaluate(inner_exp, env)\n\n\n#\n## Problem 3: Branchs and loops\n#\n\n when \"if\"\n condition = evaluate(exp[1], env)\n if condition\n evaluate(exp[2], env)\n else\n evaluate(exp[3], env)\n end\n\n\n when \"while\"\n condition = evaluate(exp[1], env)\n while condition\n evaluate(exp[2], env)\n condition = evaluate(exp[1], env)\n end\n\n# Loop.\n\n\n#\n## Problem 4: Function calls\n#\n\n when \"func_call\"\n # Lookup the function definition by the given function name.\n func = $function_definitions[exp[1]]\n\n if func.nil?\n # We couldn't find a user-defined function definition;\n # it should be a builtin function.\n # Dispatch upon the given function name, and do paticular tasks.\n case exp[1]\n when \"p\"\n # MinRuby's `p` method is implemented by Ruby's `p` method.\n p(evaluate(exp[2], env))\n when \"Integer\"\n evaluate(exp[2], env).to_i\n when \"fizzbuzz\"\n n = evaluate(exp[2], env).to_i\n if n % 15 == 0\n 'FizzBuzz'\n elsif n % 3 == 0\n 'Fizz'\n elsif n % 5 == 0\n 'Buzz'\n else\n n.to_s\n end\n else\n raise(\"unknown builtin function\")\n end\n else\n arg_names = func.arg_names\n execution = func.execution\n arguments = exp[2..-1].map { |ast| evaluate(ast, env) }\n env = arg_names.zip(arguments).to_h\n evaluate(execution, env)\n\n #\n ## Problem 5: Function definition\n #\n\n # (You may want to implement \"func_def\" first.)\n #\n # Here, we could find a user-defined function definition.\n # The variable `func` should be a value that was stored at \"func_def\":\n # parameter list and AST of function body.\n #\n # Function calls evaluates the AST of function body within a new scope.\n # You know, you cannot access a varible out of function.\n # Therefore, you need to create a new environment, and evaluate the\n # function body under the environment.\n #\n # Note, you can access formal parameters (*1) in function body.\n # So, the new environment must be initialized with each parameter.\n #\n # (*1) formal parameter: a variable as found in the function definition.\n # For example, `a`, `b`, and `c` are the formal parameters of\n # `def foo(a, b, c)`.\n end\n\n when \"func_def\"\n # Function definition.\n #\n # Add a new function definition to function definition list.\n # The AST of \"func_def\" contains function name, parameter list, and the\n # child AST of function body.\n # All you need is store them into $function_definitions.\n #\n # Advice: $function_definitions[???] = ???\n func_name = exp[1]\n arg_names = exp[2...-1].flatten\n execution_ast = exp.last\n $function_definitions[func_name] = Function.new(arg_names, execution_ast)\n\n\n#\n## Problem 6: Arrays and Hashes\n#\n\n# You don't need advices anymore, do you?\n when \"ary_new\"\n exp[1..-1].map { |ast| evaluate(ast, env) }\n\n when \"ary_ref\"\n array, index = exp[1..2].map { |ast| evaluate(ast, env) }\n array[index]\n\n when \"ary_assign\"\n array, index, value = exp[1..3].map { |ast| evaluate(ast, env) }\n array[index] = value\n\n when \"hash_new\"\n exp[1..-1].map { |ast| evaluate(ast, env) }.each_slice(2).to_h\n\n else\n p(\"error\")\n pp(exp)\n raise(\"unknown node\")\n end\nend",
"def each(&block)\n squish = lambda do |tree, list|\n new_children = tree.children.reduce(list) { |acc, elem| squish.call(elem, acc) }\n [tree.root].lazy_append(new_children)\n end\n\n squish.call(self, [])\n\n # base = [root]\n # recursive = children.map(&:each)\n # res = base.lazy_append(recursive)\n\n # return res.each(&block) if block_given?\n\n # res\n\n # res = [[root], children.flat_map(&:each)].lazy.flat_map(&:lazy)\n # res = res.map(&block) if block_given?\n # res\n end",
"def each(current = @root, &block)\n return self.to_enum(:each) unless block_given?\n return if current.nil?\n\n each(current.left, &block)\n block.call(current.data)\n each(current.right, &block)\n end",
"def expression\n if is_addop($lookahead)\n emitln \"xor %eax, %eax\"\n else\n term\n end\n\n while is_addop($lookahead)\n emitln \"movl %eax, -(0x8*#{$stackdepth})(%rsp)\"\n case $lookahead\n when \"+\"\n add\n when \"-\"\n subtract\n else\n expected \"Addop\"\n end\n end\nend",
"def each # :nodoc:\n return enum_for __method__ unless block_given?\n\n @exact.each do |requirement|\n yield requirement\n end\n\n @list.each do |requirement|\n yield requirement\n end\n end",
"def each_predicate(&block) # :nodoc:\n grouped_predicates_attributes.each do |namespace, predicates|\n predicates.each do |predicate, objects|\n block.call(namespace, predicate, objects.flatten)\n end\n end\n end",
"def each(node=@head)\n until node.nil?\n result = yield(node)\n node = node.next_node\n end\n result\n end",
"def each()\n cur = @first\n while cur\n yield cur.value\n cur = cur.next\n end\n end",
"def calculate(a,b)\n yield(a, b)\nend"
] | [
"0.7127529",
"0.6763849",
"0.6057096",
"0.59755015",
"0.59755015",
"0.5912075",
"0.5883678",
"0.5883678",
"0.58316636",
"0.58088714",
"0.57792723",
"0.5719382",
"0.5706993",
"0.5694236",
"0.5679496",
"0.5665631",
"0.5662554",
"0.56479764",
"0.5643484",
"0.56289405",
"0.562467",
"0.5591005",
"0.5580219",
"0.55611646",
"0.55489975",
"0.5547237",
"0.5525838",
"0.5521442",
"0.5477536",
"0.54498804",
"0.5445338",
"0.5436397",
"0.5428879",
"0.5402899",
"0.54025996",
"0.5400787",
"0.5380277",
"0.537614",
"0.5359048",
"0.53344333",
"0.5330508",
"0.53295946",
"0.5326",
"0.5324879",
"0.53163934",
"0.5305185",
"0.5293894",
"0.5290016",
"0.5288853",
"0.52797943",
"0.5277414",
"0.5275088",
"0.52726346",
"0.5271867",
"0.5265744",
"0.52523553",
"0.5244657",
"0.5243575",
"0.5239467",
"0.523874",
"0.52378225",
"0.523609",
"0.5234607",
"0.5231668",
"0.5225824",
"0.52226186",
"0.5222573",
"0.52223545",
"0.5215475",
"0.5215242",
"0.52149296",
"0.5205807",
"0.5204903",
"0.5204903",
"0.5197296",
"0.51930845",
"0.5187751",
"0.5187486",
"0.5185802",
"0.5183114",
"0.5182624",
"0.5177724",
"0.5169063",
"0.516103",
"0.5152382",
"0.5146565",
"0.51414526",
"0.51414526",
"0.5140307",
"0.51378506",
"0.5131417",
"0.5119752",
"0.51181525",
"0.51072145",
"0.51054555",
"0.5097509",
"0.5092227",
"0.5080889",
"0.5077763",
"0.50776565"
] | 0.7069359 | 1 |
Yield each operand of the conjunction | def each_conjunction(conjunction, &block)
each_operand(conjunction.left, &block)
each_operand(conjunction.right, &block)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each_operand(predicate, &block)\n case predicate\n when Axiom::Function::Connective::Disjunction then each_operand(predicate.inverse.optimize, &block)\n when Axiom::Function::Connective::Conjunction then each_conjunction(predicate, &block)\n else\n block.call(predicate)\n end\n end",
"def all_and(*args)\n Term.get AndTerm, *args\n end",
"def process_and(exp)\n lhs = process exp.shift\n rhs = process exp.shift\n\n return \"#{lhs} && #{rhs}\"\n end",
"def process_and(exp)\n a = exp.shift\n b = exp.shift\n\n res = without_result do\n want_expression do\n with_temporary_variable do |tmp|\n @local_variables_need_no_initialization.add(tmp)\n \"(#{tmp}=#{process(a)}, (#{tmp}!==false&&#{tmp}!==nil) ? (#{process(b)}) : #{tmp})\"\n end\n end\n end\n\n return resultify(res)\n end",
"def each\n [@lval,@rval,@operator].each { |child| yield child }\n end",
"def factor_list\n a = one_or_more { factor }\n AST.new(:and, a)\n end",
"def logical_and\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 50 )\n return_value = LogicalAndReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n string_literal232 = nil\n bit_or231 = nil\n bit_or233 = nil\n\n tree_for_string_literal232 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 585:5: bit_or ( '&&' bit_or )*\n @state.following.push( TOKENS_FOLLOWING_bit_or_IN_logical_and_3869 )\n bit_or231 = bit_or\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, bit_or231.tree )\n end\n # at line 585:13: ( '&&' bit_or )*\n while true # decision 53\n alt_53 = 2\n look_53_0 = @input.peek( 1 )\n\n if ( look_53_0 == AND )\n alt_53 = 1\n\n end\n case alt_53\n when 1\n # at line 585:15: '&&' bit_or\n string_literal232 = match( AND, TOKENS_FOLLOWING_AND_IN_logical_and_3874 )\n if @state.backtracking == 0\n\n tree_for_string_literal232 = @adaptor.create_with_payload( string_literal232 )\n root_0 = @adaptor.become_root( tree_for_string_literal232, root_0 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_bit_or_IN_logical_and_3878 )\n bit_or233 = bit_or\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, bit_or233.tree )\n end\n\n else\n break # out of loop for decision 53\n end\n end # loop for decision 53\n # - - - - - - - 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__, 50 )\n\n end\n \n return return_value\n end",
"def logical_and\n expr = equality\n\n while match?(:and)\n operator = previous\n right = equality\n expr = Ringo::Logical.new(expr, operator, right)\n end\n\n expr\n end",
"def m_ar_and_chain_1\n Rows.where(:x && :y)\n end",
"def andand(*)\n self\n end",
"def and_expr\n expr = equality()\n\n while match(:and)\n operator = previous()\n right = equality()\n expr = Expr::Logical.new expr, operator, right\n end\n\n expr\n end",
"def and!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 4 )\n\n type = AND\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 125:7: '&&'\n match( \"&&\" )\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__, 4 )\n\n end",
"def conjunction_expressions(left_expression, left_expression_joins, right_expression,\n right_expression_joins)\n if left_expression == ALWAYS_FALSE || right_expression == ALWAYS_FALSE\n [ALWAYS_FALSE, []]\n elsif left_expression == ALWAYS_TRUE\n [right_expression, right_expression_joins]\n elsif right_expression == ALWAYS_TRUE\n [left_expression, left_expression_joins]\n else\n [left_expression & right_expression, left_expression_joins + right_expression_joins]\n end\n end",
"def and!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 59 )\n\n type = AND\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 387:7: '&&'\n match( \"&&\" )\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__, 59 )\n\n end",
"def expander\n Enumerator.new do |y|\n @elements.each do |elt|\n elt.kind_of?(AndExpr) ? elt.expander.each {|e| y << e } : y << elt\n end\n end\n end",
"def bit_and\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 53 )\n return_value = BitAndReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal241 = nil\n equality240 = nil\n equality242 = nil\n\n tree_for_char_literal241 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 597:5: equality ( '&' equality )*\n @state.following.push( TOKENS_FOLLOWING_equality_IN_bit_and_3943 )\n equality240 = equality\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, equality240.tree )\n end\n # at line 597:14: ( '&' equality )*\n while true # decision 56\n alt_56 = 2\n look_56_0 = @input.peek( 1 )\n\n if ( look_56_0 == AMP )\n alt_56 = 1\n\n end\n case alt_56\n when 1\n # at line 597:17: '&' equality\n char_literal241 = match( AMP, TOKENS_FOLLOWING_AMP_IN_bit_and_3948 )\n if @state.backtracking == 0\n\n tree_for_char_literal241 = @adaptor.create_with_payload( char_literal241 )\n root_0 = @adaptor.become_root( tree_for_char_literal241, root_0 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_equality_IN_bit_and_3952 )\n equality242 = equality\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, equality242.tree )\n end\n\n else\n break # out of loop for decision 56\n end\n end # loop for decision 56\n # - - - - - - - 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__, 53 )\n\n end\n \n return return_value\n end",
"def each_logical_path(*args, &block)\n return to_enum(__method__, *args) unless block_given?\n\n filters = args.flatten.map { |arg| Manifest.compile_match_filter(arg) }\n logical_paths.each do |a, b|\n if filters.any? { |f| f.call(a, b) }\n if block.arity == 2\n yield a, b\n else\n yield a\n end\n end\n end\n\n nil\n end",
"def each_logical_path(*args, &block)\n return to_enum(__method__, *args) unless block_given?\n\n filters = args.flatten.map { |arg| Manifest.compile_match_filter(arg) }\n logical_paths.each do |a, b|\n if filters.any? { |f| f.call(a, b) }\n if block.arity == 2\n yield a, b\n else\n yield a\n end\n end\n end\n\n nil\n end",
"def and_clause\n a = factor_list\n\n space\n if accept(/and +/i)\n b = and_clause\n AST.new(:and, [a, b])\n else\n a\n end\n end",
"def and(*others)\n self.class.and(self, *others)\n end",
"def and_op(left, right, result) #method\n left = get_dir(left)\n right = get_dir(right)\n @current_context[result] = get_value(left) && get_value(right)\n end",
"def and_exp(expression)\n @use_conjunction = true\n @conjunction = @builder.and(@conjunction,expression)\n\n self\n end",
"def and!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 7 )\n\n\n\n type = AND\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 28:6: '&&'\n match( \"&&\" )\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__, 7 )\n\n\n end",
"def ampersand(&block)\n block.call\n yield\nend",
"def scan_for_and(token); end",
"def and_ a, b\n self.and a, b\n end",
"def logical_calc(arr, op)\n op=='AND' ? arr.reduce(:&) : op=='OR' ? arr.reduce(:|) : arr.reduce(:^)\nend",
"def generate_expressions(digits, allow_permutations, stats) \n digit_sets = allow_permutations ? digits.permutation : [digits]\n digit_sets_examined = 0\n stats.setProgressMax(digit_sets.count) if allow_permutations\n\n digit_sets.each do |operands|\n\n # These generators are hard to understand.\n # There really should be a more compact notation for this, which then gets intepreted to generate\n # the loop structure. And some systematic way of ensuring we generate all types of tree.\n # I *think* I have them all.\n\n # I expect to generate 25,000,000 expressions. \n # For each digit there are (typically) 5 monadic expressions\n # so the set of all binary expressions over two digits is about 4 * 5 * 5^2 ==> 500\n # binary expressions on those binary expressions: 4 * 5 * 500**2\n # 5 shapes of trees, thus\n # 5 * (4 * 5 * (4 * 5 * 5**2)**2)\n # The real count is higher, since monadic repeating decimal operator applies to digit 9\n\n d = operands.map{|digit| monadic_expressions_over(Digit.new(digit))}\n\n expressions_over(d[0], d[1]).each {|b01|\n # ((0 1) (2 3))\n expressions_over(d[2], d[3]).each {|b23|\n expressions_over(b01, b23).each {|expr| yield(expr)}}\n \n # (((0 1) 2) 3)\n expressions_over(b01, d[2]).each {|b012|\n expressions_over(b012, d[3]).each {|expr| yield(expr)}}\n }\n\n expressions_over(d[1], d[2]).each {|b12|\n\n # ((0 (1 2)) 3)\n expressions_over(d[0], b12).each {|b012|\n expressions_over(b012, d[3]).each {|expr| yield(expr)}}\n\n # (0 ((1 2) 3))\n expressions_over(b12, d[3]).each {|b123|\n expressions_over(d[0], b123).each {|expr| yield(expr)}}\n }\n\n # (0 (1 (2 3)))\n expressions_over(d[2], d[3]).each {|b23|\n expressions_over(d[1], b23).each {|b123|\n expressions_over(d[0], b123).each {|expr| yield(expr)}}}\n\n if allow_permutations\n digit_sets_examined += 1\n stats.setProgress(digit_sets_examined)\n end\n end\nend",
"def AND(x,y); \tif x==1 && y==1 \tthen 1 else 0 end; end",
"def on_and(ast_node, context)\n left, right = *ast_node\n\n return on_call_boolean(context, left) && on_call_boolean(context, right)\n end",
"def And(a, b)\n return a && b\nend",
"def _reduce_39(val, _values, result)\n result = s(:and, val[0], val[2])\n \n result\nend",
"def and *guards, &block\n if guards.empty? \n return self if not self\n else\n guards.each do |cond|\n return self if not send_as_function(cond)\n end\n end\n\n block_given? ? (yield_or_eval(&block) && self) : self\n end",
"def & other\n call_enum \"boolean\", other, :and\n end",
"def and_c\n end",
"def rewrite_and(expression)\n first = expression[1]\n second = expression[2]\n\n VirtualKeywords.call_operator_replacement(:call_and, first, second)\n end",
"def _reduce_38(val, _values, result)\n result = s(:and, val[0], val[2])\n \n result\nend",
"def _reduce_38(val, _values, result)\n result = s(:and, val[0], val[2])\n \n result\nend",
"def and\n self\n end",
"def pipeline_operator!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 11 )\n\n type = PIPELINE_OPERATOR\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 55:3: ( '&&' | '||' | '|' | '&' )\n alt_17 = 4\n look_17_0 = @input.peek( 1 )\n\n if ( look_17_0 == 0x26 )\n look_17_1 = @input.peek( 2 )\n\n if ( look_17_1 == 0x26 )\n alt_17 = 1\n else\n alt_17 = 4\n end\n elsif ( look_17_0 == 0x7c )\n look_17_2 = @input.peek( 2 )\n\n if ( look_17_2 == 0x7c )\n alt_17 = 2\n else\n alt_17 = 3\n end\n else\n raise NoViableAlternative( \"\", 17, 0 )\n end\n case alt_17\n when 1\n # at line 55:5: '&&'\n match( \"&&\" )\n\n when 2\n # at line 55:12: '||'\n match( \"||\" )\n\n when 3\n # at line 55:19: '|'\n match( 0x7c )\n\n when 4\n # at line 55:25: '&'\n match( 0x26 )\n # --> action\n @cmd_start = true \n # <-- action\n\n end\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__, 11 )\n\n end",
"def _reduce_49(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend",
"def _reduce_49(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend",
"def _reduce_49(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend",
"def _reduce_49(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend",
"def _reduce_34(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend",
"def /(c)\n map {|e| e.quo(c)}\n end",
"def &(ce)\n BooleanExpression.new(:AND, self, ce)\n end",
"def each(&block)\n old_raw = @raw\n yield self unless self.nil?\n self.left_sentence.each{|el|block.call el} if self.left_sentence\n while (not old_raw.eql?(@raw)) && (not old_raw.nil?)\n old_raw = @raw\n yield self unless self.nil?\n end\n self.right_sentence.each{|el|block.call el} if (self.right_sentence) && (not @operator.is_negation?)\n while (not old_raw.eql?(self.raw)) && (not old_raw.nil?)\n old_raw = self.raw\n yield self unless self.nil?\n end\n end",
"def _reduce_46(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend",
"def _reduce_46(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend",
"def _reduce_46(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend",
"def _reduce_41(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend",
"def _reduce_41(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend",
"def logical_or\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 49 )\n return_value = LogicalOrReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n string_literal229 = nil\n logical_and228 = nil\n logical_and230 = nil\n\n tree_for_string_literal229 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 581:5: logical_and ( '||' logical_and )*\n @state.following.push( TOKENS_FOLLOWING_logical_and_IN_logical_or_3844 )\n logical_and228 = logical_and\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, logical_and228.tree )\n end\n # at line 581:17: ( '||' logical_and )*\n while true # decision 52\n alt_52 = 2\n look_52_0 = @input.peek( 1 )\n\n if ( look_52_0 == OR )\n alt_52 = 1\n\n end\n case alt_52\n when 1\n # at line 581:20: '||' logical_and\n string_literal229 = match( OR, TOKENS_FOLLOWING_OR_IN_logical_or_3849 )\n if @state.backtracking == 0\n\n tree_for_string_literal229 = @adaptor.create_with_payload( string_literal229 )\n root_0 = @adaptor.become_root( tree_for_string_literal229, root_0 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_logical_and_IN_logical_or_3853 )\n logical_and230 = logical_and\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, logical_and230.tree )\n end\n\n else\n break # out of loop for decision 52\n end\n end # loop for decision 52\n # - - - - - - - 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__, 49 )\n\n end\n \n return return_value\n end",
"def and\n x, y = stack.pop(2)\n push x & y\n end",
"def _reduce_58(val, _values, result)\n lhs, _, rhs = val\n result = logical_op :and, lhs, rhs\n\n result\nend",
"def generate( node )\n op,*args = node\n if ! node.is_a?( Array )\n op\n elsif args.empty?\n nil\n else\n case op\n when :and\n terms_join( args, :and )\n when :or\n terms_join( args, :or )\n when :not\n @not + pwrap_gen( args[0], op )\n when :phrase\n @lquote + args.join( @space ) + @rquote\n when String\n op + @colon + pwrap_gen( args[0], op )\n else\n raise \"Unsupported op: #{node.inspect}\"\n end\n end\n end",
"def and_split(attr_list)\n expr.and_split(attr_list).map{|e| Predicate.new(e)}\n end",
"def choose_concrete_expr(y, orig, list, fiber, i)\n if orig.size == i\n # when reach the terminateion of elements, yield a concrete expression\n y << AndExpr.new(*convert_cons_list_into_array(list))\n else\n # or-clause\n if orig[i].kind_of?(Enumerator)\n # create a new fiber\n _fiber = Fiber.new do\n loop do\n # rewind unreached enumerators\n orig.each_with_index do |e, ii|\n e.rewind if ii > i && e.kind_of?(Enumerator)\n end\n # choose next\n choose_concrete_expr(y, orig, [orig[i].next, list], _fiber, i+1)\n # retrun fiber loop\n Fiber.yield\n end\n end\n # fiber loop\n begin\n _fiber.transfer while true\n rescue FiberError => e\n fiber.transfer if fiber\n end\n else\n # other elements\n choose_concrete_expr(y, orig, [orig[i], list], fiber, i+1)\n end\n end\n end",
"def _reduce_34(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n\n result\nend",
"def _reduce_49(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n\n result\nend",
"def ADDER(a,b,cin)\n\treturn XOR(XOR(a,b),cin) , OR(AND(a,b),AND(cin,XOR(a,b)))\nend",
"def _reduce_47(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend",
"def _reduce_47(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend",
"def group_operators(term_pairs)\n # create \"x OR y\" string\n term = join_terms 'OR', *term_pairs[0]\n rest = term_pairs.from(1)\n if rest.present?\n # nest the remaining pairs recursively, appending them with \" AND \"\n rest_grouped = group_operators rest\n rest_grouped[0] = \"(#{rest_grouped[0]})\" unless rest.length == 1\n join_terms 'AND', term, rest_grouped\n else\n term\n end\n end",
"def _reduce_46(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n\n result\nend",
"def _reduce_41(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n\n result\nend",
"def each\n return to_enum(:each) unless block_given?\n\n iter = from\n while iter <= to\n yield(op.call(iter))\n\n iter = unit.advance(iter)\n end\n end",
"def andand(*spec)\n AndAnd.new(self, spec.flatten)\n end",
"def all &blk\n @condition_blocks << ConditionGroup.new(model, \"AND\", binding, @from, path, &blk)\n @condition_blocks.last\n end",
"def collapse_boolean_literals(node)\n map node do |n|\n case n\n when And\n if n.children.any? do |c|\n False === c\n end\n puts \"Collapsing and(false)\"\n False.new\n else\n n.children.delete_if do |c|\n True === c\n end\n n\n end\n when Or\n if n.children.any? do |c|\n True === c\n end\n puts \"Collapsing or(true)\"\n True.new\n else\n n.children.delete_if do |c|\n False === c\n end\n n\n end\n else\n n\n end\n end\n end",
"def compose_and(first_condition, second_condition)\n validate_condition(first_condition)\n validate_condition(second_condition)\n first_condition.and(second_condition)\n end",
"def process_or(exp)\n a = exp.shift\n b = exp.shift\n\n res = without_result do\n want_expression do\n with_temporary_variable do |tmp|\n @local_variables_need_no_initialization.add(tmp)\n \"(#{tmp}=#{process(a)}, (#{tmp}!==false&&#{tmp}!==nil) ? #{tmp} : (#{process(b)}))\"\n end\n end\n end\n\n return resultify(res)\n end",
"def on_and(node)\n a, b = node.children.map { |c| @truth.fetch(c, process(c)) }\n\n if a == :true && b == :true\n :true\n elsif a == :false || b == :false\n :false\n else\n nil\n end\n end",
"def each_sat\n return to_enum(:each_sat) unless block_given?\n sat_loop(self) do |sat, solver|\n yield sat\n negated_vars = sat.terms.map do |t|\n t.is_a?(NotTerm) ? t.terms[0] : ~t\n end\n solver << PropLogic.all_or(*negated_vars)\n end\n end",
"def monadic_expressions_over(operand)\n [operand] + \n MONADIC_OPERATORS\n .select { |op| op.applies_to?(operand)}\n .map { |op| begin\n MonadicExpression.new(op, operand) \n rescue Noop\n nil\n rescue RangeError\n nil\n end \n }\n .reject(&:nil?)\nend",
"def do_conditional\n cond = inequality\n\n loop do\n type = @lexer.peek_next_type\n\n break unless [:AND, :OR].include? type\n @lexer.skip\n\n # The rhs has to be evaluated here because of short-circuiting\n\n rhs = inequality\n\n cond &&= rhs if type == :AND\n cond ||= rhs if type == :OR\n end\n\n return unless cond\n\n expect [:THEN]\n line_do\n end",
"def each_condition_node\n @elements.each do |e|\n if e.condition_node?\n yield e\n else\n e.each_condition_node do |e_child|\n yield e_child\n end\n end\n end\n end",
"def | other\n call_enum \"boolean\", other, :or\n end",
"def apply_boolean_nodes(input_array)\n last_index = input_array.size - 1\n return input_array.first if last_index < 1\n result = nil\n i = 0\n while i < last_index\n left = result || input_array[0]\n raise \"Invalid boolean syntax: #{params[:where]}\" unless left.is_a?(Arel::Nodes::Node)\n i += 1\n bool = input_array[i]\n raise \"Invalid boolean syntax: #{params[:where]}\" unless @boolean_operators.include?(bool)\n i += 1\n right = input_array[i]\n raise \"Invalid boolean syntax: #{params[:where]}\" unless right.is_a?(Arel::Nodes::Node)\n result = case input_array[1]\n when 'and'\n Arel::Nodes::And.new(input_array[0], input_array[2])\n when 'or'\n # noinspection RubyArgCount\n Arel::Nodes::Or.new(input_array[0], input_array[2])\n end\n end\n result\n end",
"def each_predicate(&block)\n grouped_predicates_attributes.each do |namespace, predicates|\n predicates.each do |predicate, objects|\n block.call(namespace, predicate, objects.flatten)\n end\n end\n end",
"def _reduce_54(val, _values, result)\n lhs, _, rhs = val\n result = logical_op :and, lhs, rhs\n\n result\nend",
"def each_term(start_instr = nil) \n cur_expr = @parse_tree\n \n if start_instr\n cur_expr = start_instr\n end\n \n while true\n if cur_expr[:term]\n yield cur_expr[:term]\n end\n if cur_expr[:rhs]\n cur_expr = cur_expr[:rhs]\n else\n break\n end\n end\n end",
"def parse_term\r\n parse_factor\r\n while(@cur_token.kind == :AND)\r\n accept_it\r\n if(@cur_token.kind == :NOT)\r\n accept_it\r\n end\r\n parse_factor\r\n end\r\n end",
"def _reduce_36(val, _values, result)\n result = logical_op :and, val[0], val[2]\n \n result\nend",
"def _reduce_36(val, _values, result)\n result = logical_op :and, val[0], val[2]\n \n result\nend",
"def testComprehension\n=begin\n yin = proc do |x|\n Transcript.cr\n x\n end.call(Continuation.current)\n\n yang = proc do |x|\n Transcript.nextPut('*')\n x\n end.call(Continuation.current)\n\n yin.call(yang)\n=end\n end",
"def expressions_over(op1, op2)\n expressions_over_lists( asArray(op1), asArray(op2))\nend",
"def _reduce_51(val, _values, result)\n lhs, _, rhs = val\n result = logical_op :and, lhs, rhs\n\n result\nend",
"def _reduce_51(val, _values, result)\n lhs, _, rhs = val\n result = logical_op :and, lhs, rhs\n\n result\nend",
"def _reduce_51(val, _values, result)\n lhs, _, rhs = val\n result = logical_op :and, lhs, rhs\n\n result\nend",
"def _reduce_48(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend",
"def _reduce_48(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend",
"def and_a\n end",
"def truthiness(x, y)\r\n puts \"AND: \", x && y\r\n puts \"OR: \", x || y\r\n puts \"!AND: \", !(x && y)\r\n puts \"!OR: \", !(x || y)\r\nend",
"def &(expr2)\n Operator.new(S_AND, self, expr2)\n end",
"def and_l\n end",
"def _reduce_33(val, _values, result)\n result = s(:and, val[0], val[2])\n result.line = val[0].line\n \n result\nend",
"def each_combination\n \n end",
"def parse_lexprs()\n\t\tputs \"parsing logical expressions\"\n\t\tif (next_TokenGrabbed( \"and\") and parse_lterm() and parse_lexprs()) \n\t\t\ttrue\n\t\telsif (next_TokenGrabbed(\"and\") and parse_lterm()) #FIXME: formatting\n\t\t\ttrue\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend"
] | [
"0.7053886",
"0.6345452",
"0.6286704",
"0.6253428",
"0.6145475",
"0.609477",
"0.60279995",
"0.5990088",
"0.58613294",
"0.58076197",
"0.58061063",
"0.5782629",
"0.5774321",
"0.57726854",
"0.5758735",
"0.5650793",
"0.5649353",
"0.5649353",
"0.5634175",
"0.56339306",
"0.5628576",
"0.5623112",
"0.55983657",
"0.5539509",
"0.5511792",
"0.5500036",
"0.5487917",
"0.54806393",
"0.54665756",
"0.5447842",
"0.54416203",
"0.54201156",
"0.5412691",
"0.5409514",
"0.54094654",
"0.54081094",
"0.54045033",
"0.54045033",
"0.5393834",
"0.5392281",
"0.5386323",
"0.5386323",
"0.5386323",
"0.5386323",
"0.53842545",
"0.5379879",
"0.5378722",
"0.53695375",
"0.5367588",
"0.5367588",
"0.5367588",
"0.53595096",
"0.53595096",
"0.5327466",
"0.5325396",
"0.5322218",
"0.5321038",
"0.5316998",
"0.5316548",
"0.53142256",
"0.53123903",
"0.531239",
"0.5311073",
"0.5311073",
"0.5300129",
"0.5288404",
"0.52840066",
"0.5280568",
"0.5272118",
"0.52693313",
"0.52478474",
"0.52447855",
"0.52379555",
"0.5235199",
"0.52196926",
"0.5218044",
"0.52169",
"0.5210305",
"0.5208917",
"0.52071714",
"0.51929706",
"0.5174206",
"0.51525533",
"0.5150844",
"0.5148707",
"0.5148707",
"0.5144682",
"0.5144462",
"0.51405823",
"0.51405823",
"0.51405823",
"0.5136437",
"0.5136437",
"0.51352686",
"0.5127967",
"0.5111922",
"0.51105845",
"0.51084554",
"0.5105705",
"0.5104724"
] | 0.65608495 | 1 |
Add a result for processing | def add(result)
@bucket.push(result.to_bool)
result.to_bool
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_result name, res\n \n end",
"def add_result(result)\n @results.push(result)\n end",
"def add_result(result)\n @results.push(result)\n end",
"def add_result(result)\n @results.push(result)\n end",
"def process_result\n end",
"def add_result(result)\n @results.push(result)\n end",
"def add_result(result)\n @results.push(result)\n end",
"def add_result(result)\n @results.push(result)\n end",
"def add_results(result_string)\n @results += result_string\n newline\n end",
"def add_result(result_tuple)\n @test_results << result_tuple\n end",
"def process_result(value, reply)\n @result[:value] += value\n end",
"def process_result(new_result)\n self.result = new_result\n calculate\n end",
"def store_result(result); end",
"def store_result()\n #This is a stub, used for indexing\n end",
"def add_result(entry)\n with_hold_file('a') do |file|\n file.write EntrySerializer.new(entry)\n file.write \"\\n\"\n end\n end",
"def process(result)\n result\n end",
"def add(result)\n @bucket.push(result)\n result\n end",
"def add_result(new_result)\n @events=@events+new_result.events\n end",
"def get_result(result_type) ; add_result(result_type, false) ; end",
"def add_result result\n source = result.source\n destination = result.destination\n\n @drb_results_received += 1\n @drb_exceptions_raised += 1 unless result.status\n\n sent_timestamp = @last_peer_send[destination].delete source\n message, argc, allocations = @last_sent_message[destination].delete source\n\n return unless sent_timestamp\n\n latency = result.timestamp - sent_timestamp\n\n @peer_latencies[destination][source].add latency\n @message_latencies[message][argc].add latency\n @message_allocations[message][argc].add allocations + result.allocations\n end",
"def add(result_type)\n mf_debug \"result requested #{result_type}\"\n metric_options = metric_options_for_result_type(result_type)\n generator_class = MetricFu::Generator.get_generator(result_type)\n mf_debug \"result class found #{generator_class}\"\n generator = generator_class.new(metric_options)\n\n result_hash.merge!(generator.generate_result)\n\n generator.per_file_info(per_file_data) if generator.respond_to?(:per_file_info)\n end",
"def process_result(result, exit_status); end",
"def use_result\n store_result\n end",
"def next_result()\n #This is a stub, used for indexing\n end",
"def result\n end",
"def add_fancy_results(result_string)\n add_results \"| #{result_string}\"\n end",
"def addResult(result, usableItems)\n r = (@results ||= []).find { |x| x.result == result.to_sym }\n if r.nil?\n r = Result.new(result.to_sym)\n @results << r\n @results.sort!\n end\n\n newItems = usableItems.to_a # guarantee array form\n newItems.each do |x|\n if !(@items ||= []).find { |y| x == y }\n @items << x\n @items = @items.sort_by { |z| z.to_s }\n r << x\n end\n end\n end",
"def add(result_type)\n mf_debug \"result requested #{result_type}\"\n clazz = MetricFu.const_get(result_type.to_s.gsub(/\\/(.?)/) { \"::#{$1.upcase}\" }.gsub(/(?:^|_)(.)/) { $1.upcase })\n mf_debug \"result class found #{clazz}\"\n metric_options = metric_options_for_result_type(result_type)\n inst = clazz.new(metric_options)\n\n result_hash.merge!(inst.generate_result)\n\n inst.per_file_info(per_file_data) if inst.respond_to?(:per_file_info)\n end",
"def add_result(meeting_individual_result)\n @results << meeting_individual_result\n sort_results\n synchronize\n end",
"def add_result(result)\n raise \"invalid result\" unless result.class == ICU::Result\n raise \"player number (#{@num}) is not matched to result player number (#{result.inspect})\" unless @num == result.player\n already = @results.find_all { |r| r.round == result.round }\n return if already.size == 1 && already[0].eql?(result)\n raise \"player #{@num} already has a result in round #{result.round} (#{already[0].inspect}) which does not match the one being added (#{result.inspect})\" unless already.size == 0\n if @results.size == 0 || @results.last.round <= result.round\n @results << result\n else\n i = ([email protected]).find { |n| @results[n].round > result.round }\n @results.insert(i, result)\n end\n end",
"def merged_result; end",
"def add_result(res)\n change_cursor { |c|\n saved_format = c.char_format # moving changes char format\n c.move_position document.character_count - 1\n c.char_format = saved_format\n\n ANSIToQt.insert(c, res)\n }\n end",
"def process(result)\n # :nocov:\n raise NotImplementedError\n # :nocov:\n end",
"def push_in_the_results(test_line)\n if end_of_line?(test_line)\n @results.push((ree? or mri?) ? @line.pack('c*') : @line.join)\n @line.clear\n end\n end",
"def process_result res\n call = res[-1]\n\n check = check_call call\n\n if check and not @results.include? call\n @results << call\n\n if include_user_input? call[3]\n confidence = CONFIDENCE[:high]\n else\n confidence = CONFIDENCE[:med]\n end\n \n warn :result => res, \n :warning_type => \"Mass Assignment\", \n :message => \"Unprotected mass assignment\",\n :line => call.line,\n :code => call, \n :confidence => confidence\n end\n res\n end",
"def process_result(msg, success)\n @results_string += \"%-70s\" % msg \n @results_string += \": \" + (success ? \"Success\" : \"Failed\") + \"\\n\"\n @results.push(success)\nend",
"def result\n\n end",
"def add_group_result(result, group: nil)\n data = {result: result}\n if group\n data[:group] = group\n end\n if result.present?\n @group_results << data\n end\n end",
"def result\n\t\t@result\n\tend",
"def add_effect_result(result)\n @damage_total += result[:effect][:damage][:amount] if result[:effect].keys.include? :damage\n @healing_total += result[:effect][:heal][:amount] if result[:effect].keys.include? :heal\n end",
"def set_result(xml)\n el = elements[\"result\"]\n el = add_element(\"result\") if el.nil?\n if xml.kind_of? REXML::Element\n el << xml\n else\n el.add_text(xml)\n end\n end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result \n @result\n end",
"def set_result\n @result = Result.new\n end",
"def process_result(player, result)\n result_object = nil\n self.results.to_a.each do |result|\n if result.player == player\n result_object = result\n end\n end\n result_object.value = result\n result_object.save!\n calculate\n end",
"def add_result(result_type, save=true, opts={})\n dir = @@RESULT_DIRS[result_type]\n return nil if dir.nil?\n base = File.expand_path(\"data/#{dir}/#{name}\", project.path)\n if opts[:force]\n FileUtils.rm(\"#{base}.json\") if File.exist?(\"#{base}.json\")\n else\n r_pre = MiGA::Result.load(\"#{base}.json\")\n return r_pre if (r_pre.nil? and not save) or not r_pre.nil?\n end\n r = File.exist?(\"#{base}.done\") ?\n self.send(\"add_result_#{result_type}\", base, opts) : nil\n r.save unless r.nil?\n r\n end",
"def <<(result)\n @results << result\n\n case result\n when Results::InsecureSource\n @insecure_sources << result\n when Results::UnpatchedGem\n @unpatched_gems << result\n end\n\n return self\n end",
"def record(result)\n r = result\n c = r.class\n file, = c.instance_method(r.name).source_location\n failures = Distributed.format(r.failures, manager)\n server.test_result(pid, file, c.name, r.name, failures, r.assertions, r.time)\n end",
"def result(res)\n clear_eval\n puts Debugger::PROMPTS[:result] + res.to_s\n end",
"def result(res)\n clear_eval\n puts Debugger::PROMPTS[:result] + res.to_s\n end",
"def result\n @result = yield\n end",
"def result\n @result\n end",
"def result()\n end",
"def collect_results\n while collect_next_line; end\n end",
"def set_last_result(result, code = \"\")\n @last_result_is_exception = false\n @output_ring << result\n\n self.last_result = result unless code =~ /\\A\\s*\\z/\n end",
"def update_result(new_result)\n @result = new_result if new_result > @result\n end",
"def add_result(name, save = true, opts = {})\n return nil if @@RESULT_DIRS[name].nil?\n base = \"#{path}/data/#{@@RESULT_DIRS[name]}/miga-project\"\n if opts[:force]\n FileUtils.rm(\"#{base}.json\") if File.exist?(\"#{base}.json\")\n else\n r_pre = MiGA::Result.load(\"#{base}.json\")\n return r_pre if (r_pre.nil? and not save) or not r_pre.nil?\n end\n r = result_files_exist?(base, \".done\") ?\n send(\"add_result_#{name}\", base) : nil\n r.save unless r.nil?\n r\n end",
"def set_result\n raw.data.status_code = raw.statusCode\n raw.data.status_text = raw.statusText\n @result = raw.data\n end",
"def child_process(result)\n end",
"def result\n @result ||= calculate_result\n end",
"def make_result_info\n end",
"def record result; @success = true; end",
"def results; end",
"def results; end",
"def results; end",
"def add sequence, result\n @sentences << [sequence, result]\n end",
"def parse_result(data)\n Parser.process(data)\n end",
"def finish(_result)\n end",
"def output_result(text)\n email_results ? (result_output << text) : RAILS_ENV!=\"test\"&&puts(text)\n end",
"def publish_result_data\n end",
"def add_result?(barcode,result,existing_barcodes)\n\t\tbegin\n\t\t\tInteger(result)\n\t\t\t#puts \"result is: #{result}\"\n\t\t\treturn false if existing_barcodes.include? barcode\n\t\t\treturn false if result.to_i == 0\n\t\t\t#puts \"the result is not zero\"\n\t\t\texisting_result = $redis.hget(ESR_RESULTS_HASH,barcode)\n\t\t\t#puts \"existing result is: #{existing_result}\"\n\t\t\tif (existing_result.blank?)\n\t\t\t\ttrue\n\t\t\telse\n\t\t\t\tif existing_result != result\n\t\t\t\t\ttrue\n\t\t\t\tend\n\t\t\tend \n\t\trescue => e\n\t\t\tputs e.to_s\n\t\t\tfalse\n\t\tend\n\t\t\n\tend",
"def prepare_result; end",
"def result=(r)\n\n fields['__result__'] = r\n end",
"def process_result(value, reply)\n unless value.nil?\n if value.is_a? Array\n value.map {|val| add_value(val)}\n else\n add_value(value)\n end\n end\n end",
"def output(request, result)\n compose(request, result.output)\n end",
"def result?; end",
"def add_result(resolvable)\n @mutex.synchronize do\n @resolvables << resolvable\n end\n end",
"def result\n data(\"result\")\n end",
"def result=(result)\n\t\tadd_tlv(TLV_TYPE_RESULT, result, true)\n\tend",
"def result=(result)\n\t\tadd_tlv(TLV_TYPE_RESULT, result, true)\n\tend",
"def manage_record_result(id, result)\n separator = @global_opts[:csv] ? \",\" : \": \"\n if @client.is_success?\n @response_data.root << result.at_xpath(RECORD_XPATH,\n \"marc\" => XMLNS_MARC\n )\n @response_status << id + separator + PAST_TENSE[@cmd] + \"\\n\"\n puts id + separator + PAST_TENSE[@cmd] if @global_opts[:verbose]\n @successes += 1\n else\n if @global_opts[:csv]\n @response_status << [id, \"failed\", result.to_s].to_csv\n else\n @response_status << id + separator + \"failed\\n\"\n @response_status << result.to_s\n end\n puts id + separator + \"failed\" if @global_opts[:verbose]\n @failures += 1\n end\n end",
"def print_result( exec, prior = nil )\n line = \"\"\n orig_result_start( exec, line )\n super( exec, prior, line )\n @out << line\n end",
"def add_to_all_results_file(filename,output)\n self.add_to_file(filename,output)\n end",
"def process_add!(result)\n self.payment = OrderPayment.new(\n :name => result.credit_card.name,\n :number => result.credit_card.number,\n :expiration_month => result.credit_card.expiration_month,\n :expiration_year => result.credit_card.expiration_year,\n :provider_name => IslayShop::Engine.config.payments.provider,\n :provider_token => result.transaction.id,\n :status => result.transaction.status,\n :card_type => result.credit_card.card_type\n )\n\n skus = Hash[*sku_items.map {|i| [i.sku_id, i.quantity]}.flatten]\n Sku.purchase_stock!(skus)\n next!(\"Authorizing #{formatted_total}\")\n end",
"def hook_result(messages); end",
"def process_result tweet\n @total_results += 1\n \n begin\n # return right away if we have already processed this tweet\n return if Vote.find_by_tweet_id( tweet.tweet_id )\n vote = create_vote_from_tweet(tweet)\n send_vote_reply( vote )\n send_poll_results( vote ) if results_reply\n @new_results += 1\n @voter_ids << tweet.from_user\n rescue InvalidVoteError\n send_error_reply( tweet, $!.to_s )\n # The users vote is invalid. TODO: send a tweet back to them indicating the error.\n logger.info \"** Invalid Vote: #{$!.inspect}\"\n logger.info \"** Vote Contents: #{tweet.inspect}\"\n rescue ActiveRecord::StatementInvalid\n if $!.to_s =~ /Mysql::Error: Duplicate entry/\n begin\n Mailer.deliver_exception_notification $!, \"Vote must have been created by another thread.\"\n rescue Errno::ECONNREFUSED\n logger.error( \"Could not connect to mail server.\")\n end \n end\n end\n end",
"def result(output)\n output\n end",
"def record(result)\n\t\t\tif options[:verbose]\n\t\t\t\tio.print \"%s#%s = %.2f s = \" % [result.class, result.name, result.time]\n\t\t\telse\n\t\t\t\tio.print \"#{result.name} \"\n\t\t\tend\n\t\t\tif result.result_code == '.'\n\t\t\t\tputs '✔'\n @@tests += 1\n else\n\t\t\t\tputs result.result_code\n end\n report_results(result, @@tests)\n end",
"def record_result result\n agent = nil\n output = \"\"\n if result.is_a?(Array)\n agent = result.shift\n output = result.join(\" \")\n else\n agent = result\n end\n unless agent.nil?\n @results << agent.extend(AgentEnhancements)\n if @msg_template\n @environment.notify(:msg => eval('\"' + @msg_template + '\"'), :tags => @tags)\n end\n end\n end",
"def add_expression_result(code)\n with_buffer{@src << ' << (' << code << ').to_s'}\n end",
"def request_add_to_result(controller, action, method, pass)\n if !@@result[controller] \n @@result.merge!({controller => {action => {method => {:requests => 1, :pass => (pass ? 1 : 0), :fail => (pass ? 0 : 1)}}}})\n elsif !@@result[controller][action]\n @@result[controller].merge!({action => {method => {:requests => 1, :pass => (pass ? 1 : 0), :fail => (pass ? 0 : 1)}}})\n elsif !@@result[controller][action][method]\n @@result[controller][action].merge!({method => {:requests => 1, :pass => (pass ? 1 : 0), :fail => (pass ? 0 : 1)}}) \n else\n @@result[controller][action][method][:requests] += 1\n @@result[controller][action][method][pass ? :pass : :fail] += 1\n end\n end",
"def store_result(result)\n synchronize_resultset do\n # Ensure we have the latest, in case it was already cached\n new_resultset = read_resultset\n\n # A single result only ever has one command_name, see `SimpleCov::Result#to_hash`\n command_name, data = result.to_hash.first\n new_resultset[command_name] = data\n File.open(resultset_path, \"w+\") do |f_|\n f_.puts JSON.pretty_generate(new_resultset)\n end\n end\n true\n end",
"def on_test_result(node)\n id, passed, *nodes = *node\n if (passed && !failed_test_ids.include?(id)) ||\n (!passed && failed_test_ids.include?(id))\n process_all(nodes)\n end\n end"
] | [
"0.8087335",
"0.7838597",
"0.7838597",
"0.7838597",
"0.77973056",
"0.77938557",
"0.77938557",
"0.77938557",
"0.7487486",
"0.7298127",
"0.7263461",
"0.72043455",
"0.71207815",
"0.7044787",
"0.70181197",
"0.6959053",
"0.69038284",
"0.6863295",
"0.68358254",
"0.6824732",
"0.6817599",
"0.6706379",
"0.6693783",
"0.66531855",
"0.6613792",
"0.6591249",
"0.65647596",
"0.65399647",
"0.6519363",
"0.65007544",
"0.6486946",
"0.64861166",
"0.64738095",
"0.6462564",
"0.644136",
"0.6437003",
"0.64363575",
"0.6435271",
"0.6413334",
"0.64108187",
"0.64040035",
"0.63998747",
"0.63998747",
"0.63998747",
"0.63998747",
"0.63998747",
"0.63998747",
"0.63998747",
"0.63998747",
"0.6375703",
"0.63626295",
"0.6357646",
"0.632976",
"0.6291162",
"0.62643534",
"0.6246311",
"0.6246311",
"0.6232375",
"0.6230515",
"0.62133527",
"0.6178692",
"0.6171641",
"0.6169191",
"0.6161057",
"0.61570346",
"0.6154277",
"0.6153944",
"0.61534065",
"0.6112234",
"0.61108565",
"0.61108565",
"0.61108565",
"0.61064124",
"0.6095882",
"0.6062845",
"0.6059448",
"0.6057031",
"0.6048815",
"0.6030371",
"0.60280097",
"0.6026781",
"0.60264677",
"0.60199565",
"0.5991686",
"0.5978742",
"0.5974379",
"0.5974379",
"0.59654367",
"0.5959229",
"0.59563106",
"0.59465235",
"0.5933251",
"0.593118",
"0.5929578",
"0.59289795",
"0.59205943",
"0.59148633",
"0.59109855",
"0.58939826",
"0.58821946"
] | 0.6560476 | 27 |
POST /teams POST /teams.json | def create
@user = User.new(user_new_params)
respond_to do |format|
if @user.save_dependent params[:setting_id], user_params[:admin]
format.html { redirect_to users_manage_users_url, notice: 'User was successfully created.' }
format.json { render :show, status: :created, location: @user }
else
format.html { redirect_to users_manage_users_url, warn: 'An error prevented user creation.' }
format.json { render json: @user.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @response = HTTParty.get('http://laxapi.herokuapp.com/api/teams')\n CreateTeamService.new.create_team_objects(@response)\n render :json => {\n :message => \" #{Team.count} teams have been created\",\n status: 200\n }\n end",
"def create\n @team = Team.new(params[:team])\n\n if @team.save\n render json: @team, status: :created, location: @team\n else\n render json: @team.errors, status: :unprocessable_entity\n end\n end",
"def create\n @team = Team.new(team_params)\n respond_to do |format|\n if @team.save\n format.html { redirect_to '/teams', notice: 'Team was successfully created.' }\n format.json { render :index, status: :created }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_team(name, params = {})\n params[:name] = name\n post('teams', params)\n end",
"def create\n @team = Team.new(params[:team])\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, :notice => 'Team was successfully created.' }\n format.json { render :json => @team, :status => :created, :location => @team }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @team.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(params[:team])\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(params[:team])\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(params[:team])\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_teams\r\n response = HTTParty.get('https://www.balldontlie.io/api/v1/teams')[\"data\"]\r\n response.each do |i|\r\n team = Team.new\r\n \r\n team.full_name = i[\"full_name\"]\r\n team.division = i[\"division\"]\r\n team.conference = i[\"conference\"]\r\n\r\n team.save\r\n\r\n end \r\n end",
"def create\n\t\t@team = Team.new(team_params)\n\n\t\tif @team.save\n\t\t\trender json: @team\n\t\telse\n\t\t\trender json: {\n\t\t\t\terror: {\n\t\t\t\t\tmessage: @team.errors.full_messages.to_sentence\n\t\t\t\t}\n\t\t\t}\n\t\tend\n\tend",
"def create\n @team = Team.new(team_params)\n @leagues = League.all.order(:name)\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team created successfully.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = @race.teams.build team_params\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to [@race, @team], notice: I18n.t(:create, scope: 'messages.crud', model: Team.model_name.human) }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n if team.save\n format.html { redirect_to team, notice: 'Team was successfully created.' }\n format.json { render json: team, status: ':created', location: team }\n else\n format.html { render action: 'new' }\n format.json { render json: team.errors, status: ':unprocessable_entity' }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.create({:name => params[:name], :status => params[:status]})\n\n if request.xhr?\n render :json => @team\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to root_path, notice: 'Team was successfully created.' }\n format.json { render action: 'show', status: :created, location: @team }\n else\n format.html { render action: 'new' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\tTeam.create(params[:team])\n\n\t\tredirect_to teams_path\n\tend",
"def create\n @team = Team.new(params.required(:team).permit!)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team created successfully.' }\n format.json { render :my_team, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = @competition.teams.build(params[:team])\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to competition_team_url(@competition, @team), notice: 'Team was successfully created.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html do\n flash[:notice] = 'Team was successfully created.'\n current_user.is_admin? ? (redirect_to teams_path) : (redirect_to user_teams_path(current_user))\n end\n format.json { render action: 'show', status: :created, location: @team }\n else\n format.html { render action: 'new' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_team = UserTeam.new(user_team_params)\n\n respond_to do |format|\n if @user_team.save\n format.html { redirect_to @user_team, notice: 'User team was successfully created.' }\n format.json { render action: 'show', status: :created, location: @user_team }\n else\n format.html { render action: 'new' }\n format.json { render json: @user_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n respond_to do |format|\n begin\n @team.save!\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n rescue => e\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(params[:team])\n @team.user = current_user\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@team = Team.new(team_params)\n\n\t\trespond_to do |format|\n\t\t\tif @team.save\n\t\t\t\tformat.html { redirect_to @team, notice: 'Team was successfully created.' }\n\t\t\t\tformat.json { render :show, status: :created, location: @team }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @team.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @swim_team = SwimTeam.new(params[:swim_team])\n\n respond_to do |format|\n if @swim_team.save\n format.html { redirect_to swim_teams_path(), notice: 'Swim team was successfully created.' }\n format.json { render json: @swim_team, status: :created, location: @swim_team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @swim_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n define_team_user\n end",
"def create\n @games_team = GamesTeam.new(games_team_params)\n\n respond_to do |format|\n if @games_team.save\n format.html { redirect_to @games_team, notice: 'Games team was successfully created.' }\n format.json { render :show, status: :created, location: @games_team }\n else\n format.html { render :new }\n format.json { render json: @games_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n @team.users << current_user\n\n respond_to do |format|\n if @team.save\n setup_team(@team)\n format.html { redirect_to user_root_url, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n \t\t\t@team = Team.new team_params\n\n \t\t\tif @team.save\n\n \t\t\t\trender json: @team,status: :created\n\n \t\t\telse\n\n \t\t\t\trender json: {error: true,errors: @team.errors},status: :unprocessable_entity\n\n \t\t\tend\n\n \t\tend",
"def create\n @ultimate_team = UltimateTeam.new(params[:ultimate_team])\n\n respond_to do |format|\n if @ultimate_team.save\n format.html { redirect_to @ultimate_team, notice: 'Ultimate team was successfully created.' }\n format.json { render json: @ultimate_team, status: :created, location: @ultimate_team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ultimate_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(_team)\n # stub\n end",
"def create\n @my_team = MyTeam.new(my_team_params)\n\n respond_to do |format|\n if @my_team.save\n format.html { redirect_to @my_team, notice: 'My team was successfully created.' }\n format.json { render :show, status: :created, location: @my_team }\n else\n format.html { render :new }\n format.json { render json: @my_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def teams\n render json: @team_query\n end",
"def create\n puts \"IN CREATE ACTION\"\n if(current_user.role == \"guest\")\n redirect_to login_url and return\n end\n @coaches = Coach.all\n @divisions = Division.all\n @organizations = Organization.all\n @students = Student.all\n @team = Team.new(team_params)\n\n unless current_user.coach.nil?\n @team_organization = current_user.coach.organization\n #@team_name = @team.organization.short_name + \" \" + (@team.organization.teams.count+1).to_s\n @team.organization_id = @team_organization.id\n #@team.name = @team_name\n end\n\n puts \"TEAM IS #{@team.valid?} -- #{@team.to_yaml}\"\n \n respond_to do |format|\n if @team.save\n params[:team][:student_teams_attributes].each do |sta|\n st = StudentTeam.new\n puts \"PREVIEW -- #{@team.id} :: #{sta[1][1]}\"\n # @team.student_teams.each do |st|\n st.team_id = 86\n st.student_id = sta[1][1]\n if st.save\n puts \"StudentTeam ID: #{st.id}\"\n else\n puts \"FAIL\"\n end\n end\n format.html { redirect_to edit_team_url(@team), notice: 'Team was successfully created.' }\n format.json { render action: 'show', status: :created, location: @team }\n else\n format.html { render action: 'new' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.find_by_name(params[:team][:team_name])\n if @team.nil?\n @team = Team.new(captain_id: params[:team][:captain_id],\n\t\t team_name: params[:team][:team_name])\n\n respond_to do |format|\n if @team.save\n format.json { render json: @team, status: :created, location: @team }\n if params[:players]\n \tTeamPlayers.create(params[:players], team_name: @team.name)\n end\n else\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n else \n Team.update(params[:team])\n end\n end",
"def create\n\t\t# league admin can add\n\t\t# anyone can add (own team) as pending iff league is addable\n\t\tds = DivisionSeason.find params[:division_season_id]\n\t\tteam = Team.find team[:team_id]\n\n\t\tif can? :manage_teams, ds\n\t\t\tTeamDSService.add_team(ds, team)\n\t\telse\n\t\t\tauthorize! :add_team, ds\n\t\t\tTeamDSService.add_pending_team(ds, team)\n\t\tend\n\n\t\trespond_with tdsr\n\tend",
"def create\n @team = current_user.teams.new(team_params)\n @league = League.find_by(id: params[:league_id])\n @team.league = @league\n if @team.save\n LeagueInvite.where(email: current_user.email, league: @league).destroy_all\n flash[:success] = \"Added team to league\"\n if @league.teams.count == 10 && current_season = Season.current.first\n if LeagueSeason.where(league: @league, season: current_season).count == 0\n LeagueSeason.create(league: @league, season: current_season)\n end\n end\n redirect_to league_players_path(@league)\n else\n render action: :new\n end\n end",
"def create\n match_day_team = MatchDayTeam.new(match_day_team_params)\n if match_day_team.save\n render json: match_day_team, status: 201, location: [:api, match_day_team]\n else\n failed_to_create(match_day_team, \"match_day_team\")\n end\n end",
"def create\n @users_team = UsersTeam.new(users_team_params)\n\n respond_to do |format|\n if @users_team.save\n format.html { redirect_to @users_team, notice: 'Membro adicionado com sucesso.' }\n format.json { render :show, status: :created, location: @users_team }\n else\n format.html { render :new }\n format.json { render json: @users_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n respond_to do |format|\n if @team.save\n # current_game.users.push(@team)\n format.html { redirect_to teams_path, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n if @team.save\n flash[:notice] = 'Team was successfully created.'\n @changed << @team.id\n \n format.html { redirect_to teams_path }\n format.js { render 'shared/index'; flash.discard }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: 'new', template: 'shared/new' }\n format.js { render 'team'; flash.discard }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @team = @competition.teams.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def create_user_team(name, path)\n post(\"/user_teams\", :body => {:name => name, :path => path})\n end",
"def index\n @teams = Team.all\n render json: @teams\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@team = Team.new(team_params)\n\n\t\trespond_to do |format|\n\t\t\tif @team.save\n\t\t\t\tformat.html do\n\t\t\t\t\t# Add current user to team.\n\t\t\t\t\tmembership = Membership.new\n\t\t\t\t\tmembership.user_id = current_user.id\n\t\t\t\t\tmembership.team_id = @team.id\n\t\t\t\t\tmembership.started_at = DateTime.now\n\n\t\t\t\t\tredirect_to @team, notice: \"Team was successfully created.\", alert: (membership.save ? nil : \"Could not join created team.\")\n\t\t\t\tend\n\t\t\t\tformat.json { render action: \"show\", status: :created, location: @team }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @team.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @mens_team = MensTeam.new(mens_team_params)\n\n respond_to do |format|\n if @mens_team.save\n format.html { redirect_to @mens_team, notice: 'Mens team was successfully created.' }\n format.json { render :show, status: :created, location: @mens_team }\n else\n format.html { render :new }\n format.json { render json: @mens_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event_team = EventTeam.new(event_team_params)\n\n respond_to do |format|\n if @event_team.save\n format.html { redirect_to @event_team, notice: 'Event team was successfully created.' }\n format.json { render :show, status: :created, location: @event_team }\n else\n format.html { render :new }\n format.json { render json: @event_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new\n @team.name = team_params[:name]\n @team.captain = current_user\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n authorize @team\n current_user.update team: @team\n\n respond_to do |format|\n if @team.persisted?\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n student_ids = params[:student_ids].to_a\n student_ids.each_with_index do |student_id|\n student = Student.where(id: student_id.to_i).first\n @team.students << student\n end\n end",
"def create\n unless current_user.instructor\n render :nothing => true, :status => :unauthorized\n end\n \n # create team\n team = Team.create(name: params[:team_name], course: $selected_course)\n\n # add students to teams\n student_ids = params[:student_ids]\n student_ids.each do |student_id|\n StudentTeam.create(student_id: student_id, team: team)\n end\n\n render json: { success: true }\n end",
"def create\n @team = Team.new(team_params)\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: \"Team was successfully created.\" }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n newTeam = TeamMemberRelation.new()\n newTeam.team_id = @team.id\n newTeam.user_id = session[:user]\n newTeam.team_role_id = 1\n newTeam.save\n end",
"def create\n @admin_team = Team.new(admin_team_params)\n\n respond_to do |format|\n if @admin_team.save\n format.html { redirect_to admin_teams_url, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @admin_team }\n else\n format.html { render :new }\n format.json { render json: @admin_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_team_member\n clinics = params[:clinics].split(\", \")\n\n team_member = TeamMember.create(\n email: params[:email],\n first_name: params[:first_name],\n last_name: params[:last_name],\n user: params[:user],\n status: \"Active\",\n role: params[:role]\n )\n\n clinics.each do |clinic|\n Clinic.find(clinic).team_members << team_member\n end\n\n render json: team_member, include: ['clinics']\n end",
"def create\n @team = Team.new(team_params)\n if @team.save\n flash[:notice] = \"Team successfully created\"\n redirect_to teams_url\n else\n render \"new\"\n end\n end",
"def create\n @team = Team.new(team_params)\n @team.slug = @team.name.downcase.gsub(\" \", \"-\")\n\n @team.community_rating = 0\n\n # Set default picture url\n if [email protected]_url\n @team.picture_url = 'https://d13yacurqjgara.cloudfront.net/users/205424/screenshots/1953810/pandamoniumshot.png'\n end\n\n @user = User.find(session[:session_key])\n\n respond_to do |format|\n if @team.save\n @team.users.push(@user)\n @team.users\n @team.save\n user_teams = @team.user_teams.find_by(user_id: @user.id)\n user_teams.role = params[:role]\n user_teams.status = 1\n user_teams.save!\n\n # TODO: Add game to user profile if it's not already there\n\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n team_name = params[:name]\n description = params[:description]\n\n @okr_team = OkrTeam.new(name: team_name, description: description)\n\n respond_to do |format|\n if @okr_team.save\n format.json { render json: 'Team is created successfully!', status: :ok }\n else\n format.json { render json: 'Error!', status: :unprocessable_entity }\n end\n end\n end",
"def new\n @teammate = Teammate.new\n @teams = Hackathon.find(params[:hackathon_id]).teams\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @teammate }\n end\n end",
"def create_team(opts)\n HelloSign::Resource::Team.new post('/team/create', :body => opts)\n end",
"def create\n @sports_team = SportsTeam.new(sports_team_params)\n\n respond_to do |format|\n if @sports_team.save\n format.html { redirect_to @sports_team, notice: 'Sports team was successfully created.' }\n format.json { render :show, status: :created, location: @sports_team }\n else\n format.html { render :new }\n format.json { render json: @sports_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render action: 'show', status: :created, location: @team }\n else\n format.html { render action: 'new' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n\n @membership = Membership.new(team_id: @team.id, player_id: @team.player_id)\n @membership.save\n end",
"def create\n @manage_team = ManageTeam.new(manage_team_params)\n\n respond_to do |format|\n if @manage_team.save\n format.html { redirect_to @manage_team, notice: 'Manage team was successfully created.' }\n format.json { render action: 'show', status: :created, location: @manage_team }\n else\n format.html { render action: 'new' }\n format.json { render json: @manage_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @teams = Team.all\n render :json => @teams\n end",
"def destroy_team\n post('/team/destroy')\n end",
"def destroy_team\n post('/team/destroy')\n end",
"def create\n @users = User.active\n @team = Team.new(team_params)\n @projects = Project.active\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render action: 'show', status: :created, location: @team }\n else\n format.html { render action: 'new' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_team(opts)\n HelloSign::Resource::Team.new post('/team/create', body: opts)\n end",
"def create\n @sales_team = SalesTeam.new(params[:sales_team])\n\n respond_to do |format|\n if @sales_team.save\n format.html { redirect_to @sales_team, notice: 'Sales team was successfully created.' }\n format.json { render json: @sales_team, status: :created, location: @sales_team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sales_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def team_params\n params.require(:team).permit(:name, :description, :company_id, :opportunity_ids => [], :team_ids => [])\n end",
"def create\n @ab_team = AbTeam.new(ab_team_params)\n\n respond_to do |format|\n if @ab_team.save\n format.html { redirect_to @ab_team, notice: 'Record was created.' }\n format.json { render :show, status: :created, location: @ab_team }\n else\n format.html { render :new }\n format.json { render json: @ab_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = fetch_team\n authorize @team\n @team.owners << current_user\n\n if @team.save\n @team.create_activity(:create,\n owner: current_user,\n parameters: { team: @team.name })\n respond_with(@team)\n else\n respond_with @team.errors, status: :unprocessable_entity\n end\n end",
"def create\n @mission_team = @game.mission_teams.new(mission_team_params)\n\n respond_to do |format|\n if @mission_team.save\n format.html { redirect_to [@game, @mission_team], notice: 'Mission team was successfully created.' }\n format.json { render :show, status: :created, location: @mission_team }\n else\n format.html { render :new }\n format.json { render json: @mission_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @monster_team = MonsterTeam.new(monster_team_params)\n\n respond_to do |format|\n if @monster_team.save\n format.html { redirect_to monster_teams_path, notice: 'Monster team was successfully created.' }\n format.json { render :show, status: :created, location: @monster_team }\n else\n format.html { render :new }\n format.json { render json: @monster_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def create\n @team = @project.ae_teams.new(team_params)\n if @team.save\n redirect_to editor_project_ae_team_path(@project, @team), notice: \"Team was successfully created.\"\n else\n render :new\n end\n end",
"def create_teams\n parent = Object.const_get(session[:team_type]).find(params[:id])\n Team.randomize_all_by_parent(parent, session[:team_type], params[:team_size].to_i)\n undo_link(\"Random teams have been successfully created.\")\n ExpertizaLogger.info LoggerMessage.new(controller_name, '', 'Random teams have been successfully created', request)\n redirect_to action: 'list', id: parent.id\n end",
"def create\n unless team_registrable?\n respond_to do |format|\n format.html { redirect_to teams_path, alert: 'Team registration is closed.' }\n format.json { render json: { status: 'closed' } }\n end\n return\n end\n\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render action: 'show', status: :created, location: @team }\n else\n format.html { render action: 'new' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = @organization.teams.build(team_params)\n\n respond_to do |format|\n if @team.save\n current_user.add_role :admin, @team\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_teams\n number_of_teams.to_i.times do |i|\n self.teams << Team.create!(:name => TEAM_NAMES[i])\n end\n end",
"def create\n @athletes_team = AthletesTeam.new(athletes_team_params)\n\n respond_to do |format|\n if @athletes_team.save\n format.html { redirect_to @athletes_team, notice: 'Athletes team was successfully created.' }\n format.json { render :show, status: :created, location: @athletes_team }\n else\n format.html { render :new }\n format.json { render json: @athletes_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @team = Team.new\n @sports = Sport.all\n @levels = Level.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @team }\n end\n end"
] | [
"0.7407207",
"0.73531765",
"0.720625",
"0.71847314",
"0.7073526",
"0.7023654",
"0.7023654",
"0.7023654",
"0.69896674",
"0.69699323",
"0.6960711",
"0.69256973",
"0.6924587",
"0.6920893",
"0.6915711",
"0.6915711",
"0.6915711",
"0.6915711",
"0.6915711",
"0.6915711",
"0.6915711",
"0.6915711",
"0.6915142",
"0.68973833",
"0.68860245",
"0.68762136",
"0.6869881",
"0.68536556",
"0.6850627",
"0.6833452",
"0.6781673",
"0.6753697",
"0.67527556",
"0.67472523",
"0.6731029",
"0.6726226",
"0.6723991",
"0.670987",
"0.67077595",
"0.66904783",
"0.66737217",
"0.6657221",
"0.66341287",
"0.66292596",
"0.66166365",
"0.66087013",
"0.66003925",
"0.6554767",
"0.65410656",
"0.65377474",
"0.65272796",
"0.6521903",
"0.6520932",
"0.6518718",
"0.6516089",
"0.65108895",
"0.6510569",
"0.65006495",
"0.6495722",
"0.6477344",
"0.6472681",
"0.6471233",
"0.64708024",
"0.64650536",
"0.64631504",
"0.64623946",
"0.6451495",
"0.643162",
"0.6426935",
"0.64197105",
"0.6401191",
"0.6398951",
"0.6388028",
"0.6382015",
"0.63722056",
"0.6367282",
"0.63663244",
"0.63663244",
"0.63652986",
"0.63632196",
"0.6358887",
"0.6339572",
"0.6335604",
"0.6325273",
"0.63095397",
"0.6293223",
"0.6291498",
"0.6291498",
"0.6291498",
"0.6291498",
"0.6291498",
"0.6291498",
"0.6291498",
"0.62912405",
"0.6288672",
"0.6280309",
"0.6273026",
"0.62640953",
"0.6262832",
"0.62538695",
"0.62537396"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def user_new_params
params.require(:user).permit(:email, :displayName, :oauth, :password, :setting_id)
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 |
Returns true if OS is windows (copied from facter/util/config.rb) | def windows?
(defined?(RbConfig) ? RbConfig : Config)::CONFIG['host_os'] =~ /mswin|win32|dos|mingw|cygwin/i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def windows?\n\tRbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/\nend",
"def windows?\n return @windows if defined?(@windows)\n @windows = (RbConfig::CONFIG['host_os'] =~ /mswin|windows|mingw/i)\n end",
"def windows?\n # Is this a Windows based system\n @win ||= RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw|bccwin|wince|emc/\n end",
"def windows?\n RbConfig::CONFIG['host_os'] =~ /mswin|mingw/\n end",
"def windows?\n RbConfig::CONFIG['host_os'] =~ /mswin|mingw/\n end",
"def windows?\n RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw32|windows/i\nend",
"def windows?\n @windows ||= is? /mswin|^win|mingw/\n end",
"def windows?\n RUBY_PLATFORM =~ /mswin/\n end",
"def windows?\n RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/\nend",
"def isWindows()\r\n # See: http://stackoverflow.com/questions/4871309\r\n require 'rbconfig'\r\n return (RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/)\r\nend",
"def windows?\n !(RUBY_PLATFORM =~ /win32/).nil?\n end",
"def windows?\n !!(RUBY_PLATFORM =~ /mswin|mingw/)\n end",
"def windows?\n has_os? && !!os_image_type.match(/windows/i)\n end",
"def windows?\n ::RUBY_PLATFORM =~ /mingw|mswin/\n end",
"def is_windows?\n return [email protected](/^windows.*$/)\n end",
"def is_windows?\n win_patterns = [\n /bccwin/i,\n /cygwin/i,\n /djgpp/i,\n /mingw/i,\n /mswin/i,\n /wince/i\n ]\n\n case RUBY_PLATFORM\n when *win_patterns\n return true\n else\n return false\n end\nend",
"def windows_platform?\n case RUBY_PLATFORM\n when /cygwin|mswin|mingw|bccwin|wince|emx/\n true\n else\n false\n end\n end",
"def windows_platform?\n case RUBY_PLATFORM\n when /cygwin|mswin|mingw|bccwin|wince|emx/\n true\n else\n false\n end\n end",
"def windows?\n ruby_platform?(:windows)\nend",
"def windows?(platform = nil)\n get_platform(platform) == :WINDOWS\n end",
"def windows?\n kind_of? Windows::Platform rescue false\n end",
"def windows?\n !!(ua =~ /Windows/)\n end",
"def windows_nix?\n (/cygwin|mingw|bccwin/ =~ ruby_platform) != nil\n end",
"def sensible_os?\n\n return ::RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ ? false : true\n\n end",
"def is_windows?(dbc)\n begin\n q = dbc.query('SELECT @@version_compile_os;')\n q.each { |x| @os = x[0] }\n if @os =~ /Win|\\.NET/i\n if @os =~ /Win64|WOW64/i\n @build='x64'\n else\n @build='x32'\n end\n return true\n else\n return false\n end\n rescue Mysql::Error => e\n print_error(\"Problem confirming target is Windows!\")\n puts \"\\t=> \".white + \"#{e}\".light_red\n return false\n end\n end",
"def unix?\n !windows?\n end",
"def windows?\n return @windowsp unless @windowsp.nil?\n\n @windowsp = defined?(RSpec::Support) ? RSpec::Support::OS.windows? : !!File::ALT_SEPARATOR\nend",
"def is_unix_like?\n os_type !~ /^\\s*windows\\s*$/i\n end",
"def windows_ruby?\n !!(RUBY_PLATFORM =~ /mswin|mingw|windows/)\n end",
"def windows_xp?\n windows? && !!(ua =~ /Windows NT 5.1/)\n end",
"def windows_platform?(node = __getnode)\n node[\"platform\"] == \"windows\"\n end",
"def windows?(platform = T.unsafe(nil)); end",
"def include_win?\n RUBY_PLATFORM.include?('mswin') or RUBY_PLATFORM.include?('mingw')\nend",
"def posix?\n !windows?\n end",
"def windows?(node = __getnode(true))\n # This is all somewhat complicated. We prefer to get the node object so that chefspec can\n # stub the node object. But we also have to deal with class-parsing time where there is\n # no node object, so we have to fall back to RUBY_PLATFORM based detection. We cannot pull\n # the node object out of the Chef.run_context.node global object here (which is what the\n # false flag to __getnode is about) because some run-time code also cannot run under chefspec\n # on non-windows where the node is stubbed to windows.\n #\n # As a result of this the `windows?` helper and the `ChefUtils.windows?` helper do not behave\n # the same way in that the latter is not stubbable by chefspec.\n #\n node ? node[\"platform_family\"] == \"windows\" : windows_ruby?\n end",
"def is_windows?(dbc)\n begin\n q = dbc.query('SELECT @@version_compile_os;')\n q.each { |x| @os = x[0] }\n if @os =~ /Win|\\.NET/i\n if @os =~ /Win64/i\n @build='x64'\n else\n @build='x32'\n end\n return true\n else\n return false\n end\n rescue Mysql::Error => e\n puts \"Problem confirming target is Windows\".light_red + \"!\".white\n puts \"\\t=> \".white + \"#{e}\".light_red\n puts \"Sorry, can't continue without this piece\".light_red + \"....\\n\\n\".white\n exit 666;\n end\nend",
"def is_image_windows?\n ami && ami.platform == \"windows\"\n end",
"def linux?\n @linux ||= is? /linux|cygwin/\n end",
"def target_win32?\n return true if ENV['OS'] == 'Windows_NT'\n build.is_a?(MRuby::CrossBuild) && build.host_target.to_s =~ /mingw/\nend",
"def unix?\n not windows? and not java?\n end",
"def on_windows?\n # Ruby only sets File::ALT_SEPARATOR on Windows and the Ruby standard\n # library uses that to test what platform it's on.\n !!File::ALT_SEPARATOR\n end",
"def is_windows? # {{{\n return @is_win if @is_win\n begin\n require \"win32ole\"\n rescue LoadError\n end\n @is_win ||= Object.const_defined?(\"WIN32OLE\")\n end",
"def is_windows?\n return @is_win if @is_win\n\n begin; require \"win32ole\"; rescue LoadError; end\n\n @is_win ||= Object.const_defined?(\"WIN32OLE\")\n end",
"def is_mingw?\n @path =~ /mingw/ # Kludge\n end",
"def really_windows?; end",
"def platform\n \"win\"\n end",
"def is_windows?\n return @is_windows unless @is_windows.nil?\n\n require 'win32ole'\n @is_win = Object.const_defined?(:WIN32OLE)\n\n rescue LoadError\n @is_win = Object.const_defined?(:WIN32OLE)\n end",
"def windows?\n ::File::ALT_SEPARATOR == '\\\\'\n end",
"def windows?\n @windows\n end",
"def windows_x64?\n !!(windows? && ua =~ /(Win64|x64)/)\n end",
"def windows_gemfile_lock?\n platforms.detect do |platform|\n /mingw|mswin/.match(platform.os) if platform.is_a?(Gem::Platform)\n end\n end",
"def test_Enviroment_002_isPlatform\r\n\r\n puts2(\"\")\r\n puts2(\"#######################\")\r\n puts2(\"Testcase: test_Enviroment_002_isPlatform\")\r\n puts2(\"#######################\")\r\n\r\n puts2(\"Running Ruby for Windows: \" + is_win?.to_s)\r\n puts2(\"Running Ruby for Windows 32-bit: \" + is_win32?.to_s)\r\n puts2(\"Running Ruby for Windows 64 bit: \" + is_win64?.to_s)\r\n puts2(\"Running Ruby for Linux: \" + is_linux?.to_s)\r\n puts2(\"Running Ruby for OS/X: \" + is_osx?.to_s)\r\n puts2(\"Running on JRuby: \" + is_java?.to_s)\r\n\r\n end",
"def linux?\n unix? and not mac?\n end",
"def linux?\n unix? and not mac?\n end",
"def win_or_mac\r\n os = RUBY_PLATFORM\r\n if os.include? 'darwin'\r\n puts \"+ <lib><webdriver_helper> OS: Mac OSX\"\r\n return 'mac'\r\n elsif os.include? 'mingw32'\r\n puts \"+ <lib><webdriver_helper> OS: Windows\"\r\n return 'win'\r\n else\r\n puts \"+ <lib><webdriver_helper> Sorry, we do not support your Operating-System right now\"\r\n end\r\n end",
"def bash_on_windows?; end",
"def detect_os\n os = RUBY_PLATFORM.split('-')\n @class_name = if os.size == 2\n if os[1] == 'mingw32'\n 1\n else\n 0\n end\n else\n 0\n end\n end",
"def windows_nano?\n return false unless inspec.os[:release].to_i >= 10\n\n inspec.powershell('Get-ItemProperty \"HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Server\\ServerLevels\" | Select -ExpandProperty \"NanoServer\" ').stdout.chomp == '1'\n end",
"def linux? ; RUBY_PLATFORM =~ /linux/i end",
"def vanilla_windows?; end",
"def linux?\n RUBY_PLATFORM.match(/linux/)\n end",
"def windows_enabled\n return @windows_enabled\n end",
"def client_os? system\n detect_os == system.to_sym\n end",
"def os_windows_other\n\t\t\t\t\tnot_os_windows_2k12.not_os_windows_8.not_os_windows_7.not_os_windows_2k8.not_os_windows_vista.not_os_windows_2k3.not_os_windows_xp.not_os_windows_2k.not_os_windows_nt\n\t\t\t\tend",
"def unix?\n kind_of? Unix::Platform rescue false\n end",
"def linux?\n !darwin?\n end",
"def linux?\n /linux/.match(RUBY_PLATFORM)\n end",
"def linux?\n RUBY_PLATFORM =~ /linux/i\nend",
"def linux?\n kind_of? Unix::Platform rescue false\n end",
"def linux?\n @linux\n end",
"def platform?\n system? and (RUBY_PLATFORM =~ @system)\n end",
"def has_pathname_length_limitations?\n # Goddamn, does Windows ever suck. Man.\n os_type =~ /^\\s*windows\\s*$/i\n end",
"def linux?\n RUBY_PLATFORM =~ /linux/\n end",
"def docker_for_mac_or_win?\n ::Docker.info(::Docker::Connection.new(config[:docker_host_url], {}))['Name'] == 'moby'\n rescue\n false\n end",
"def supported_platform?\n linux? || darwin?\n end",
"def get_os\n if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/\n return :Windows\n elsif RbConfig::CONFIG['host_os'] =~ /darwin/\n return :Mac\n elsif RbConfig::CONFIG['host_os'] =~ /linux/\n return :Linux\n elsif RbConfig::CONFIG['host_os'] =~ /bsd/\n return :BSD\n else\n return :unknown_os\n end\nend",
"def linux?\n !!(ua =~ /Linux/)\n end",
"def windows_mobile?\n !!(ua =~ /Windows CE/)\n end",
"def on_os name\n os_kernel = `uname -a`\n os_kernel.downcase.include?(name)\nend",
"def is_linux?\n return (!is_windows? && !is_unix?)\n end",
"def linux?\n linux_internal?\n end",
"def host_os\n @os ||= (\n case RbConfig::CONFIG['host_os']\n when /mswin|msys|mingw|cygwin|bccwin|wince|emc/\n :windows\n when /darwin|mac os/\n :macosx\n when /linux/\n :linux\n when /solaris|bsd/\n :unix\n else\n raise \"Unknown os: #{RbConfig::CONFIG['host_os']}\"\n end\n )\n end",
"def is_nix_os?\n RbConfig::CONFIG[\"host_os\"] =~ /linux|freebsd|darwin|unix/\n end",
"def check_os\n @os ||= (\n host_os = RbConfig::CONFIG['host_os']\n case host_os\n when /mswin|msys|mingw|cygwin|bccwin|wince|emc/\n :windows\n when /darwin|mac os/\n :macosx\n when /linux/\n :linux \n when /solaris|bsd/\n :unix\n else\n raise Error::WebDriverError, \"unknown os: {host_os.inspect}\"\n end\n )\nend",
"def detect_os\r\n user_agent = request.env['HTTP_USER_AGENT']\r\n if user_agent =~ /(Windows|Mac)/\r\n return $1\r\n end\r\n return 'Unknow OS'\r\n end",
"def myOs\n if OS.windows?\n \"Windows\"\n elsif OS.linux?\n \"Linux\"\n elsif OS.mac?\n \"Osx\"\n else\n \"Não consegui indentificar!\"\n end\nend",
"def mac?\n Config::CONFIG[\"host_os\"] =~ /darwin/i ? true : false\n end",
"def mac? ; RUBY_PLATFORM =~ /.*(sal|86).*-darwin1/i end",
"def platform_version_windows(arg)\n # Make a best guess and assume a server OS\n # See: http://msdn.microsoft.com/en-us/library/windows/\n # desktop/ms724832(v=vs.85).aspx\n {\n '6.3' => '2012r2', '6.2' => '2012', '6.1' => '2008r2',\n '6.0' => '2008', '5.2' => '2003r2', '5.1' => 'xp', '5.0' => '2000'\n }[arg.match(/^[0-9]+\\.[0-9]+/).to_s]\n end",
"def os_x?\n RUBY_PLATFORM.match(/darwin/)\n end",
"def Check_OS_Bit()\n\tif File.directory?(\"C:\\\\Program Files (x86)\")\n\t\tputs(\"OS is 64 bit\")\n\t\tos_bit = \"x64\"\n\t\treturn os_bit\n\telse\n\t\tputs(\"OS is 32 bit\")\n\t\tos_bit = \"x86\"\n\t\treturn os_bit\n\tend\nend",
"def linux?\n %w(debian redhat ubuntu).include?(os[:family])\nend",
"def mac?\n kind_of? Mac::Platform rescue false\n end",
"def detect_platform\r\n\t\tprint_status(\"Attempting to automatically detect the platform\")\r\n\t\tres = send_serialized_request(\"osname.bin\")\r\n\r\n\t\tif (res.body =~ /(Linux|FreeBSD|Windows)/i)\r\n\t\t\tos = $1\r\n\t\t\tif (os =~ /Linux/i)\r\n\t\t\t\treturn 'linux'\r\n\t\t\telsif (os =~ /FreeBSD/i)\r\n\t\t\t\treturn 'linux'\r\n\t\t\telsif (os =~ /Windows/i)\r\n\t\t\t\treturn 'win'\r\n\t\t\tend\r\n\t\tend\r\n\t\tnil\r\n\tend",
"def is_os_x?\n RbConfig::CONFIG[\"host_os\"] =~ /darwin/\n end",
"def linux?\n has_os? && !!os_image_type.match(/suse|redhat|ubuntu|debian|centos|fedora/i)\n end",
"def mac?\n RUBY_PLATFORM =~ /darwin/i\nend",
"def os\n Facter.value(:operatingsystem)\n end",
"def chrome_os?\n !!(ua =~ /CrOS/)\n end",
"def macys?\n ExecutionEnvironment.macys?\n end"
] | [
"0.8950443",
"0.891576",
"0.8913106",
"0.88760805",
"0.88760805",
"0.87613297",
"0.87284344",
"0.87029076",
"0.86806524",
"0.86690414",
"0.8663334",
"0.85244286",
"0.8514668",
"0.8481104",
"0.8462259",
"0.8440089",
"0.84059644",
"0.83960205",
"0.8368152",
"0.832635",
"0.8320881",
"0.8304273",
"0.8256737",
"0.8247486",
"0.8194768",
"0.80888313",
"0.80435866",
"0.8006835",
"0.7981251",
"0.7957124",
"0.78492016",
"0.78286517",
"0.77845067",
"0.77723885",
"0.77296215",
"0.76503086",
"0.7629155",
"0.7582084",
"0.7565952",
"0.75606173",
"0.75204134",
"0.7500684",
"0.7476675",
"0.745829",
"0.7446682",
"0.7386081",
"0.73504156",
"0.73415273",
"0.73035026",
"0.725117",
"0.72479",
"0.72464794",
"0.72005945",
"0.7194461",
"0.7176652",
"0.7117518",
"0.7070907",
"0.7070697",
"0.7042515",
"0.702936",
"0.7019603",
"0.70045966",
"0.69957674",
"0.6979041",
"0.6969732",
"0.6968286",
"0.69580525",
"0.6957092",
"0.6956525",
"0.69551456",
"0.692242",
"0.6892557",
"0.6889743",
"0.68676543",
"0.68645376",
"0.68508375",
"0.68494946",
"0.68405944",
"0.68284094",
"0.679595",
"0.6788594",
"0.6784638",
"0.67773396",
"0.67745113",
"0.67574185",
"0.66694355",
"0.66597354",
"0.6640602",
"0.66157764",
"0.65968275",
"0.659631",
"0.6557275",
"0.65565133",
"0.6531749",
"0.6525948",
"0.6524438",
"0.65053153",
"0.65044856",
"0.64522964",
"0.64439285"
] | 0.9045687 | 0 |
Prepare the file installation. | def prepare_installation
InstallOptions.configs = true
InstallOptions.batch_files = true
ARGV.options do |opts|
opts.banner = "Usage: #{File.basename($PROGRAM_NAME)} [options]"
opts.separator ''
opts.on('--[no-]configs', 'Prevents the installation of config files', 'Default off.') do |onconfigs|
InstallOptions.configs = onconfigs
end
opts.on('--destdir[=OPTIONAL]',
'Installation prefix for all targets',
'Default essentially /') do |destdir|
InstallOptions.destdir = destdir
end
# opts.on('--configdir[=OPTIONAL]', 'Installation directory for config files', 'Default /etc') do |configdir|
# InstallOptions.configdir = configdir
# end
opts.on('--bindir[=OPTIONAL]',
'Installation directory for binaries',
'overrides RbConfig::CONFIG["bindir"]') do |bindir|
InstallOptions.bindir = bindir
end
opts.on('--ruby[=OPTIONAL]',
'Ruby interpreter to use with installation',
'overrides ruby used to call install.rb') do |ruby|
InstallOptions.ruby = ruby
end
opts.on('--sitelibdir[=OPTIONAL]',
'Installation directory for libraries',
'overrides RbConfig::CONFIG["sitelibdir"]') do |sitelibdir|
InstallOptions.sitelibdir = sitelibdir
end
opts.on('--mandir[=OPTIONAL]',
'Installation directory for man pages',
'overrides RbConfig::CONFIG["mandir"]') do |mandir|
InstallOptions.mandir = mandir
end
opts.on('--full', 'Performs a full installation. All', 'optional installation steps are run.') do |_full|
InstallOptions.configs = true
end
opts.on('--no-batch-files', 'Prevents installation of batch files for windows', 'Default off') do |_batch_files|
InstallOptions.batch_files = false
end
opts.separator('')
opts.on_tail('--help', 'Shows this help text.') do
warn opts
exit
end
opts.parse!
end
version = [RbConfig::CONFIG['MAJOR'], RbConfig::CONFIG['MINOR']].join('.')
libdir = File.join(RbConfig::CONFIG['libdir'], 'ruby', version)
# Mac OS X 10.5 and higher declare bindir
# /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin
# which is not generally where people expect executables to be installed
# These settings are appropriate defaults for all OS X versions.
RbConfig::CONFIG['bindir'] = '/usr/bin' if RUBY_PLATFORM =~ /^universal-darwin[\d\.]+$/
# if InstallOptions.configdir
# configdir = InstallOptions.configdir
# elsif windows?
# path = File.join(File.dirname(__FILE__), "lib", "custom_facts", "util", "config.rb")
# require_relative(path)
# configdir = File.join(LegacyFacter::Util::Config.windows_data_dir, "PuppetLabs", "facter", "etc")
# else
# configdir = File.join('/', 'etc', 'puppetlabs', 'facter')
# end
bindir = InstallOptions.bindir || RbConfig::CONFIG['bindir']
if InstallOptions.sitelibdir
sitelibdir = InstallOptions.sitelibdir
else
sitelibdir = RbConfig::CONFIG['sitelibdir']
if sitelibdir.nil?
sitelibdir = $LOAD_PATH.find { |x| x =~ /site_ruby/ }
if sitelibdir.nil?
sitelibdir = File.join(libdir, 'site_ruby')
elsif sitelibdir !~ Regexp.quote(version)
sitelibdir = File.join(sitelibdir, version)
end
end
end
mandir = InstallOptions.mandir || RbConfig::CONFIG['mandir']
# This is the new way forward
destdir = InstallOptions.destdir || ''
# configdir = join(destdir, configdir)
bindir = join(destdir, bindir)
mandir = join(destdir, mandir)
sitelibdir = join(destdir, sitelibdir)
# makedirs(configdir) if InstallOptions.configs
makedirs(bindir)
makedirs(mandir)
makedirs(sitelibdir)
InstallOptions.site_dir = sitelibdir
# InstallOptions.config_dir = configdir
InstallOptions.bin_dir = bindir
InstallOptions.lib_dir = libdir
InstallOptions.man_dir = mandir
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepare_for_installation; end",
"def prepare\n FileUtils.mkdir_p(veewee_autoyast_dir) unless veewee_autoyast_dir.directory?\n FileUtils.cp(sources_dir.join(\"postinstall.sh\"), veewee_autoyast_dir)\n end",
"def prepare_config_files\n #Create .config dir\n #Create tucotuco dir\n #Create short dir\n #Create info file\n end",
"def prepare_command\n info(\"Preparing the SUT and Pester dependencies...\")\n resolve_downloads_paths!\n really_wrap_shell_code(install_command_script)\n end",
"def do_prepare\n quick_make_file @file, 'config.yaml'\n quick_make_file 'Vagrantfile', 'Vagrantfile'\n must_recreate\n end",
"def prepare\n started_at = DateTime.now.to_s\n prepare_deploy\n prepare_common_installation\n puppet_installation\n create_prepare_checkpoint(started_at)\n end",
"def prepare_for_install(ksp_path, caveats)\n add_caveat_message!(caveats)\n @ksp_path = ksp_path\n install_prerequisites!(caveats)\n @download_dir = download_and_unzip!\n end",
"def prepare\n prepare_sources\n prepare_rubygems\n prepare_gems\n end",
"def setup\n return unless git?\n\n Dir.chdir source_path do\n\n path = clone\n\n Dir.chdir path do\n\n if name = build then\n file = File.expand_path name\n\n # private instance variable. When this is set Entry#install looks\n # for a local file instead of trying to download by name\n @entry.instance_variable_set :@file, file\n end\n\n end if path\n\n end\n end",
"def install\n run \"bundle exec backup generate:config --config-path=config/backup\" unless File.exists?(\"config/backup/config.rb\")\n template \"general.rb\", \"config/backup/models/general.rb\"\n if File.exists? \".env\"\n append_file \".env\" do\n File.read(File.expand_path(find_in_source_paths('env.env')))\n end\n else\n template \"env.env\", \".env\"\n end\n run \"bundle exec wheneverize .\" unless File.exists?(\"config/schedule.rb\")\n append_file \"config/schedule.rb\" do\n File.read(File.expand_path(find_in_source_paths('schedule.rb')))\n end\n end",
"def prepare\n FileUtils.mkdir_p(@base_dir)\n end",
"def prepare\n FileUtils.rm_rf(output_dir)\n FileUtils.mkdir_p(output_dir)\n end",
"def prepare\n FileUtils.rm_rf(output_dir)\n FileUtils.mkdir_p(output_dir)\n end",
"def prepare_for_configuration \n # clear_base_directory\n make_base_directory\n copy_misc_templates\n copy_custom_monitors\n store_keys_in_file\n Script.save!(self)\n # not my favorite...\n copy_ssh_key\n before_configuration_tasks\n end",
"def main\n generate_config unless $dont_gen_conf\n\n if $just_gen_conf\n puts \"\\nSkips installing, just generated the config file!\".pink\n exit(0)\n end\n \n install_dependencies if $install_req\n\n install_to_directory\nend",
"def pre_install; end",
"def install\n end",
"def install\n copy_envrc\n copy_database_yml\n copy_docker_db_setup_sh\n system(`direnv allow`)\n print(\"#{readme}\\n\")\n end",
"def prepare_install_sh\n Mixlib::Install.install_sh(base_url: url(settings.virtual_path).chomp('/'))\n end",
"def prepare!\n cleanup_hostname!\n cleanup_network!\n\n imports = ''\n\n # Find all /etc/nixos/vagrant-*.nix files\n machine.communicate.tap do |c|\n c.execute('find /etc/nixos -maxdepth 1 -type f -name \"vagrant-*.nix\"') do |type, data|\n imports << data\n end\n end\n\n # build\n conf = <<CONF\n{ config, pkgs, ... }:\n{\n imports = [\n #{imports.lines.join(\" \").strip}\n ];\nCONF\n # default NIX_PATH\n conf << <<CONF if config.NIX_PATH\n config.environment.shellInit = ''\n export NIX_PATH=#{config.NIX_PATH}:$NIX_PATH\n '';\nCONF\n conf << '}'\n # output / build the config\n\n write_config(\"vagrant.nix\", conf)\n end",
"def setup\n @clarisse_dir = @path.join(CLARISSE_DIR)\n if File.exists? @clarisse_dir \n if not File.directory? @clarisse_dir\n raise SetupError.new (\n \"Could not create directory #{@clarisse_dir}. A file with that name \" +\n \"already exists.\"\n )\n elsif not File.readable? @clarisse_dir or not File.writable? @clarisse_dir\n raise SetupError.new (\n \"Clarisse has not enough permissions to write to '#{@clarisse_dir}'\"\n )\n end\n else\n begin\n Dir.mkdir(@clarisse_dir)\n rescue SystemCallError => e\n raise SetupError, \"Failed to create directory '#{@clarisse_dir}'\"\n end\n end\n end",
"def prepare\n if not File.exists?(OBS_BUILD_DIR)\n FileUtils.mkdir_p OBS_BUILD_DIR\n end\n cleanup\n end",
"def install\n #python executable files\n end",
"def prepare\r\n # if output_dir is not specified, output in the same directory\r\n # as the imput file\r\n @output_dir = File.dirname(@input_file) if !@output_dir && @input_file\r\n\r\n if /.bz2$/ =~ @input_file\r\n if @bz2_gem\r\n file = Bzip2::Reader.new File.open(@input_file, \"r:UTF-8\")\r\n elsif Gem.win_platform?\r\n file = IO.popen(\"bunzip2.exe -c #{@input_file}\")\r\n elsif (bzpath = command_exist?(\"lbzip2\") || command_exist?(\"pbzip2\") || command_exist?(\"bzip2\"))\r\n file = IO.popen(\"#{bzpath} -c -d #{@input_file}\")\r\n end\r\n else # meaning that it is a text file\r\n @infile_size = File.stat(@input_file).size\r\n file = open(@input_file)\r\n end\r\n\r\n # create basename of output file\r\n @outfile_base = File.basename(@input_file, \".*\") + \"-\"\r\n @total_size = 0\r\n @file_index = 1\r\n outfilename = File.join(@output_dir, @outfile_base + @file_index.to_s)\r\n @outfiles = []\r\n @outfiles << outfilename\r\n @fp = File.open(outfilename, \"w\")\r\n @file_pointer = file\r\n true\r\n end",
"def install\n end",
"def install\n end",
"def install\n \n end",
"def prepareForFile(filename)\n end",
"def make_install\n run_with_failure_handler(\"cd #{@extracted_path} ; sudo make install\", 'make install')\n end",
"def setup\n @expand_path = File.expand_path(@infile)\n @basename = File.basename(@expand_path)\n @infile_ext = File.extname(@infile)\n file_ext_check\n true\n end",
"def setup\n make_config\n make_users_file\n end",
"def install\n end",
"def create_req_files\n Dir.mkdir DATA_DIR unless File.exists? DATA_DIR\n FileUtils.touch NODES_FILE unless File.exists? NODES_FILE\n FileUtils.touch ENC_ROLES_FILE unless File.exists? ENC_ROLES_FILE\n FileUtils.touch HIERA_DATA_FILE unless File.exists? HIERA_DATA_FILE\n end",
"def install\n Dir.chdir(DATA) do\n read_config\n end\n Install.new(@config)\n end",
"def install(env); end",
"def install\n # nothing to do\n end",
"def execute_installation\n #start logging\n set_log_file @options[:log]\n \n download_and_decompress(@options[:prefix], [REDIS_URL, SQLITE3_URL, NGINX_URL])\n \n install_redis if @options[:redis]\n install_sqlite\n configure_nginx @options\n\n install_all_gems\n install_rhoconnect\n \n #remove downloaded tarballs\n cleanup options[:prefix]\n end",
"def post_install; end",
"def prepare\n FileUtils.rm_rf(@tempdirs, secure: true) if @tempdirs\n @tempdirs = []\n @base_options = nil\n @mode_options = nil\n @user_recipients = nil\n @user_keys = nil\n @system_identifiers = nil\n end",
"def run_install(install_path)\n require 'fileutils'\n install_path ||= '.'\n FileUtils.mkdir_p install_path unless File.exists?(install_path)\n install_file \"#{CC_ROOT}/config/config.example.yml\", \"#{install_path}/config.yml\"\n install_file \"#{CC_ROOT}/config/config.example.ru\", \"#{install_path}/config.ru\"\n install_file \"#{CC_ROOT}/config/database.example.yml\", \"#{install_path}/database.yml\"\n install_file \"#{CC_ROOT}/actions\", \"#{install_path}/actions\", true\n end",
"def install\n FileUtils.mv self.class.extracted_file.to_s, self.class.force_installed_executable.to_s\n end",
"def install\n\n FileUtils.mkdir_p THIRD_PARTY_INSTALL\n\n Dir.chdir(THIRD_PARTY_INSTALL){\n\n info \"Unzipping precompiled '#{@FullName}' to #{THIRD_PARTY_INSTALL}\"\n\n # Overwrite everything\n runOpen3Checked(*p7zip, \"x\", targetFile, \"-aoa\")\n\n # TODO:\n # puts \"Verifying that unzipping created wanted files\"\n\n success \"Done unzipping\"\n }\n \n end",
"def prepareDirectory( outputfn )\n scriptpath = File.dirname __FILE__\n cf = File.join scriptpath, \"conversion_files\"\n i = 0 \n max = 3\n\n print \"#\"*40, \"\\n\", \"Preparing Directory\\n\", \"#\"*40, \"\\n\\n\"\n\n phasePrint \"Create Base Folder / Check Dependencies\", i+=1, max\n # Make our base directory\n if not Dir.exists? outputfn\n FileUtils.mkdir_p outputfn\n end\n\n # See if our conversion_files folder exists, this is required\n if not Dir.exists? cf \n error \"Missing conversion_files folder:\\n#{cf}\\n\\nThe conversion process cannot continue.\"\n return nil\n end\n\n # Check for the python cache extracted folder\n if not Dir.exists? File.join( cf, \"python27\" ) and $options[:python]\n if not File.exists? cf+\"python27.zip\"\n error \"Missing packaged Python 2.7.8 installation folder or zip in conversion_files, this is required for the \\\"Include Python\\\"//\\\"--python\\\" option.\\n\\nThe conversion process cannot continue.\"\n return nil\n else\n # Extract our python27.zip folder\n phasePrint \"Extracting Python\", i+=0.5, max\n error \"Extracting python27.zip, this may take some time.\\n\\nIt is quicker to extract this by hand into the conversion_files folder using 7-zip or Peazip, as they are capable of using multiple cores.\"\n unzip \"#{cf}python27.zip\", cf\n end\n end\n\n i = i.floor if i.is_a? Float\n phasePrint \"Copying Python to Output Folder\", i+=1, max\n print \" This will take some time\\n\"\n # Copy Python over to the directory\n if not Dir.exists? File.join( outputfn, \"python27\" ) and $options[:python]\n FileUtils.cp_r File.join( cf, \"python27\" ), outputfn\n end\n\n phasePrint \"Initializing File Structure\", i+=1, max\n FileUtils.cp File.join( cf, \"run.bat\" ), outputfn\n\n FileUtils.cp_r File.join( cf, \"includes\" ), outputfn\n\n return File.new( File.join( outputfn, \"run_test.py\" ), \"w+:UTF-8\" )\nend",
"def prepare_pre_import\n end",
"def install!\n cmd = [attributes.gem_binary, 'install']\n cmd << '-v' << attributes.version if attributes.version\n cmd << '--source' << attributes.source if attributes.source\n cmd << '--prerelease' if attributes.prerelease\n cmd << attributes.package_name\n\n run_command(cmd)\n end",
"def setup\n FileUtils.mkdir_p(data_path)\n end",
"def setup\n FileUtils.mkdir_p(data_path)\n end",
"def prepare_dirs\n require 'fileutils'\n recipe = File.join(@data_dir, '/test/integration/test_recipe.rb')\n\n FileUtils.chmod(755, exec_order)\n FileUtils.chown_R('vagrant', 'vagrant', '/home/oneops')\n FileUtils.mkdir_p(\"/home/oneops/#{@circuit}/components/cookbooks\")\n FileUtils.mkdir_p('/home/oneops/shared/cookbooks/test/recipes')\n FileUtils.cp_r(recipe, '/home/oneops/shared/cookbooks/test/recipes/')\n end",
"def setup_file\n self.setup_path \n end",
"def prepare(ant)\n @directory.ensure_directory\n \n ant.copy(:todir => @directory.to_s, :overwrite => false) {\n ant.fileset(:dir => @static_resources.terracotta_home_template_directory.to_s) {\n ant.exclude(:name => '.svn/**')\n }\n }\n \n self\n end",
"def setup!\n policyfile_path = RSpec.configuration.policyfile_path\n if policyfile_path.nil?\n policyfile_path = File.join(Dir.pwd, \"Policyfile.rb\")\n end\n\n Chef::WorkstationConfigLoader.new(nil).load\n\n installer = ChefCLI::PolicyfileServices::Install.new(\n policyfile: policyfile_path,\n ui: ChefCLI::UI.null,\n config: Chef::Config\n )\n\n installer.run\n\n exporter = ChefCLI::PolicyfileServices::ExportRepo.new(\n policyfile: policyfile_path,\n export_dir: @tmpdir\n )\n\n FileUtils.rm_rf(@tmpdir)\n exporter.run\n\n ::RSpec.configure do |config|\n config.cookbook_path = [\n File.join(@tmpdir, \"cookbooks\"),\n File.join(@tmpdir, \"cookbook_artifacts\"),\n ]\n end\n end",
"def prepare_install_ps1\n Mixlib::Install.install_ps1(base_url: url(settings.virtual_path).chomp('/'))\n end",
"def post_install\n end",
"def install_custom!\n package package_name do\n source new_resource.source.to_s\n checksum new_resource.checksum unless new_resource.checksum.nil?\n end\n end",
"def configuration_setup\n dirname = File.expand_path(USER_DIR)\n if !File.exists?(dirname)\n Dir.mkdir(dirname) \n create_storage_dir\n create_staging_dir\n create_user_conf_file\n create_user_email_conf_file\n else \n create_user_conf_file if !File.exists?(USER_CONF_FILE)\n create_storage_dir if !File.exists?(File.expand_path(STORAGE_DIR))\n create_staging_dir if !File.exists?(File.expand_path(STAGING_DIR))\n create_user_email_conf_file if !File.exists?(EMAIL_CONF_FILE)\n end\n end",
"def setup()\n create_directories\n end",
"def prepare(module_name, version)\n return if @target.directory?\n\n begin\n @target.mkpath\n Puppet.notice _(\"Created target directory %{dir}\") % { dir: @target }\n rescue SystemCallError => orig_error\n raise converted_to_friendly_error(module_name, version, orig_error)\n end\n end",
"def install\n system \"python\", \"setup.py\", \"install\"\n\n # Make BUSCO read config.ini from current directory\n inreplace \"scripts/run_BUSCO.py\", \"BuscoConfig('%s/../config/config.ini' % os.path.dirname(os.path.realpath(__file__))\", \"BuscoConfig('config.ini'\"\n \n bin.install \"scripts/run_BUSCO.py\"\n bin.install \"scripts/generate_plot.py\"\n bin.install_symlink \"run_BUSCO.py\" => \"busco\"\n\n # Set correct directories in config template\n inreplace \"config/config.ini.default\", \"/usr/bin/\", \"/mnt/lustre/software/linuxbrew/colsa/bin/\"\n inreplace \"config/config.ini.default\", \"/home/osboxes/BUSCOVM/augustus/augustus-3.2.2/bin/\", \"/mnt/lustre/software/linuxbrew/colsa/bin/\"\n inreplace \"config/config.ini.default\", \"/home/osboxes/BUSCOVM/augustus/augustus-3.2.2/scripts/\", \"/mnt/lustre/software/linuxbrew/colsa/Cellar/augustus/3.2.2_2/libexec/scripts/\"\n inreplace \"config/config.ini.default\", \"/home/osboxes/BUSCOVM/hmmer/hmmer-3.1b2-linux-intel-ia32/binaries/\", \"/mnt/lustre/software/linuxbrew/colsa/bin/\"\n libexec.install Dir[\"config\"]\n doc.install \"BUSCO_v3_userguide.pdf\"\n end",
"def install!\n src = package_source\n chk = package_checksum\n windows_package 'Chef Development Kit' do\n source src\n checksum chk\n end\n end",
"def install_custom!\n remote_file local_path do\n source new_resource.source.to_s\n checksum new_resource.checksum unless new_resource.checksum.nil?\n end\n dpkg_package local_path\n end",
"def install\n mkdir \"build\" do\n system \"cmake\", \"..\", \"-DCMAKE_INSTALL_SYSCONFDIR=#{etc}\", *std_cmake_args\n system \"make\", \"install\"\n end\n end",
"def install\n self.run_preseed if @resource[:responsefile]\n should = @resource[:ensure]\n\n checkforcdrom\n cmd = %w{-q -y}\n\n keep = \"\"\n if config = @resource[:configfiles]\n if config == :keep\n cmd << \"-o\" << 'DPkg::Options::=--force-confold'\n else\n cmd << \"-o\" << 'DPkg::Options::=--force-confnew'\n end\n end\n\n str = @resource[:name]\n case should\n when true, false, Symbol\n # pass\n else\n # Add the package version and --force-yes option\n str += \"=#{should}\"\n cmd << \"--force-yes\"\n end\n\n cmd << :install << str\n\n aptget(*cmd)\n end",
"def create_installer(install_file, id)\n puts \"Downloading install file\"\n File.open(install_file, \"w+\"){ |f|\n f.write(download_install_file(\"logicmonitorsetup\", {\"id\" => id.to_s, \"arch\" => get_arch,}))\n }\n puts \"Download complete\"\nend",
"def install_sequence\n stop\n \n backup_database\n install_pre_hook\n pre_migrate_database\n copy_files\n freeze_rails\n create_default_config_files\n fix_permissions\n create_directories\n create_initial_database\n set_initial_port_number\n expand_template_files\n \n migrate\n install_post_hook\n save\n \n run_rails_tests\n \n start\n end",
"def post_install_actions\n Dir.chdir(@project_name) do\n SemVer.new.save(SemVer::FILE_NAME)\n end\n end",
"def install\n ENV[\"XML_CATALOG_FILES\"] = etc/\"xml/catalog\"\n system \"autoreconf\", \"--force\", \"--install\", \"--verbose\" if build.head?\n system \"./configure\", *std_configure_args,\n \"--disable-silent-rules\",\n \"--disable-video\",\n \"--without-python\",\n \"--without-qt\",\n \"--without-gtk\",\n \"--without-x\"\n system \"make\", \"install\"\n end",
"def setup\n self.class.load_rdoc\n\n raise Gem::FilePermissionError, @doc_dir if\n File.exist?(@doc_dir) and not File.writable?(@doc_dir)\n\n FileUtils.mkdir_p @doc_dir unless File.exist? @doc_dir\n end",
"def setup\n self.class.load_rdoc\n\n raise Gem::FilePermissionError, @doc_dir if\n File.exist?(@doc_dir) and not File.writable?(@doc_dir)\n\n FileUtils.mkdir_p @doc_dir unless File.exist? @doc_dir\n end",
"def prepare!\n if !@is_prepared\n @is_prepared = true\n buildfile = manifest.target.buildfile\n if buildfile.task_defined? 'entry:prepare'\n buildfile.invoke 'entry:prepare',\n :entry => self,\n :manifest => self.manifest,\n :target => self.manifest.target,\n :config => self.manifest.target.config,\n :project => self.manifest.target.project\n end\n end\n return self\n end",
"def install(testmode=false)\n @changeset.clear\n extract_files(testmode)\n\n # Generate checksums and add to hash\n checksums = Hash.new\n if File.exists?(@install_dir)\n Dir.chdir(@install_dir) do |path|\n @changeset.each do |file|\n checksums[file] = sha1sum(file) unless @exclude.include? file\n end\n end \n #\tDir.glob(\"**/*.*\") do |file|\n #\t @changeset << file.to_s\n #\t if File.file?(file)\n #\t if [email protected]? file\n #\t checksums[file] = sha1sum(file)\n #\t end\n #\t end\n #\tend\n # end\n end\n \n # Write out checksum file\n File.open(checksum_fqn, \"w+\") do |file|\n file.puts JSON.generate(checksums)\n end unless testmode\n\n return @changeset\n end",
"def setup\n add_standard_properties\n #\n create_banner\n create_standard_options\n create_advanced_options\n create_mode_options\n create_application_options\n create_feature_options\n create_tail_options\n #\n parse_options\n load_config_configuration\n create_result_directory\n load_results_archive\n end",
"def install!\n\t\t\traise \"Target exists\" if target.present?\n\n\t\t\t# Directory entry - create the directory\n\t\t\ttarget.mkpath\n\t\tend",
"def install\n nil\n end",
"def install\n # # Changes log level to default value\n # inreplace \"etc/baetyl/conf.yml\" do |s|\n # s.gsub! \"level: debug\", \"\"\n # end\n\n bin.install Dir[\"bin/*\"]\n etc.install Dir[\"etc/*\"]\n end",
"def initialize\n # Load the setup settings and any user overrides.\n @settings = Configuration::CombinedConfiguration.new\n @settings.load_configuration('default', 'Configuration/setup.yaml')\n @settings.load_configuration('user', 'Configuration/user.yaml')\n\n @ruby_bin = RbConfig::CONFIG['bindir']\n @install_flag = \".bundle/#{RUBY_VERSION}_#{ruby_platform}.flag\"\n\n # The timestamp values - the installer is run depending on these values.\n @t1 = UserSettings.last_modify_date.to_i\n @t2 = File.mtime('Gemfile').to_i\n\n @gem_path = File.join(@settings['setup.gem_path'], ruby_platform)\n @mysql_dir = File.join(FRAMEWORK_ROOT, \"#{LIB_DIR}/mysql/#{ruby_platform}\")\n\n runtime.save(:ruby_bin, @ruby_bin)\n runtime.save(:gem_path, @gem_path)\n runtime.save(:mysql_dir, @mysql_dir)\n runtime.save(:setup_settings, @settings)\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 generate_manifest_files iss_file, update_url\n iss = InnoSetup::SourceFile.new(iss_file, Dir.getwd, 'CD_INSTALLER' => 1)\n iss.components.each do |name, component|\n next unless component.includes_manifest?\n manifest = component.manifest\n # TODO - We need to include *.iss file's directory when creating this file.\n File.open(component.manifest_name, 'w') {|f| f.write(manifest) }\n end\n File.open(\"release.spec\", 'w') do |f| \n f.write(iss.spec_file(\"Build\" => release_id || \"DIRTY\", \n \"Update-URL\" => update_url))\n end\n sign_file_with_gpg 'release.spec'\nend",
"def prepare_path\n log(\"prepare_path\")\n FileUtils.mkdir_p(path) unless Dir.exist?(path)\n rescue Exception => e\n log(\"prepare_path\", \"ERROR #{e}\")\n notify( \"reader.error\", { :error => \"prepare_path\" } )\n end",
"def pkg_install\n return if @install.count == 0\n\n sysprint \"#{@name} install\"\n\n if @install[:bsys_install] != nil\n if @bsdstyle == true\n FileUtils::cd(@srcdir)\n else\n FileUtils::cd(@objdir)\n end\n\n unless sysexec(@install[:bsys_install])\n syserr \"Failed to install package\"\n raise\n end\n\n FileUtils::cd(BSYS_ROOTDIR)\n\n @install.delete(:bsys_install)\n end\n\n @install.each_pair do |src, dst|\n dst = File::join($project_rootdir, dst)\n if File::directory? src\n FileUtils::mkdir_p dst\n continue\n end\n\n # Create directory if it doesn't exists\n FileUtils::mkdir_p dst[0..-(File::basename(dst).length + 1)]\n\n if File::executable? src\n FileUtils::install(src, dst, :mode => 0755)\n else\n FileUtils::install(src, dst, :mode => 0644)\n end\n end\n end",
"def setup(install_dir, jar_dir)\n @install_dir = install_dir\n @jar_dir = jar_dir\n end",
"def setup_files\n create_application_rb\n create_production_rb\n end",
"def setup\n install_latest_ruby\n\n install_global_gems\n end",
"def prepare_target_dir\n begin\n FileUtils.mkdir(@output_dir)\n copy_default_files\n rescue Errno::EEXIST\n puts \"-- #{output_dir} already exists -- canceling initialization. \"\n return\n end\n end",
"def prepare doc_dir\n debug_msg \" preparing for web (gzip)\"\n cwd = Dir.pwd\n begin\n Dir.chdir doc_dir\n zip_file = 'rdoc.zip'\n `zip -r #{zip_file} .`\n ensure\n Dir.chdir cwd\n end\n end",
"def post_fetch local_filename\n if local_filename.end_with?('.tsv')\n logger.info \"Deploying contents of config file: #{local_filename}\"\n process_config_file local_filename\n\n elsif local_filename.end_with?('.gz')\n logger.info \"Deploying R package: #{local_filename}\"\n execute \"install custom R package #{local_filename}\" do\n command \"R CMD INSTALL #{local_filename}\"\n end\n\n elsif local_filename.end_with?('.deb')\n logger.info \"Deploying Debian package: #{local_filename}\"\n package_base = Regexp.new(\".*/([^/]+)_([^_/]+)\\.deb$\").match(local_filename)[1]\n dpkg_package \"#{package_base}\" do\n action :install\n source local_filename\n end\n end\n end",
"def run\n header\n what_is_installed?\n install_pianobar\n setup_config_file\n make_fifos\n setup_auto_play_station\n end",
"def prerequisites\n\tKitchenplan::Application.fatal! \"Don't run this as root!\" unless running_as_normaluser?\n\tKitchenplan::Application.fatal! \"#{ENV['USER']} needs to be part of the 'admin' group!\" unless user_is_admin?\n\tKitchenplan::Application.fatal! \"Platform version too low. Your version: #{self.version}\" unless version_supported?\n\tinstall_bundler\n\t# needed for proper librarian usage\n\tinstall_git\n\tkitchenplan_bundle_install\n end",
"def prerequisites\n\tKitchenplan::Application.fatal! \"Don't run this as root!\" unless running_as_normaluser?\n\tKitchenplan::Application.fatal! \"#{ENV['USER']} needs to be part of the 'admin' group!\" unless user_is_admin?\n\tKitchenplan::Application.fatal! \"Platform version too low. Your version: #{self.version}\" unless version_supported?\n\tinstall_bundler\n\t# needed for proper librarian usage\n\tinstall_git\n\tkitchenplan_bundle_install\n end",
"def _init_filesystem\n\t\t# Prepare temporary work directory\n\t\tcommand_send(\"sudo rm -rf /tmp/.captain\")\n\t\tcommand_send(\"mkdir -p /tmp/captain/transfers\")\n\t\tcommand_send(\"mkdir -p /tmp/captain/checkpoints/export\")\n\t\tcommand_send(\"mkdir -p /tmp/captain/checkpoints/import\")\n\tend",
"def install_update_file(file, extension)\n @log.info('Installing' + extension + 'file.')\n command = 'echo ' + @sudo_password + ' | '\n case extension\n when '.deb'\n command += 'sudo -S dpkg -i \"' + file.path + '\"'\n when '.rpm'\n command += 'sudo -S rpm -i \"' + file.path + '\"'\n end\n Kernel.system(command)\n end",
"def install\n safe_system \"pax --insecure -rz -f Payload.gz -s ',./bin,#{bin},' -s ',./man,#{man},' -s ',./lib,#{lib},' -s ',./license_gpl_pdftk,#{prefix}/LICENSE,' -s ',./,#{prefix}/README/,'\"\n end",
"def setup\n @infile_ext = File.extname(@infile)\n file_ext_check\n true\n end",
"def install_file(source, destination)\n overwrite = overwrite? destination\n if overwrite.downcase == \"y\"\n FileUtils.copy_entry(source, destination, :preserve=>true, :remove_destination=>true)\n return true\n else\n puts \"Skipped installation of #{File.basename(source)}\"\n return false\n end\nend",
"def setup(*_)\n require 'reaper-man'\n location = ReaperMan::Signer::HELPER_COMMAND\n if(location.include?('jar!'))\n tmp_file = Tempfile.new('reaper-man')\n new_location = File.join(Dir.home, File.basename(tmp_file.path))\n tmp_file.delete\n File.open(new_location, 'w') do |file|\n file.puts File.read(location)\n end\n File.chmod(0755, new_location)\n ReaperMan::Signer.send(:remove_const, :HELPER_COMMAND)\n ReaperMan::Signer.const_set(:HELPER_COMMAND, new_location)\n warn \"Updated ReaperMan utility script location: #{new_location}\"\n end\n end",
"def install\n cd_and_sh( pkg_dir, install_commands )\n end",
"def setup\n super\n handle_packages\n end",
"def initialize_generate\n super\n add_accessors\n declare_chefignore\n declare_gitignore\n end",
"def install\n raise \"Not implemented yet!\"\n end",
"def init(name, version)\n @name = name\n @version = version\n @package_files = Rake::FileList.new\n @package_dir = \"pkg\"\n @need_tar = false\n @need_tar_gz = false\n @need_tar_bz2 = false\n @need_tar_xz = false\n @need_zip = false\n @tar_command = \"tar\"\n @zip_command = \"zip\"\n @without_parent_dir = false\n end",
"def install_dry_crud\n Dir.chdir(self.class.source_root) do\n Dir.glob(File.join('**', '**')).sort.each do |file_source|\n copy_file_source(file_source) if should_copy?(file_source)\n end\n copy_crud_test_model\n end\n\n readme 'INSTALL'\n end"
] | [
"0.73702633",
"0.68934363",
"0.6653475",
"0.660166",
"0.6587716",
"0.6555563",
"0.65277135",
"0.64865",
"0.64402",
"0.63029134",
"0.6293101",
"0.6291249",
"0.6290417",
"0.62669516",
"0.6244357",
"0.6234847",
"0.62029576",
"0.6201506",
"0.6194785",
"0.61641777",
"0.6161949",
"0.6155538",
"0.6146442",
"0.61405694",
"0.6117207",
"0.6117207",
"0.6078555",
"0.6067268",
"0.6041683",
"0.60377944",
"0.60359097",
"0.60301155",
"0.5936305",
"0.5931569",
"0.5911479",
"0.5880102",
"0.58740675",
"0.5858448",
"0.5850645",
"0.58412063",
"0.5840097",
"0.58235466",
"0.5818542",
"0.5796175",
"0.5795382",
"0.5788748",
"0.5788748",
"0.57871145",
"0.57854337",
"0.57637614",
"0.5724619",
"0.5721635",
"0.5717664",
"0.5714514",
"0.57102174",
"0.57068753",
"0.56895185",
"0.5680379",
"0.56459993",
"0.5636611",
"0.5636152",
"0.5617655",
"0.56089777",
"0.5607234",
"0.56069154",
"0.560246",
"0.5602245",
"0.5602245",
"0.55926275",
"0.55915046",
"0.5586518",
"0.5585443",
"0.5579269",
"0.5561786",
"0.555665",
"0.5554522",
"0.55450726",
"0.55428505",
"0.5506868",
"0.550282",
"0.5498704",
"0.54977983",
"0.54974663",
"0.5495067",
"0.54903007",
"0.54812783",
"0.5466676",
"0.5466676",
"0.5461033",
"0.54601204",
"0.5456452",
"0.54537237",
"0.54459333",
"0.54433686",
"0.54399455",
"0.54388404",
"0.5432421",
"0.5430246",
"0.5428807",
"0.54281306"
] | 0.6584198 | 5 |
Join two paths. On Windows, dir must be converted to a relative path, by stripping the drive letter, but only if the basedir is not empty. | def join(basedir, dir)
return "#{basedir}#{dir[2..-1]}" if windows? && !basedir.empty? && (dir.length > 2)
"#{basedir}#{dir}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path_join(base, path)\n return path if path_is_absolute(path)\n base.gsub(/[\\/]+$/, '') + '/' + path.gsub(/^[\\/]+/, '')\n end",
"def join_files(base_dir, path)\n if(Pathname.new(path).relative?)\n File.join(base_dir, path)\n else\n path\n end\n end",
"def join_path(path)\n if path.include?('\\\\') && path.include?('/')\n path.gsub('\\\\', '/')\n else\n path\n end\n end",
"def join_path(*path)\n windows? ? win_friendly_path(::File.join(path)) : ::File.join(path)\n end",
"def windows_safe_path_join(*args)\n ::File.join(args).gsub(::File::SEPARATOR, ::File::ALT_SEPARATOR || File::SEPARATOR)\nend",
"def join_paths(*args)\n paths = []\n full_path = []\n temp_paths = []\n args.each {|x| temp_paths << x }\n temp_paths.flatten!\n temp_paths.each do |x|\n unless x.nil?\n paths << x.to_s.dup\n end\n end\n if paths[0].start_with?('/')\n absolute_path = true\n else\n absolute_path = false\n end\n paths.each do |path|\n unless path.nil?\n path.strip!\n path.slice!(0) while path.start_with?('/')\n path.chop! while path.end_with?('/')\n full_path << path\n end\n end\n full_path_string = full_path.join('/')\n full_path_string.slice!(0) while full_path_string.start_with?('/')\n full_path_string.chop! while full_path_string.end_with?('/')\n full_path_string.insert(0, '/') if absolute_path == true\n full_path_string\n end",
"def join(*args)\n args.unshift self\n result = Path.new(args.pop)\n return result if result.absolute?\n args.reverse_each { |arg|\n arg = Path.new(arg)\n result = arg / result\n return result if result.absolute?\n }\n result\n end",
"def join_paths(paths)\n paths.join('/').gsub(%r{/+}, '/')\n end",
"def join_path(*path)\n win_friendly_path(::File.join(path))\n end",
"def join_path(*path)\n win_friendly_path(::File.join(path))\n end",
"def merge_path(base, rel)\n\n # RFC2396, Section 5.2, 5)\n # RFC2396, Section 5.2, 6)\n base_path = split_path(base)\n rel_path = split_path(rel)\n\n # RFC2396, Section 5.2, 6), a)\n base_path << '' if base_path.last == '..'\n while i = base_path.index('..')\n base_path.slice!(i - 1, 2)\n end\n\n if (first = rel_path.first) and first.empty?\n base_path.clear\n rel_path.shift\n end\n\n # RFC2396, Section 5.2, 6), c)\n # RFC2396, Section 5.2, 6), d)\n rel_path.push('') if rel_path.last == '.' || rel_path.last == '..'\n rel_path.delete('.')\n\n # RFC2396, Section 5.2, 6), e)\n tmp = []\n rel_path.each do |x|\n if x == '..' &&\n !(tmp.empty? || tmp.last == '..')\n tmp.pop\n else\n tmp << x\n end\n end\n\n add_trailer_slash = !tmp.empty?\n if base_path.empty?\n base_path = [''] # keep '/' for root directory\n elsif add_trailer_slash\n base_path.pop\n end\n while x = tmp.shift\n if x == '..'\n # RFC2396, Section 4\n # a .. or . in an absolute path has no special meaning\n base_path.pop if base_path.size > 1\n else\n # if x == '..'\n # valid absolute (but abnormal) path \"/../...\"\n # else\n # valid absolute path\n # end\n base_path << x\n tmp.each {|t| base_path << t}\n add_trailer_slash = false\n break\n end\n end\n base_path.push('') if add_trailer_slash\n\n return base_path.join('/')\n end",
"def join(prefix, path, suffix=nil)\n root = prefix.nil? ? path.relative : prefix + \"/\" + path.relative\n suffix.nil? ? root : root + \"/\" + suffix\n end",
"def join(*args)\n args.unshift self\n result = args.pop\n result = VirtualPath.new(result) unless VirtualPath === result\n return result if result.absolute?\n args.reverse_each {|arg|\n arg = VirtualPath.new(arg) unless VirtualPath === arg\n result = arg + result\n return result if result.absolute?\n }\n result\n end",
"def join *args\n File.expand_path File.join(*args)\n end",
"def join_path(*parts)\n File.join(*parts.reject { |x| x.nil? || x.empty? })\n end",
"def join(path)\n path_str = path.to_s\n super(path_str[0..0] == '/' ? path_str[1..-1] : path_str).p\n end",
"def rto(a, b)\n\tPathname.new(File.join a, '..', b).cleanpath.to_s\nend",
"def join_and_expand_path(*parts)\n File.expand_path(File.join(parts))\n end",
"def path_join(*paths)\n path = File.join @target_path, *paths\n\n path\n end",
"def join_path segments, root = nil\n root ? %(#{root}#{segments * SLASH}) : segments * SLASH\n end",
"def join_filenames(filenames, base='./')\n filenames.map { |f| File.expand_path(File.join(base, f)) }.join(' ')\nend",
"def relativize_path path\n base_dir = Pathname.new(File.expand_path(DIR))\n other_dir = Pathname.new(File.expand_path(path))\n other_dir.relative_path_from base_dir\n end",
"def uri_join(*paths)\n return nil if paths.length == 0\n leadingslash = paths[0][0] == '/' ? '/' : ''\n trailingslash = paths[-1][-1] == '/' ? '/' : ''\n paths.map! { |path| path.sub(/^\\/+/, '').sub(/\\/+$/, '') }\n leadingslash + paths.join('/') + trailingslash\n end",
"def join_url(base_url, path)\n return path if(path.include?(':')) # Absolute URL contains ':'\n if(path[0..0] == '/')\n new_url = base_url.clone\n new_url.path = path\n new_url.to_s\n else\n (base_file_url + path).to_s\n end\n end",
"def join(*args)\n Path::Name.new(*args)\n #args.unshift self\n #result = args.pop\n #result = Path::Name.new(result) unless Path::Name === result\n #return result if result.absolute?\n #args.reverse_each {|arg|\n # arg = Path::Name.new(arg) unless Path::Name === arg\n # result = arg + result\n # return result if result.absolute?\n #}\n #result\n end",
"def Join(paths)\n pathsToJoin = [@RelativePath]\n if(paths.respond_to?(:length))\n paths.each do |path|\n pathsToJoin.concat(path.RelativePath)\n end \n else\n pathsToJoin.push(paths.RelativePath)\n end\n \n copy = CreateCopy()\n copy.RelativePath = JoinPaths(pathsToJoin)\n \n return copy\n end",
"def join(other)\n if other.is_a? Integer\n return shed(-other) if other.negative?\n\n other = other.to_s\n end\n\n other = '/' + other if other.is_a?(String) && other[0] != '/'\n self.class.new(@path + self.class.new(other).to_a)\n end",
"def relativize( path ) # :doc:\n p = Pathname.new( path )\n unless p.relative?\n p = p.relative_path_from( Pathname.pwd ).to_s\n p += '/' if path[-1] == '/'\n path = p if p.length < path.length\n end\n path\n end",
"def windows_safe_path(*pieces)\n path = File.join(*pieces)\n\n if File::ALT_SEPARATOR\n path.gsub(File::SEPARATOR, File::ALT_SEPARATOR)\n else\n path\n end\n end",
"def normalisedDir(baseDir)\n return baseDir.end_with?(\"/\") ? baseDir : baseDir + \"/\"\n end",
"def join(*args) = args.empty? ? self : subpath(super)",
"def resolve_relative_path(path, base_path)\n p = Pathname(base_path)\n p = p.dirname unless p.extname.empty?\n p += path\n\n p.cleanpath.to_s\n end",
"def join(*strings)\n relative_join(strings).absolute!\n end",
"def chop_path(path, base='.')\n full_base = File.expand_path(base)\n full_path = File.expand_path(path)\n if full_path == full_base\n '.'\n elsif full_path.start_with?(full_base)\n full_path[full_base.size+1..-1]\n else\n full_path\n end\n end",
"def getFullPath(relativePath)\n return baseDir + relativePath\n end",
"def shorten2(path)\n p = get(path)\n home = Pa.home2\n\n return p if home.empty?\n\n ret = relative_to2(p, home)\n\n if ret == p\n p\n else\n ret == \".\" ? \"\" : ret\n File.join(\"~\", ret)\n end\n end",
"def relative_dir(path, *args)\n relative_path = args ? args.join('/') : ''\n Pathname(path).dirname.join(relative_path)\n end",
"def rewrite_base_path(path) # :nodoc:\n if path !~ %r(^/)\n File.join('/', dir, path)\n else\n path\n end\n end",
"def _SplitAndJoinParts(path, pop) \n pathParts = path.split(\"/\")[0..-(pop+1)]\n \n result = JoinPaths(pathParts)\n \n # we face an absolute linux part\n if(path.start_with?(\"/\"))\n result = \"/\" + result\n end\n \n return result\n end",
"def make_path(base, href)\n return href if href[0] == '/'\n base + href\n end",
"def relative_path\n @relative_path ||= File.join(*[@dir, @name].map(&:to_s).reject(&:empty?)).delete_prefix(\"/\")\n end",
"def remove_shared_path_components(a, b)\n a_path = Pathname.new(a)\n b_path = Pathname.new(b)\n raise \"Absolute path expected but #{a} given.\" unless a_path.absolute?\n raise \"Absolute path expected but #{b} given.\" unless b_path.absolute?\n\n a_components = a_path.each_filename.to_a\n b_components = b_path.each_filename.to_a\n\n while a_components[0] == b_components[0]\n a_components.shift\n b_components.shift\n end\n File.join(a_components)\n end",
"def relativepath(abspath, relativeto)\n path = abspath.split(File::SEPARATOR)\n rel = relativeto.split(File::SEPARATOR)\n while (path.length > 0) && (path.first == rel.first)\n path.shift\n rel.shift\n end\n ('..' + File::SEPARATOR) * (rel.length - 1) + path.join(File::SEPARATOR)\n end",
"def relativize_paths(paths)\n return paths unless relativize_paths?\n paths.map do |path|\n path.gsub(%r{^#{@directory}/}, '')\n end\n end",
"def url_join(*segments)\n segments.compact!\n\n # this regex strips off leading and trailing forward slashes\n joined = segments.map { |p| p.sub(/\\A\\/?(.*?)\\/?\\z/, \"\\\\1\") }.join('/')\n\n # handle absolute URLs\n segments.first.start_with?('/') ? \"/#{joined}\" : joined\n end",
"def relative_path(*relative)\n Pathname.pwd.join(*(relative.flatten.map(&:to_s))).expand_path\n end",
"def +(path)\n self.join(path)\n end",
"def expand_path path\n dir = File.dirname path\n full_dir = call \"cd #{dir} && pwd\"\n File.join full_dir, File.basename(path)\n end",
"def relative_directory\n return '' unless @directory_root\n @path - @directory_root - name\n end",
"def relative_path path, base\n (root? path) && (offset = descends_from? path, base) ? (path.slice offset, path.length) : path\n end",
"def relativize_path(path)\n path.to_s.gsub(/^\\/?#{Regexp.escape(root_path.to_s)}\\/?/, '')\n end",
"def uri_join(*parts)\n parts = parts.compact.map(&URI.method(:escape))\n URI.parse(parts.join('/')).normalize.to_s\nend",
"def getFullPath(relativePath)\n return @baseDirectory.fullPath + relativePath\n end",
"def path_to(*args)\n args = args.map(&:to_s)\n File.join(*args)\n end",
"def merge_path_elements(dir, name, format)\n result = ::File.join([@page_file_dir, dir, self.page_file_name(name, format)].compact)\n result = Pathname.new(result).cleanpath.to_s\n if @page_file_dir\n raise Gollum::IllegalDirectoryPath unless result.start_with?(\"#{@page_file_dir}/\")\n result\n else\n result[0] == '/' ? result[1..-1] : result\n end\n end",
"def relative_path(path_to, path_from)\n path_from ||= \"\"\n path_to = Pathname.new(path_to)\n dir_from = Pathname.new(path_from).dirname\n\n path_to.relative_path_from(dir_from).to_s\n end",
"def /(other)\n File.join(self, other.to_s)\n end",
"def build_dir_path(dir_path)\r\n dir_builder = \"\"\r\n dir_path.split(\"/\").each { |dir|\r\n unless Dir.exists?(dir_builder + dir)\r\n Dir.mkdir(dir_builder + dir)\r\n end\r\n dir_builder += dir + \"/\"\r\n }\r\n end",
"def relative_path_from(other)\n Pathname.new(self).relative_path_from(Pathname.new(other)).to_s\n end",
"def append_to_home_if_not_absolute( p )\n path = Pathname.new( p )\n unless path.absolute? then\n path = Pathname.new( home_dir ) + path\n end\n return path.to_s\n end",
"def relative_path(path = @pwd, to = @root)\n Pathname.new(path).relative_path_from(Pathname.new(to)).to_s\n end",
"def +(other)\n path = self.class.new(File.join(to_s, other.to_s))\n path.cleanpath\n\n #other = Path::Name.new(other) unless Path::Name === other\n #return other if other.absolute?\n #pth = (@path + other.pathlist)\n #pth.delete('.')\n #Path::Name.create(pth, @absolute, other.trail?)\n\n # path1 = @path#\n # path2 = other.to_s\n # while m2 = %r{\\A\\.\\.(?:/+|\\z)}.match(path2) and\n # m1 = %r{(\\A|/+)([^/]+)\\z}.match(path1) and\n # %r{\\A(?:\\.|\\.\\.)\\z} !~ m1[2]\n # path1 = m1[1].empty? ? '.' : '/' if (path1 = m1.pre_match).empty?\n # path2 = '.' if (path2 = m2.post_match).empty?\n # end\n # if %r{\\A/+\\z} =~ path1\n # while m2 = %r{\\A\\.\\.(?:/+|\\z)}.match(path2)\n # path2 = '.' if (path2 = m2.post_match).empty?\n # end\n # end\n #\n # return Path::Name.new(path2) if path1 == '.'\n # return Path::Name.new(path1) if path2 == '.'\n #\n # if %r{/\\z} =~ path1\n # Path::Name.new(path1 + path2)\n # else\n # Path::Name.new(path1 + '/' + path2)\n # end\n end",
"def resolvePath(possiblyRelativePath, rootDir)\n\t\tpath = Pathname.new(possiblyRelativePath)\n\t\tif(path.absolute?()) then\n\t\t\treturn path.to_s()\n\t\telse\n\t\t\trootPath = Pathname.new(rootDir)\n\t\t\treturn rootPath.join(path)\n\t\tend\n\tend",
"def relative_path(target = '.')\n my_path = Pathname.new(path).expand_path\n target_path = Pathname.new(target.to_s).expand_path\n target_path = target_path.dirname if target_path.file?\n\n new_path = my_path.relative_path_from(target_path).to_s\n\n return new_path if new_path.index('.') == 0\n \"./#{new_path}\"\n end",
"def relative_path(target = '.')\n my_path = Pathname.new(path).expand_path\n target_path = Pathname.new(target.to_s).expand_path\n target_path = target_path.dirname if target_path.file?\n\n new_path = my_path.relative_path_from(target_path).to_s\n\n return new_path if new_path.index('.') == 0\n \"./#{new_path}\"\n end",
"def relative_path_from(other_path)\n out = [ ]\n\n matching_prefix = true\n 0.upto(@parts.length - 1) do |index|\n matching_prefix = false unless @parts[index] == other_path.part(index)\n out << @parts[index] unless matching_prefix\n end\n\n FilePath.new(*out)\n end",
"def dirname_up(path)\n path =~ /(.*)\\\\(.*)$/\n\n return $1 || path\n end",
"def get_full_path(sub_path)\n File.join(Dir.pwd, sub_path)\nend",
"def concat(other)\n other = Wgit::Url.new(other)\n raise 'other must be relative' unless other.relative?\n\n other = other.omit_leading_slash\n separator = %w[# ? .].include?(other[0]) ? '' : '/'\n\n # We use to_s below to call String#+, not Wgit::Url#+ (alias for concat).\n concatted = omit_trailing_slash.to_s + separator.to_s + other.to_s\n\n Wgit::Url.new(concatted)\n end",
"def path_debase(aPath, aBase)\n\t\t\t\taBase = append_slash(aBase)\n\t\t\t\taPath = remove_slash(aPath) unless aPath=='/'\n\t\t\t\taPath[0, aBase.length]==aBase ? aPath[aBase.length, aPath.length-aBase.length] : aPath\n\t\t\tend",
"def rewrite_path # :nodoc:\n if uri.path[0] != ?/\n prepend_path File.join('/', options[:dir].to_s)\n end\n end",
"def base_relative_dir\n \t\[email protected](/^\\//,\"\")\n \tend",
"def fix_dir(dir)\n (dir.nil? || dir.empty?) && '/' || dir\n end",
"def qualify_path(path, root = @app_dir)\n \"$PWD/#{Pathname.new(path).relative_path_from(Pathname.new(root))}\"\n end",
"def uniPath(source)\n source.gsub(/\\\\/, File::SEPARATOR)\nend",
"def relative_path(from, to); end",
"def path_to(to)\n from = Pathname.new('/' + current_resource.destination_path).dirname\n rp = Pathname.new( Pathname.new(to).relative_path_from(from) ).cleanpath.to_s + '/'\n rp == './' ? '' : rp\n end",
"def root_path(*args)\n relative = File.join(*args)\n return relative if relative.expand_path == relative\n root.expand_path / relative\n end",
"def root_path(*args)\n relative = File.join(*args)\n return relative if relative.expand_path == relative\n root.expand_path / relative\n end",
"def join_string(str1, str2)\n full = str1 + str2\n return full\nend",
"def MakeRelativeTo(path)\n if(path == nil)\n return self\n end\n \n #puts \"Making path relative, self: \" + self.to_s + \", path: \" + path.to_s \n \n originalPathParts = PathParts()\n pathParts = path.PathParts()\n \n #puts \"original parts: #{originalPathParts}\"\n #puts \"input parts: #{pathParts}\"\n \n #newPath = ProjectPath.new({base: path.AbsolutePath()})\n \n minPartsNumber = [originalPathParts.length, pathParts.length].min\n commonPartsNumber = 0\n \n for i in 0..minPartsNumber-1\n if(originalPathParts[i] != pathParts[i])\n break\n end\n commonPartsNumber += 1\n end\n \n #puts \"Common parts: #{commonPartsNumber}\"\n \n # the paths are basically the same, so we return the path \".\"\n if(commonPartsNumber == originalPathParts.length && commonPartsNumber == pathParts.length)\n return ProjectPath.new({\n base: path.AbsolutePath(),\n relative: \".\"\n })\n end\n\n upSwitchesNumber = pathParts.length - commonPartsNumber\n for i in commonPartsNumber-1..pathParts.length-1\n if(pathParts[i] == '.' or pathParts[i] == '..')\n upSwitchesNumber -= 1\n end\n end\n \n upSwitches = Array.new(upSwitchesNumber, \"..\")\n \n return ProjectPath.new({\n base: path.AbsolutePath(),\n relative: JoinPaths(upSwitches + originalPathParts[commonPartsNumber..-1])\n })\n end",
"def path(root, *parts)\n send(root).join(*parts)\n end",
"def collect_path_string(dir_set)\n path = \"/\"\n dir_set.each { |dir| path += \"#{dir}/\" }\n path\n end",
"def win_slashify(path)\n path.gsub(File::SEPARATOR, (File::ALT_SEPARATOR || '\\\\'))\n end",
"def ref_path(dir, subdir, path)\n # this stuff is overkill, and doesn't work anyways:\n #depth = dir.split(File::SEPARATOR).reject{ |d| d.empty? }.count\n #parent_dirs = Array.new(depth, '..')\n File.join('..', ContentRepo::ResourceNode::PATHNAME, path )\n end",
"def abspath path\n if path[0] != '/'\n @homedir + '/' + path\n else\n path\n end\n end",
"def relative_path_to(other)\n other.relative_path_from(@root)\n end",
"def join(separator = $OFS)\n '' + _join(separator)\n end",
"def simplify_path(path)\n stack = []\n result = ''\n\n path.split('/').each do |dir|\n if dir == '' || dir == '.'\n next\n elsif dir == '..'\n stack.pop()\n else\n stack.push(dir)\n end\n end\n\n while stack.length > 0\n result = '/' + stack.pop() + result\n end\n\n return '/' if result == ''\n\n result\nend",
"def relative!\n @string.gsub!(/(?<!:)#{separator * 2}/, separator)\n @string[/\\A#{separator}|^/] = \"\"\n\n self\n end",
"def platform_specific_path(path)\n if RUBY_PLATFORM =~ /mswin|mingw|windows/\n system_drive = ENV['SYSTEMDRIVE'] ? ENV['SYSTEMDRIVE'] : \"\"\n path = win_slashify File.join(system_drive, path.split('/')[2..-1])\n end\n\n path\n end",
"def fullpath(uri)\n return File.join(DIR, uri.gsub('/', File::SEPARATOR))\n end",
"def expand_path(file_name, dir_string = '/')\n expanded = File.expand_path(file_name, dir_string)\n if RUBY_PLATFORM.match?(/(:?mswin|mingw)/) # only if the platform is Windows\n expanded = expanded[2..-1] # remove the drive letter ('D:')\n end\n expanded\n end",
"def common_directory paths\n dirs = paths.map{|path| path.split('/')}\n min_size = dirs.map{|splits| splits.size}.min\n dirs = dirs.map{|splits| splits[0...min_size]}\n uncommon_idx = dirs.transpose.each_with_index.find{|dirnames, idx| dirnames.uniq.length > 1}.last\n dirs[0][0...uncommon_idx].join('/')\n end",
"def rel_path_to(target=self.class.pwd, base: self.class.pwd, mode: :rel, clean_mode: :abs_clean, inside: false, **opts)\n\t\t\t\ttarget=self.class.new(target) unless target.is_a?(self.class)\n\t\t\t\tsbase=opts[:source_base]||base\n\t\t\t\tsmode=opts[:source_mode]||clean_mode\n\t\t\t\ttbase=opts[:target_base]||base\n\t\t\t\ttmode=opts[:target_mode]||clean_mode\n\t\t\t\tsource=self.convert_path(base: sbase, mode: smode)\n\t\t\t\ttarget=target.convert_path(base: tbase, mode: tmode)\n\t\t\t\tfrom=inside ? source : source.dirname\n\t\t\t\ttarget.convert_path(base: from, mode: mode)\n\t\t\tend",
"def cleanpath\n names = []\n split('/').each do |name|\n case name\n when '..'\n names.pop\n when '.'\n when ''\n else\n names.push name\n end\n end\n names.join('/')\n end",
"def reduce_path(path)\n if path =~ /^(https?:\\/\\/.+)(\\/.*)/\n prefix = $1\n path = $2\n relative = false\n else\n prefix = nil\n relative = path[0] != '/'\n end\n\n while path.sub!(/\\/*[^\\/]+\\/+\\.\\./, ''); end\n while path.sub!(/\\/+\\.\\/+/, '/'); end\n path = path[2..-1] if path[0..1] == './'\n while path.sub!(/\\/\\//, '/'); end\n\n path = path[1..-1] if relative and path[0] == '/'\n path = prefix + path if prefix\n path\n end",
"def expand_path file\n return File.expand_path(file) if file.start_with?(\"~/\")\n return file if file[0] == '/'\n\n return File.join(@current_dir, file)\nend",
"def expand_path path\n path_segments, path_root = partition_path path\n if path.include? DOT_DOT\n resolved_segments = []\n path_segments.each do |segment|\n segment == DOT_DOT ? resolved_segments.pop : resolved_segments << segment\n end\n join_path resolved_segments, path_root\n else\n join_path path_segments, path_root\n end\n end",
"def remove_leading_slash(path); end"
] | [
"0.7850884",
"0.74524856",
"0.73209846",
"0.7192438",
"0.71310014",
"0.7095972",
"0.7014305",
"0.6994182",
"0.6990909",
"0.6990909",
"0.6944775",
"0.682914",
"0.6815405",
"0.66741234",
"0.6613223",
"0.6578078",
"0.6552504",
"0.6476609",
"0.63659006",
"0.6244955",
"0.62412465",
"0.6230574",
"0.62089425",
"0.61115515",
"0.6092976",
"0.60591286",
"0.60482305",
"0.60376793",
"0.59515893",
"0.59491974",
"0.594503",
"0.59166425",
"0.58892584",
"0.5876343",
"0.5865668",
"0.58617944",
"0.579019",
"0.57475716",
"0.57328695",
"0.5646309",
"0.56384826",
"0.56357247",
"0.56204194",
"0.56200767",
"0.5612782",
"0.5600726",
"0.557819",
"0.5564569",
"0.5562354",
"0.55462736",
"0.5522459",
"0.5519981",
"0.5500404",
"0.54973954",
"0.5495015",
"0.54774743",
"0.5456185",
"0.5419852",
"0.541468",
"0.54127705",
"0.5401445",
"0.53968847",
"0.53923327",
"0.5385269",
"0.5385269",
"0.53756106",
"0.5364303",
"0.53438574",
"0.5342415",
"0.53281355",
"0.5325993",
"0.53232765",
"0.53178596",
"0.53165597",
"0.53152615",
"0.5292509",
"0.52855986",
"0.5281258",
"0.5281258",
"0.5253654",
"0.5230571",
"0.52299",
"0.52116734",
"0.5209146",
"0.52059203",
"0.5204188",
"0.52000487",
"0.51976186",
"0.518525",
"0.51799047",
"0.5177449",
"0.5177137",
"0.5170075",
"0.5148506",
"0.5145194",
"0.5144894",
"0.51444805",
"0.51384133",
"0.5138289",
"0.51358247"
] | 0.7886245 | 0 |
Install file(s) from ./bin to RbConfig::CONFIG['bindir']. Patch it on the way to insert a ! line; on a Unix install, the command is named as expected (e.g., bin/rdoc becomes rdoc); the shebang line handles running it. Under windows, we add an '.rb' extension and let file associations do their stuff. | def install_binfile(from, op_file, target)
tmp_file = Tempfile.new('facter-binfile')
ruby = if !InstallOptions.ruby.nil?
InstallOptions.ruby
else
File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'])
end
File.open(from) do |ip|
File.open(tmp_file.path, 'w') do |op|
op.puts "#!#{ruby}"
contents = ip.readlines
contents.shift if contents[0] =~ /^#!/
op.write contents.join
end
end
if windows? && InstallOptions.batch_files
installed_wrapper = false
if File.exist?("#{from}.bat")
install("#{from}.bat", File.join(target, "#{op_file}.bat"), mode: 0o755, preserve: true, verbose: true)
installed_wrapper = true
end
if File.exist?("#{from}.cmd")
install("#{from}.cmd", File.join(target, "#{op_file}.cmd"), mode: 0o755, preserve: true, verbose: true)
installed_wrapper = true
end
unless installed_wrapper
tmp_file2 = Tempfile.new('facter-wrapper')
cwv = <<-SCRIPT
@echo off
SETLOCAL
if exist "%~dp0environment.bat" (
call "%~dp0environment.bat" %0 %*
) else (
SET "PATH=%~dp0;%PATH%"
)
ruby.exe -S -- facter %*
SCRIPT
File.open(tmp_file2.path, 'w') { |cw| cw.puts cwv }
install(tmp_file2.path, File.join(target, "#{op_file}.bat"), mode: 0o755, preserve: true, verbose: true)
tmp_file2.unlink
end
end
install(tmp_file.path, File.join(target, op_file), mode: 0o755, preserve: true, verbose: true)
tmp_file.unlink
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def installBIN(from, opfile)\r\n\r\n tmp_dir = nil\r\n for t in [\".\", \"/tmp\", \"c:/temp\", $bindir]\r\n stat = File.stat(t) rescue next\r\n if stat.directory? and stat.writable?\r\n tmp_dir = t\r\n break\r\n end\r\n end\r\n\r\n fail \"Cannot find a temporary directory\" unless tmp_dir\r\n tmp_file = File.join(tmp_dir, \"_tmp\")\r\n\r\n File.open(from) do |ip|\r\n File.open(tmp_file, \"w\") do |op|\r\n ruby = File.join($realbindir, $ruby)\r\n op.puts \"#!#{ruby}\"\r\n op.write ip.read\r\n end\r\n end\r\n\r\n opfile += \".rb\" if CONFIG[\"target_os\"] =~ /mswin/i\r\n File::install(tmp_file, File.join($bindir, opfile), 0755, true)\r\n File::unlink(tmp_file)\r\nend",
"def wrap bin_file, pythonpath\n bin_file = Pathname.new bin_file\n libexec_bin = Pathname.new libexec/'bin'\n libexec_bin.mkpath\n mv bin_file, libexec_bin\n bin_file.write <<-EOS.undent\n #!/bin/sh\n PYTHONPATH=\"#{pythonpath}:$PYTHONPATH\" \"#{libexec_bin}/#{bin_file.basename}\" \"$@\"\n EOS\n end",
"def wrap bin_file, pythonpath\n bin_file = Pathname.new bin_file\n libexec_bin = Pathname.new libexec/'bin'\n libexec_bin.mkpath\n mv bin_file, libexec_bin\n bin_file.write <<-EOS.undent\n #!/bin/sh\n PYTHONPATH=\"#{pythonpath}:$PYTHONPATH\" \"#{libexec_bin}/#{bin_file.basename}\" \"$@\"\n EOS\n end",
"def wrap bin_file, pythonpath\n bin_file = Pathname.new bin_file\n libexec_bin = Pathname.new libexec/'bin'\n libexec_bin.mkpath\n mv bin_file, libexec_bin\n bin_file.write <<-EOS.undent\n #!/bin/sh\n PYTHONPATH=\"#{pythonpath}:$PYTHONPATH\" \"#{libexec_bin}/#{bin_file.basename}\" \"$@\"\n EOS\n end",
"def install_bin\n bin.install_symlink \"../opt/#{pkgname}/git-annex\"\n bin.install_symlink \"../opt/#{pkgname}/git-annex-shell\"\n bin.install_symlink \"../opt/#{pkgname}/git-annex\" => \"git-remote-tor-annex\"\n end",
"def bin(name, opts)\n if opts[:go]\n import = opts[:go]\n path = File.join(BIN, import.split('/').last)\n file(path) { run \"go install #{import}\" }\n define_method(name) do\n Rake::Task[path].invoke\n path\n end\n elsif opts[:brew]\n formula = opts[:brew]\n define_method(name) do\n run \"hash #{name} || brew install #{formula}\"\n name\n end\n end\nend",
"def install_to_directory\n # Get the current directory\n curr_dir = FileUtils::pwd + '/'\n # Use FileUtils\n fu = FileUtils\n # If we're just running as a simulation\n if $simulate\n # Use ::DryRun, that just echoes the commands, instead of the normal FileUtils\n fu = FileUtils::DryRun # ::DryRun / ::NoWrite\n end\n\n # Tell the user\n puts \"Installing the files to \".green + $install_dir.yellow\n puts \" (Keeping the .rb extensions) \".green if $keep_extensions\n\n # Go through the files\n files = ['deleteemailalias.rb','addemailalias.rb','listemailaliases.rb',\n 'deleteemaildomain.rb','addemaildomain.rb','deleteemailaccount.rb',\n 'listemailaccounts.rb','addemailaccount.rb','generate_password.rb']\n files.each { |f|\n # Remove the extenstion (unless we should keep it)\n nf = $keep_extensions ? f : f[0..-4]\n\n # Tell the user\n puts \"> Linking \".green + \"#{curr_dir}#{f}\".yellow + ' to '.green + \"#{$install_dir}#{nf}\".yellow\n\n if $force_install\n puts \"Forcing the install of #{nf}!\".red\n # Link the file\n fu.ln_sf curr_dir + f, $install_dir + nf\n else\n begin\n # Link the file\n fu.ln_s curr_dir + f, $install_dir + nf\n rescue Exception => e\n puts \"Couldn't link the file:\".pink\n puts e.message.red\n next\n end\n end\n\n puts \"> Adding 'execute permission' to the file\".green\n # adding \"execute permission\"\n fu.chmod \"a+x\", $install_dir + nf\n }\n\nend",
"def install\n # # Changes log level to default value\n # inreplace \"etc/baetyl/conf.yml\" do |s|\n # s.gsub! \"level: debug\", \"\"\n # end\n\n bin.install Dir[\"bin/*\"]\n etc.install Dir[\"etc/*\"]\n end",
"def bin_wrapper_file\n rbconfig('ruby_install_name').match /^(.*)ruby(.*)$/\n File.join(Config.bin_dir, \"#{$1}#{@bin_name}#{$2}\")\n end",
"def path_with_prepended_ruby_bin\n env_path = ENV[\"PATH\"].dup || \"\"\n existing_paths = env_path.split(File::PATH_SEPARATOR)\n existing_paths.unshift(RbConfig::CONFIG[\"bindir\"])\n env_path = existing_paths.join(File::PATH_SEPARATOR)\n env_path.encode(\"utf-8\", invalid: :replace, undef: :replace)\n end",
"def install(executable_path, base_directory = base_directory_guess, &block)\n executable_file = Pathname.new(executable_path).expand_path\n executable_name = executable_file.basename.to_s\n\n used_hook_paths(base_directory).each do |hook_path|\n hook_path.mkpath\n hook_executable_file = hook_path + executable_name \n block.call(hook_executable_file) if block\n hook_executable_file.unlink if hook_executable_file.symlink?\n hook_executable_file.make_symlink(executable_file)\n end\n end",
"def build_ruby\n bin = RbConfig::CONFIG[\"RUBY_INSTALL_NAME\"] || RbConfig::CONFIG[\"ruby_install_name\"]\n bin << (RbConfig::CONFIG['EXEEXT'] || RbConfig::CONFIG['exeext'] || '')\n File.join(RbConfig::CONFIG['bindir'], bin)\n end",
"def install\n FileUtils.mv self.class.extracted_file.to_s, self.class.force_installed_executable.to_s\n end",
"def ruby_bin_path\n #config_section.ruby_bin_path || ENV['_'] =~ /ruby/ ||\n require 'rbconfig'\n File.expand_path(Config::CONFIG['RUBY_INSTALL_NAME'], Config::CONFIG['bindir'])\n end",
"def add_bindir(executables)\n return nil if executables.nil?\n\n if @bindir\n Array(executables).map {|e| File.join(@bindir, e) }\n else\n executables\n end\n rescue\n return nil\n end",
"def install\n bin.install \"SwiftyScripts\"\n end",
"def gem_install_args\n gem, version = config[:version].split(\"@\")\n if gem =~ /^\\d+\\.\\d+\\.\\d+/\n version = gem\n gem = \"busser\"\n end\n\n root = config[:root_path]\n gem_bin = remote_path_join(root, \"bin\")\n\n # We don't want the gems to be installed in the home directory,\n # this will force the bindir and the gem install location both\n # to be under /tmp/verifier\n args = gem\n args += \" --version #{version}\" if version\n args += \" --no-rdoc --no-ri --no-format-executable -n #{gem_bin}\"\n args += \" --no-user-install\"\n args\n end",
"def prepare_installation\n InstallOptions.configs = true\n InstallOptions.batch_files = true\n\n ARGV.options do |opts|\n opts.banner = \"Usage: #{File.basename($PROGRAM_NAME)} [options]\"\n opts.separator ''\n opts.on('--[no-]configs', 'Prevents the installation of config files', 'Default off.') do |onconfigs|\n InstallOptions.configs = onconfigs\n end\n opts.on('--destdir[=OPTIONAL]',\n 'Installation prefix for all targets',\n 'Default essentially /') do |destdir|\n InstallOptions.destdir = destdir\n end\n # opts.on('--configdir[=OPTIONAL]', 'Installation directory for config files', 'Default /etc') do |configdir|\n # InstallOptions.configdir = configdir\n # end\n opts.on('--bindir[=OPTIONAL]',\n 'Installation directory for binaries',\n 'overrides RbConfig::CONFIG[\"bindir\"]') do |bindir|\n InstallOptions.bindir = bindir\n end\n opts.on('--ruby[=OPTIONAL]',\n 'Ruby interpreter to use with installation',\n 'overrides ruby used to call install.rb') do |ruby|\n InstallOptions.ruby = ruby\n end\n opts.on('--sitelibdir[=OPTIONAL]',\n 'Installation directory for libraries',\n 'overrides RbConfig::CONFIG[\"sitelibdir\"]') do |sitelibdir|\n InstallOptions.sitelibdir = sitelibdir\n end\n opts.on('--mandir[=OPTIONAL]',\n 'Installation directory for man pages',\n 'overrides RbConfig::CONFIG[\"mandir\"]') do |mandir|\n InstallOptions.mandir = mandir\n end\n opts.on('--full', 'Performs a full installation. All', 'optional installation steps are run.') do |_full|\n InstallOptions.configs = true\n end\n opts.on('--no-batch-files', 'Prevents installation of batch files for windows', 'Default off') do |_batch_files|\n InstallOptions.batch_files = false\n end\n opts.separator('')\n opts.on_tail('--help', 'Shows this help text.') do\n warn opts\n exit\n end\n\n opts.parse!\n end\n\n version = [RbConfig::CONFIG['MAJOR'], RbConfig::CONFIG['MINOR']].join('.')\n libdir = File.join(RbConfig::CONFIG['libdir'], 'ruby', version)\n\n # Mac OS X 10.5 and higher declare bindir\n # /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin\n # which is not generally where people expect executables to be installed\n # These settings are appropriate defaults for all OS X versions.\n RbConfig::CONFIG['bindir'] = '/usr/bin' if RUBY_PLATFORM =~ /^universal-darwin[\\d\\.]+$/\n\n # if InstallOptions.configdir\n # configdir = InstallOptions.configdir\n # elsif windows?\n # path = File.join(File.dirname(__FILE__), \"lib\", \"custom_facts\", \"util\", \"config.rb\")\n # require_relative(path)\n\n # configdir = File.join(LegacyFacter::Util::Config.windows_data_dir, \"PuppetLabs\", \"facter\", \"etc\")\n # else\n # configdir = File.join('/', 'etc', 'puppetlabs', 'facter')\n # end\n\n bindir = InstallOptions.bindir || RbConfig::CONFIG['bindir']\n\n if InstallOptions.sitelibdir\n sitelibdir = InstallOptions.sitelibdir\n else\n sitelibdir = RbConfig::CONFIG['sitelibdir']\n if sitelibdir.nil?\n sitelibdir = $LOAD_PATH.find { |x| x =~ /site_ruby/ }\n if sitelibdir.nil?\n sitelibdir = File.join(libdir, 'site_ruby')\n elsif sitelibdir !~ Regexp.quote(version)\n sitelibdir = File.join(sitelibdir, version)\n end\n end\n end\n\n mandir = InstallOptions.mandir || RbConfig::CONFIG['mandir']\n\n # This is the new way forward\n destdir = InstallOptions.destdir || ''\n\n # configdir = join(destdir, configdir)\n bindir = join(destdir, bindir)\n mandir = join(destdir, mandir)\n sitelibdir = join(destdir, sitelibdir)\n\n # makedirs(configdir) if InstallOptions.configs\n makedirs(bindir)\n makedirs(mandir)\n makedirs(sitelibdir)\n\n InstallOptions.site_dir = sitelibdir\n # InstallOptions.config_dir = configdir\n InstallOptions.bin_dir = bindir\n InstallOptions.lib_dir = libdir\n InstallOptions.man_dir = mandir\n end",
"def install\n run \"bundle exec backup generate:config --config-path=config/backup\" unless File.exists?(\"config/backup/config.rb\")\n template \"general.rb\", \"config/backup/models/general.rb\"\n if File.exists? \".env\"\n append_file \".env\" do\n File.read(File.expand_path(find_in_source_paths('env.env')))\n end\n else\n template \"env.env\", \".env\"\n end\n run \"bundle exec wheneverize .\" unless File.exists?(\"config/schedule.rb\")\n append_file \"config/schedule.rb\" do\n File.read(File.expand_path(find_in_source_paths('schedule.rb')))\n end\n end",
"def install\n bin.install 'flush.sh' => 'flush'\n end",
"def copy_etch_files(destdir, options={})\n if options[:bindir]\n bindir = File.join(destdir, options[:bindir])\n mkdir_p(bindir)\n binapps = ['etch', 'etch_to_trunk', 'etch_cron_wrapper']\n binapps.each do |binapp|\n if options[:ruby]\n # Change #! line\n File.open(File.join(bindir, binapp), 'w') do |newfile|\n File.open(File.join('bin', binapp)) do |oldfile|\n # Modify the first line\n firstline = oldfile.gets\n # Preserve any options. I.e. #!/usr/bin/ruby -w\n shebang, shebangopts = firstline.split(' ', 2)\n newfile.puts \"#!#{options[:ruby]} #{shebangopts}\"\n # Then dump in the rest of the file\n newfile.write(oldfile.read)\n end\n end\n else\n cp(File.join('bin', binapp), bindir, :preserve => true)\n end\n chmod(0555, File.join(bindir, binapp))\n end\n end\n \n if options[:libdir]\n libdir = File.join(destdir, options[:libdir])\n mkdir_p(libdir)\n mkdir_p(File.join(libdir, 'etch'))\n \n # Substitute ETCHVER into etch/client.rb\n # Substitute proper path into CONFIGDIR in etch/client.rb if appropriate\n File.open(File.join(libdir, 'etch', 'client.rb'), 'w') do |newfile|\n IO.foreach(File.join('etch', 'client.rb')) do |line|\n if line =~ /^\\s*VERSION/\n line.sub!(/=.*/, \"= '#{ETCHVER}'\")\n end\n if options[:etcdir] && line =~ /^\\s*CONFIGDIR/\n line.sub!(/=.*/, \"= '#{options[:etcdir]}'\")\n end\n newfile.write(line)\n end\n end\n chmod(0444, File.join(libdir, 'etch', 'client.rb'))\n \n serverlibs = ['etch.rb', 'silently.rb', 'versiontype.rb']\n serverlibs.each do |serverlib|\n cp(File.join('..', 'server', 'lib', serverlib), libdir, :preserve => true)\n chmod(0444, File.join(libdir, serverlib))\n end\n end\n \n if options[:mandir]\n mandir = File.join(destdir, options[:mandir])\n man8dir = File.join(mandir, 'man8')\n mkdir_p(man8dir)\n cp(File.join('man', 'man8', 'etch.8'), man8dir, :preserve => true)\n chmod(0444, File.join(man8dir, 'etch.8'))\n end\n \n if options[:etcdir]\n etcdir = File.join(destdir, options[:etcdir])\n mkdir_p(etcdir)\n cp(File.join('etc', 'etch.conf'), etcdir, :preserve => true)\n chmod(0644, File.join(etcdir, 'etch.conf'))\n # All of the supporting config files go into a subdirectory\n etcetchdir = File.join(etcdir, 'etch')\n mkdir_p(etcetchdir)\n etcetchfiles = ['ca.pem', 'dhparams']\n etcetchfiles.each do |etcetchfile|\n cp(File.join('etc', 'etch', etcetchfile), etcetchdir, :preserve => true)\n chmod(0644, File.join(etcetchdir, etcetchfile))\n end\n end\n \n if options[:crondir]\n crondir = File.join(destdir, options[:crondir])\n mkdir_p(crondir)\n cp(File.join('etc', 'cron.d', 'etch'), crondir, :preserve => true)\n chmod(0444, File.join(crondir, 'etch'))\n end\nend",
"def install\n system \"python\", \"setup.py\", \"install\"\n\n # Make BUSCO read config.ini from current directory\n inreplace \"scripts/run_BUSCO.py\", \"BuscoConfig('%s/../config/config.ini' % os.path.dirname(os.path.realpath(__file__))\", \"BuscoConfig('config.ini'\"\n \n bin.install \"scripts/run_BUSCO.py\"\n bin.install \"scripts/generate_plot.py\"\n bin.install_symlink \"run_BUSCO.py\" => \"busco\"\n\n # Set correct directories in config template\n inreplace \"config/config.ini.default\", \"/usr/bin/\", \"/mnt/lustre/software/linuxbrew/colsa/bin/\"\n inreplace \"config/config.ini.default\", \"/home/osboxes/BUSCOVM/augustus/augustus-3.2.2/bin/\", \"/mnt/lustre/software/linuxbrew/colsa/bin/\"\n inreplace \"config/config.ini.default\", \"/home/osboxes/BUSCOVM/augustus/augustus-3.2.2/scripts/\", \"/mnt/lustre/software/linuxbrew/colsa/Cellar/augustus/3.2.2_2/libexec/scripts/\"\n inreplace \"config/config.ini.default\", \"/home/osboxes/BUSCOVM/hmmer/hmmer-3.1b2-linux-intel-ia32/binaries/\", \"/mnt/lustre/software/linuxbrew/colsa/bin/\"\n libexec.install Dir[\"config\"]\n doc.install \"BUSCO_v3_userguide.pdf\"\n end",
"def ensure_local_bin_for(*gems)\n if bin_dir && File.directory?(bin_dir)\n gems.each do |gem|\n if gemspec_path = Dir[File.join(gem_dir, 'specifications', \"#{gem}-*.gemspec\")].last\n spec = Gem::Specification.load(gemspec_path)\n spec.executables.each do |exec| \n if File.exists?(executable = File.join(gem_dir, 'bin', exec))\n local_executable = File.join(bin_dir, exec)\n puts \"Adding local executable #{local_executable}\"\n File.open(local_executable, 'w', 0755) do |f| \n f.write(executable_wrapper(spec, exec))\n end\n end\n end\n end\n end\n end\n end",
"def install\n bin.install \"#{PACKAGE_NAME}\"\n end",
"def call\n return unless @bin_dir.directory?\n\n each_binstub do |binstub|\n @bad_binstubs << binstub if binstub.bad_shebang?\n end\n\n warn unless @bad_binstubs.empty?\n end",
"def set_symlinks_for_jruby_commands\n %w(ruby irb).each do |item|\n FileUtils.ln_s(bin_path(\"j#{item}\"), bin_path(item))\n end\n end",
"def ruby_bin\n @ruby_bin ||= begin\n c = ::Config::CONFIG\n File.join(c['bindir'], c['ruby_install_name']) << c['EXEEXT']\n end\n end",
"def install\n bin.install \"bin/vh-config\"\n end",
"def install\n #python executable files\n end",
"def install\n bin.install \"bing-wallpaper.sh\" => \"bing-wallpaper\"\n prefix.install_metafiles\n end",
"def install\n # ENV.deparallelize # if your formula fails when building in parallel\n\n # Remove unrecognized options if warned by configure\n system \"git init && git submodule init && git submodule update\"\n bin.install \"install-dot-files\"\n end",
"def custom_install_commands #:nodoc:\n dress @options[:custom_install], nil, :install\n end",
"def execute_bundle_install\n log :execute_bundle_install, \"\"\n in_root { run \"bundle\" }\n end",
"def kitchenplan_bundle_install\n\tKitchenplan::Log.info \"#{self.class} : Run kitchenplan bundle install\"\n\tsudo \"#{self.omnibus_path}\\\\embedded\\\\bin\\\\bundle.bat install --binstubs=bin --quiet\"\n end",
"def kitchenplan_bundle_install\n\tKitchenplan::Log.info \"#{self.class} : Run kitchenplan bundle install\"\n\tsudo \"bundle install --binstubs=bin --quiet\"\n end",
"def fix_shebang(path)\n tmpfile = path + '.tmp'\n begin\n #XXX: needed at all?\n # it seems that FileUtils doesn't expose its default output\n # @fileutils_output = $stderr\n # we might want to allow this to be redirected.\n $stderr.puts \"shebang:open #{tmpfile}\" if @options.verbose\n unless @options.noop\n File.open(path) do |r|\n File.open(tmpfile, 'w', 0755) do |w|\n first = r.gets\n return unless SHEBANG_RE =~ first\n ruby = File.join(::RbConfig::CONFIG['bindir'],::RbConfig::CONFIG['ruby_install_name'])\n ruby << ::RbConfig::CONFIG['EXEEXT']\n #w.print first.sub(SHEBANG_RE, '#!' + RbConfig::CONFIG['ruby-prog'])\n w.print first.sub(SHEBANG_RE, '#!' + ruby)\n w.write r.read\n end\n end\n end\n FileUtils.mv(tmpfile, path, :verbose => @options.verbose,\n :noop => @options.noop)\n ensure\n FileUtils.rm_f(tmpfile, :verbose => @options.verbose,\n :noop => @options.noop)\n end\n end",
"def _install\n args = Array.new\n args << '-a'\n args << '--delete'\n component.ignore_paths.each { |p| args << \"--exclude=#{p}\" }\n dst_path = platform.local_path + platform.contrib_path + component.target_path\n dont_debug { dst_path.mkpath }\n args << component.local_path.to_s + '/'\n args << dst_path.to_s + '/'\n begin\n runBabyRun 'rsync', args\n rescue => ex\n odie \"Installing or updating library #{component.name} failed: #{ex}\"\n end\n end",
"def embedded_bin(bin)\n windows_safe_path(\"#{install_dir}/embedded/bin/#{bin}\")\n end",
"def bin_dir *args\n root.join('bin', *args).to_s\n end",
"def rundaemon(*cmd)\n @ruby ||= %x{which ruby}.chomp\n cmd = cmd.unshift(@ruby).join(\" \")\n\n out = nil\n Dir.chdir(bindir) {\n out = %x{#{@ruby} #{cmd}}\n }\n out\n end",
"def bin\n File.join(@root, 'bin')\n end",
"def install!\n cmd = [attributes.gem_binary, 'install']\n cmd << '-v' << attributes.version if attributes.version\n cmd << '--source' << attributes.source if attributes.source\n cmd << '--prerelease' if attributes.prerelease\n cmd << attributes.package_name\n\n run_command(cmd)\n end",
"def fake_embedded_bin(name)\n bin = File.join(software.install_dir, 'embedded', 'bin')\n\n FileUtils.mkdir_p(bin)\n FileUtils.ln_s(Bundler.which(name), File.join(bin, name))\n end",
"def install\n cd_and_sh( pkg_dir, install_commands )\n end",
"def install\r\n automated_install {\r\n installer = Gem::Installer.new( @gem_path,\r\n :domain => :both,\r\n :generate_rdoc => true,\r\n :generate_ri => true,\r\n :force => true,\r\n :test => false,\r\n :wrappers => true,\r\n :install_dir => Gem.dir,\r\n :security_policy => nil\r\n )\r\n installer.install\r\n }\r\n end",
"def install\n bin.install \"testscript\"\n end",
"def install\n prefix.install Dir[\"*\"] \n end",
"def to_ruby\n%{#!#{ File.join(rbconfig('bindir'), rbconfig('ruby_install_name')) }\n#\n# This file was generated by MicroGem (µgem).\n#\n# The application '#{@bin_name}' is installed as part of a gem, and\n# this file is here to facilitate running it.\n\nrequire 'rubygems'\n\nversion = \"> 0\"\nif ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then\n version = $1\n ARGV.shift\nend\n\ngem '#{@gem_name}', version\nload '#{@bin_name}'\n}\n end",
"def bundle_install\n system(\"bundle install --path=#{VENDOR_BUNDLE} --jobs=#{BUNDLER_JOBS} --retry=#{BUNDLER_RETRIES}\")\n end",
"def install\n prefix.install Dir[\"*\"]\n end",
"def install\n prefix.install Dir[\"*\"]\n end",
"def install\n bin.install \"email-backup\"\n end",
"def kitchenplan_bundle_install\n\tKitchenplan::Log.info \"#{self.class} : Run kitchenplan bundle install\"\n\tsudo \"bundle install --binstubs=#{self.omnibus_path}/bin --quiet\"\n end",
"def install_mono(source, file, build_dir, prefix)\n remote_file \"#{Chef::Config[:file_cache_path]}/#{file}\" do\n source source + file\n mode '0644'\n action :create_if_missing\n not_if \"test -e #{prefix}/bin/mono\"\n end\n\n bash \"install-#{build_dir}\" do\n user 'root'\n cwd Chef::Config[:file_cache_path]\n\n code <<-EOH\n set -e\n tar -xf #{file}\n cd #{build_dir}\n ./configure --prefix=#{prefix} --disable-nls\n make\n make install\n EOH\n not_if \"test -e #{prefix}/bin/mono\"\n end\nend",
"def ensure_bin_wrapper_for(gem_dir, bin_dir, *gems)\n if bin_dir && File.directory?(bin_dir)\n gems.each do |gem|\n if gemspec_path = Dir[File.join(gem_dir, 'specifications', \"#{gem}-*.gemspec\")].last\n spec = Gem::Specification.load(gemspec_path)\n spec.executables.each do |exec|\n executable = File.join(bin_dir, exec)\n puts \"Writing executable wrapper #{executable}\"\n File.open(executable, 'w', 0755) do |f|\n f.write(executable_wrapper(spec, exec))\n end\n end\n end\n end\n end\n end",
"def install\n # Get rid of the JRE directory so it'll use the system JRE\n system \"rm\", \"-rf\", \"jre\"\n\n # There's probably a more correct way to do this\n system \"cp\", \"-a\", \".\", \"#{libexec}\"\n\n # Link in the actual commands\n bin.install_symlink \"../libexec/SMCIPMITool\"\n end",
"def install\n bin.install \"rover\"\n end",
"def create_bin_wrapper!\n Utils.log(:debug, \"Creating bin wrapper `#{bin_wrapper_file}'\")\n File.open(bin_wrapper_file, 'w') { |f| f << to_ruby }\n File.chmod(0755, bin_wrapper_file)\n end",
"def install(app_path)\n runcmd 'install', app_path\n end",
"def run_install(install_path)\n require 'fileutils'\n install_path ||= '.'\n FileUtils.mkdir_p install_path unless File.exists?(install_path)\n install_file \"#{CC_ROOT}/config/config.example.yml\", \"#{install_path}/config.yml\"\n install_file \"#{CC_ROOT}/config/config.example.ru\", \"#{install_path}/config.ru\"\n install_file \"#{CC_ROOT}/config/database.example.yml\", \"#{install_path}/database.yml\"\n install_file \"#{CC_ROOT}/actions\", \"#{install_path}/actions\", true\n end",
"def ensure_bin_wrapper_for(gem_dir, bin_dir, *gems)\n if bin_dir && File.directory?(bin_dir)\n gems.each do |gem|\n if gemspec_path = Dir[File.join(gem_dir, 'specifications', \"#{gem}-*.gemspec\")].last\n spec = Gem::Specification.load(gemspec_path)\n spec.executables.each do |exec|\n executable = File.join(bin_dir, exec)\n message \"Writing executable wrapper #{executable}\"\n File.open(executable, 'w', 0755) do |f|\n f.write(executable_wrapper(spec, exec))\n end\n end\n end\n end\n end\n end",
"def install_update_file(file, extension)\n @log.info('Installing' + extension + 'file.')\n command = 'echo ' + @sudo_password + ' | '\n case extension\n when '.deb'\n command += 'sudo -S dpkg -i \"' + file.path + '\"'\n when '.rpm'\n command += 'sudo -S rpm -i \"' + file.path + '\"'\n end\n Kernel.system(command)\n end",
"def install\n\t install_dir(plugin_dirs) do |file|\n\t\tnext if file =~ /ROBOT/\n\t\tfile\n\t end\n\tend",
"def create_bin_stubs(stubs)\n results = stubs.map do |stub|\n run_command 'spring binstub', stub unless File.exist? \"#{Dir.pwd}/bin/#{stub}\"\n end\n !results.any? or results.all? { |result| result }\n end",
"def install\n bin.install \"cmd/brew-pkg.rb\"\n end",
"def install\n system \"curl\", \"-L\", \"-o\", \"nuget.exe\", \"https://nuget.org/nuget.exe\"\n system \"/usr/local/bin/mono\", \"nuget.exe\", \"restore\", \"./Source/Boogie.sln\"\n system \"/usr/local/bin/xbuild\", \"Source/Boogie.sln\"\n system \"mkdir\", \"#{prefix}/Binaries\"\n prefix.install Dir[\"Binaries/*\"]\n system \"echo '#!/bin/sh'$'\\\\n''mono\\ #{prefix}/Boogie.exe\\ \\\"$@\\\"'$'\\\\n' > boogie\"\n system \"chmod\", \"+x\", \"boogie\"\n bin.install \"boogie\"\n end",
"def install_conf_files\n generate(\"bindery:solr_conf\", \"#{File.join(save_location, 'solr')} --force\")\n end",
"def emulate_extension_install\n extension_name = \"utilikilt\"\n File.open('Makefile', 'w') { |f| f.write \"all:\\n\\ninstall:\\n\\n\" }\n File.open('make', 'w') do |f|\n f.write '#!/bin/sh'\n f.chmod f.stat.mode | 0111\n end\n File.open(extension_name + '.so', 'w') {}\n File.open(extension_name + '.dll', 'w') {}\n File.open('nmake.bat', 'w') { |f| }\nend",
"def bin_file(name)\n File.join bin_dir, name\n end",
"def exec\n FileUtils.cd(@dest) do\n puts \"Running `bundle install` in #{Dir.pwd}\"\n system(\"bundle install\")\n end\n end",
"def _install\n args = Array.new\n # If the project contains a makefile, it is a candidate for a derivative build.\n # In such case, protect 'libraries', 'modules' and 'themes' subdirectories\n # from deletion.\n if component.makefile\n args << '-f' << 'P /libraries/***' # this syntax requires rsync >=2.6.7.\n args << '-f' << 'P /modules/***'\n args << '-f' << 'P /profiles/***'\n args << '-f' << 'P /themes/***'\n end\n if component.drupal?\n args = Array.new\n args << '-f' << 'R /profiles/default/***' # D6\n args << '-f' << 'R /profiles/minimal/***' # D7\n args << '-f' << 'R /profiles/standard/***' # D7\n args << '-f' << 'R /profiles/testing/***' # D7\n args << '-f' << 'P /profiles/***'\n args << '-f' << 'R /sites/all/README.txt'\n args << '-f' << 'R /sites/default/default.settings.php'\n args << '-f' << 'P /sites/***'\n end\n args << '-a'\n args << '--delete'\n component.ignore_paths.each { |p| args << \"--exclude=#{p}\" }\n dst_path = platform.local_path + platform.dest_path(component)\n dont_debug { dst_path.mkpath }\n args << component.local_path.to_s + '/'\n args << dst_path.to_s + '/'\n begin\n runBabyRun 'rsync', args\n rescue => ex\n odie \"Installing or updating #{component.name} failed: #{ex}\"\n end\n end",
"def export_bin_dir\n bin_dir = config[:bin]\n return unless bin_dir\n return if ENV['PATH'].split(':').include? bin_dir\n ENV['PATH'] = \"#{bin_dir}:#{ENV['PATH']}\"\n end",
"def install\n Dir.chdir(DATA) do\n read_config\n end\n Install.new(@config)\n end",
"def emulate_extension_install(extension_name)\n File.open('Makefile', 'w') { |f| f.write \"all:\\n\\ninstall:\\n\\n\" }\n File.open('make', 'w') do |f|\n f.write '#!/bin/sh'\n f.chmod f.stat.mode | 0111\n end\n File.open(extension_name + '.so', 'w') {}\n File.open(extension_name + '.dll', 'w') {}\n File.open('nmake.bat', 'w') { |f| }\nend",
"def install\n # Get rid of the JRE directory so it'll use the system JRE\n system \"rm\", \"-rf\", \"jre\"\n\n # There's probably a more correct way to do this\n system \"cp\", \"-a\", \".\", \"#{libexec}\"\n\n # Link in the actual commands\n bin.install_symlink \"../libexec/IPMIView20\"\n bin.install_symlink \"../libexec/JViewerX9\"\n bin.install_symlink \"../libexec/TrapReceiver\"\n bin.install_symlink \"../libexec/iKVM\"\n end",
"def install\n\t\tbin.install \"cpu-sentinel\"\n\t\tconfigdir.install \"procs.conf\"\n\tend",
"def cli_install(executable_path)\n puts \"Creating symlinks at the Smuxi plugin hook locations…\"\n puts\n\n install(executable_path) do |hook_executable_file|\n puts \"Creating `#{hook_executable_file}`\"\n end\n\n puts\n puts \"Plugin `#{name}` installed.\"\n\n exit\n end",
"def install_bundle\n if options[:bundle_install]\n system('bundle', 'install')\n end\n end",
"def install\n system \"make\", \"-f\", \"LINUX/Makefile\"\n bin.install 'xum1541cfg'\n end",
"def bin_dir\n @bin_dir ||= File.join gem_dir, bindir\n end",
"def install\n libexec.install \"networking-swagger-java.sh\"\n bin.install_symlink libexec/\"networking-swagger-java.sh\" => \"networking-swagger-java\"\n end",
"def alternate_bin_paths\n [\n PDK::Util::RubyVersion.bin_path,\n File.join(PDK::Util::RubyVersion.gem_home, 'bin'),\n PDK::Util::RubyVersion.gem_paths_raw.map { |gem_path_raw| File.join(gem_path_raw, 'bin') },\n PDK::Util.package_install? ? File.join(PDK::Util.pdk_package_basedir, 'bin') : nil\n ].flatten.compact\n end",
"def install(dry = false)\n create_dirs(dry) unless @needs_dir.nil?\n link(dry) unless @links.nil?\n run_shell_commands(dry) unless @commands.empty?\n end",
"def install\n system \"./configure\", *std_configure_args\n system \"make\", \"install\"\n end",
"def install\n system \"./configure\", \"--disable-dependency-tracking\",\n \"--prefix=#{prefix}\", '--verbose', '--with-beecrypt', '--without-archive', '--with-external-db', '--without-lua'\n system \"make\", \"install\"\n end",
"def install_hack(installer)\n server_installer_name = File.basename(installer)\n return \";\" if server_installer_name.nil?\n<<SCRIPT\ncp /home/vagrant/.gitconfig /root/.gitconfig\nif [ -d \"/opt/opscode/embedded\" ]\nthen\n echo \"Bypassing server install, it appears done.\"\nelse\n echo \"PATH=/opt/opscode/embedded/bin:$PATH\" > /root/.bashrc\n sudo dpkg -i \"/installers/#{server_installer_name}\"\nfi\nSCRIPT\nend",
"def add_priv_assm\n libruby_regex = /msvcrt-ruby\\d+\\.dll$/i\n bin_dir = File.join D_INSTALL, \"bin\"\n Dir.chdir(bin_dir) { |d|\n libruby = Dir['*.dll'].grep(libruby_regex)[0]\n new = <<-EOT\n <dependency>\n <dependentAssembly>\n <assemblyIdentity version='1.0.0.0' type='win32' name='ruby_builtin_dlls'/>\n </dependentAssembly>\n </dependency>\n <file name='#{libruby}'/>\nEOT\n ['ruby.exe', 'rubyw.exe'].each { |fn|\n image = File.binread(fn)\n image.gsub!(/<\\?xml.*?<assembly.*?<\\/assembly>\\s+/m) { |m|\n orig_len = m.bytesize\n newm = m.gsub(/^\\s*<\\/assembly>/, \"#{new}</assembly>\")\n # shorten to match original\n newm.gsub!(/<!--The ID below indicates application support for/, '<!--') if newm.bytesize > orig_len\n newm.gsub!(/^ *<!--.*?-->\\n/m, \"\") if newm.bytesize > orig_len\n newm.gsub!(/^ +/, \"\") if newm.bytesize > orig_len\n raise \"replacement manifest too big #{m.bytesize} < #{newm.bytesize}\" if m.bytesize < newm.bytesize\n newm + \" \" * (orig_len - newm.bytesize)\n }\n File.binwrite(fn, image)\n }\n }\n end",
"def bin_path(_opts)\n '/bin'\n end",
"def bin_path(_opts)\n '/bin'\n end",
"def bin_path(_opts)\n '/bin'\n end",
"def install\n end",
"def ruby_path\n ext = ((RbConfig::CONFIG['ruby_install_name'] =~ /\\.(com|cmd|exe|bat|rb|sh)$/) ? \"\" : RbConfig::CONFIG['EXEEXT'])\n File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'] + ext).sub(/.*\\s.*/m, '\"\\&\"')\n end",
"def install_component\n if (backend != :stdlib && command?('rsync')) || backend == :rsync\n FileUtils.mkdir_p destination_path\n cmd = [command?('rsync'), '-rtc', '--del', '--links', \"#{source_path}/\", destination_path]\n logger.debug { \"Running command: #{cmd.join ' '}\" }\n system(*cmd)\n else\n FileUtils.remove_entry_secure destination_path if Dir.exist? destination_path\n FileUtils.mkdir_p destination_path\n FileUtils.cp_r \"#{source_path}/.\", destination_path, preserve: true\n end\n end",
"def install\n ENV.prepend_path \"PYTHONPATH\", libexec/\"lib/python2.7/site-packages\"\n system \"python\", *Language::Python.setup_install_args(libexec)\n bin.install Dir[libexec/\"bin/*\"]\n bin.env_script_all_files(libexec/\"bin\", :PYTHONPATH => ENV[\"PYTHONPATH\"])\n man1.install Dir[libexec/\"share/man/man1/*\"]\n end",
"def install_bundler\n\t# What we really need to do is check the result of the normaldo and then do a wrapped sudo.\n\t# That should be good on different platforms as long as Ruby's present.\n\tsudo \"#{self.omnibus_path}\\\\embedded\\\\bin\\\\gem install bundler --no-rdoc --no-ri\" unless bundler_installed?\n end",
"def pkg_install\n return if @install.count == 0\n\n sysprint \"#{@name} install\"\n\n if @install[:bsys_install] != nil\n if @bsdstyle == true\n FileUtils::cd(@srcdir)\n else\n FileUtils::cd(@objdir)\n end\n\n unless sysexec(@install[:bsys_install])\n syserr \"Failed to install package\"\n raise\n end\n\n FileUtils::cd(BSYS_ROOTDIR)\n\n @install.delete(:bsys_install)\n end\n\n @install.each_pair do |src, dst|\n dst = File::join($project_rootdir, dst)\n if File::directory? src\n FileUtils::mkdir_p dst\n continue\n end\n\n # Create directory if it doesn't exists\n FileUtils::mkdir_p dst[0..-(File::basename(dst).length + 1)]\n\n if File::executable? src\n FileUtils::install(src, dst, :mode => 0755)\n else\n FileUtils::install(src, dst, :mode => 0644)\n end\n end\n end",
"def install\n system \"#{ENV.cc} #{ENV.cflags} src/C/bbox.c -o bbox\"\n bin.install 'bin/ps2eps'\n bin.install 'bbox'\n share.install Dir['doc/man']\n doc.install Dir['doc/pdf']\n doc.install Dir['doc/html']\n end",
"def bin_path\n @bin_path ||= begin\n path = settings[:bin] || \"bin\"\n path = Pathname.new(path).expand_path(root).expand_path\n SharedHelpers.filesystem_access(path) {|p| FileUtils.mkdir_p(p) }\n path\n end\n end",
"def build_env_bat\n connector_dir = File.join(@mysql_dir, 'lib')\n env = {mysql_lib: to_windows_path(connector_dir)}\n\n print 'ruby.exe location: '; env[:ruby_bin] = read_path\n print '7z.exe location: '; env[:zip_bin] = read_path\n print 'wincmp3.exe location: '; env[:compare_bin] = read_path\n puts\n\n FileUtils.cd(FRAMEWORK_ROOT) { File.write('env.bat', ENV_BAT_TEMPLATE % env) }\n end",
"def install\n system \"cargo\", \"install\", *std_cargo_args\n end"
] | [
"0.67985654",
"0.6465603",
"0.6465603",
"0.6465603",
"0.6356538",
"0.6227714",
"0.6089722",
"0.60171336",
"0.6011992",
"0.5956288",
"0.58188164",
"0.5812065",
"0.57681555",
"0.57576466",
"0.57524705",
"0.5722547",
"0.57196623",
"0.57008654",
"0.5665033",
"0.5632094",
"0.56261784",
"0.56234765",
"0.56086504",
"0.5602401",
"0.55898803",
"0.5575081",
"0.5569408",
"0.5562279",
"0.55602175",
"0.55455124",
"0.5539066",
"0.5528166",
"0.5528162",
"0.5511793",
"0.55055463",
"0.54910254",
"0.54874176",
"0.5472705",
"0.5449067",
"0.54388875",
"0.54382706",
"0.54321903",
"0.5431945",
"0.54314303",
"0.54100144",
"0.5387656",
"0.5385382",
"0.5378593",
"0.5375714",
"0.53741133",
"0.53741133",
"0.53656036",
"0.53540844",
"0.5347538",
"0.53448105",
"0.53225625",
"0.53171116",
"0.5314424",
"0.5302483",
"0.5290012",
"0.5284034",
"0.52821094",
"0.52683586",
"0.5264993",
"0.52565175",
"0.5255092",
"0.5240501",
"0.5232761",
"0.52294713",
"0.52288604",
"0.52100265",
"0.520798",
"0.52039963",
"0.52034074",
"0.51981354",
"0.5194441",
"0.5192341",
"0.51797235",
"0.5171035",
"0.5169505",
"0.51686",
"0.5148834",
"0.5146668",
"0.5139137",
"0.5136768",
"0.513456",
"0.51314497",
"0.51206905",
"0.51206905",
"0.51206905",
"0.5101374",
"0.50994176",
"0.5091784",
"0.5084967",
"0.5082185",
"0.5079872",
"0.50745076",
"0.5069978",
"0.50689995",
"0.50618166"
] | 0.6630315 | 1 |
Change directory into the facter root so we don't get the wrong files for install. | def run
cd File.dirname(__FILE__) do
# Set these values to what you want installed.
bins = glob(%w[bin/facter])
libs = glob(%w[lib/**/*.rb lib/facter/fixtures/* lib/facter/os_hierarchy.json
lib/facter/fact_groups.conf lib/facter/templates/*])
man = glob(%w{man/man[0-9]/*})
prepare_installation
do_bins(bins, InstallOptions.bin_dir)
do_libs(libs)
do_man(man) unless windows?
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def install_root\n self.class.install_root.join(name)\n end",
"def set_dir(new_dir)\n # checking for / at the end of the env variable\n new_dir = '' unless new_dir\n new_dir += '/' unless new_dir[-1, 1] == '/'\n @dir = new_dir\n end",
"def install_directory\n \"C:\\\\opscode\\\\chef\"\n end",
"def chroot\n Dir.chdir '/'\n File.umask 0000\n end",
"def base\n result = sphere.cache_path.join('chef')\n result.mkpath\n result\n end",
"def simp_target_dir(subdir=File.join('simp','modules'))\n install_target = puppet_codedir\n\n if install_target.empty?\n fail('Error: Could not find a Puppet code directory for installation')\n end\n\n install_target = File.join(install_target,'environments', subdir)\n\n return install_target\nend",
"def install_dir(val = NULL)\n if null?(val)\n @install_dir || raise(MissingRequiredAttribute.new(self, :install_dir, \"/opt/chef\"))\n else\n @install_dir = val.tr('\\\\', \"/\").squeeze(\"/\").chomp(\"/\") # rubocop:disable Style/StringLiterals\n end\n end",
"def install_root\n Pathname.new(ENV[\"PREFIX\"] || \"/var/www/ood/apps/sys\")\n end",
"def install_dir(val = NULL)\n if null?(val)\n @install_dir || raise(MissingProjectConfiguration.new('install_dir', '/opt/chef'))\n else\n @install_dir = File.expand_path(val, Config.project_root)\n end\n end",
"def controll_root\n root = '/'\n if defined?(\"::Rails\")\n if Rails.respond_to?(:root)\n root = ::Rails.root\n end\n end\n root = File.join(root, PATH)\n unless File.exist?(root)\n Dir.mkdir(root)\n end\n Dir.open(root)\n end",
"def omnibus_root\n \"/opt/chef\"\n end",
"def install_files(dirpath)\n # Copy the contents of dirpath to /var/cfengine on the VM\n unless File.directory?(dirpath)\n env[:vm].ui.error(\"The path #{dirpath} must exist and be a directory\")\n raise CFEngineError, :invalid_files_directory\n end\n env[:vm].ui.info(\"Copying files from /vagrant/#{dirpath} to /var/cfengine on VM\")\n env[:vm].channel.sudo(\"cp -a '/vagrant/#{dirpath}/'* /var/cfengine\")\n end",
"def chroot(&block)\n ::Dir.chroot(path, &block)\n end",
"def mirror_spec_gemdir\n define_directories\n FileUtils.mkdir_p( @scratch_dir )\n FileUtils.cp_r( @idx_test_datadir, @scratch_dir )\n end",
"def chdir; end",
"def user_install_dir\n eval_path(find_val('user_install_dir') || home_dir)\n end",
"def chroot\n warn \"Path::Name#chroot is obsoleted. Use Dir.chroot.\"\n Dir.chroot(path)\n end",
"def setup_home_path\n\t\t\tsuper\n\n\t\t\tAWS_SUBDIRS.each do |dir|\n\t\t\t\tpath = aws_home_path.join(dir)\n\t\t\t\tnext if File.directory?(path)\n\t\t\t\t\n\t\t\t\tbegin\n\t\t\t\t\[email protected](\"Creating: #{dir}\")\n\t\t\t\t\tFileUtils.mkdir_p(path)\n\t\t\t\trescue Errno::EACCES\n\t\t\t\t\traise Errors::HomeDirectoryNotAccessible, :home_path\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def config_directory\n \"C:\\\\chef\"\n end",
"def install_dest\n ENV[\"DOTFILES_HOME\"] || ENV[\"HOME\"]\n end",
"def chroot(new_root_dir)\n @commands_and_opts.push \"#{OPTIONAL_OPTS[:chroot]}=#{new_root_dir}\"\n self\n end",
"def root_dir\n 'gen_passwd'\n end",
"def restart_dir; end",
"def generate_base_directory_environments(tmpdir)\n puppet_conf = \"#{tmpdir}/puppet2.conf\"\n dir_envs = \"#{tmpdir}/environments\"\n\n step 'Configure a the direnv directory environment'\n apply_manifest_on master, %Q{\n File {\n ensure => directory,\n owner => #{master.puppet['user']},\n group => #{master.puppet['group']},\n mode => \"0750\",\n }\n file {\n [\n '#{dir_envs}',\n '#{dir_envs}/direnv',\n ]:\n }\n\n file {\n '#{puppet_conf}':\n ensure => file,\n content => \"\n [main]\n environmentpath=#{dir_envs}\n \"\n }\n }\n\n return puppet_conf\n end",
"def prepare_dirs\n require 'fileutils'\n recipe = File.join(@data_dir, '/test/integration/test_recipe.rb')\n\n FileUtils.chmod(755, exec_order)\n FileUtils.chown_R('vagrant', 'vagrant', '/home/oneops')\n FileUtils.mkdir_p(\"/home/oneops/#{@circuit}/components/cookbooks\")\n FileUtils.mkdir_p('/home/oneops/shared/cookbooks/test/recipes')\n FileUtils.cp_r(recipe, '/home/oneops/shared/cookbooks/test/recipes/')\n end",
"def initial_path_setup\n repo_name = @repo.repo_name.gsub(/[.]+/, '-') || @repo.repo_name\n repo_path = Rails.root.join('storage', 'repos', @repo.username, @repo.supplier_project_id.to_s, repo_name)\n FileUtils.mkdir_p(repo_path) unless File.directory?(repo_path)\n Dir.chdir(repo_path)\n ActiveRecord::Base.connection_pool.with_connection do \n @repo.update(clone_path: repo_path)\n end\n end",
"def set_root_path!\n raise 'IRONNAILS_ROOT is not set' unless defined?(::IRONNAILS_ROOT)\n raise 'IRONNAILS_ROOT is not a directory' unless File.directory?(::IRONNAILS_ROOT)\n\n @root_path =\n # Pathname is incompatible with Windows, but Windows doesn't have\n # real symlinks so File.expand_path is safe.\n if ENV['OS'] == 'Windows_NT'.freeze\n File.expand_path(::IRONNAILS_ROOT)\n\n # Otherwise use Pathname#realpath which respects symlinks.\n else\n Pathname.new(::IRONNAILS_ROOT).realpath.to_s\n end\n\n Object.const_set(:RELATIVE_IRONNAILS_ROOT, ::IRONNAILS_ROOT.dup) unless defined?(::RELATIVE_IRONNAILS_ROOT)\n\n ::IRONNAILS_ROOT.replace @root_path\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 setup_path\n if [email protected]_path.nil? and [email protected]_path.empty?\n Dir.chdir(@repo.clone_path)\n else\n initial_path_setup\n end\n end",
"def install!\n\t\t\traise \"Target exists\" if target.present?\n\n\t\t\t# Directory entry - create the directory\n\t\t\ttarget.mkpath\n\t\tend",
"def location(dir)\n\tdir = File.expand_path(dir)\n\tif !File.directory? dir\n\t\tFileUtils::mkpath(dir)\n\tend\n\treturn dir\nend",
"def install_to_directory\n # Get the current directory\n curr_dir = FileUtils::pwd + '/'\n # Use FileUtils\n fu = FileUtils\n # If we're just running as a simulation\n if $simulate\n # Use ::DryRun, that just echoes the commands, instead of the normal FileUtils\n fu = FileUtils::DryRun # ::DryRun / ::NoWrite\n end\n\n # Tell the user\n puts \"Installing the files to \".green + $install_dir.yellow\n puts \" (Keeping the .rb extensions) \".green if $keep_extensions\n\n # Go through the files\n files = ['deleteemailalias.rb','addemailalias.rb','listemailaliases.rb',\n 'deleteemaildomain.rb','addemaildomain.rb','deleteemailaccount.rb',\n 'listemailaccounts.rb','addemailaccount.rb','generate_password.rb']\n files.each { |f|\n # Remove the extenstion (unless we should keep it)\n nf = $keep_extensions ? f : f[0..-4]\n\n # Tell the user\n puts \"> Linking \".green + \"#{curr_dir}#{f}\".yellow + ' to '.green + \"#{$install_dir}#{nf}\".yellow\n\n if $force_install\n puts \"Forcing the install of #{nf}!\".red\n # Link the file\n fu.ln_sf curr_dir + f, $install_dir + nf\n else\n begin\n # Link the file\n fu.ln_s curr_dir + f, $install_dir + nf\n rescue Exception => e\n puts \"Couldn't link the file:\".pink\n puts e.message.red\n next\n end\n end\n\n puts \"> Adding 'execute permission' to the file\".green\n # adding \"execute permission\"\n fu.chmod \"a+x\", $install_dir + nf\n }\n\nend",
"def librarian_set_tmp_directory(tmp_path)\n command = ['librarian-puppet', 'config', 'tmp', tmp_path, '--global']\n command << '--verbose' unless ENV['LIBRARIAN_VERBOSE'].nil?\n sh *command\nend",
"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 safe_dir\n options[:root_dir] / name.to_s\n end",
"def define_im_install_dir\n user = define_user\n case new_resource.im_install_mode\n when 'admin'\n im_install_dir = if new_resource.im_install_dir.nil?\n '/opt/IBM/InstallationManager'\n else\n new_resource.im_install_dir\n end\n im_install_dir\n when 'nonAdmin'\n im_install_dir = if new_resource.im_install_dir.nil?\n '/home/' + user + '/IBM/InstallationManager'\n else\n new_resource.im_install_dir\n end\n im_install_dir\n when 'group'\n im_install_dir = if new_resource.im_install_dir.nil?\n '/home/' + user + '/IBM/InstallationManager_Group'\n else\n new_resource.im_install_dir\n end\n im_install_dir\n end\nend",
"def define_im_install_dir\n user = define_user\n case new_resource.im_install_mode\n when 'admin'\n im_install_dir = if new_resource.im_install_dir.nil?\n '/opt/IBM/InstallationManager'\n else\n new_resource.im_install_dir\n end\n im_install_dir\n when 'nonAdmin'\n im_install_dir = if new_resource.im_install_dir.nil?\n '/home/' + user + '/IBM/InstallationManager'\n else\n new_resource.im_install_dir\n end\n im_install_dir\n when 'group'\n im_install_dir = if new_resource.im_install_dir.nil?\n '/home/' + user + '/IBM/InstallationManager_Group'\n else\n new_resource.im_install_dir\n end\n im_install_dir\n end\nend",
"def find_root\n pwd = Dir.pwd\n if pwd.end_with? \"rootfs\"\n \"\" # analysing a supportconfig\n elsif pwd =~ %r{/nts_} && File.directory?(\"rootfs\")\n \"rootfs/\" # analysing a supportconfig\n elsif File.exist? \"/var/log/crowbar/install.log\"\n \"/\" # on an actual admin server\n else\n abort \"Couldn't find log files; aborting.\"\n end\nend",
"def move_root_files\n docs = \"#{@dir}/usr/share/doc/#{@ctrl[:package]}\"\n files = Dir.entries(@dir).select {|f| !File.directory?(f) }\n return unless files.any?\n\n FileUtils.mkdir_p(docs)\n\n # move all the files from the root of the package\n files.each do |file|\n file = File.join(@dir, file)\n next unless File.exist?(file)\n\n FileUtils.mv(file, docs)\n @log.info \"#{file} => usr/share/doc/#{pkgname}\"\n end\n end",
"def chroot(newroot)\n return if !block_given?\n raise BakerError, \"can't chroot into #{newroot}, directory dosen't exist\" if !File.directory?(newroot)\n FileUtils.mkdir(File.join(newroot,'proc')) if !File.directory?(File.join(newroot,'proc'))\n raise BakerError, \"mount proc failed\" unless system(\"mount -n -t proc #{Dir.map('/proc')} #{File.join(newroot,'proc')}\")\n begin\n trap('INT','IGNORE')\n pid = Process.fork do\n begin\n Dir.chdir(newroot)\n puts `ls ./root/bin`\n ENV['PATH'] = \"/root/bin:#{ENV['PATH']}\"\n ENV['SHELL'] = \"/bin/bash\"\n `chroot ./` #Dir.chroot('.')\n p \"here\"\n yield\n rescue Exception => e\n puts \"Error in chroot: #{e}\"\n end\n end\n Process.waitpid(pid)\n ensure\n system(\"umount -ln #{File.join(newroot,'proc')}\")\n trap('INT','DEFAULT')\n end\n end",
"def restore_dir\n cd @dir\n end",
"def clean_dir_root\n File.join(root_dir, \"test\", \"tmp\", \"cleanreps\")\n end",
"def setup_system_dir(name)\n system_dir = File.join(base_systems_dir, name)\n unless File.directory?(system_dir)\n say \"Creating new system #{name} directory\"\n mkdir_p(system_dir)\n end\n set_system(name)\n end",
"def install_dir\n @install_dir ||= ENV['WD_INSTALL_DIR'] || DEFAULT_INSTALL_DIR\n end",
"def fix_path!\n @path = path.sub(/^\\~\\//, \"#{ENV['HOME']}/\")\n end",
"def workdir\n result = base.join('cache')\n result.mkpath\n result\n end",
"def setup_remote_dirs\n @connection.create_directories([Gift::GIFT_DIR, File.join(Gift::GIFT_DIR, DELIVERIES_DIR)])\n end",
"def init\n FileUtils.mkdir_p home\n FileUtils.mkdir_p home(\"templates\")\n FileUtils.touch home(\"config.yml\")\n end",
"def rootdir() File.join(File.dirname(File.expand_path(__FILE__)), 'pipin') end",
"def cd(target = ENV['HOME'])\n Dir.chdir(target.strip)\n \"Directory changed to #{Dir.pwd}\"\n end",
"def install_initial_data\n\t\t$stderr.print \"Installing testing directory data...\"\n\t\tslapadd = self.find_binary( 'slapadd' )\n\t\tldiffile = SPEC_LDIF.to_s\n\t\tconfigfile = TEST_WORKDIR + 'slapd.conf'\n\n\t\tcmd = [\n\t\t\tslapadd,\n\t\t\t'-f', configfile.to_s,\n\t\t\t'-l', ldiffile\n\t\t]\n\n\t\ttrace \">>> \", Shellwords.join(cmd)\n\t\tsystem( *cmd, chdir: TEST_WORKDIR.to_s ) or\n\t\t\traise \"Couldn't load initial data: #{Shellwords.join(cmd)}\"\n\t\ttrace \"installed.\"\n\tend",
"def server_home\n FilePath.new(@build_dir, \"homes\", \"server\").ensure_directory\n end",
"def new_dirs; end",
"def _spec_conf_dir(file)\n specdir = Dir.new('./spec/conf/')\n File.join(specdir.path, file)\nend",
"def _spec_conf_dir(file)\n specdir = Dir.new('./spec/conf/')\n File.join(specdir.path, file)\nend",
"def default_install_dir\n @install_dir ||= CernerSplunk::PathHelpers.default_install_dirs[package][node['os'].to_sym]\n raise \"Unsupported Combination: #{package} + #{node['os']}\" unless @install_dir\n @install_dir\n end",
"def make_home_directory( username, skeldir=SKELDIR )\n\t\tself.log.info \"Making home directory for %p, cloned from %s\" % [ username, skeldir ]\n\t\thomedir = HOMEDIR_BASE + username\n\t\traise \"%s: already exists\" % [ homedir ] if homedir.exist?\n\t\traise \"%s: already has an archived homedir\" % [ username ] if\n\t\t\t( ARCHIVE_BASE + username ).exist?\n\n\t\tFileUtils.cp_r( skeldir.to_s, homedir )\n\t\tFileUtils.chown_R( username, nil, homedir )\n\n\t\treturn homedir.to_s\n\tend",
"def sync\n rm_berks_cookbooks\n target_dir = \"/home/#{USER}/provisioning\"\n rsync_current_dir target_dir: target_dir\n ssh_exe \"sudo chown #{USER}:#{USER} -R #{target_dir}\"\n end",
"def chdir(&block)\n Dir.chdir(ROOT.join(name), &block)\n end",
"def gforge_files_root\n \"/var/www/gforge-files/#{unix_group_name}/\"\n end",
"def set_directory(path)\n if File.exists? path and File.directory? path\n @directory = path.reverse.index(\"/\") == 0 ? path.chop : path\n else\n raise Error, \"Invalid path name\"\n end \n end",
"def install_dir(lib)\n if fr = ENV['FAKEROOT']\n return File.join(fr, lib)\n end\n\n lib\nend",
"def cleanup_windows_workaround\n directory 'c:/opscode/chef.upgrade' do\n action :delete\n recursive true\n end\nend",
"def script_directory\n '/etc/init'\n end",
"def create_link_to_dummy_directory\n FileUtils.ln_sf(\"#{destination_root}/db\", Rails.root.join('db'))\n end",
"def install_component(component)\n Dir.chdir component do\n dirs, files = Dir[\"**/*\"].partition { |path| File.directory? path }\n\n dirs.sort.each do |path|\n unless (prefix + path).exist?\n Dir.mkdir(prefix + path, File.stat(path).mode)\n end\n end\n\n files.each do |file|\n dest = prefix + file\n unless dest.exist?\n # Use FileUtils.mv over File.rename to handle filesystem boundaries. If src\n # is a symlink, and its target is moved first, FileUtils.mv will fail:\n # https://bugs.ruby-lang.org/issues/7707\n # In that case, use the system \"mv\" command.\n if File.symlink? file\n raise unless Kernel.system 'mv', file, dest\n else\n FileUtils.mv file, dest\n end\n end\n end\n end\n end",
"def setup_data_dir\n changes = []\n\n case distro\n\n when RHEL\n unless pg_data_dir == pg_default_data_dir\n changes = rput( 'etc/sysconfig/pgsql/postgresql', user: :root )\n end\n\n sudo_if( \"[ ! -d '#{pg_data_dir}/base' ]\" ) do\n sudo <<-SH\n mkdir -p #{pg_data_dir}\n chown postgres:postgres #{pg_data_dir}\n chmod 700 #{pg_data_dir}\n SH\n pg_initdb\n end\n\n when Debian\n unless pg_data_dir == pg_default_data_dir\n sudo <<-SH\n if [ ! -d '#{pg_data_dir}/base' ]; then\n mkdir -p #{pg_data_dir}\n chown postgres:postgres #{pg_data_dir}\n chmod 700 #{pg_data_dir}\n mv #{pg_default_data_dir}/* #{pg_data_dir}/\n fi\n SH\n end\n else\n raise ContextError, \"Distro #{distro.class.name} not supported\"\n end\n\n changes\n end",
"def install_overwrite!\n\t\t\t# This may not happen because for a directory entry, an existing\n\t\t\t# target is either current (if it's a directory or a symlink to a\n\t\t\t# directory) or blocking (it it's anything else), and both must\n\t\t\t# be checked before calling this method.\n\t\t\traise \"Trying to overwrite a directory\"\n\t\tend",
"def set_initial_path\n `echo $PATH`.split(':').each do |path|\n add_env_path path\n end\nend",
"def install_dir\n Crate.project.install_dir\n end",
"def copy_test_files\n\t\tinstall_with_filter( SPEC_SLAPDCONF, TEST_WORKDIR, binding() )\n\t\tinstall_with_filter( SPEC_DBCONFIG, TEST_DATADIR, binding )\n\tend",
"def change_dir f\n unless File.directory? f\n perror \"#{f} is not a directory, or does not exist.\"\n return\n end\n\n # before leaving a dir we save it in the list, as well as the cursor\n # position, so we can restore that position when we return\n @visited_dirs.insert(0, Dir.pwd)\n save_dir_pos\n\n f = expand_path(f)\n Dir.chdir f\n @current_dir = Dir.pwd # 2019-04-24 - earlier was in post_cd but too late\n read_directory\n post_cd\n\n redraw_required\nend",
"def install\n # # Changes log level to default value\n # inreplace \"etc/baetyl/conf.yml\" do |s|\n # s.gsub! \"level: debug\", \"\"\n # end\n\n bin.install Dir[\"bin/*\"]\n etc.install Dir[\"etc/*\"]\n end",
"def subdir(dir)\n dir = Pathname.new(dir) if dir.instance_of? String\n dir = Pathname.new('.') if dir.to_s =~ /\\.\\./ or dir.to_s =~ /^\\//\n dir = Pathname.new('.') if any_symlinks_in dir\n newdir = @path + dir\n Filesystem.new newdir\n end",
"def root_dir\n ManageIQ::Providers::Lenovo::Engine.root.join(\"content/ansible_runner\")\n end",
"def copy_config_files_in_directory_to_tmp_dir(dir)\n dest_dir = \"#{base_tmp_dir}/#{File.basename(dir)}\"\n FileUtils.mkdir_p dest_dir\n \n if File.directory?(\"#{user_dir}/#{dir}\") \n Dir[\"#{user_dir}/#{dir}/*\"].each do |file|\n File.copy(file, dest_dir)\n end\n else\n Dir[\"#{root_dir}/#{dir}/*\"].each do |file|\n File.copy(file, dest_dir)\n end\n end \n end",
"def set_root_path!\n raise 'APP_ROOT is not set' unless defined?(::APP_ROOT)\n raise 'APP_ROOT is not a directory' unless File.directory?(::APP_ROOT)\n\n @root_path =\n # Pathname is incompatible with Windows, but Windows doesn't have\n # real symlinks so File.expand_path is safe.\n if RUBY_PLATFORM =~ /(:?mswin|mingw)/\n File.expand_path(::APP_ROOT)\n\n # Otherwise use Pathname#realpath which respects symlinks.\n else\n Pathname.new(::APP_ROOT).realpath.to_s\n end\n\n Object.const_set(:RELATIVE_APP_ROOT, ::APP_ROOT.dup) unless defined?(::RELATIVE_APP_ROOT)\n ::APP_ROOT.replace @root_path\n end",
"def change_directory_for_start\n \"cd tomcat\"\n end",
"def root( *args )\n if self.home =~ /^[a-zA-Z]:/\n self.home.to_s[0..3].fwf_filepath.join( *args )\n else\n \"/\".fwf_filepath.join( *args )\n end\n end",
"def setup\n switch_dir\n end",
"def root_dir\n superblock.root_dir\n end",
"def root=(dir) \n @root = Pathname.new(dir)\n #@paths = [@root + 'meta', @root + '.meta']\n end",
"def change_dir(dir)\n begin\n return true if Dir.chdir(dir)\n rescue Exception => error\n Loggers::Main.log.warn error.message\n exit 5\n end\n end",
"def install\n prefix.install Dir[\"*\"] \n end",
"def user_directory\n File.expand_path('~')\n end",
"def _DISTFILESDIR; Config._DISTFILES; end",
"def chdir(path)\n ensure_relative_path! :chdir, path\n @path += path\n end",
"def destination(base_directory); end",
"def siteroot\n \"/var/www/gforge-projects\"\n end",
"def normalisedDir(baseDir)\n return baseDir.end_with?(\"/\") ? baseDir : baseDir + \"/\"\n end",
"def _spec_data_dir(file)\n datadir = Dir.new('./spec/data/')\n File.join(datadir.path, file)\nend",
"def db_root\n dataroot.join(\"db\").tap { |p| p.mkpath unless p.exist? }\n end",
"def setup_filesystem\n FileUtils.mkdir_p($out_pth)\n FileUtils.mkdir_p($log_dir)\n end",
"def os_install_dir\n @os_install_dir\n end",
"def install_lua(source, file, build_dir, prefix)\n remote_file \"#{Chef::Config[:file_cache_path]}/#{file}\" do\n source source + file\n mode '0644'\n action :create_if_missing\n not_if \"test -e #{prefix}/bin/lua\"\n end\n\n bash \"install-#{build_dir}\" do\n user 'root'\n cwd Chef::Config[:file_cache_path]\n\n code <<-EOH\n set -e\n\n tar xf #{file}\n cd #{build_dir}\n\n sed -e 's|^INSTALL_TOP=.*|INSTALL_TOP= #{prefix}|' Makefile > Makefile.tmp\n mv Makefile.tmp Makefile\n\n make linux\n make install\n EOH\n\n not_if \"test -e #{prefix}/bin/lua\"\n end\nend",
"def create_dir path\n path = with_root path\n path = fix_path path\n sftp.mkdir! path\n end",
"def ensure_root\n if self.root? and self.root_cfs_directory.blank?\n self.root_cfs_directory = self\n self.save!\n end\n true\n end",
"def change_dir f, pos=nil\nend",
"def changeRepositoryPath(iRepositoryPath)\n @WEACEInstallDir = \"#{iRepositoryPath}/Install\"\n @DefaultLogDir = \"#{iRepositoryPath}/Log\"\n end",
"def setup_path\n # The Java Buildpack for WLS creates the complete domain structure and other linkages during staging.\n # The directory used for staging is at /tmp/staged/app\n # But the actual DEA execution occurs at /home/vcap/app. This discrepancy can result in broken paths and non-startup of the server.\n # So create linkage from /tmp/staged/app to actual environment of /home/vcap/app when things run in real execution\n # Also, this script needs to be invoked before starting the server as it will create the links and also tweak the server args\n # (to listen on correct port, use user supplied jvm args)\n\n File.open(@application.root.to_s + '/' + SETUP_ENV_SCRIPT, 'w') do |f|\n\n f.puts '#!/bin/sh '\n f.puts '# There are 4 things handled by this script '\n f.puts ' '\n f.puts '# 1. Create links to mimic staging env and update scripts with jvm options '\n f.puts '# The Java Buildpack for WLS creates complete domain structure and other linkages during staging at '\n f.puts '# /tmp/staged/app location '\n f.puts '# But the actual DEA execution occurs at /home/vcap/app. '\n f.puts '# This discrepancy can result in broken paths and non-startup of the server. '\n f.puts '# So create linkage from /tmp/staged/app to actual environment of /home/vcap/app when things run in real execution '\n f.puts '# Create paths that match the staging env, as otherwise scripts will break!! '\n f.puts ' '\n f.puts 'if [ ! -d \\\"/tmp/staged\\\" ]; then '\n f.puts ' /bin/mkdir /tmp/staged '\n f.puts 'fi; '\n f.puts 'if [ ! -d \\\"/tmp/staged/app\\\" ]; then '\n f.puts ' /bin/ln -s `pwd` /tmp/staged/app '\n f.puts 'fi; '\n f.puts ' '\n f.puts ' '\n end\n end"
] | [
"0.6859048",
"0.64444476",
"0.6411936",
"0.63491637",
"0.6321923",
"0.62551296",
"0.62340105",
"0.61548954",
"0.61532754",
"0.60671103",
"0.602973",
"0.6015278",
"0.60026175",
"0.5950696",
"0.5901396",
"0.58851194",
"0.5861252",
"0.5814387",
"0.5797751",
"0.5776985",
"0.5758902",
"0.5757456",
"0.57565325",
"0.5754691",
"0.57524997",
"0.575019",
"0.57357657",
"0.57323194",
"0.57244056",
"0.5719022",
"0.5709388",
"0.56988174",
"0.569427",
"0.569422",
"0.56856596",
"0.56738955",
"0.56732124",
"0.56664383",
"0.5664785",
"0.56613064",
"0.56604135",
"0.5656284",
"0.56529063",
"0.5641825",
"0.56376714",
"0.56333923",
"0.5605418",
"0.560329",
"0.55807525",
"0.55803126",
"0.5569127",
"0.5566275",
"0.5566206",
"0.5548916",
"0.5548916",
"0.5540888",
"0.55394787",
"0.5532593",
"0.55264324",
"0.55244535",
"0.5515374",
"0.5513102",
"0.5508787",
"0.5502414",
"0.5501109",
"0.5500984",
"0.5496732",
"0.54931647",
"0.549182",
"0.5483223",
"0.5481471",
"0.5478483",
"0.5470515",
"0.54691714",
"0.5465619",
"0.54577065",
"0.5454919",
"0.54521114",
"0.5449322",
"0.54473054",
"0.5445758",
"0.5445604",
"0.54299533",
"0.5427203",
"0.54266477",
"0.5424418",
"0.5420919",
"0.541896",
"0.5417853",
"0.5416734",
"0.541637",
"0.54121095",
"0.5410544",
"0.5409952",
"0.54047394",
"0.5404033",
"0.5397133",
"0.53963363",
"0.5395315",
"0.53890383"
] | 0.54873526 | 69 |
this is the original word we are trying to find an anagram for | def initialize(name)
@name = name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def detect_anagram(word, dictionary)\n letter_array = word.downcase.split(//)\n word_array = []\n letter_array.permutation(word.length){|word| word_array << word.join }\n word_array.select {|word| dictionary.include?(word)}\nend",
"def anagram(word)\n anagrams_array = %w(enlists google inlets banana)\n search = word.split('')\n search.sort!\n anagrams_array.each do |wordanna|\n new_word = wordanna.split('')\n new_word.sort!\n if search == new_word\n puts wordanna\n end\n end\nend",
"def is_anagram?(word)\n#try determining if they are composed of the same letters.\n word.chars.sort == @word.chars.sort\n end",
"def anagram_finder(word, dictionary)\n\tag = []\ndictionary.each {|x| ag << x if word.split('').sort == x.split('').sort }\nag\nend",
"def anagrams(word)\n EpicAnagram.find_anagrams(word)\n end",
"def anagram?(word)\n normalize(word) == normalize(@word)\n end",
"def valid_anagram(text)\n\nend",
"def isAnagram(test, original)\n str1 = test.split(\"\").map{ |x| x.ord}.inject(:+)\n str2 = original.split(\"\").map{ |x| x.ord}.inject(:+)\n str1 == str2\nend",
"def first_anagram?(word1, word2)\n anagrams = []\n arr = word1.chars \n\n arr.permutation.each do |subArr|\n anagrams << subArr.join(\"\")\n end \n p anagram?(anagrams, word2) \nend",
"def anagram(words)\n words_hash = {}\n\n words.each do |w1|\n sorted_word = w1.chars.sort\n\n if words_hash.has_key?(sorted_word)\n words_hash[sorted_word] << w1\n else\n words_hash[sorted_word] = [w1]\n end\n end\n\n words_hash.values\nend",
"def first_anagram(word1, word2) #the worst \r\n word1.chars.permutation.to_a.any? { |sub| sub.join == word2 } \r\nend",
"def anagrams(word, words)\n word = word.chars.sort\n words.select{|x| x.chars.sort == word}\nend",
"def word_unscrambler(arr, word)\n \n # get a helper function anangram or not\n \n # fileter out diff lengths\n same_length = arr.select{|dict_word| dict_word.length == word.length}\n \n matches = same_length.select{|string| anagram?(string, word)}\n \n matches\n \n #filter out non anagram words\n \n #\n\nend",
"def anagrams(word, words)\n words.select { |w| w.chars.sort == word.chars.sort }\nend",
"def anagrams_for(word, array)\n p array.select {|w| canonical(word) == canonical(w)}\nend",
"def anagram(words)\r\n result = words.group_by { |word| word.chars.sort.join }\r\n result.each {|k, v| p v unless v.size == 1}\r\nend",
"def find_anagrams(base_word, word_list)\n word_list.select do |word|\n anagram?(base_word, word)\n end\nend",
"def anagram_word?(test_word)\n sort_word(@word) == sort_word(test_word)\n end",
"def make_anagram word1, word2\n s1 = word1.chars\n s2 = word2.chars\n\n count = 0\n\n # s1.each do |x|\n # if s2.include? x\n # count +=1\n # end\n # end \n # ana = (word1.size - count)*2\n\n freq = Hash.new(0)\n s1.each do |key|\n freq.store(key, freq[key]+1)\n end\n freq\n\n s2.each do |x|\n if freq[x] != nil\n freq[x] -= 1\n end\n end\n\n freq\n\n freq.each do |key,value|\n if value != 0\n count += value.abs\n end\n end\n\n count\n\nend",
"def is_anagram(test, original)\n test.downcase.chars.sort == original.downcase.chars.sort\nend",
"def second_anagram?(word1, word2)\n w1_copy = word1.dup\n w2_copy = word2.dup\n w1_copy.each_char do |ch1|\n w2_copy.each_char do |ch2|\n if ch1 == ch2\n w1_copy[w1_copy.index(ch1)] = \"\"\n w2_copy[w2_copy.index(ch2)] = \"\"\n end\n end\n end\n w1_copy.empty? && w2_copy.empty?\nend",
"def find_anagrams( target_word, list_of_words )\n anagrams = []\n list_of_words.each{ |element|\n if anagram_canonical_form(element) == anagram_canonical_form(target_word)\n anagrams << element\n end\n }\n return anagrams\nend",
"def anagrams(word, words)\n p words.select {|x| x.chars.sort == word.chars.sort }\nend",
"def is_anagram word1, word2\n \tpermute = permute_word(word1)\n \tpermute.each do |w|\n \t puts w.join\n \t if w.join.eql?(word2)\n \t \treturn true\n \t end\n \tend\n \treturn false\n end",
"def anagrams\n word.anagram.words.pluck(:text) - [word.text]\n end",
"def combine_anagrams (words)\n if(words.length == 0) \n return words\n end\n\n anagram_list = [];\n \n print words\n puts\n\n words = words.flatten\n\n#words = words & words\n\n words.each do |word|\n if(anagram_list.length == 0)\n then\n anagram_list << [word];\n next\n end\n\n sorted_word = word.downcase.scan(/./).sort.join\n\n print sorted_word\n\n# word_exists = anagram_list.flatten.select { |anag| anag =~ /#{word}/ }\n#if (word_exists != nil && word_exists.length == 1)\n#next\n#end\n \n inserted = false\n anagram_list.each_index do |i|\n print \" \" \n print anagram_list[i][0].downcase.scan(/./).sort.join\n print \"\\n\"\n if(anagram_list[i][0].downcase.scan(/./).sort.join == sorted_word)\n then\n anagram_list[i] << word\n inserted = true\n break\n end\n end\n anagram_list << [ word ] unless (inserted)\n end\n return anagram_list;\nend",
"def get_anagrams(word)\n # FILL ME IN\n unless valid_word?(word)\n return \"Invalid input (string should only consist of letters).\"\n end\n counter = get_counts(word.downcase)\n if @anagrams.has_key?(counter) && @anagrams[counter].size() > 0\n return @anagrams[counter].to_a - [word.downcase]\n else\n return \"No anagrams found!\"\n end\n end",
"def match(possible_anagrams)\nresult = []\nsplitted_word = @word.downcase.split(\"\").sort\n\npossible_anagrams.each do |element|\nif splitted_word == element.downcase.split(\"\").sort\n result << element\nend \nend\nresult\nend",
"def match(array) #takes in an array of possible anagrams\n anagrams = []\n \n # iterate over array of words\n array.each do |word|\n # compare each word of array to OG word \n # determine if word is anagram\n if word.chars.sort == @word.chars.sort\n anagrams << word\n end\n end\n anagrams #return all matches/ empty array if no matches exist\n end",
"def anagram(str)\n\n raise \"Require string input\" unless str.is_a?(String)\n\n anagrams = []\n\n dict = [\"RETOOL\", \"ROOTLE\", \"TOOLER\", \n \"PLAY\", \"VIKING\"]\n \n dict.each do |word|\n anagrams << word if word.split(\"\").sort == str.upcase.split(\"\").sort\n end\n\n return anagrams\n\n\n end",
"def third_anagram?(word1, word2)\n word1_chars = word1.split(\"\").sort\n word2_chars = word2.split(\"\").sort\n word1_chars == word2_chars\n\nend",
"def anagram string\n mid = string.size/2 -1\n s1 = string.slice(0..mid).chars\n s2 = string.slice(mid+1..-1).chars\n freq = Hash.new(0)\n count = 0\n\n s1.each{ |key| freq[key]+=1 }\n\n s2.each do |letter|\n freq[letter] > 0 ? freq[letter] -=1 : count +=1\n end\n\n string.size.even? ? count : -1\nend",
"def anagram_finder(current_word, word_length)\n WORD_LIST.select do |word|\n word.length == word_length && (word.chars & current_word.chars).length == current_word.length\n end.uniq\n\n # return if word_length >= 9\n # #memoise\n\n # filtered_words.each do |word|\n # anagram_finder(word, word_length+1)\n # end\nend",
"def anagrams_for(word, array)\n #Pasar la palabra a minuscula para que sea igual\n word.downcase!\n #Arreglo vacio para meter los que sean anagramas\n arr = []\n #Separar la palabra en su forma canonica\n cano = word.chars.sort\n #iterar dentro de cada palabra del array\n array.each do |dicc|\n #crear una variable donde pase la palabra del array a su forma canonica\n word_cano = dicc.chars.sort\n #si la palabra es igual a la palabra del array\n #Ya las 2 en su forma canonica\n if cano == word_cano\n #mete la palabra a el array\n arr << dicc\n #De lo contrario deja el array igual\n else\n arr\n end\n end\n #Regresar el array lleno si habia palabras\n #o vacio si no las encontro\n arr\nend",
"def second_anagram?(word1, word2)\n word2_arr = word2.chars\n\n word1.chars.each_with_index do |char, idx|\n remove_idx = word2_arr.index(char)\n word2_arr.delete_at(remove_idx) if remove_idx\n end \n p word2_arr.empty? \nend",
"def search_for (word)\n\n chars = word.split(\"\")\n all_words = chars.permutation(chars.size).map{|_chars|\n _chars.join \"\"\n }\n\n anagrams = []\n all_words.each do |w|\n anagrams.push w if @word_list[w]\n end\n\n return anagrams\n end",
"def find_anagrams(word, dictionary)\n sort_chars = lambda{ |x| x.chars.sort.join }\n anagrams = Hash.new{|h,k| h[k] = [] }\n dictionary.each do |w|\n anagrams[sort_chars.call(w)] << w\n end\n return anagrams[sort_chars.call(word)]\nend",
"def third_anagram?(str, word)\n str.chars.sort == word.chars.sort\n end",
"def anagrams_oneliner(string)\n string.chars.to_a.permutation.map(&:join).select {|value| value != string and WORDS.include? value}\nend",
"def are_anagrams?(word1, word2)\n #si las palabras son anagramas regresa true de lo contrario regresa false\n if canonical(word1) == canonical(word2) then true else false end\nend",
"def third_anagram?(word_1, word_2)\n word_1.chars.sort == word_2.chars.sort\nend",
"def anagram(words)\n words_hash = {}\n\n words_hash = words.each_with_object(Hash.new []) do |word, hash|\n hash[word.chars.sort] += [word]\n end\n\n words_array = words_hash.flatten\n final_hash = []\n\n words_array.each_index do |index|\n final_hash << words_array[index] if index.odd?\n end\n\n return final_hash\nend",
"def anagrams(word, words)\n sorted_test_word = word.chars.sort.join\n sorted_words = words.map do |word|\n word.chars.sort.join\n end\n\n anagram_locations = sorted_words.map.with_index do |word, index|\n if word == sorted_test_word\n index\n end\n end.compact\n # sorted_words.keep_if.with_index {|word, index| word == sorted_test_word}\n anagrams = []\n anagram_locations.each do |location|\n anagrams << words[location]\n end\n anagrams\nend",
"def anagram (str1, str2)\n # to downcase and remove non alphanumeric characters \n str1_hash = str_to_hash(str1.downcase.gsub(/(\\W)/, \"\"))\n str2_hash = str_to_hash(str2.downcase.gsub(/(\\W)/, \"\"))\n\n if str1_hash == str2_hash\n return true\n else\n return false\n end\n\nend",
"def second_anagram(word1, word2)\n return false unless word1.length == word2.length\n word1_arr = word1.split(\"\")\n characters = word2.chars\n\n word1_arr.each do |letter1|\n idx = characters.find_index(letter1)\n characters.delete_at(idx) unless idx.nil?\n\n end\n characters.empty?\nend",
"def match(possible_anagrams)\n anagrams = []\n possible_anagrams.each do |possible_anagram|\n if possible_anagram.split(\"\").sort == @word.split(\"\").sort\n anagrams << possible_anagram\n end\n end\n anagrams\nend",
"def match(words)\n#iterate over the array of words that the .match method takes as an argument.\n words.select do |word|\n is_anagram?(word)\n end\n end",
"def anagramI?(str1, str2)\n anagrams = str1.split(\"\").permutation.to_a.map { |anagram| anagram.join(\"\") }\n anagrams.include?(str2)\nend",
"def word_unscrambler(word, dic)\n word = word.split(\"\").sort!\n anagrams = []\n\n i = 0\n while i < dic.length\n compare = dic[i].split(\"\").sort\n if word == compare\n anagrams << dic[i]\n end\n i += 1\n end\n p anagrams\nend",
"def third_anagram?(word1, word2)\n split1= word1.chars.sort\n split2 = word2.chars.sort\n split1 == split2\nend",
"def combine_anagrams_method2(words)\n\ttemp1 = Array.new\n\ttemp1 = words.clone\t# making a deep copy of the input \n\tanagram = Array.new\t\n\ti = 0\n\twhile i < temp1.length\t\t\t\n\t\tcount = 0 # count the number of anagrams of a particular string say \"cars\"\n\t\tfor j in i+1..(temp1.length - 1)\n\t\t\tif temp1[i].downcase.chars.sort.join == temp1[j].downcase.chars.sort.join \n\t\t\t\tcount = count + 1\n\t\t\t\ttemp1[j],temp1[i+count] = temp1[i+count],temp1[j] # get all the anagrams to one place by swapping\n\t\t\tend\n\t\tend\n\t\tanagram.push([temp1[i..i+count]]) # pushing the array of anagrams into anagram array say [\"cars\", \"racs\", \"scar\"]\n\t\ti = i + count + 1\n\tend\n\t# printing each group\n\tfor i in 0..anagram.length-1\n\t\tprint \"anagram[\" + i.to_s + \"]: \" \n\t\tputs anagram[i]\n\tend\t\nend",
"def anagrams?(word1, word2)\n if word1.length != word2.length\n return false\n end\n word1.each_char do |ele|\n if !word2.include?(ele)\n return false\n end\n end\n return true\nend",
"def match(anagram_array)\n anagram_array.select {|item| item.chars.sort == self.word.chars.sort}\n end",
"def first_anagram?(word1, word2)\n permutations = word1.split('').permutation.to_a.map(&:join)\n permutations.include?(word2)\nend",
"def second_anagram?(str_1, str_2)\n return false if str_1.length != str_2.length \n word_1 = str_1.chars\n word_2 = str_2.chars\n word_1.each_with_index do |char, idx| #\n idx_2 = word_2.find_index(char) \n if !idx_2.nil? #\n word_2.delete_at(idx_2) #m\n end\n end\n word_2.empty? #m\nend",
"def anagrams(str1, str2)\n \nend",
"def find_anagrams(target_word, array_of_words)\n array_of_anagrams = []\n\n array_of_words.each do |member|\n if member.split(//).sort == target_word.split(//).sort\n array_of_anagrams.push(member)\n else\n next\n end\n end\n array_of_anagrams\nend",
"def match(anagram_ary)\n match_ary = []\n anagram_ary.each do |anagram|\n if word.split('').sort == anagram.split('').sort\n match_ary << anagram\n end\n end\n match_ary\n end",
"def third_anagram?(word1, word2)\n word1.chars.sort == word2.chars.sort #sort is quicksort under the hood so O(n^2) worst case, average case O(n log n)\nend",
"def fourth_anagram?(word1, word2)\n letters = Hash.new(0)\n word1.each_char do |char|\n letters[char] += 1\n end\n word2.each_char do |char2|\n letters[char2] -= 1\n end\n letters.all? {|k,v| v ==0}\nend",
"def second_anagram?(word1, word2)\n word1.each_char do |char|\n index = word2.index(char)\n word2.slice!(index)\n end\n\n if word2.empty?\n true\n else\n false\n end\n\nend",
"def combine_anagrams(words)\n\n ouArr = Array.new\n\n words.each do |w|\n\n ouIt = Array.new [w]\n\n words.each do |w2|\n if w.downcase.chars.sort == w2.downcase.chars.sort && !ouIt.include?(w2)\n ouIt.push(w2)\n end\n end\n ouIt.sort!\n\n if !ouArr.include?(ouIt)\n ouArr.push(ouIt)\n end\n end\n ouArr\nend",
"def anagrams(string, array)\nend",
"def match(array_possible_anagrams)\n matching_words=[]\n word_broken=self.word.split(\"\").sort\n array_possible_anagrams.each do |possible_match|\n #possible_match=possible.word\n possible_match_broken=possible_match.split(\"\").sort\n if possible_match_broken == word_broken\n matching_words << possible_match\n else\n end #end of if\n end #end of do\n matching_words\n end",
"def anagram str1, str2\n str1.downcase.chars.sort.join == str2.downcase.chars.sort.join\nend",
"def anagramStrSearch(str, searchstr)\n arResult = Array.new(str.size, 0) #initialize each position with false\n searchSize = searchstr.size\n # create all possible anagrams\n arSearch = searchstr.split('') #split chars in array\n arSearch = arSearch.permutation.to_a #create all array permutations\n for i in 0..arSearch.size-1\n arSearch[i] = arSearch[i].join #join each permutation back as string\n end\n \n # search if str match into of the anagrams\n for i in 0..str.size-searchSize\n if arSearch.include?(str[i,searchSize]) then\n arResult[i] = 1\n end\n end\n # p arSearch\n return arResult\n end",
"def third_anagram?(word, goal)\n word = word.split('') # O(n)\n goal = goal.split('') # O(n)\n # O(n^2) + O(n^2) || O(n log(n)) + O(n log(n))\n word.sort == goal.sort\nend",
"def fourth_anagram(word1, word2)\n hash1 = Hash.new(0)\n hash2 = Hash.new(0)\n\n word1.each_char { |char| hash1[char] += 1 }\n word2.each_char { |char| hash2[char] += 1 }\n\n hash1 == hash2\nend",
"def anagram?\n chars1 = @input1.downcase.gsub(/[!@#$%^&*()-=_+|;':\",.<>?']/, '').split(\"\").sort\n chars2 = @input2.downcase.gsub(/[!@#$%^&*()-=_+|;':\",.<>?']/, '').split(\"\").sort\n if\n self.allwords?\n if\n chars1 == chars2\n return \"These words are anagrams!\"\n elsif\n self.antigrams?\n return \"These words are not anagrams but they are antigrams!\"\n elsif self.antigrams? == false\n return \"These words are neither anagrams nor antigrams!\"\n end\n else\n return \"You need to input actual words!\"\n end\n end",
"def match(anagram_array)\n anagram_array.select do |word|\n if @word.split(//).sort == word.split(//).sort \n @@words << word \n end\n end \n end",
"def fourth_anagram(first_word, second_word)\n hash1 = Hash.new {|h, k| h[k] = []}\n first_word.each_char do |char|\n hash1[char] << char\n end\n second_word.each_char do |char|\n hash1[char] << char\n end\n hash1.values.all? {|ele| ele.length.even?}\nend",
"def anagrams?(word1, word2)\n\nend",
"def anagrams?(word1, word2)\n\nend",
"def my_anagram(type_array) \n #Create Hash container\n storage_hash = {} \n #Take given array argument and opperate on each element.\n #Anagrams are words that can be spelled using the same letters. Order inmaterial. \n\n #Split text into Array / Sort String.split(\"\") Array using Array.sort. / String.join \n #Iterate over array input\n\n type_array.each do |word|\n word_sorted = word.split(\"\").sort.join\n #Check to see if word sorted is already in container (storage_array)\n if storage_hash.has_key?(word_sorted)\n storage_hash[word_sorted].push(word)\n else\n #add the new unique storage key\n storage_hash[word_sorted] = [word]\n end\n end\n #Iterate threw your storage and print results\n storage_hash.each do |key, value|\n puts \"---#{key}----\"\n p value\n end\nend",
"def third_anagram?(first_word, second_word)\n first_word.chars.sort == second_word.chars.sort\nend",
"def second_anagram?(word1, word2)\n second_word = word2.split(\"\")\n word1.each_char do |char|\n second_word.delete_at(second_word.find_index(char)) if second_word.include?(char)\n end\n second_word == []\n\nend",
"def third_anagram?(word1, word2)\n word1.split(\"\").sort == word2.split(\"\").sort\nend",
"def anagram(s)\n firstSubString=s[0...s.length/2]\n secondSubString=s[s.length/2..s.length].split('')\n \n \n if s.length.odd?\n return -1\n else \n firstSubString.each_char do |char1|\n secondSubString.each_with_index do |char2,ids|\n if char1==char2\n secondSubString.delete_at(ids)\n break\n end\n end\n end\n return secondSubString.length \n end\nend",
"def anagrams(string, array)\n string_anagram = string.chars\n \n array.select! do |word|\n word.chars.all? do |letter|\n word.chars.count(letter) == string_anagram.count(letter)\n end\n end\n array\nend",
"def anagrams(word)\n dictionary = File.readlines(Dir.pwd << \"/enable.txt\").map { |word| word.chomp }\n anagrams = []\n\n word = word.split(\"\")\n word.permutation.to_a.each do |possible_perm|\n anagrams << possible_perm.join.upcase if dictionary.include?(possible_perm.join)\n end\n anagrams\nend",
"def combine_anagrams(words)\n\tsorted = Hash.new\n\tk=0\n\twords.each { |c| sorted[k]=c.downcase.chars.sort.join; k=k+1 }\n\tanagram = Array.new\n\ta = Array.new\n\tb = Array.new\n\ti=0\n\tsorted.invert.each { |w,y| a[i] = sorted.select { |k,v| v == w }.keys; a[i].each { |x| b << words[x] }; anagram << anagram[i].to_a + b.to_a ; b.clear; i=i+1 }\n\treturn anagram\nend",
"def fourth_anagram?(first_word, second_word)\n first_hash = Hash.new(0)\n second_hash = Hash.new(0)\n\n first_word.chars.each { |char| first_hash[char] += 1 }\n second_word.chars.each { |char| second_hash[char] += 1 }\n\n first_hash == second_hash\nend",
"def fourth_anagram2?(word1, word2)\n hash = Hash.new { |h, k| h[k] = 0 }\n word1.chars.each do |char|\n hash[char] += 1\n end\n word2.chars.each do |char|\n hash[char] -= 1\n end\n hash.keys.all? { |v| v == 0 }\nend",
"def is_anagram(w1, w2)\n\tw1.downcase.split(\"\").sort.join == w2.downcase.split(\"\").sort.join\nend",
"def third_anagram?(word1, word2)\n\n word1_arr = word1.split(\"\")\n word2_arr = word2.split(\"\")\n\n word1_arr.sort == word2_arr.sort\n\nend",
"def anagram_hash(input)\n list = {} # empty hash\n input.each do |word| # iterates over each word in the array\n add_word = word.chars.sort.join # sorts the anagrams\n list[add_word] ||= []\n list[add_word] << word\n end\n # list of all anagrams and words\n list.values\nend",
"def anagrams_for(word, array)\n array.find_all {|element| are_anagrams?(word, element)}\nend",
"def anagrams?(word1, word2)\n return char_count(word1) == char_count(word2)\nend",
"def anagrams?(word1, word2)\n return char_count(word1) == char_count(word2)\nend",
"def anagrams?(word1, word2)\n return char_count(word1) == char_count(word2)\nend",
"def anagrams(word)\n\n dictionary = File.open(\"enable.txt\").read.split(\"\\n\")\n\n dictionary_array = word.chars.to_a\n matches = dictionary_array.permutation(word.length).to_a\n\n my_anagrams = []\n matches.each do |i|\n matches = i.join\n if dictionary.include?(matches)\n \tmy_anagrams.push(matches) \n end\n end\n my_anagrams.delete(word)\n\n return my_anagrams.sort_by(&:downcase)\nend",
"def sec_anagram?(word1, word2)\n let_1 = word1.split(\"\")\n let_2 = word2.split(\"\")\n let_1.each do |letter|\n if let_2.include?(letter)\n index = let_2.index(letter)\n let_2.delete_at(index)\n else\n return false\n end\n end\n \n let_2.empty?\n\nend",
"def anagrams?(word1, word2)\r\n return charCount(word1) == charCount(word2)\r\nend",
"def combine_anagrams(words)\n#\n\n hash = {}\n words.each{ |word| \n key = word.downcase.split(//).sort\n hash[key] = (hash[key] || []) + [word]\n }\n ans = []\n hash.map{ |k, v|\n ans += v\n }\n ans\nend",
"def isAntigram(comparedWord)\n String.chars.each(comparedWord)\n end",
"def find_anagrams(base, words_list)\n words_list.select { |word| word.split('').sort == base.split('').sort }\nend",
"def find_anagrams(base, words_list)\n words_list.select { |word| word.split('').sort == base.split('').sort }\nend",
"def anagrams(string)\n # We take a string, split it into its characters, \n # put those characters in an array, get all permuations of the array,\n # and join each permutation into words.\n permutations = string.chars.to_a.permutation.map(&:join)\n\n # Then we select only permutations that are words, but not our starting word.\n permutations = permutations.select {|value| value != string and WORDS.include? value }\n\n return permutations\nend",
"def fourth_anagram?(first_word, second_word)\n first_hash = Hash.new(0)\n second_hash = Hash.new(0)\n first_word.each_char do |char|\n first_hash[char] += 1\n end\n second_word.each_char do |char|\n second_hash[char] += 1\n end\n first_hash == second_hash\nend",
"def match(anagrams)\n anagrams.each do |array_word|\n if @word.split(\"\").sort == array_word.split(\"\").sort\n @final_array << array_word\n end\n end\n @final_array\n end",
"def fourth_anagram?(word1, word2) # O(3n) aka O(n)\n hash = Hash.new(0)\n\n word1.each_char { |char| hash[char] += 1 }\n word2.each_char { |char| hash[char] -= 1 }\n\n return hash.values.all?(&:zero?)\nend"
] | [
"0.80684036",
"0.8043097",
"0.7751775",
"0.7741899",
"0.76958025",
"0.76335484",
"0.7626589",
"0.7579514",
"0.75751394",
"0.7562663",
"0.7511891",
"0.74927235",
"0.74900067",
"0.74167097",
"0.7406935",
"0.73989326",
"0.73584545",
"0.73465425",
"0.73395884",
"0.7336822",
"0.7303189",
"0.7300155",
"0.7296575",
"0.7282068",
"0.72537947",
"0.72537893",
"0.7251789",
"0.7247845",
"0.72478056",
"0.724076",
"0.7229686",
"0.7205332",
"0.7202762",
"0.7197512",
"0.71927637",
"0.7191267",
"0.7189159",
"0.7187389",
"0.71773446",
"0.71770954",
"0.71757567",
"0.71743774",
"0.7172723",
"0.71719664",
"0.7161285",
"0.7157005",
"0.7147863",
"0.7139648",
"0.71366614",
"0.7131844",
"0.712984",
"0.71240497",
"0.7120106",
"0.7118997",
"0.71039474",
"0.7087603",
"0.70829105",
"0.7078076",
"0.70726293",
"0.70631444",
"0.7061402",
"0.7058514",
"0.7053366",
"0.704306",
"0.7038979",
"0.7037266",
"0.7035948",
"0.7031878",
"0.70317835",
"0.7030343",
"0.70281637",
"0.70237726",
"0.70237726",
"0.70141816",
"0.7004701",
"0.70001376",
"0.69993514",
"0.6991273",
"0.69866633",
"0.69805926",
"0.6967141",
"0.69637245",
"0.6961757",
"0.69587404",
"0.6956016",
"0.69537914",
"0.6950177",
"0.6945125",
"0.6945125",
"0.6945125",
"0.6940916",
"0.69397885",
"0.69363713",
"0.69343305",
"0.6930961",
"0.69274926",
"0.69274926",
"0.692604",
"0.6922342",
"0.6919365",
"0.69184905"
] | 0.0 | -1 |
Public: Deletes the Rule. Returns Boolean indicating success. | def delete(service=Azure::ServiceBus::Rules)
service.delete(self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @rule.destroy\n\n respond_with(rule, location: rules_url, notice: 'RUle was successfully destroyed.')\n end",
"def destroy\n @rule.destroy\n respond_to do |format|\n format.html { redirect_to rules_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@rule = Rule.find(params[:id])\n @rule.destroy\n\n respond_to do |format|\n format.html { redirect_to(rules_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @rule.destroy\n respond_to do |format|\n format.html { redirect_to rules_url, notice: 'Rule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rule.destroy\n respond_to do |format|\n format.html { redirect_to rules_url, notice: 'Rule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @route_rule = RouteRule.find(params[:id])\n @route_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to(route_rules_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @rule.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete rules\n raise ArgumentError.new('No rules provided') if rules.nil? || rules.empty?\n request = create_delete_request(construct_rules(rules))\n response = fetch_data(request)\n return true if response.nil?\n return GnipApi::JsonParser.new.parse(response)\n end",
"def destroy\n @rule = Rule.find(params[:id])\n \n\t@account = Account.find(params[:account_id])\n @rule.destroy\n\n respond_to do |format|\n format.html { redirect_to(account_rules_url(@account)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @rule_set = RuleSet.find(params[:id])\n @rule_set.destroy\n\n respond_to do |format|\n format.html { redirect_to rule_sets_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @rule.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test_rule.destroy\n respond_to do |format|\n format.html { redirect_to test_rules_url, notice: 'Test rule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_rule(scope, kind, id)\n make_request(:delete, \"/pushrules/#{scope}/#{kind}/#{id}\").code == 200\n end",
"def destroy\n @code_rule = CodeRule.find(params[:id])\n @code_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to(code_rules_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @transaction_rule = @business.transaction_rules.find(params[:id])\n @transaction_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to business_transaction_rules_url(@business), notice: _(\"Regla eliminada\") }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lar_rule.destroy\n respond_to do |format|\n format.html { redirect_to lar_rules_url }\n format.json { head :no_content }\n end\n end",
"def location_rule_destroy\n location_id = @rule.location_id\n @rule.destroy ? flash[:status] = _('Rule_deleted') : flash[:notice] = _('Rule_not_deleted')\n redirect_to(action: 'location_rules', id: location_id)\n end",
"def destroy\n @target_rule = TargetRule.find(params[:id])\n @target_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to target_rules_url }\n format.json { head :no_content }\n end\n end",
"def delete_rule!(objectID, forward_to_replicas = false, request_options = {})\n res = delete_rule(objectID, forward_to_replicas, request_options)\n wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options)\n return res\n end",
"def destroy\n return if @name.nil?\n delete_rest \"rules/#{@name}\"\n end",
"def destroy\n @rule_type = RuleType.find(params[:id])\n @rule_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(rule_types_url) }\n format.xml { head :ok }\n end\n end",
"def location_rule_destroy\n location_id = @rule.location_id\n @rule.destroy ? flash[:status] = _('Rule_deleted') : flash[:notice] = _('Rule_not_deleted')\n redirect_to :action => 'location_rules', :id => location_id\n end",
"def delete(fw_rule)\n Dnet.fw_delete @handle, fw_rule\n end",
"def destroy\n @rule.destroy\n render json: {}\n\n end",
"def delete_rule(rule_id)\n request({\n 'Action' => 'DeleteRule',\n 'RuleArn' => rule_id,\n :parser => Fog::Parsers::AWS::ELBV2::Empty.new\n })\n end",
"def destroy\r\n @contact_rule = ContactRule.find(params[:id])\r\n @contact_rule.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to contact_rules_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @payin_rule = PayinRule.find_by(guid: params[:guid])\n\n if @payin_rule.destroy!\n head :ok\n else\n head :bad_request\n end\n end",
"def destroy\n @taxon_rule = TaxonRule.find(params[:id])\n @taxon_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to taxon_rules_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @site_rule.destroy\n respond_to do |format|\n format.html { redirect_to site_rules_url, notice: 'Site rule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 45 )\n\n type = DELETE\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 166:10: 'delete'\n match( \"delete\" )\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__, 45 )\n\n end",
"def destroy\n @reward_rule = RewardRule.find(params[:id])\n @reward_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to reward_rules_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student_group_rule = StudentGroupRule.find(params[:id])\n @student_group_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to(student_group_rules_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @certificate_rule.destroy\n respond_to do |format|\n format.html { redirect_to admin_certificate_rules_url, notice: 'Certificate rule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def plugin_rule_delete(rule_id)\n nessus_rest_delete(\"plugin-rules/#{rule_id}\")\n end",
"def delete(name)\n @driver.deleteRule([name])\n end",
"def destroy\n @price_rule = PriceRule.find(params[:id])\n @price_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to(price_rules_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @template_rule.destroy\n respond_to do |format|\n format.html { redirect_to template_rules_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @field_rule.destroy\n respond_to do |format|\n format.html { redirect_to object_rule_field_rules_url, notice: ' field rule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @convert_rule = ConvertRule.find(params[:id])\n @convert_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to convert_rules_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @attend_rule.destroy\n respond_to do |format|\n format.html { redirect_to attend_rules_url, notice: 'Attend rule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @posting_rule = PostingRule.find(params[:id])\n @posting_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to agreement_path(@posting_rule.agreement) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rulemaking.destroy\n respond_to do |format|\n format.html { redirect_to rulemakings_url, notice: 'Rulemaking was successfully destroyed.' }\n end\n end",
"def destroy\n @reorder_rule.destroy\n respond_to do |format|\n format.html { redirect_to reorder_rules_url, notice: 'Reorder rule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rule_type.destroy\n respond_to do |format|\n format.html { redirect_to rule_types_url, notice: 'Rule type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @prd_attribute = PrdAttribute.find(params[:id])\n @prd_attribute.destroy\n\n #delete_rules()\n\n respond_to do |format|\n format.html { redirect_to(prd_attributes_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end",
"def destroy\n record = TaxRule.find(params[:id])\n record.trash\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete_notification_rule(opts = {})\n delete_notification_rule_with_http_info(opts)\n nil\n end",
"def destroy\n @info_parser_rule = InfoParserRule.find(params[:id])\n @info_parser_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to info_parser_rules_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @numbering_rule = NumberingRule.find(params[:id])\n @numbering_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to(numbering_rules_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @obligation_rule = ObligationRule.find(params[:id])\n @obligation_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to obligation_rules_url }\n format.json { head :no_content }\n end\n end",
"def delete_rule(section_id, rule_id, opts = {})\n delete_rule_with_http_info(section_id, rule_id, opts)\n nil\n end",
"def remove_rule(rule_number, egress)\n requires :network_acl_id\n\n service.delete_network_acl_entry(network_acl_id, rule_number, egress)\n true\n end",
"def destroy\n @http_domain_rule = collection.find(params[:id])\n @http_domain_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to @core_application }\n format.json { head :ok }\n end\n end",
"def destroy\n @notification_rule.destroy\n respond_to do |format|\n format.html { redirect_to notification_rules_url, notice: 'Notification rule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @context = Context.find(params[:context_id])\n @context_rule = @context.context_rules.find(params[:id])\n @context_rule.destroy\n redirect_to context_path(@context)\n end",
"def destroy\n @free_shipping_rule = FreeShippingRule.find(params[:id])\n @free_shipping_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_free_shipping_rules_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @rule.destroy\n render :update do |page|\n page.hide(\"rule_#{@rule.id}\")\n end\n end",
"def delete_area_rule(id, opts = {})\n delete_area_rule_with_http_info(id, opts)\n nil\n end",
"def delete!\n @resource.delete!\n end",
"def destroy\n @provider_fw_rule = ProviderFwRule.find(params[:id])\n @provider_fw_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to provider_fw_rules_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @system_rule.destroy\n respond_to do |format|\n format.html { redirect_to [:admin, @system] }\n format.xml { head :ok }\n format.js\n end\n website.add_log(user: current_user, action: \"Deleted system_rule: #{@system_rule.name}\")\n end",
"def delete_bre_rule(id, opts = {})\n delete_bre_rule_with_http_info(id, opts)\n return nil\n end",
"def delete\n self.is_deleted = true\n save :validate => false\n true\n end",
"def destroy\n @smart_group = @smart_group_rule.smart_group\n if @smart_group_rule.destroy\n flash[:notice] = \"Smart Group Rule was successfully destroyed.\"\n else\n flash[:alert] = \"Smart Group Rule could not be destroyed. Errors: #{@smart_group_rule.errors.full_messages {|m|}.to_sentence}.\"\n end\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def destroy\n requires :network_acl_id\n\n service.delete_network_acl(network_acl_id)\n true\n end",
"def destroy\n errors.clear\n @record = nil\n true\n end",
"def destroy\n reminder = @reminder_rule.reminder\n @reminder_rule.destroy\n CountAllocator.new(reminder).allocate!\n\n respond_to do |format|\n format.html { redirect_to reminder, notice: 'Reminder rule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @formula.destroy\n\n respond_to do |format|\n format.html { redirect_to(formulas_url) }\n format.xml { head :ok }\n end\n end",
"def delete_sync_rule(audience_id, sync_rule_id)\n delete(\"audiences/#{audience_id}/sync_rules/#{sync_rule_id}\")\n end",
"def delete_record(name, type, ttl, value, log_errors = true)\n delete_result = true\n begin\n @route53.client.change_resource_record_sets({\n :hosted_zone_id => @hosted_zone_id, \n :change_batch => {\n :changes => [ \n {\n :action => \"DELETE\", \n :resource_record_set => { \n :name => name, \n :type => type,\n :ttl => ttl, \n :resource_records => [ { :value => value } ]\n }\n }\n ]\n }\n })\n rescue StandardError => bang\n @log.error \"Error deleting A record from Route53: #{bang}\" if log_errors\n delete_result = false\n end\n delete_result\n end",
"def destroy\n @machine_time_rule.destroy\n respond_to do |format|\n format.html { redirect_to machine_time_rules_url, notice: 'Machine time rule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n if current_rule.antragtyp\n @antrag_typ.destroy\n respond_to do |format|\n format.html { redirect_to antrag_typs_url, notice: 'Antrag typ was successfully destroyed.' }\n format.json { head :no_content }\n end \n else\n redirect_to root_path alert: \"Keine Recht\"\n end\n \n end",
"def content_rules_rule_group_name_delete(authorization, web_application_name, rule_group_name, opts = {})\n data, status_code, headers = content_rules_rule_group_name_delete_with_http_info(authorization, web_application_name, rule_group_name, opts)\n [data, status_code, headers]\n end",
"def delete\n @resource.delete\n end",
"def delete!\n delete(:force => true)\n nil\n end",
"def destroy\n self.is_deleted = true\n self.save!\n run_callbacks :destroy do\n delete\n end\n end",
"def clear_rules\n response = @create_send.delete \"/segments/#{segment_id}/rules.json\", {}\n end",
"def destroy\n return false if new? || destroyed?\n handle_response SurveyGizmo.delete(handle_route(:delete)) do\n _response.ok? ? destroyed! : false\n end\n end",
"def destroy\n @choice_question = ChoiceQuestion.find(params[:id])\n question_content_id = @choice_question.question_content.id\n destroy_default_rule_and_display_field(@choice_question)\n @choice_question.destroy\n respond_to do |format|\n format.html { redirect_to survey_path(@survey_version.survey), :notice => \"Successfully deleted choice question.\"}\n format.js { render :partial => \"shared/element_destroy\" }\n end\n # Remove any rules which have actions that point to the choice question_content that just got deleted.\n Action.where(\"value LIKE ?\", question_content_id).each do |a|\n if a.rule.present?\n a.rule.destroy\n end\n end\n end",
"def destroy\n return false if destroyed? || new_record?\n\n response = @client.connection.delete(url || path)\n\n @destroyed = true # FIXME always returns true\n end",
"def destroy\n\n @rule.destroy\n flash.keep\n\n respond_to do |format|\n format.html { redirect_to pattern_path(@pattern), :flash => {:success => 'Successfully deleted the specified Rule.' } }\n format.json { render :json => @rule, :status => :ok }\n end\n rescue Exception => e\n respond_to do |format|\n warning_message = pre_process_exception(e)\n\n if not warning_message.nil?\n logger.debug(warning_message)\n format.html { redirect_to pattern_rules_url(@pattern), :flash => {:error => warning_message} }\n format.json { render :json => @rule, :status => :unprocessable_entity }\n end\n\n error_message = \"Failed to destroy the specified Rule.\"\n format.html { redirect_to pattern_rules_url(@pattern), :flash => {:error => error_message} }\n format.json { render :json => @rule, :status => :unprocessable_entity }\n end\n\n end",
"def destroy\n if @model.present?\n @model.destroy\n @model = nil\n true\n else\n @errors << self.class.model_not_found\n return false\n end\n end",
"def destroy\n render_json_auto @survey.delete_logic_control_rule(params[:id].to_i) and return\n end",
"def delete_vm_host_rule(cpi, cluster_name, rule_name)\n cluster = cpi.client.cloud_searcher.get_managed_object(VimSdk::Vim::ClusterComputeResource, name: cluster_name)\n\n cluster_rule_spec = VimSdk::Vim::Cluster::RuleSpec.new\n cluster_rule_spec.operation = 'remove'\n cluster_rule_spec.remove_key = rule_name\n\n config_spec = VimSdk::Vim::Cluster::ConfigSpecEx.new\n config_spec.rules_spec = [cluster_rule_spec]\n\n reconfigure_cluster(cpi, cluster, config_spec)\n end",
"def delete\n code = @session.delete_resource(@proxy_uri)[0]\n @loaded = false\n @research_object.remove_resource(self)\n code == 204\n end",
"def destroy\n if current_rule.antragStatus\n @antrag_status.destroy\n respond_to do |format|\n format.html { redirect_to antrag_statuses_url, notice: 'Antrag status was successfully destroyed.' }\n format.json { head :no_content }\n end \n else\n redirect_to root_path alert: \"Keine Recht\"\n end\n \n end",
"def delete\n links_in_table = CONNECTION.execute(\"SELECT COUNT(*) FROM assignments_links WHERE link_id = #{@id};\")\n if links_in_table.first[0] == 0\n CONNECTION.execute(\"DELETE FROM links WHERE id = #{@id};\")\n true\n else\n false\n end\n end",
"def destroy\n @shcedule.destroy\n respond_to do |format|\n format.html { redirect_to shcedules_url, notice: 'Shcedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete!\n delete_if { true }\n end",
"def destroy\n return false if not self.saved?\n return self.class.destroy self\n end",
"def destroy\n @destination = Destination.find(params[:id])\n @roadmap = @destination.roadmap \n \n if not validate_permission(@roadmap)\n return\n end\n \n @destination.destroy\n\n respond_to do |format|\n format.html { redirect_to(@roadmap) }\n format.xml { head :ok }\n end\n end",
"def delete\n ensure_service!\n service.delete_model dataset_id, model_id\n # Set flag for #exists?\n @exists = false\n true\n end",
"def remove_rule(rule)\n new_rules = rules.dup\n new_rules.delete(rule)\n @rules = new_rules.uniq.freeze\n self\n end",
"def delete\n Model.test_for_invalid_status(:delete, @model_status)\n clear_alerts; run_validation(:delete)\n\n unless @model_status == :error\n interface.delete(@model_id) \n @model_status = :deleted\n end\n self\n rescue Pod4::WeakError\n add_alert(:error, $!)\n self\n end",
"def remove_policy(_sec, ptype, rule)\n db[table_name].where(policy_line(ptype, rule)).delete\n end",
"def destroy\n @prerequisite = Prerequisite.find(params[:id])\n @prerequisite.destroy\n\n respond_to do |format|\n flash[:notice] = 'Prerequisite successfully destroyed'\n format.html { redirect_to(subject_path(@subject)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n self.run_hook :before_destroy\n result = Driver.client[self.class.coll_name].find({'_id' => self._id}).delete_one\n self.run_hook :after_destroy\n\n result ? true : false\n end",
"def destroy\n @definition_category_association = DefinitionCategoryAssociation.find(params[:id])\n @definition_category_association.destroy\n\n respond_to do |format|\n format.html { redirect_to(definition_category_associations_url) }\n format.xml { head :ok }\n end\n end",
"def delete!\n deleted\n save!\n end",
"def delete_timeframe_rule(id, opts = {})\n delete_timeframe_rule_with_http_info(id, opts)\n nil\n end",
"def destroy\n @criterion = Criterion.find(params[:id])\n @criterion.destroy\n\n respond_to do |format|\n format.html { redirect_to(subject_url(@criterion.subject)) }\n format.xml { head :ok }\n end\n end"
] | [
"0.7176578",
"0.6948633",
"0.6902315",
"0.6860611",
"0.6860611",
"0.68598527",
"0.6763058",
"0.6714959",
"0.6702585",
"0.6665095",
"0.6629522",
"0.66048187",
"0.6590658",
"0.65637",
"0.6509748",
"0.6498065",
"0.64931893",
"0.6483303",
"0.6481372",
"0.6448768",
"0.6448235",
"0.6438768",
"0.6401465",
"0.6396873",
"0.63871986",
"0.6377932",
"0.63675547",
"0.6362086",
"0.6340636",
"0.6330467",
"0.6324096",
"0.63050056",
"0.62722373",
"0.6252493",
"0.62419313",
"0.6237654",
"0.62131184",
"0.62116104",
"0.6197004",
"0.61967486",
"0.61647165",
"0.6163449",
"0.6146871",
"0.61454165",
"0.6142144",
"0.6140321",
"0.6129868",
"0.60476184",
"0.6032374",
"0.6031802",
"0.6000532",
"0.5995363",
"0.5960545",
"0.58985275",
"0.5890922",
"0.58637303",
"0.58332014",
"0.5778297",
"0.5772792",
"0.5763103",
"0.5710371",
"0.56806284",
"0.56635416",
"0.56578684",
"0.5585848",
"0.5585247",
"0.55694884",
"0.5553424",
"0.5515573",
"0.54948175",
"0.5476559",
"0.5466096",
"0.54542047",
"0.5451525",
"0.54499465",
"0.54441607",
"0.5443876",
"0.54436845",
"0.5440289",
"0.54377764",
"0.5430572",
"0.5421693",
"0.54095703",
"0.54012024",
"0.5400315",
"0.53956556",
"0.538391",
"0.53785044",
"0.5365277",
"0.5351214",
"0.5329065",
"0.5326357",
"0.5321716",
"0.53200155",
"0.5307808",
"0.53077877",
"0.53018767",
"0.5298502",
"0.52853566",
"0.5275296",
"0.5273778"
] | 0.0 | -1 |
UNIT TEST FOR print_start(x) Equivalence classes: number = nil, raise number = string, raise number = float, raise number = int, puts This is test when argument is nil EDGE CASE | def test_print_start_nil
assert_raises(StandardError) { print_start(nil) } # pass
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_print_start_float\n assert_raises(StandardError) { print_start(1.2) } # pass\n end",
"def test_print_start_string\n assert_raises(StandardError) { print_start('1') } # pass\n end",
"def test_print_start_int\n assert_output(\"Rubyist #1 starting in Enumerable Canyon.\\n\") { @p.print_start(1) } # pass\n end",
"def test_print_one_type\n\t\tp = Print.new\n\t\tassert_output(\"\\tFound 1 ruby in Town.\\n\") {p.print_day([1,0],'Town')}\n\tend",
"def test_print_heading_nil\n assert_output(\"Heading from to \\n\"){@p.print_heading(nil, nil)}\n end",
"def test_invalid_integer_argument\n assert_raises \"TypeError: Invalid command line arguments.\" do\n @grapher.make_graph([1])\n end\n end",
"def test_print_some_both_types\n\t\tp = Print.new\n\t\tassert_output(\"\\tFound 1 ruby and 2 fake rubies in Town.\\n\") {p.print_day([1,2],'Town')}\n\tend",
"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 test(arg = nil)\n puts \"test\"\n end",
"def test_zero_prospectors\n\t\tassert check_args([1, 0])\n\tend",
"def test_print_heading_float\n assert_output(\"Heading from 1.1 to 1.2\\n\"){@p.print_heading(1.1, 1.2)}\n end",
"def test_print_nil\n assert_output(\"\\tMining Results\\n\\tNo precious metals were found!\\n\") do\n @game.print_mining_results(0, 0)\n end\n end",
"def test_args_check_nil\n\t\targs_checker = ArgsChecker::new\n\t\tarr = nil\n\t\tassert_raises(\"I need one number bud, try again\") { args_checker.check_args arr }\n\tend",
"def test_end_string_zero\n pros = Prospector.new(0,0,0)\n assert pros.end_string.eql? 'Going home empty handed.'\n end",
"def test_print_empty\n assert_output(\"Empty graph!\\n\") { @graph.print }\n end",
"def test_no_arg\n\tassert_output(nil, abort) {GoldRush.argchecker(-1)}\n end",
"def test_format_print_one_real\n simulator = Sim.new(nil, nil, nil)\n assert_equal simulator.ruby_format_print([1, 0]), \"\\tFound 1 ruby in Enumerable Canyon.\\n\"\n end",
"def test_s_one\n p = Prospector.new(0, 0, 0)\n assert p.s?(1), ''\n end",
"def test_no_arg\n\tassert_output(nil, abort) {GoldRush.argchecker()}\n end",
"def test_format_print_two_fake\n simulator = Sim.new(nil, nil, nil)\n assert_equal simulator.ruby_format_print([0, 2]), \"\\tFound 2 fake rubies in Enumerable Canyon.\\n\"\n end",
"def test_s_not_one\n p = Prospector.new(0, 0, 0)\n assert p.s?(4), 's'\n end",
"def test_via_nil_string\r\n assert_equal 'Fifth Ave', @driver.via('nil', 'nil')\r\n end",
"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 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_print_heading_int\n assert_output(\"Heading from 1 to 2\\n\") {@p.print_heading(1, 2)}\n end",
"def test_initialize_edge\n\n dummy_loc = MiniTest::Mock.new('test_loc')\n #dummy_game = MiniTest::Mock.new('test_game')\n def dummy_loc.name; 'Test Location'; end\n #def dummy_game.print; print_day; end\n g_test = Game.new(dummy_loc, -2, -5)\n # Assert that print_day catches and reports edge case\n assert_equal -1, g_test.print_day(dummy_loc, -2, -5)\n end",
"def test_print_classes_negative\n\t\tassert_raises(\"Cannot have fewer than 0 classes\") { print_classes(-1,-1) }\n\tend",
"def test_arg_check_prospectors_decimal\n def exit(x); 1; end\n ret = arg_check_prospectors '1.6'\n assert_equal ret, -3\n end",
"def test_nil_args\n refute check_args(nil)\n end",
"def test_008_phase\n assert_equal 'edge', @me.phase\n end",
"def test_check_block_num_unequal\r\n assert_nil nil, @g.check_block_num(1, 0)\r\n end",
"def test_print_dinos_negative\n\t\tassert_raises(\"Cannot have fewer than 0 dinosaur toys\") { print_dinos(-1,-1) }\n\tend",
"def test_end_string_one\n pros = Prospector.new(0,0,0)\n pros.instance_variable_set(:@real, 1)\n assert pros.end_string.eql? 'Going home sad.'\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 test_input_target_is_nil\n Crd::Spec.new 'Testing' do |s|\n assert_nil( s.input )\n end\n end",
"def test_raises_incorrect_prospectors_input\n assert_raises \"Should raise error when prospectors input is less than or equal to 0!\\n\\n\" do\n ruby_rush=RubyRush.new(1, 2, 3)\n ruby_rush.prospectors_check(0)\n end\n \n assert_raises \"Should raise error when prospectors input is not an integer!\\n\\n\" do\n ruby_rush=RubyRush.new(1, 2, 3)\n rb_rush.prospectors_check(1.1)\n end\n \n assert_raises \"Should raise error when prospectors input is not an integer and is less than or equal to 0!\\n\\n\" do\n ruby_rush=RubyRush.new(1, 2, 3)\n ruby_rush.prospectors_check(-1.1)\n end\n \n assert_raises \"Should raise error when prospectors input is not a number!\\n\\n\" do\n ruby_rush=RubyRush.new(1, 2, 3)\n ruby_rush.prospectors_check(\"\")\n end\n \n end",
"def test_print\r\n reader = GraphReader.new('whatever')\r\n reader.add_node(0, 'A', nil)\r\n assert_output(\"\\nNumber: 0\\nLetter: A\\nNeighbors: none\\n\") {reader.print_graph()}\r\n end",
"def test_output_target_is_nil\n Crd::Spec.new 'Testing' do |s|\n assert_nil( s.output )\n end\n end",
"def print_good(msg='')\n end",
"def test_print_location_starting\n\t\ttest_main = Main.new(3, 1, 6)\n\t\tmocked_Graph = MiniTest::Mock.new(\"mocked graph\")\n\t\tmocked_Graph.expect(:get_curr_loc, Node.new(\"Enumerable Canyon\", 4, 5, 10))\n\t\ttest_main.print_location(mocked_Graph, 0)\n\t\tassert mocked_Graph\n\tend",
"def test_convert_word_nil\n arr = nil\n assert_nil @grapher.convert_word(arr)\n end",
"def test_start_string\n pros = Prospector.new(0,0,0)\n assert pros.start_string.eql? 'Rubyist #0 starting in Enumerable Canyon.'\n end",
"def test_ruby_string_0\n pros = Prospector.new(0,0,0)\n assert pros.ruby_string(0).eql? ''\n end",
"def test_palindrome_parameter_empty\n err = assert_raises EmptyDigitError do\n Palindrome.new('')\n end\n assert_match 'The argument is empty', err.message\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 test_raises_incorrect_turns_input\n assert_raises \"Should raise error when turns input is less than or equal to 0!\\n\\n\" do\n ruby_rush=RubyRush.new(1, 2, 3)\n ruby_rush.turns_check(0)\n end\n \n assert_raises \"Should raise error when turns input is not an integer!\\n\\n\" do\n ruby_rush=RubyRush.new(1, 2, 3)\n ruby_rush.turns_check(1.1)\n end\n \n assert_raises \"Should raise error when turns input is not an integer and is less than or equal to 0!\\n\\n\" do\n ruby_rush=RubyRush.new(1, 2, 3)\n ruby_rush.turns_check(-1.1)\n end\n \n assert_raises \"Should raise error when turns input is not a number!\\n\\n\" do\n ruby_rush=RubyRush.new(1, 2, 3)\n ruby_rush.turns_check(\"\")\n end\n end",
"def test_graph_to_s_incomplete\n sut_graph = Graph.new\n sut_graph.name=\"test_graph\" \n #sut_graph.type=:digraph\n sut_graph.node_style=:ellipse\n \n sut_graph.add_edge(\"TEST1\" , \"TEST2\" , \"take_me_to_test_2\")\n assert_raises RuntimeError do\n returned_obj = sut_graph.to_s\n end # end assert\n end",
"def test_raises_incorrect_seed_input\n \n assert_raises \"Should raise error when seed input is not an integer!\\n\\n\" do\n ruby_rush=RubyRush.new(1, 2, 3)\n ruby_rush.seed_check(1.1)\n end\n \n assert_raises \"Should raise error when seed input is not a number!\\n\\n\" do\n ruby_rush=RubyRush.new(1, 2, 3)\n ruby_rush.seed_check(\"\")\n end\n end",
"def test_sg_not_one\n\n p = Prospector.new(0, 0, 0)\n assert p.sg?(4), 's'\n end",
"def test_end_string_ten\n pros = Prospector.new(0,0,0)\n pros.instance_variable_set(:@real, 10)\n assert pros.end_string.eql? 'Going home victorious!'\n end",
"def test_values\r\n assert_equal((3**-3).to_s, @p2.to_s)\r\n assert_equal((3**-2).to_s, @p3.to_s)\r\n assert_equal((3**-1).to_s, @p4.to_s)\r\n assert_equal((3**0).to_s, @p5.to_s)\r\n assert_equal((3**1).to_s, @p6.to_s)\r\n assert_equal((3**2).to_s, @p7.to_s)\r\n assert_equal((3**3).to_s, @p8.to_s)\r\n assert_raise(ArgumentError) {Exponentiation.new(-1.4)}\r\n assert_raise(ArgumentError) {Exponentiation.new(test)}\r\n assert_nothing_raised(ArgumentError) {Exponentiation.new(Exponentiation.new(3).to_i)}\r\n end",
"def test_fake_string_0\n pros = Prospector.new(0,0,0)\n assert pros.fake_string(0).eql? ''\n end",
"def test_error_normal\n stack = TokenStack.new\n expected = 'Line 0: Testing'\n terp = Interpreter.new(false, true)\n error = terp.error(0, stack, 0, 'Testing')\n\n assert_equal expected, error\n end",
"def test_print_ruby_found_nil\n mock_location = Minitest::Mock.new('location')\n def mock_location.name; 'a'; end\n def plural?(x); 'ruby'; end\n assert_raises(StandardError){@p.print_ruby_found_in_this_location(mock_location, nil)}\n end",
"def test_end_search_0_turns\n \tpro = Prospector.new(1)\n \tpro.loop_prospector(0)\n \tassert pro.total_rubies == 0\n \tassert pro.total_fake_rubies == 0\n \tassert pro.days == 0\n \tassert pro.turns == 0\n end",
"def test_code_1\n string = \"Line 321: Variable x is not initialized\\n\"\n assert_output(string) { Errorcode.error(1, 321, 'x') }\n end",
"def test_first_example\n assert_equal(0, purple([\"+1\", \"-1\"]))\n end",
"def test_nothing; end",
"def test_sg_one\n p = Prospector.new(0, 0, 0)\n assert p.sg?(1), ''\n end",
"def test_initalize_with_no_arguments\n assert_nil @animal.name\n assert_nil @animal.species\n assert_equal 0, @animal.speed\n assert_equal 0, @animal.legs\n end",
"def greet(name)\n\nif name == \"\"\n p nil\nelsif name == nil\n p nil\nelse\n \"hello #{name}!\"\nend\n\nend",
"def print_one(arg)\r\n puts \"arg: #{arg}\"\r\nend",
"def print0\n end",
"def assertions=(_arg0); end",
"def assertions=(_arg0); end",
"def test_extended\r\n\t\tassert('two'.length == 3)\t\t\t\t\t\t# Boolean expression\r\n\t\tassert_not_equal(\"Expected\", \"Actual\")\t\t\t# != \r\n\t\tassert_raise(ZeroDivisionError) { 2/0} \t\t\t# Exception type\r\n\t\tassert_nothing_raised(ZeroDivisionError) { 2/1 }# Positive if the none of the exceptions raised\r\n\t\tassert_instance_of(String, 23) \t\t\t\t# Checks the object against its type\r\n\tend",
"def test_message_type\n @main = <<HERE\nMessage m = self.next_message\nm = m.next_message\nWord w = m.get_class_name()\nw.putstring()\nHERE\n @stdout = \"Message\"\n check\n end",
"def test_valid_input\n assert_equal(nil, RomanMathmaticalOperation.new(\"X\", \"+\",\"V\").send(:valid_input))\n exception = assert_raise(\"RomanMathmaticalOperationError\") {RomanMathmaticalOperation.new(\"X\", \"+\",nil).send(:valid_input)}\n assert_equal(\"This X or is not valid\", exception.message)\n exception = assert_raise(\"RomanMathmaticalOperationError\") {RomanMathmaticalOperation.new(\"X\", \"%\",\"V\").send(:valid_input)}\n assert_equal(\"Operator missmatch\", exception.message)\n end",
"def test_check_num\n assert_raises SystemExit do\n assert_output 'Line 2: Invalid block number 1, should be 2\\nBLOCKCHAIN INVALID' do\n block_no = '1'\n line_no = '2'\n @verify.check_num(block_no, line_no)\n end\n end\n end",
"def test_string_and_integer_argument\n assert_output(\"Usage:\\nruby word_finder.rb *name_of_file*\\n*name_of_file* should be a file\\n\") {@grapher.make_graph(['wordlist.txt', 1])}\n end",
"def test_addition_of_two_number\n # assert_raises \"Invalid values.\" do\n magic_ball = MagicBall.new\n puts \"--------------\"\n puts magic_ball.addition(5, 5)\n puts \"--------------\"\n assert magic_ball.addition(5, 5), 10\n # assert addition == 10\n # end\n end",
"def start_test(test)\n puts \"\\e[36mRunning test:\\e[0m \\e[37m#{test.name} Line: #{test.lineNumber}\\e[0m\"\n end",
"def _test_2\n dotest(\n TestCase45a2,\n \"\"\"\n.0 - 1\n.1 - 2\ndone.\n \"\"\".strip)\n end",
"def expected_value; end",
"def expected_value; 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 stest_method_1(test); end",
"def test_print_usage\n assert_output(\"Usage:\nruby ruby_rush.rb *seed* *num_prospectors* *num_turns*\n*seed* should be an integer\n*num_prospectors* should be a non-negative integer\n*num_turns* should be a non-negative integer\\n\") { print_usage }\n end",
"def test_parse_line_empty\n assert_nil @grapher.parse_line_tokens('')\n end",
"def initialize(value)\n value==nil ? raise : #throw an exception if there were no value\n @value=value\n @node_to_go=nil\n rescue\n puts \"There is no such number\"\n end",
"def print_start_round\n print_separator\n print_msg('round_begin')\n print_separator\n end",
"def start=(_arg0); end",
"def assertions; end",
"def assertions; end",
"def test_0_dummy\n\t\tend",
"def test_arg_check_prospectors_negative\n def exit(x); 1; end\n ret = arg_check_prospectors '-1'\n assert_equal ret, -3\n end",
"def test_code_2\n string = \"Line 999: Operator + applied to empty stack\\n\"\n assert_output(string) { Errorcode.error(2, 999, '+') }\n end",
"def test_print_books_singular\n\t\tassert_output(\"Driver 1 obtained 1 book!\\n\") { print_books(1,1) }\n\tend",
"def test_arg_check_turns_decimal\n def exit(x); 1; end\n ret = arg_check_turns '1.6'\n assert_equal ret, -4\n end",
"def test_type_checks_work\n assert_raises(ArgumentError) {\n VLib.new.get_length(10)\n }\n assert_raises(ArgumentError) {\n VLib.new.get_str_length(10)\n }\n VLib.new.sum_3(10, 4, 2.0)\n assert_raises(ArgumentError) {\n VLib.new.sum_3(10, 4, 2)\n }\n assert_raises(ArgumentError) {\n VLib.new.sum_3(10.9, 4, 2.0)\n }\n end",
"def test_type_checks_work\n assert_raises(ArgumentError) {\n VLib.new.get_length(10)\n }\n assert_raises(ArgumentError) {\n VLib.new.get_str_length(10)\n }\n VLib.new.sum_3(10, 4, 2.0)\n assert_raises(ArgumentError) {\n VLib.new.sum_3(10, 4, 2)\n }\n assert_raises(ArgumentError) {\n VLib.new.sum_3(10.9, 4, 2.0)\n }\n end",
"def test_end_string_twenty\n pros = Prospector.new(0,0,0)\n pros.instance_variable_set(:@real, 20)\n assert pros.end_string.eql? 'Going home victorious!'\n end",
"def print_one(arg1)\n # whatever arg1 is defined as will get printed to the screen\n puts \"arg1: #{arg1}\"\n #the method ends with end\nend",
"def test_divide_by_zero\n calc = RpnCalc.new\n calc.enter(1)\n calc.enter(0)\n assert_raise(ZeroDivisionError) do\n calc.enter('/')\n end\n end",
"def test_wertgleichheit()\n assert(@rp1==@rp1,\"Keine korrekte Pruefung fuer identische Objekte\")\n assert(@rp1==@rp1_6, \"Keine korrekter Vergleich fuerr inhaltsgleiche Objekte\")\n assert(@rp1==@rp1_1, \"Keine korrekter Vergleich für inhaltsgleiche Objekte\")\n assert_equal(false,@rp1==@rp5, \"Fehler: Gleichheit für ungleiche Objekte\")\n assert(@rp0_1==@rp0_2,\"Keine korrekte Prüfung bei 0-Zaehler und leerem Wort\")\n # Arbeitet der Vergleich auch mit Objekten anderen Typs korrekt\n assert_nothing_raised(\"Test auf Wertgleichheit mit Objekten anderen Typs darf keinen Fehler werfen\"){!(@rp1==7)}\n end",
"def test_intialize\r\n\tassert_equal 0, @test_prospector.current_gold\r\n\tassert_equal 0, @test_prospector.current_silver\r\n\tassert_equal 0, @test_prospector.total_gold\r\n\tassert_equal 0, @test_prospector.total_silver\r\n\tassert_equal 0, @test_prospector.move_count\r\n\tassert_nil @test_prospector.previous_location\r\n\tassert_equal 0, @test_prospector.num_days\r\n\tassert_equal 'Sutter Creek', @test_prospector.current_location\r\n end",
"def test_print_results\n\t\ttest_main = Main.new(3, 1, 6)\n\t\tmocked_Graph = MiniTest::Mock.new(\"mocked graph\")\n\t\tmocked_Graph.expect(:get_curr_loc, Node.new(\"Enumerable Canyon\", 4, 5, 10))\n\t\ttest_main.print_results\n\t\tassert mocked_Graph\n\tend",
"def print_one(arg1)\n\tputs \"\\t>> print_one\"\n\tputs \"arg1: #{arg1}\"\n\tputs \"\\t<< print_one\"\nend",
"def test_missing_argument_invalid_argument\n\t\tc = Check.new\n\t\trefute c.check_arguments([1,1,'s'])\n\tend",
"def tests=(_arg0); end"
] | [
"0.71186864",
"0.68293035",
"0.631714",
"0.6228734",
"0.6148202",
"0.5930467",
"0.59097457",
"0.5875946",
"0.5849329",
"0.5828582",
"0.5791807",
"0.57870793",
"0.57451963",
"0.5736707",
"0.5723348",
"0.57193047",
"0.5693964",
"0.5679269",
"0.56739587",
"0.5655085",
"0.5642526",
"0.5637553",
"0.56316763",
"0.5626991",
"0.562419",
"0.5618225",
"0.560176",
"0.55749416",
"0.557431",
"0.55598015",
"0.55564976",
"0.5552174",
"0.5544968",
"0.5541166",
"0.55354375",
"0.5523596",
"0.5497964",
"0.5496436",
"0.5494008",
"0.5489668",
"0.54878074",
"0.5472907",
"0.5468272",
"0.5464137",
"0.5463009",
"0.5449111",
"0.5448293",
"0.54424435",
"0.54264766",
"0.5420851",
"0.5418137",
"0.54019946",
"0.53855336",
"0.53767234",
"0.53762513",
"0.5370413",
"0.53629345",
"0.53586614",
"0.53560257",
"0.5343018",
"0.5319361",
"0.5314388",
"0.53134555",
"0.5309249",
"0.5309249",
"0.53071064",
"0.53059196",
"0.5303438",
"0.5299307",
"0.5286409",
"0.528354",
"0.52817535",
"0.52753645",
"0.5272227",
"0.5272227",
"0.5271546",
"0.5257139",
"0.5256994",
"0.525519",
"0.5254229",
"0.5251988",
"0.5246373",
"0.5236135",
"0.5236135",
"0.52352655",
"0.52325636",
"0.52188015",
"0.52185225",
"0.52126896",
"0.5210393",
"0.5210393",
"0.52066875",
"0.5202265",
"0.51934814",
"0.5193161",
"0.51902854",
"0.51699734",
"0.51695323",
"0.5166139",
"0.51658624"
] | 0.7505627 | 0 |
This is test when argument is a string | def test_print_start_string
assert_raises(StandardError) { print_start('1') } # pass
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_string_argument\n\t\tc = Check.new\n\t\tassert c.check_arguments([1,'1',1])\n\tend",
"def test_string\n args = Arguments.new\n assert_equal false, args.check_args(\"puppy\")\n end",
"def test_arg_check_2string\n \t@args = ArgumentCheck.new\n \tassert_equal(false, @args.arg_check(['poop', 'poopy']))\n end",
"def string?\n !@arg[:textValue].nil?\n end",
"def test_check_args_invalid_string\n args = CheckArgs.new\n assert_equal false, args.check_args(['HI'])\n end",
"def string?(input)\n input.class == String\nend",
"def test_check_args_invalid_string2\n args = CheckArgs.new\n assert_equal false, args.check_args(['HI', 4, 'There'])\n end",
"def string_check(arg)\n return arg if arg.is_a?(String)\n return arg.send(:to_str) if arg.respond_to?(:to_str, true) # MRI honors it, even if private\n return arg.to_path if arg.respond_to?(:to_path)\n raise TypeError\n end",
"def test_arg_check_3string\n \t@args = ArgumentCheck.new\n \tassert_equal(false, @args.arg_check(['poop', 'poopy', 'poopypoop']))\n end",
"def is_string(input)\n input.kind_of?(String)\n end",
"def value?(value) value.is_a?(String) end",
"def should_be_string(data)\n if data.class != String\n raise \"Data needs to be a string; you passed in a #{data.class}: #{data}\"\n end\n end",
"def valid_argument? name, type\n if name.nil? || name.empty? || name == type\n shell.say(\"ERROR: Invalid/missing argument.\") and false\n else\n true\n end\n end",
"def test_check_num_args_string1\n args = CheckNumArgs.new\n assert_equal false, args.check_args(['HELLO'])\n end",
"def valid_string?(field, param)\n true\n end",
"def test_check_num_args_string2\n args = CheckNumArgs.new\n assert_equal false, args.check_args(['HELLO', 'THERE'])\n end",
"def require_string(value)\n if value.nil? == true || value.to_s.empty?\n log_error_and_raise(\"expected string value, got nil or empty string\")\n end\n\n if value.is_a?(String) != true\n log_error_and_raise(\"expected string value, got #{value.class}, #{value.inspect}\")\n end\n\n end",
"def expect_string name, value\n expect_type name,\n value, \n \"string\",\n String\n end",
"def is_string?(); @type == GRT_STRING; end",
"def validate_string( str )\r\n if str.kind_of?(String)\r\n return true\r\n else\r\n puts \"#{self.class}:check_string: Error: Input must be a string.\"\r\n return false\r\n end\r\n end",
"def string?(string, &block)\n string !~ /\\0/ && runner( String, string, &block )\n end",
"def isText _args\n \"isText _args;\" \n end",
"def test_check_num_args_string3\n args = CheckNumArgs.new\n assert_equal false, args.check_args(['HELLO', 'THERE', 'KENOBI'])\n end",
"def string?(str)\n str.is_a?(String)\n end",
"def hello(name)\n\n if name.is_a? String\n \"Hello, #{name}\"\n end\nend",
"def check_string(param, default, options = {})\n allowed = options[:allowed]\n if (param && allowed.class == Regexp && param =~ allowed)\n param\n elsif (param && allowed.class == Array && allowed.include?(param))\n param\n elsif (param && allowed.class == String && allowed == param)\n param\n else\n default\n end\n end",
"def compatible_string(value, label: 'Argument')\n unless value.is_a? String\n raise ArgumentError, \"#{label} must be a String\"\n end\n\n unless value.length >= 2\n raise ArgumentError, \"#{label} must be 2 or more characters long\"\n end\n\n unless value.length < @max_input_length\n raise ArgumentError, \"#{label} must be less than #{@max_input_length} characters long\"\n end\n\n value.downcase\n end",
"def test_palindrome_parameter_string\n err = assert_raises InvalidStringError do\n Palindrome.new('Hola mundo')\n end\n assert_match 'The argunment is a String', err.message\n end",
"def valid_string?(string)\n if string.class == String\n string\n else\n false\n end\nend",
"def test_arg_check_turns_valid\n ret = arg_check_turns '1'\n assert_equal ret, 0\n end",
"def double_quotes_required?(string); end",
"def double_quotes_required?(string); end",
"def validate_string(value)\n raise CustomErrors::FilterArgumentError, 'Value must be a string' unless value.is_a?(String)\n end",
"def test_does_say_hello_work\n if (\"hello\" == say_hello)\n puts \"Passed\"\n else\n puts \"Failed\"\n end\nend",
"def test_arg_check_prospectors_valid\n ret = arg_check_prospectors '1'\n assert_equal ret, 0\n end",
"def test_missing_argument_invalid_argument\n\t\tc = Check.new\n\t\trefute c.check_arguments([1,1,'s'])\n\tend",
"def expected_type\n 'string'\n end",
"def validate_string(arg)\n arg.split(\"\").each do |i|\n if(i != '0' && i !='1')\n puts \"The input argument contain(s) characters other than 0 and 1. Please correct!\"\n return false\n end\n end\n end",
"def safe_string?(param)\n return true unless param\n (param =~ %r{^[A-Za-z0-9._-]+$}) != nil\nend",
"def first_validate_arg(arg)\n if(arg.length != length)\n puts \"The length of the string is not correct. Your input length is #{arg.length} but the length needs to be #{length}\"\n self.valid = false\n return false\n else\n arg.split(\"\").each do |i|\n if(i != '0' && i !='1')\n puts \"The input argument contain(s) characters other than 0 and 1. Please correct!\"\n self.valid = false\n return false\n end\n end\n end\n return true\n end",
"def string?(description)\n description.type == :str\n end",
"def isIntegerString?(string)\n Integer(string)\n return true\nrescue ArgumentError\n return false\nend",
"def string?\n type == \"STRING\"\n end",
"def username_arg_ok? username\n return false if username.nil?\n return false unless (1..16) === username.length\n return false unless username.match /\\A[0-9a-zA-Z]*\\z/\n \n # oh? okay, all good.\n true\n end",
"def string(str); end",
"def is_strtype?(); @type == GRT_STRTYPE; end",
"def valid_string_and_reg_ex?(char_string, reg_exp)\n str_flag = is_string?(char_string)\n regex_flag = is_reg_exp?(reg_exp) \n puts \"First argument should be a String.\" unless(str_flag)\n puts \"Second argument should be a Regular Expression.\" unless(regex_flag)\n str_flag && regex_flag\nend",
"def provided?\n [email protected]?\n end",
"def expects_argument?\n true\n end",
"def slug?(arg)\n false if Integer(arg)\n rescue ArgumentError, TypeError\n true\n end",
"def test_js_type_string(t)\n\treturn t.class == String\nend",
"def isok(input)\n # make sure that the input does not contain system ''\n ! input.downcase.include? 'system'\n end",
"def valid_param?(val)\n !val.nil? && val.is_a?(String) && !val.empty?\nend",
"def right_type?\n ARGV[0].is_a?(String) && ARGV[1].is_number? && ARGV[2].is_number?\n end",
"def is_valid? argument\n argument.to_s.to_i == argument\nend",
"def nmap_validate_arg(str)\n # Check for existence\n if str.nil? || str.empty?\n print_error \"Missing nmap argument\"\n return false\n end\n # Check for quote balance\n if !(str.scan(/'/).size % 2).zero? or !(str.scan(/\"/).size % 2).zero?\n print_error \"Unbalanced quotes in nmap argument: #{str}\"\n return false\n end\n # Check for characters that enable badness\n disallowed_characters = /([\\x00-\\x19\\x21\\x23-\\x26\\x28\\x29\\x3b\\x3e\\x60\\x7b\\x7c\\x7d\\x7e-\\xff])/n\n badchar = str[disallowed_characters]\n if badchar\n print_error \"Malformed nmap arguments (contains '#{badchar}'): #{str}\"\n return false\n end\n # Check for commas outside of quoted arguments\n quoted_22 = /\\x22[^\\x22]*\\x22/n\n requoted_str = str.tr('\\'','\"')\n if requoted_str.split(quoted_22).join[/,/]\n print_error \"Malformed nmap arguments (unquoted comma): #{str}\"\n return false\n end\n return true\nend",
"def test_empty\r\n args = Args.new\r\n assert_equal false, args.check_args(\" \")\r\n end",
"def test_assert_string_returns_true\n secret_word = \"cat\"\n assert_equal(true, get_word?(secret_word))\n end",
"def is_strname?(); @type == GRT_STRNAME; end",
"def is_string()\n res = super(context,self)\n return res\n end",
"def match(str = T.unsafe(nil)); end",
"def match(str = T.unsafe(nil)); end",
"def catch_argument_passed_as_input(arg_list, arg, arg_input)\n arg_list.each do |arg_element|\n if arg_input.strip == arg_element\n exit_failure(missing_input_msg(arg))\n end\n end\n end",
"def string?\n data_type == String\n end",
"def test_arguments\n\texpect_error(42, /illegal argument/)\n\texpect_error([], /illegal argument/)\n\n\tbegin\n\t # We already tested tempfile arguments elsewhere (see\n\t # test_from_tempfile).\n\t str = StringSubclass.new('abc') # should be OK\n\trescue NQXML::ParserError => ex\n\t assert_fail(\"unexpected parser error on line #{ex.line}: #{$!}\")\n\tend\n end",
"def test_string_sanity\n assert(!'foo'.respond_to?(:uri), \"Someone added an 'uri' method to the String class. This will cause problems.\")\n end",
"def is_ustring?(); @type == GRT_USTRING; end",
"def is_string\n return @is_string\n end",
"def string?; end",
"def who_is_it?(name=\"Bob\")\n name\nend",
"def test_include_accepts_arguments_it_annouce\n s = Sample.new << ['+ a b a b', '+ a b', '- a', '+']\n assert_equal true, s.include?('+ a b a b')\n assert_equal true, s.include?(InputString.new('a b a b',true))\n assert_equal true, s.include?(ADL::parse_string('+ a b a b'))\n assert_equal true, s.include?(['+ a b a b', '+ a b'])\n assert_equal true, s.include?(s)\n end",
"def checkTypo(arg,regex)\r\n return !(arg=~regex)\r\nend",
"def test_string_and_integer_argument\n assert_output(\"Usage:\\nruby word_finder.rb *name_of_file*\\n*name_of_file* should be a file\\n\") {@grapher.make_graph(['wordlist.txt', 1])}\n end",
"def test_wrong_argument_type\n assert_raises \"name should be a string\" do\n pl = Place::new 12\n end\n end",
"def argument?; end",
"def string_validator(string, parameter)\n \n\tif string.length <= $MIN_LENGTH\n puts \"The #{parameter} requires at least #{$MIN_LENGTH} letters\"\n\t\treturn false\n\telsif string != string.gsub(/[^0-9a-z]/i, '')\n puts \"The #{parameter} can only contain alpha numeric characters \"\\\n\t\t \"(no spaces or special characters)\"\n\t\treturn false\n\telsif string !~ /[A-Z]/\n\t puts \"The #{parameter} requires an uppercase character\"\n\t\treturn false\n elsif string !~ /[a-z]/\n\t puts \"The #{parameter} requires an lowercase character\"\n\t\treturn false\n elsif string !~ /\\d/\n\t puts \"The #{parameter} requires numeric character\"\n\t\treturn false\n end\n\n\treturn true\nend",
"def only_with_a_string(value)\r\n if value.is_a?(String)\r\n yield(value)\r\n return self\r\n else\r\n raise ArgumentError, 'only string values are accepted'\r\n end\r\n end",
"def test_fake_string_0\n pros = Prospector.new(0,0,0)\n assert pros.fake_string(0).eql? ''\n end",
"def test_negative\r\n args = Args.new\r\n assert_equal false, args.check_args(\"hello\")\r\n end",
"def is_string?\n @name.is_a?(String) && @stack.empty?\n end",
"def test_one_arg\n assert_true ArrayPatternMatcher.new(1) === [1]\n assert_true ArrayPatternMatcher.new(Integer) === [1]\n assert_true ArrayPatternMatcher.new(/\\s/) === [' ']\n assert_true ArrayPatternMatcher.new(String) === [' ']\n assert_false ArrayPatternMatcher.new(Integer) === []\n assert_false ArrayPatternMatcher.new(Integer) === [' ']\n assert_false ArrayPatternMatcher.new(String) === ' '\n assert_false ArrayPatternMatcher.new(Array) === ' '\n end",
"def is_func(str)\n\tstr == \"\\\\\"\nend",
"def validate_name(arg = nil)\n set_or_return(:name, arg, :kind_of => String, :callbacks => {\n \"user must be string of word characters and Engine ID should be either empty string or 5 to 32 octets separated by colons\" => lambda {\n |name| !@@title_pattern.match(name).nil?\n }\n })\n end",
"def test_string_match\n s = \"a\"\n assert_equal(0, string_match(\"a\", s))\n assert_equal(0, string_match(/a/, s))\n assert_equal(0, string_match('\\(a\\|\\b\\)', s))\n assert_equal(0, string_match(/a|b/, s))\n assert_equal(0, string_match(/^a/, s))\n assert_equal(0, string_match(/a$/, s))\n assert_equal(0, string_match(/.*/, s))\n assert_equal(nil, string_match(/not-match/, s))\n \n end",
"def string?\n @kind == :double_string_lit || @kind == :single_string_lit\n end",
"def param_check_string(_param, _display, _value)\n critical_error('the param_check_string method was not overridden after being included in a database class')\n end",
"def string=(_arg0); end",
"def test_only_name_argument\n \n output = `./cheers Abby`\n expected = <<EOS\n Give me an... A\n Give me a... B\n Give me a... B\n Give me a... Y\n Abby’s just GRAND!\n Try again with `./cheers.rb [Name] [MM/DD Birthday]\nEOS\n assert_equal expected, output\n end",
"def spec\n string_match_operator\n string_element_reference_regexp\n string_byteslice\n string_scan\n string_unary_minus\n string_reverse\n string_tr\n\n true\nend",
"def correct?(str)\n str = str.is_a?(String) ? str : str.to_s\n str == (@answer.is_a?(String) ? @answer : @answer.to_s) # don't change @answer type\n end",
"def test_arg_check_oneArg\n \t@args = ArgumentCheck.new\n \tassert_equal(true, @args.arg_check([1]))\n end",
"def test_via_numeric_string\r\n assert_equal 'Fifth Ave', @driver.via(123, 456)\r\n end",
"def test_bad_argument\n assert_equal 1, go_with_args(%w(--this_is_really_redonculouslywrong))\n assert_match(/Error: bad arguments/, @stderr_io.string )\n end",
"def test_7_return_true_if_letter_in_word\r\n $word = \"test\"\r\n letter = \"e\"\r\n results = letter_test(letter)\r\n assert_equal(true, results)\r\n end",
"def expects_argument?\n config[:argument] && config[:argument] != :optional\n end",
"def input_string; end",
"def term_valid?(term)\n term.is_a?(String)\n end",
"def validate_name(arg=nil)\n set_or_return(:name, arg, kind_of: String, callbacks: {\n 'user must be string of word characters and ' \\\n 'Engine ID should be either empty string or ' \\\n '5 to 32 octets separated by colons' => lambda do |name|\n !@@title_pattern.match(name).nil?\n end,\n })\n end",
"def integer?(string)\n b = Integer(string)\n return b\nrescue ArgumentError\n return false\nend",
"def is_valid_landline_no?(landline_no)\n is_string?(landline_no) ? is_valid_length_of_landline_no?(landline_no) : (puts \"Landline no. should be a String.\")\nend",
"def test_ruby_string_0\n pros = Prospector.new(0,0,0)\n assert pros.ruby_string(0).eql? ''\n end"
] | [
"0.79019797",
"0.7803992",
"0.78000855",
"0.73190004",
"0.7282978",
"0.72626835",
"0.72085804",
"0.7157702",
"0.71222144",
"0.70948565",
"0.69643587",
"0.6953815",
"0.6880464",
"0.6835147",
"0.6759548",
"0.674851",
"0.6727656",
"0.6717465",
"0.6697668",
"0.66266453",
"0.6593392",
"0.6517607",
"0.64311993",
"0.6414163",
"0.64088666",
"0.6379483",
"0.6374308",
"0.63730204",
"0.6335665",
"0.63345945",
"0.63273245",
"0.63273245",
"0.6326491",
"0.6324889",
"0.6317025",
"0.6307992",
"0.6305044",
"0.6297017",
"0.62775916",
"0.62771946",
"0.6253774",
"0.6222389",
"0.6215499",
"0.62031686",
"0.6172234",
"0.6142782",
"0.61370534",
"0.60861075",
"0.60856235",
"0.6072322",
"0.6063236",
"0.6062581",
"0.6059574",
"0.6048184",
"0.60463333",
"0.60030913",
"0.5999646",
"0.59980744",
"0.59969175",
"0.5995305",
"0.59876084",
"0.59876084",
"0.5981479",
"0.5974729",
"0.59533644",
"0.59226716",
"0.5921244",
"0.59170187",
"0.5906372",
"0.58988595",
"0.5896471",
"0.5893159",
"0.58908176",
"0.5884222",
"0.5872653",
"0.5841998",
"0.58399814",
"0.583426",
"0.5823094",
"0.58230674",
"0.58095264",
"0.58089405",
"0.5805748",
"0.5793563",
"0.5793103",
"0.5790417",
"0.5786709",
"0.5782027",
"0.5775993",
"0.57727915",
"0.5772207",
"0.5769648",
"0.5768973",
"0.5763525",
"0.5749283",
"0.57468104",
"0.5742913",
"0.57304144",
"0.5722678",
"0.5720594",
"0.5708421"
] | 0.0 | -1 |
This is test when argument is a float | def test_print_start_float
assert_raises(StandardError) { print_start(1.2) } # pass
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_float?(input)\n input.to_f.to_s == input\nend",
"def expect_float(value, field, subfield)\n return true if value.blank?\n return true if value.is_a?(Float)\n errors.add(field, \"#{subfield} must be a float if present\")\n false\n end",
"def float?(object)\n return true if Float(object)\n rescue \n return false\nend",
"def float?(num)\n num.to_f.to_s == num\nend",
"def assert_floatable *args\n args.each do |var|\n assert do\n var.not_nil? && var.is_a?(Numeric)\n end\n end\n end",
"def float?(num)\n num == num.to_f.to_s\nend",
"def float?(num)\n num.to_f().to_s()==num\nend",
"def isFloat?\n !!Float(exp) rescue false\n end",
"def float?\n !!Float(self)\n rescue ArgumentError, TypeError\n false\n end",
"def is_float?\n self.to_f.to_s == self\n end",
"def should_be_float?(field_info, field)\n field_info[\"type\"] == \"REAL\"\n end",
"def float3?(input)\n Float(input) rescue false\nend",
"def float_val?(val)\n !!(val =~ /\\A[-+]?\\d+(\\.\\d+)?\\z/)\n end",
"def valid_float_number?(num)\n num.to_f.to_s == num\nend",
"def is_float(answer)\n float_answer = answer.to_f\n if float_answer == 0.0\n float_answer = nil\n end\n [float_answer, \"#{answer} must be a valid float.\"]\nend",
"def float?\n !!strip.match(/^-?\\d+\\.\\d+$/)\n end",
"def float?\n self.class.float?(self)\n end",
"def match_float( val )\n\t\treturn Float( val ) rescue nil\n\tend",
"def float?(field)\n self.send(field).is_a? Float\n end",
"def is_valid_float_param(param_name)\n # this is the equivalent one-liner ruby-style\n # true if Float params[param_name] rescue false\n begin\n Float(params[param_name])\n return true\n rescue\n return false\n end\n end",
"def float?\n @kind == :float_lit || @kind == :float_exp_lit\n end",
"def check_float(a, b)\n #tolerance = 1e-12\n tolerance = 1e-2\n a = a.to_f\n b = b.to_f\n if a.finite? and b.finite?\n (a-b).abs < tolerance\n else\n true\n end\n end",
"def numeric_check(first_num)\n Float(first_num) != nil rescue false\nend",
"def verifica(numero)\n true if (Float(numero)) && (Float(numero) > 1.0) rescue false\nend",
"def float_check(num)\n\tif num.include?(\".\")\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend",
"def float_check(num)\n\tif num.include?(\".\")\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend",
"def test_002_convert_float2\r\n\tresult = convert_float( '')\r\n\tassert close_enough( 0.0, result )\r\n end",
"def is_float?\n\t\tFloat(self) != nil rescue false\n\tend",
"def float?\n type == \"FLOAT\" || type == \"FLOAT64\"\n end",
"def check_for_float(company)\n float(company) unless\n company.floated? ||\n (initial_offering.percentage_owned(company) > BigDecimal.new('0.5'))\n end",
"def check_float(a, b)\n tolerance = 1e-12\n a = a.to_f\n b = b.to_f\n if a.finite? and b.finite?\n (a-b).abs < tolerance\n else\n true\n end\nend",
"def numeric(x)\n true if Float(x) rescue false\n end",
"def check_float(a, b)\n tolerance = Math::TOLERANCE\n a = a.to_f\n b = b.to_f\n if a.finite? and b.finite?\n (a-b).abs < tolerance\n else\n true\n end\nend",
"def check_float(a, b)\n tolerance = Math::TOLERANCE\n a = a.to_f\n b = b.to_f\n if a.finite? and b.finite?\n (a-b).abs < tolerance\n else\n true\n end\nend",
"def check_float(param, default, options = {})\n min = (options[:min] ? param.to_f >= options[:min] : true)\n max = (options[:max] ? param.to_f <= options[:max] : true)\n\n if (param && param.strip =~ /^-?[0-9]+(\\.[0-9]+)?$/ && min && max)\n param.to_f\n else\n default\n end\n end",
"def float2?(input)\n /\\d/.match(input) && /^-?\\d*\\.?\\d*$/.match(input)\nend",
"def are_floats?(x,y)\n return x.is_a?(Float) && y.is_a?(Float)\n end",
"def numeric?(object)\n true if Float(object) rescue false\nend",
"def is_numeric?(val)\n Float val rescue false\n end",
"def float?(string)\n b = Float(string.tr(',', '.'))\n return b\nrescue ArgumentError\n return false\nend",
"def expect_integer_or_float(value, field, subfield)\n return true if value.blank?\n return true if value.is_a?(Integer) || value.is_a?(Float)\n errors.add(field, \"#{subfield} must be an integer or float if present\")\n false\n end",
"def is_f?\n !!(self =~ /^[-+]?[0-9,]+\\.[0-9]+$/)\n end",
"def numeric?; float?; end",
"def float?(str)\n true if Float(str) rescue false\n end",
"def check_real(field_info, field)\n if should_be_float?(field_info, field) && !float?(field)\n add_float_message_to_errors(field)\n end\n end",
"def float?(num)\n /\\d/.match(num) && /^-?\\d*\\.?\\d*$/.match(num) ? true : false\nend",
"def value_is_float?(string)\n return false if string.scan(/\\./).length != 1\n sides = string.split('.')\n return sides[0].numeric? && sides[1].numeric? && sides[1].to_i >= 0\n end",
"def operand?(str)\n\t\ttrue if Float(str) rescue false\n end",
"def float?(word)\n (word.to_f.to_s != word) && word\n end",
"def numeric?\n !!Float(self) rescue false\n end",
"def numeric?(num)\n !!Float(num) rescue false\nend",
"def is_number(num)\n true if Float(num) rescue false\nend",
"def numeric(input)\n return Float(input) != nil rescue false\n end",
"def like_f?\n return false unless self.to_f?\n\n num = self.without_leading_zeros\n (num.to_i != num.to_f) || num.include?(\".\")\n end",
"def is_digit?(input)\n !!Float(input) rescue false\nend",
"def Float(p0) end",
"def validate_float(inFloat) \n\t returnValue = []\n\t if nil == inFloat\n\t\t returnValue << \"cannot be null \"\n\t else\n\t\t begin \n\t\t\t Float(inFloat)\n\t\t\t returnValue = nil \n\t\t rescue Exception => err \n\t\t\t returnValue = \" #{err.message }\" \n\t\t end \n\t end\n\t returnValue\n end",
"def to_Float\n begin\n fl = Float stripn\n return fl\n rescue ArgumentError\n return false\n end\n end",
"def numeric?(input)\n !Float(input).nil?\n rescue\n false\n end",
"def ==(f)\n self.toFloat() == f.toFloat()\n end",
"def ==(f)\n self.toFloat() == f.toFloat()\n end",
"def is_number?(i)\n true if Float(i) rescue false\nend",
"def is_number?(i)\n true if Float(i) rescue false\nend",
"def test_positive_float\n\n @values_positive_float.each { |x|\n assert_in_delta(Math::log(x), ln(x))\n }\n\n end",
"def is_numeric?(value)\n !!Float(value) rescue false \n end",
"def numeric?(object)\n \t\ttrue if Float(object) rescue false\n\tend",
"def is_number?(input)\n true if Float(input) rescue false\n end",
"def is_numeric?\n begin Float(self)\n true \n end\n rescue\n false\n end",
"def test_Arithmetic_Sample05\n assert(3.0 < Float::MAX)\n assert(Float::MAX == Float::MAX)\n end",
"def test_NilClass_InstanceMethod_to_f\n\t\tassert_equal(0.0, nil.to_f)\n\tend",
"def is_number?(string)\n true if Float(string) rescue false #need to understand this\nend",
"def test_negative_float\n\n @values_positive_float.each { |x|\n assert_in_delta(Math::log(x), ln(x))\n }\n\n end",
"def is_number(string)\r\n\ttrue if Float(string) rescue false\r\nend",
"def is_number? string\n true if Float(string) rescue false\nend",
"def float?(num)\n num.to_f.to_s == num # converts num to interger and back to string and then compares this with num.\n\n #num.match(/\\d/) # this asks is input num has any letters in it.\nend",
"def float?(num)\n num.to_f.to_s == num # converts num to interger and back to string and then compares this with num.\n\n #num.match(/\\d/) # this asks is input num has any letters in it.\nend",
"def is_num(num)\n #First convert num to float or integer . If it is not a number, result will be 0.0. Convert that back in to string to confirm that it matches\n num.to_f.to_s == num || num.to_i.to_s == num\nend",
"def number?(input)\n #edge case, doesn't deal with 1. or 1.30 it either adds a zero or takes one off\n input.to_i.to_s == input || input.to_f.to_s == input\nend",
"def float(limit = nil)\n Validation.new { |d| d.is_a?(Float) && in_range?(d, limit) }\n end",
"def check_number_operand(operator, operand)\n unless operand.is_a?(Float)\n raise LoxRuntimeError.new(operator, \"Operand must be a number.\")\n end\n end",
"def fahrenheit? = unit == 'fahrenheit'",
"def test_float_literal\n check(C::FloatLiteral, <<-EOS)\n |1.0\n EOS\n end",
"def numeric?(object)\n true if Float(object) rescue false\n end",
"def number?(num)\n integer?(num) || float?(num)\nend",
"def valid_num?(input)\n integer?(input) || float?(input)\nend",
"def test_should_multiply_by_a_Fixnum_or_Float\n currency1 = Currency.new(\"USD\", 4.0)\n\n assert_equal Currency.new(\"USD\", 12.0), currency1 * 3\n end",
"def is_num_float(num_string)\n !(num_string !~ /^\\s*[+-]?((\\d+_?)*\\d+(\\.(\\d+_?)*\\d+)?|\\.(\\d+_?)*\\d+)(\\s*|([eE][+-]?(\\d+_?)*\\d+)\\s*)$/)\nend",
"def valid_float(input)\n while true\n if input =~ /^(\\d)*(.)?(\\d)+$/ && input.to_f > 0\n return input.to_f\n else\n puts \"Try again! Only use numbers\"\n input = gets.chomp\n end\n end\nend",
"def is_number?(variable)\n true if Float(variable) rescue false\n end",
"def check_type (num)\n # convert to float if validated number contains a decimal\n if num =~ /\\./\n return num = Float(num)\n else\n return num = Integer(num)\n end\nend",
"def is_number? token\n Float(token) && true rescue false\n end",
"def valid_number?(num)\n integer?(num) || float?(num)\nend",
"def is_number(str)\n true if Float(str)\nrescue StandardError\n false\nend",
"def on_float(token)\n log \"FLOAT: '#{token}'\"\n super(token)\n end",
"def test_it_can_find_average_invoices_per_merchant\n # assert_equal 10.49, @sa_real.average_invoices_per_merchant\n assert_equal 1.5, @sa.average_invoices_per_merchant\n assert_instance_of Float, @sa.average_invoices_per_merchant\n end",
"def parse(v)\n ((float = Float(v)) && (float % 1.0 == 0) ? float.to_i : float) rescue v\nend",
"def type_float!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 35 )\n\n\n\n type = TYPE_FLOAT\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 211:13: 'float'\n match( \"float\" )\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__, 35 )\n\n\n end",
"def number?\n\t\ttrue if Float(string) rescue false\n\tend",
"def post_process_float( val )\n\t\t\treturn Float( val.to_s )\n\t\tend",
"def represents_f?\n f_value = self.to_f\n # is this not equal to zero and also not actually an integer?\n if (f_value != 0) && (f_value.to_s == self)\n true\n else\n false\n end\n end"
] | [
"0.7803217",
"0.7672317",
"0.74978817",
"0.7496122",
"0.7493937",
"0.74459857",
"0.7402145",
"0.73782814",
"0.7361746",
"0.7350024",
"0.73318166",
"0.73252285",
"0.7324091",
"0.73114324",
"0.7230167",
"0.7213706",
"0.71565896",
"0.7153273",
"0.7125753",
"0.7122772",
"0.7102084",
"0.7101858",
"0.7073401",
"0.70391124",
"0.6997281",
"0.6997281",
"0.69968235",
"0.6992705",
"0.6991707",
"0.6973408",
"0.69711244",
"0.6967331",
"0.69479066",
"0.69479066",
"0.69461256",
"0.69441634",
"0.6930713",
"0.6925014",
"0.6914977",
"0.6891931",
"0.68857515",
"0.6876958",
"0.68732363",
"0.687132",
"0.68697965",
"0.6867234",
"0.6837755",
"0.6823885",
"0.68115544",
"0.6793964",
"0.6783984",
"0.6765371",
"0.6763664",
"0.674799",
"0.673877",
"0.67381185",
"0.67197406",
"0.6713326",
"0.6689958",
"0.6670949",
"0.6670949",
"0.6620267",
"0.6620267",
"0.6617476",
"0.66172785",
"0.6586554",
"0.6584439",
"0.6520958",
"0.6506805",
"0.6458284",
"0.64548784",
"0.6442703",
"0.6441408",
"0.6438931",
"0.64261806",
"0.64261806",
"0.6424863",
"0.64111197",
"0.63963443",
"0.6357991",
"0.63537216",
"0.6341451",
"0.6336768",
"0.6336456",
"0.6332399",
"0.6306954",
"0.630682",
"0.6305167",
"0.6286552",
"0.6275481",
"0.62691194",
"0.6266514",
"0.6252177",
"0.6242558",
"0.62353295",
"0.62350535",
"0.62283736",
"0.6200291",
"0.61869234",
"0.61748534"
] | 0.6670952 | 59 |
This is test when argument is a int | def test_print_start_int
assert_output("Rubyist #1 starting in Enumerable Canyon.\n") { @p.print_start(1) } # pass
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_one_ints\n args = Arguments.new\n assert_equal false, args.check_args([1])\n end",
"def is_valid? argument\n argument.to_s.to_i == argument\nend",
"def test_check_num_args_valid2\n args = CheckNumArgs.new\n args.check_args([1,1,1])\n assert_kind_of Integer, 1\n end",
"def require_integer(value)\n if value.is_a?(Integer) != true\n log_error_and_raise(\"expected integer value, got #{value.class}, #{value.inspect}\")\n end\n end",
"def integer?(input)\n Integer(input) rescue false\nend",
"def integer?() end",
"def integer?(input)\n input.to_i.to_s == input\nend",
"def integer?(input)\n input.to_i.to_s == input\nend",
"def integer?(input)\n input.to_i.to_s == input\nend",
"def is_integer?(input)\n input.to_i.to_s == input\nend",
"def is_int(value)\n true if Integer(value) rescue false\n end",
"def integer?(input)\n # could also do input.to_i.to_s == input but something with a\n # leading 0 (\"00\", \"01\", etc) will return false\n Integer(input)\nrescue ArgumentError\n false\nend",
"def test_int_check_pass\n assert_equal int_check([]), true # EDGE CASE\n assert_equal int_check(['1']), true # pass\n assert_equal int_check(['1', '1']), true # pass\n assert_equal int_check(['1', '1', '1']), true # pass\n end",
"def test_two_ints\n args = Arguments.new\n assert_equal false, args.check_args([1, 2])\n end",
"def test_min_int\n assert_equal(1, min_int(1,2))\n assert_equal(1, min_int(2,1))\n\n assert_raise(RT) { min_int('str', true) }\n end",
"def integer?(num)\n num.to_i.to_s == num\nend",
"def expect_integer name, value\n expect_type name,\n value,\n \"integer\",\n Integer\n end",
"def verify(x)\n\ty = 1\n\twhile y == 1\n\t\tif x.is_a?(Integer) && x > 0 && x < 10 #need to fix this. Still able to take non integers like 1.5\n\t\t\treturn x\n\t\t\ty-=1\n\t\telse\n\t\t\tputs \"Try again - number must be 1 through 10 and an integer\"\n\t\t\tx = gets.chomp.to_i\n\t\tend\n\tend\nend",
"def integer?(num)\n num.to_i > 0 && num.to_i.to_s == num\nend",
"def integer?(value)\n value.is_a?(Integer)\n end",
"def test_positive_int\n cfg = ReqArgCfg.new(:id).as(:positive_int)\n assert_raises ArgumentError do\n ReqArg.new('0', cfg)\n end\n end",
"def integer?(num)\n num.to_i().to_s()==num\nend",
"def integer?(command)\n command == command.to_i.to_s\nend",
"def res_ok?(x)\n x.to_i == x\nend",
"def is_integer?\n self =~ /\\A-?(?:0|[1-9][0-9]*)\\z/\n end",
"def check(number)\n \n end",
"def valid_int?(num)\n num =~ /^\\d+$/\nend",
"def validate_argument(arg)\n raise ArgumentError, \"Argument #{arg} is not Fixnum\" unless arg.is_a? Fixnum\n raise ArgumentError, \"Argument #{arg} is negative\" if arg < 0\n end",
"def silly_check(argument)\n\tif argument.to_i < 5\n\t\tputs \"the number is less than 5\"\n\telse\n\t\tputs \"the number is greater than or equal to 5\"\n\tend\t\nend",
"def check_nums(num, surname)\n if (num.class == Integer && surname[0] == 'P')\n puts \"it's class is integer, so it\\'s number\"\n else puts \"argument num [val:#{num}]is not a num!! it\\'s class object is#{num.class}\"\n end\nend",
"def test_int_check_fail\n assert_equal int_check(['k', 'k', 'k']), false # pass\n assert_equal int_check(['a', 's', 'd', 'f']), false # pass\n end",
"def match_integer( val )\n\t\treturn Integer( val ) rescue nil\n\tend",
"def integer?(obj)\n obj = obj.to_s unless obj.is_a? String\n /^\\d+$/.match obj\nend",
"def check_integer\n if @position == 0 \n return false\n else return true\n end\n end",
"def is_integer?\n self.to_i.to_s == self\n end",
"def isint\n int? ? Q::ONE : Q::ZERO\n end",
"def is_int(answer)\n int_answer = answer.to_i\n if int_answer == 0\n int_answer = nil\n end\n [int_answer, \"#{answer} must be a valid integer.\"]\nend",
"def is_int\r\n\t\tself.to_i.to_s != self.to_s\r\n\tend",
"def isNumber _args\n \"isNumber _args;\" \n end",
"def integer?(token)\n token.to_i.to_s == token\n end",
"def integer?(num)\n num.to_i.to_s == num # converts num to interger and back to string and then compares this with num.\n\n #num.match(/\\d/) # this asks is input num has any letters in it.\nend",
"def integer?(num)\n num.to_i.to_s == num # converts num to interger and back to string and then compares this with num.\n\n #num.match(/\\d/) # this asks is input num has any letters in it.\nend",
"def integer?(object)\n (object.to_s.to_i == object) || (object.to_i.to_s == object)\nend",
"def is_int? str\n Integer(str) rescue return false\n return true\nend",
"def test_check_num_args_invalid_zero\n args = CheckNumArgs.new\n assert_equal false, args.check_args([0,0,0])\n end",
"def test_three_ints\n args = Arguments.new\n assert_equal true, args.check_args([1, 2, 3])\n end",
"def check_position_int(input)\n step = input[:step]\n position = step[:position].to_i\n\n if (1..9).include?(position)\n Success(input)\n else\n Failure('Position should be in interval 1..9')\n end\n end",
"def integer?(string)\n b = Integer(string)\n return b\nrescue ArgumentError\n return false\nend",
"def test_arg_check_turns_negative\n def exit(x); 1; end\n ret = arg_check_turns '-1'\n assert_equal ret, -4\n end",
"def test_check_num_args_invalid_negative\n args = CheckNumArgs.new\n assert_equal false, args.check_args([0,-1,-1])\n end",
"def test_max_int\n assert_equal(2, max_int(1,2))\n assert_equal(2, max_int(2,1))\n\n assert_raise(RT) { max_int('str', true) }\n end",
"def test_check_num_args_valid\n args = CheckNumArgs.new\n assert_equal true, args.check_args([1,1,1])\n end",
"def test_check_num_args_invalid2\n args = CheckNumArgs.new\n assert_equal false, args.check_args([1])\n end",
"def check_integer(param, default, options = {})\n min = (options[:min] ? param.to_i >= options[:min] : true)\n max = (options[:max] ? param.to_i <= options[:max] : true)\n\n if (param && param.strip =~ /^-?[0-9]+$/ && min && max)\n param.to_i\n else\n default\n end\n end",
"def valid_integer?(string)\r\n string.to_i.to_s == string\r\nend",
"def validate_integer(input)\n input.to_s.to_i = input\nend",
"def is_integer(string)\n string.to_i.to_s == string\nend",
"def is_integer?(input)\n return input.to_s.ord >= 48 and input.to_s.ord <= 57\nend",
"def test_arg_check_turns_valid\n ret = arg_check_turns '1'\n assert_equal ret, 0\n end",
"def test_is_number_true\n #Arrange\n input = '2'\n #Act\n result = @roman.is_number?(input)\n #Assert\n assert_equal(true, result)\n end",
"def integer?(num)\n /^-?\\d*$/.match(num) ? true : false\nend",
"def check_id_or_raise(id)\n id_number = Integer(id, 10)\n raise \"'id' parameter with value '#{id}' should be a positive integer\" if id_number < 0\n end",
"def is_value?(value)\n\t\tvalue.to_i < 10\n\tend",
"def validate_integer_type(field)\n if field.is_a?(Integer)\n return true\n else\n return false\n end\n end",
"def string_is_integer?(n)\n n == n.to_i.to_s\nend",
"def valid_integer?(string)\n string.to_i.to_s == string\nend",
"def valid_integer?(string)\n string.to_i.to_s == string\nend",
"def check_args(args)\n begin\n results = [Integer(args[0]), Integer(args[1])] \n rescue ArgumentError, TypeError\n puts 'Invalid input.' \n end\n args.count == 2 && results[1] >= 1\nrescue StandardError\n false\nend",
"def is_valid? num\n num.to_i.to_s == num\nend",
"def test_arg_check_turns_decimal\n def exit(x); 1; end\n ret = arg_check_turns '1.6'\n assert_equal ret, -4\n end",
"def get_an_int(arg, opts={})\n ret_value = get_int_noerr(arg)\n if !ret_value\n if opts[:msg_on_error]\n errmsg(opts[:msg_on_error])\n else\n errmsg(\"Expecting an integer, got: #{arg}.\")\n end\n return nil\n end\n if opts[:min_value] and ret_value < opts[:min_value]\n errmsg(\"Expecting integer value to be at least %d; got %d.\" %\n [opts[:min_value], ret_value])\n return nil\n elsif opts[:max_value] and ret_value > opts[:max_value]\n errmsg(\"Expecting integer value to be at most %d; got %d.\" %\n [opts[:max_value], ret_value])\n return nil\n end\n return ret_value\n end",
"def validnum?(num)\n num == num.to_i.to_s\nend",
"def square(param)\n\n #\n # Quit if not an int.\n #\n if not param.is_a? Integer\n puts \"‘#{param}’ is not an integer. Bailing out...\"\n return false\n end\n\n #\n # Square and print it.\n #\n puts \"#{param} squared is #{param ** 2}.\"\n\nend",
"def test_check_seed_valid_int_negative\n test_args = [-1, 2, 3]\n args = Args.new test_args\n assert_equal(-1, args.check_seed(test_args[0]))\n end",
"def is_number(input)\n input.to_s == input.to_i.to_s\nend",
"def test_positive\r\n args = Args.new\r\n assert_equal false, args.check_args(6)\r\n end",
"def validate_num(number)\n number.to_i.to_s == number && number.to_i > 0\nend",
"def integer(param_name, **args)\n validation_builder(:to_i, param_name, **args)\n parameters_to_filter << param_name if args[:submit] == false\n end",
"def valid?(num)\n num.to_i.to_s == num\nend",
"def good_guess?(int)\n\tunless int==42\n\t\tfalse\n\telse true\n\tend\nend",
"def safenum?\n match?(/^[0-9][0-9]$/) && to_i.positive?\n end",
"def get_an_int(arg, opts={})\n ret_value = get_int_noerr(arg)\n if !ret_value\n if opts[:msg_on_error]\n errmsg(opts[:msg_on_error])\n else\n errmsg(\"Expecting an integer, got: #{arg}.\")\n end\n return nil\n end\n if opts[:min_value] and ret_value < opts[:min_value]\n errmsg(\"Expecting integer value to be at least %d; got %d.\" %\n [opts[:min_value], ret_value])\n return nil\n elsif opts[:max_value] and ret_value > opts[:max_value]\n errmsg(\"Expecting integer value to be at most %d; got %d.\" %\n [opts[:max_value], ret_value])\n return nil\n end\n return ret_value\n end",
"def valid_num?(number)\n number == number.to_i.to_s\nend",
"def good_guess?(int)\r\n\treturn int == 42\r\nend",
"def integer?\n self.to_i.to_s == self\n end",
"def validate_non_negative_integer(source,value)\n if not value.kind_of?(Integer) or value < 0\n raise ArgumentError, \"#{source} must be a non-negative integer\"\n end\n value\n end",
"def multiply(num1, num2)\n if num1.to_s.to_i != num1\n puts \"Argument must be an integer, please try again.\"\n return\n end\n num1 * num2\nend",
"def funcion_que_recibe_un_numero numero\n if numero.is_a? Numeric\n puts 'es un numero!'\n else\n # Esta linea genera una excepción de la clase ArgumentError con el contenido 'NO ES UN NUMERO!'\n raise ArgumentError, 'NO ES UN NÚMERO!'\n end\nend",
"def test_positive\n args = Arguments.new\n assert_equal false, args.check_args(5)\n end",
"def is_even int\n if int.class != Integer\n p 'Please enter a whole number'\n elsif int % 2 == 0\n p \"#{int} is even.\"\n else\n p \"#{int} is odd.\"\n end\nend",
"def valid_number?(num)\n num.to_i() != 0 \n # Why not equal to 0? Remember that if a user inputs a string of characters, like \"hi\", to_i method will output 0 \nend",
"def test_palindrome_parameter_0\n err = assert_raises InvalidIntegerError do\n Palindrome.new(0)\n end\n assert_match 'The argument is not an integer greater than 1', err.message\n end",
"def valid_number?(input)\n input.to_i.to_s == input\nend",
"def is_integer?(obj)\n\t\tif obj\n\t\t\treturn obj.to_s == obj.to_i.to_s\n\t\tend\n\t\treturn false\n\tend",
"def number? (number)\r\n \r\n if number.to_i == 0\r\n if number == \"0\"\r\n # puts \"number 0\"\r\n return number.to_i\r\n else\r\n \r\n return false\r\n end\r\n else\r\n # puts \"number #{number}\"\r\n return number.to_i\r\n end\r\n \r\nend",
"def integer?(range: (1..))\n proc do |o|\n o.is_a? String and o.is_i? and range.include?(o.to_i)\n end\n end",
"def valid_integer?(number)\n (number.to_i.abs.to_s == number) && (number.to_i != 0)\nend",
"def not_int?(dig)\n if dig.to_i == 0 && dig != \"0\"\n puts \"Invalid Number, enter again\" \n true\n else\n false \n end #end of if \n end",
"def test_check_num_args_invalid3\n args = CheckNumArgs.new\n assert_equal false, args.check_args([1, 2])\n end",
"def good_guess?(int)\n\tif int == 42\n\t\tp true\n\telse \n\t\tp false \n\tend\nend",
"def test(n)\r\n unless n >= 5\r\n raise ArgumentError, \"Zbyt maly argument: #{n} < 5\"\r\n else\r\n puts \"Ok!\"\r\n end\r\nend"
] | [
"0.71655023",
"0.7113545",
"0.69703054",
"0.69493824",
"0.69103307",
"0.6864587",
"0.68623227",
"0.68623227",
"0.68613374",
"0.6861294",
"0.68394995",
"0.68392366",
"0.6831147",
"0.6789303",
"0.6767887",
"0.67573863",
"0.6743626",
"0.67280775",
"0.67021215",
"0.6670196",
"0.6632297",
"0.66185576",
"0.6608124",
"0.66035473",
"0.6601165",
"0.65605277",
"0.65520316",
"0.6550151",
"0.6540833",
"0.6534139",
"0.6500825",
"0.64935243",
"0.6482755",
"0.64597905",
"0.64426965",
"0.64380306",
"0.643206",
"0.6430968",
"0.6392917",
"0.6389716",
"0.63521975",
"0.63521975",
"0.63520455",
"0.63347024",
"0.633017",
"0.63254344",
"0.63192135",
"0.6314455",
"0.6279848",
"0.62787735",
"0.6277636",
"0.6272936",
"0.6264713",
"0.62575215",
"0.6255058",
"0.6254936",
"0.623644",
"0.62364006",
"0.6231271",
"0.6221672",
"0.62187606",
"0.6209435",
"0.62072253",
"0.6202681",
"0.618094",
"0.6165539",
"0.6165539",
"0.6158146",
"0.6157001",
"0.61552566",
"0.6150199",
"0.61500114",
"0.6137733",
"0.6133987",
"0.6130766",
"0.61261654",
"0.6121859",
"0.6116993",
"0.61148226",
"0.6110383",
"0.61054116",
"0.6104282",
"0.61030084",
"0.609849",
"0.6093396",
"0.6091269",
"0.60864174",
"0.6080446",
"0.6075068",
"0.60677797",
"0.60558486",
"0.60480773",
"0.6044287",
"0.60432893",
"0.60432315",
"0.603157",
"0.601202",
"0.6008935",
"0.60068434",
"0.60027087",
"0.6001116"
] | 0.0 | -1 |
UNIT TESTS FOR print_ruby_found_in_this_location(x, y) Equivalence classes: real = 0 > only print out fake fake = 0 > only print out real both not 0 > print results both 0 > print nothing found both nil > nil (EDGE CASE) This test when only found fake ruby | def test_print_ruby_found_fake_only
mock_location = Minitest::Mock.new('location')
def mock_location.name; 'a'; end
def plural?(x); 'ruby'; end
assert_output(" Found 1 fake ruby in a.\n") {
@p.print_ruby_found_in_this_location(mock_location, [0, 1])}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_print_ruby_found_nothing\n mock_location = Minitest::Mock.new('location')\n def mock_location.name; 'a'; end\n assert_output(\" Found no rubies or fake rubies in a.\\n\"){\n @p.print_ruby_found_in_this_location(mock_location, [0, 0])}\n end",
"def test_print_ruby_found_both\n mock_location = Minitest::Mock.new('location')\n def mock_location.name; 'a'; end\n def plural?(x); 'ruby'; end\n assert_output(\" Found 1 ruby and 1 fake ruby in a.\\n\"){\n @p.print_ruby_found_in_this_location(mock_location, [1, 1])}\n end",
"def print_ruby_found_in_this_location(current_location, current_found)\n real = current_found[0]\n fake = current_found[1]\n if real.zero? && fake.zero?\n puts \" Found no rubies or fake rubies in #{current_location.name}.\"\n elsif fake.zero?\n puts \" Found #{real} #{plural?(real)} in #{current_location.name}.\"\n elsif real.zero?\n puts \" Found #{fake} fake #{plural?(fake)} in #{current_location.name}.\"\n else\n puts \" Found #{real} #{plural?(real)} and #{fake} fake #{plural?(fake)} in #{current_location.name}.\"\n end\n end",
"def test_print_ruby_found_real_only\n mock_location = Minitest::Mock.new('location')\n def mock_location.name; 'a'; end\n def plural?(x); 'ruby'; end\n assert_output(\" Found 1 ruby in a.\\n\") {\n @p.print_ruby_found_in_this_location(mock_location, [1, 0])}\n end",
"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 test_print_out_found_nothing\n ruby_rush=RubyRush.new(1, 2, 3)\n ruby_rush.real_sp='rubies'\n ruby_rush.fake_sp='rubies'\n assert_output (\"\\tFound no #{ruby_rush.real_sp} or fake #{ruby_rush.fake_sp} in #{ruby_rush.city}.\\n\") {ruby_rush.print_out_found_nothing}\n end",
"def mining_message(real, fake, current_location)\n raise 'Not an integer' unless real.is_a? Integer\n raise 'Not an integer' unless fake.is_a? Integer\n raise 'Not an location' unless current_location.is_a? Location\n raise 'Negative integer' unless real >= 0 && fake >= 0\n\n # Message display [real, fake] is [0, 0]\n if real.zero? && fake.zero? \n puts \"\\tFound no rubies or fake rubies in #{current_location.name_reader}.\"\n # Message display [real, fake] is [0, 1]\n elsif real.zero? && fake == 1\n puts \"\\tFound 1 fake ruby in #{current_location.name_reader}.\"\n # Message display [real, fake] is [1, 0]\n elsif real == 1 && fake.zero?\n puts \"\\tFound 1 ruby in #{current_location.name_reader}.\"\n # Message display [real, fake] is [1, 1]\n elsif real == 1 && fake == 1\n puts \"\\tFound 1 ruby and 1 fake ruby in #{current_location.name_reader}.\"\n # Message display [real, fake] is [0, n](n is a integer bigger than one)\n elsif real.zero? && fake > 1\n puts \"\\tFound #{fake} fake rubies in #{current_location.name_reader}.\"\n # Message display [real, fake] is [1, n](n is a integer bigger than one)\n elsif real == 1 && fake > 1\n puts \"\\tFound 1 ruby and #{fake} fake rubies in #{current_location.name_reader}.\"\n # Message display [real, fake] is [n, 0] (n is a integer bigger than one)\n elsif real > 1 && fake.zero?\n puts \"\\tFound #{real} rubies in #{current_location.name_reader}.\"\n # Message display [real, fake] is [n, 1] (n is a integer bigger than one)\n elsif real > 1 && fake == 1\n puts \"\\tFound #{real} rubies and 1 fake ruby in #{current_location.name_reader}.\"\n # Message display [real, fake] is [n, m](n and m are integers bigger than one)\n elsif real > 0 && fake > 0\n puts \"\\tFound #{real} rubies and #{fake} fake rubies in #{current_location.name_reader}.\"\n end\n end",
"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_day_output_several_real\r\n location = Minitest::Mock.new(\"test_location_arr\")\r\n def location.get_id(index); \"Hash Crossing\"; end\r\n assert_output(\"\\tFound 2 rubies in Hash Crossing.\\n\") { @g.day_output([2, 0], 3, location) }\r\n end",
"def test_nil_town_search_found_something\n ruby_rush=RubyRush.new(1, 2, 3)\n doubled_prng = Minitest::Mock.new('doubled prng')\n def doubled_prng.rand(seed); 3; end\n ruby_rush.prng=doubled_prng\n ruby_rush.cur_fake_rb=3\n ruby_rush.fake_sp='rubies'\n assert_output(\"\\tFound #{ruby_rush.cur_fake_rb} fake #{ruby_rush.fake_sp} in #{ruby_rush.city}.\\n\" ) {ruby_rush.nil_town_search}\n end",
"def test_format_print_two_fake\n simulator = Sim.new(nil, nil, nil)\n assert_equal simulator.ruby_format_print([0, 2]), \"\\tFound 2 fake rubies in Enumerable Canyon.\\n\"\n end",
"def test_print_location_starting\n\t\ttest_main = Main.new(3, 1, 6)\n\t\tmocked_Graph = MiniTest::Mock.new(\"mocked graph\")\n\t\tmocked_Graph.expect(:get_curr_loc, Node.new(\"Enumerable Canyon\", 4, 5, 10))\n\t\ttest_main.print_location(mocked_Graph, 0)\n\t\tassert mocked_Graph\n\tend",
"def print_rubies_found(rubies_found, fake_rubies_found, town)\n raise 'Ruby and/or Fake Ruby counts can not be < 0!' if rubies_found < 0 || fake_rubies_found < 0\n\n name = town.name\n if rubies_found.zero? && fake_rubies_found.zero?\n puts \"\\tFound no rubies or fake rubies in #{name}.\"\n elsif rubies_found == 1 && fake_rubies_found.zero?\n puts \"\\tFound 1 ruby in #{name}.\"\n elsif rubies_found.zero? && fake_rubies_found == 1\n puts \"\\tFound 1 fake ruby in #{name}.\"\n elsif rubies_found == 1 && fake_rubies_found == 1\n puts \"\\tFound 1 ruby and 1 fake ruby in #{name}.\"\n elsif rubies_found > 1 && fake_rubies_found.zero?\n puts \"\\tFound #{rubies_found} rubies in #{name}.\"\n elsif rubies_found.zero? && fake_rubies_found > 1\n puts \"\\tFound #{fake_rubies_found} fake rubies in #{name}.\"\n else\n puts \"\\tFound #{rubies_found} rubies and\n #{fake_rubies_found} fake rubies in #{name}.\"\n end\n end",
"def test_day_output_one\r\n location = Minitest::Mock.new(\"test_location_arr\")\r\n def location.get_id(index); \"Nil Town\"; end\r\n assert_output(\"\\tFound 1 ruby and 1 fake ruby in Nil Town.\\n\") { @g.day_output([1, 1], 3, location) }\r\n end",
"def test_rubyist_display_zero\r\n location = Minitest::Mock.new(\"test_location_arr\")\r\n def location.get_id(index); \"Hash Crossing\"; end\r\n assert_raises('rubyist_num cannot be less than or equal to 0!') { @g.new_rubyist_display(0, location) }\r\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 test_print_some_both_types\n\t\tp = Print.new\n\t\tassert_output(\"\\tFound 1 ruby and 2 fake rubies in Town.\\n\") {p.print_day([1,2],'Town')}\n\tend",
"def test_print_results\n\t\ttest_main = Main.new(3, 1, 6)\n\t\tmocked_Graph = MiniTest::Mock.new(\"mocked graph\")\n\t\tmocked_Graph.expect(:get_curr_loc, Node.new(\"Enumerable Canyon\", 4, 5, 10))\n\t\ttest_main.print_results\n\t\tassert mocked_Graph\n\tend",
"def test_showResults\n\t\td = Driver::new(\"Driver 1\",0)\n\t\tassert_output (\"Driver 1 obtained 0 books!\\nDriver 1 obtained 0 dinosaur toys!\\nDriver 1 attended 1 class!\\n\") {d.showResults}\n\t\td.setLocation 0 #from hospital to cathedral\n\t\td.checkLocation\n\t\tassert_output (\"Driver 1 obtained 0 books!\\nDriver 1 obtained 0 dinosaur toys!\\nDriver 1 attended 2 classes!\\n\") {d.showResults}\n\t\td.setLocation 1 #from cathedral to museum\n\t\td.checkLocation\n\t\tassert_output (\"Driver 1 obtained 0 books!\\nDriver 1 obtained 1 dinosaur toy!\\nDriver 1 attended 2 classes!\\n\") {d.showResults}\n\t\td.setLocation 1 #from museum to hillman\n\t\td.checkLocation\n\t\tassert_output (\"Driver 1 obtained 1 book!\\nDriver 1 obtained 1 dinosaur toy!\\nDriver 1 attended 2 classes!\\n\") {d.showResults}\n\t\td.setLocation 0 #from hillman to downtown\n\t\td.checkLocation\n\t\tassert_output (\"Driver 1 obtained 1 book!\\nDriver 1 obtained 1 dinosaur toy!\\nDriver 1 attended 2 classes!\\n\") {d.showResults}\n\tend",
"def test_rubyist_display\r\n location = Minitest::Mock.new(\"test_location_arr\")\r\n def location.get_id(index); \"Hash Crossing\"; end\r\n assert_output(\"Rubyist #1 starting in Hash Crossing.\\n\") { @g.new_rubyist_display(1, location) }\r\n end",
"def test_print_fake\r\n test = Prospect.new(0)\r\n test.totalfakes = 1\r\n assert_output(/\\tFound 1 fake ruby in Enumerable Canyon. /) { test.print_all_rubies(test.totalruby, test.totalfakes)}\r\n end",
"def test_hash_crossing_search_found_something\n ruby_rush=RubyRush.new(1, 2, 3)\n doubled_prng = Minitest::Mock.new('doubled prng')\n def doubled_prng.rand(seed); 2; end\n ruby_rush.prng=doubled_prng\n ruby_rush.cur_real_rb=2\n ruby_rush.cur_fake_rb=2\n ruby_rush.real_sp='rubies'\n ruby_rush.fake_sp='rubies'\n assert_output(\"\\tFound #{ruby_rush.cur_real_rb} #{ruby_rush.real_sp} and #{ruby_rush.cur_fake_rb} fake #{ruby_rush.fake_sp} in #{ruby_rush.city}.\\n\" ) {ruby_rush.hash_crossing_search}\n end",
"def test_print_mine_results_4\n map = create_towns\n p1 = Prospector::new map[0]\n ret = [0, 0]\n test_i = p1.print_mine_results ret\n assert_equal test_i, 4\n end",
"def printTestExpectedOutput( fp )\n\t\tfp.printf( \"%s\\t\", @name ) if @name\n\t\tmissing = countMissing()\n\t\tfp.printf( \"%s:%s:%d:%d\\t\",\n\t\t\t\tmissing < @vector.length ? \"I\" : \"?\",\n\t\t\t\tdegenerate? ? \"!\" : \"-\", \n\t\t\t\t@cats, \n\t\t\t\tmissing )\n\t\tfp.puts( @vector.collect { |x| x.nil? ? OUTPUT_NA_MARKER : x }.join(\"\\t\") )\n\tend",
"def printTestExpectedOutput( fp )\n\t\tfp.printf( \"%s\\t\", @name ) if @name\n\t\tmissing = countMissing()\n\t\tfp.printf( \"%s:%s:%d:%d\\t\",\n\t\t\t\tmissing < @vector.length ? \"I\" : \"?\",\n\t\t\t\tdegenerate? ? \"!\" : \"-\", \n\t\t\t\t@cats, \n\t\t\t\tmissing )\n\t\tfp.puts( @vector.collect { |x| x.nil? ? OUTPUT_NA_MARKER : x }.join(\"\\t\") )\n\tend",
"def test_print_out_found_long\n ruby_rush=RubyRush.new(1, 2, 3)\n ruby_rush.real_sp='ruby'\n ruby_rush.fake_sp='ruby'\n ruby_rush.cur_real_rb=1\n ruby_rush.cur_fake_rb=1\n assert_output(\"\\tFound #{ruby_rush.cur_real_rb} #{ruby_rush.real_sp} and #{ruby_rush.cur_fake_rb} fake #{ruby_rush.fake_sp} in #{ruby_rush.city}.\\n\") {ruby_rush.print_out_found_long}\n ruby_rush.real_sp='rubies'\n ruby_rush.fake_sp='ruby'\n ruby_rush.cur_real_rb=2\n ruby_rush.cur_fake_rb=1\n assert_output(\"\\tFound #{ruby_rush.cur_real_rb} #{ruby_rush.real_sp} and #{ruby_rush.cur_fake_rb} fake #{ruby_rush.fake_sp} in #{ruby_rush.city}.\\n\") {ruby_rush.print_out_found_long}\n ruby_rush.real_sp='rubies'\n ruby_rush.fake_sp='rubies'\n ruby_rush.cur_real_rb=2\n ruby_rush.cur_fake_rb=1\n assert_output(\"\\tFound #{ruby_rush.cur_real_rb} #{ruby_rush.real_sp} and #{ruby_rush.cur_fake_rb} fake #{ruby_rush.fake_sp} in #{ruby_rush.city}.\\n\") {ruby_rush.print_out_found_long}\n ruby_rush.real_sp='ruby'\n ruby_rush.fake_sp='rubies'\n ruby_rush.cur_real_rb=1\n ruby_rush.cur_fake_rb=2\n assert_output(\"\\tFound #{ruby_rush.cur_real_rb} #{ruby_rush.real_sp} and #{ruby_rush.cur_fake_rb} fake #{ruby_rush.fake_sp} in #{ruby_rush.city}.\\n\") {ruby_rush.print_out_found_long}\n end",
"def test_print_ruby_found_nil\n mock_location = Minitest::Mock.new('location')\n def mock_location.name; 'a'; end\n def plural?(x); 'ruby'; end\n assert_raises(StandardError){@p.print_ruby_found_in_this_location(mock_location, nil)}\n end",
"def test_day_output_several_fakes\r\n location = Minitest::Mock.new(\"test_location_arr\")\r\n def location.get_id(index); \"Duck Type Beach\"; end\r\n assert_output(\"\\tFound 2 fake rubies in Duck Type Beach.\\n\") { @g.day_output([0, 2], 3, location) }\r\n end",
"def test_print_one_type\n\t\tp = Print.new\n\t\tassert_output(\"\\tFound 1 ruby in Town.\\n\") {p.print_day([1,0],'Town')}\n\tend",
"def test_print_mine_results_2\n map = create_towns\n p1 = Prospector::new map[0]\n ret = [1, 0]\n test_i = p1.print_mine_results ret\n assert_equal test_i, 2\n end",
"def test_string_results_neither_zero\n mock_loc = Minitest::Mock.new(\"mock_loc\")\n\tdef mock_loc.name;'Sutter Creek';end\n p = Prospector.new(0, mock_loc, 0)\n\tp.silver_found = 3\n\tp.gold_found = 3\n\tp.s = 's'\n\tp.sg = 's'\n\tassert_equal 'Found 3 ounces of gold and 3 ounces of silver in Sutter Creek', p.string_findings\n end",
"def test_day_output_zero\r\n location = Minitest::Mock.new(\"test_location_arr\")\r\n def location.get_id(index); \"Enumerable Canyon\"; end\r\n assert_output(\"\\tFound no rubies or no fake rubies in Enumerable Canyon.\\n\") { @g.day_output([0, 0], 3, location) }\r\n end",
"def test_duck_type_beach_search_found_something\n ruby_rush=RubyRush.new(1, 2, 3)\n doubled_prng = Minitest::Mock.new('doubled prng')\n def doubled_prng.rand(seed); 2; end\n ruby_rush.prng=doubled_prng\n ruby_rush.cur_real_rb=2\n ruby_rush.cur_fake_rb=2\n ruby_rush.real_sp='rubies'\n ruby_rush.fake_sp='rubies'\n assert_output(\"\\tFound #{ruby_rush.cur_real_rb} #{ruby_rush.real_sp} and #{ruby_rush.cur_fake_rb} fake #{ruby_rush.fake_sp} in #{ruby_rush.city}.\\n\" ) {ruby_rush. duck_type_beach_search}\n end",
"def test_day_output_several_both\r\n location = Minitest::Mock.new(\"test_location_arr\")\r\n def location.get_id(index); \"Matzburg\"; end\r\n assert_output(\"\\tFound 2 rubies and 2 fake rubies in Matzburg.\\n\") { @g.day_output([2, 2], 3, location) }\r\n end",
"def test_see_results_valid_output\n mock_map = Minitest::Mock.new('Mock Map')\n mock_map_finder = Minitest::Mock.new('Mock Map Finder')\n joe = Prospector.new(mock_map, mock_map_finder)\n out_put = \"After 0 days, Rubyist 4 found:\\n 0 rubies.\\n 0 fake rubies.\\nGoing home empty-handed.\\n\"\n assert_output(out_put) { joe.see_results(4) }\n end",
"def test_print_location\n \t@gold_rush.initialize(2, 2)\n \tassert_equal \"Heading from Sutter Creek to Angels Camp, holding 1 ounce of gold and 0 ounces of silver.\", @gold_rush.print_location(@prospectors[0], 0)\n end",
"def test_day_output_one_fake\r\n location = Minitest::Mock.new(\"test_location_arr\")\r\n def location.get_id(index); \"Dynamic Palisades\"; end\r\n assert_output(\"\\tFound 1 fake ruby in Dynamic Palisades.\\n\") { @g.day_output([0, 1], 3, location) }\r\n end",
"def test_day_output_one_real\r\n location = Minitest::Mock.new(\"test_location_arr\")\r\n def location.get_id(index); \"Monkey Patch City\"; end\r\n assert_output(\"\\tFound 1 ruby in Monkey Patch City.\\n\") { @g.day_output([1, 0], 3, location) }\r\n end",
"def test_turn_putter_both\n pros = Prospector.new(0,0,0)\n assert pros.turn_putter(1,1).eql? \"\\tFound 1 ruby and 1 fake ruby in Enumerable Canyon\"\n end",
"def run_tests\n check_solution(1, [6, 29, 18, 2, 72, 19, 18, 10, 37], 18, 2)\n check_solution(2, [6, 29, 18, 2, 72, 19, 18, 10, 37], 9, -1)\nend",
"def test_print_mine_results_3\n map = create_towns\n p1 = Prospector::new map[0]\n ret = [0, 1]\n test_i = p1.print_mine_results ret\n assert_equal test_i, 3\n end",
"def report expected, actual\n if expected == actual\n puts \"Yes, found '#{actual}'\"\n else\n puts \"Failed, found '#{actual}' but was expecting '#{expected}'\"\n end\nend",
"def test_prospect_search_no_fakes\n \tlocation_stub = Minitest::Mock.new('Mock Location')\n pro = Prospector.new(1)\n def location_stub.loc\n \"Laboon Lake\"\n end\n def location_stub.max_rubies\n 1\n end\n def location_stub.max_fake_rubies\n 0\n end\n def location_stub.neighbor_list\n [\"Sean's Bowser Castle\", \"Kitty's Cozy Condo\"]\n end\n pro.change_curr_location(location_stub)\n pro.prospect_search(1)\n assert pro.total_fake_rubies == 0\n end",
"def printProbe\n puts \"Your origin was (#{@x},#{@y},#{@z})\"\n puts \"Traveled #{@traveled_distance}\"\n puts \"Visited #{@visited_stars}\"\n puts \"Explored #{@explored_planets}\"\n puts \"Remaining fuel #{@fuel}\"\n end",
"def test_doe_latin_hypercube_method_should_return_evenly_distributed_points_across_parameter_space_5_param_case\n @experiment_with_multiple_params.doe_info = [[\"latinHypercube\", [\"param-0\", \"param-1\", \"param-2\", \"param-3\", \"param-4\"]]]\n\n\n doe_method_result = @experiment_with_multiple_params.apply_doe_methods.first\n\n\n\n assert_equal \"latinHypercube\", doe_method_result[0]\n assert_equal [\"param-0\", \"param-1\", \"param-2\", \"param-3\", \"param-4\"], doe_method_result[1]\n assert_equal 6, doe_method_result[2].size\n\n level_counters = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]\n\n doe_method_result[2].each do |input_parameter_space_point|\n input_parameter_space_point.each_with_index do |value, index|\n level_counters[index][value / 20] += 1\n end\n end\n\n level_counters.each { |counter| assert_equal [1, 1, 1, 1, 1, 1], counter }\n end",
"def test_print_mine_results_1\n map = create_towns\n p1 = Prospector::new map[0]\n ret = [1, 1]\n test_i = p1.print_mine_results ret\n assert_equal test_i, 1\n end",
"def print_output(expected, actual)\n puts \"expect: \" + expected.robust\n puts \"actual: \" + actual.robust\nend",
"def test_dig_once\n mock_location = Minitest::Mock.new('location')\n mock_rng = Minitest::Mock.new('rng')\n def mock_location.name; 'a'; end\n def mock_location.random_total_ruby(mock_rng); [0, 0]; end\n assert_output(\" Found no rubies or fake rubies in a.\\n\"){@p.dig(mock_location, mock_rng)}\n end",
"def test_found_no_rubies\n\t\tp = Print.new\n\t\tassert_output(\"\\tFound no rubies or fake rubies in Town.\\n\") {p.print_day([0,0],'Town')}\n\tend",
"def results\n if @rubies_found > 1 && @fake_rubies_found > 1\n puts \"\\tFound #{@rubies_found} rubies and #{@fake_rubies_found} fake rubies in #{@current_city}\"\n elsif @rubies_found == 1 && @fake_rubies_found == 1\n puts \"\\tFound #{@rubies_found} ruby and #{@fake_rubies_found} fake ruby in #{@current_city}\"\n elsif @rubies_found > 1 && @fake_rubies_found == 1\n puts \"\\tFound #{@rubies_found} rubies and #{@fake_rubies_found} fake ruby in #{@current_city}\"\n elsif @rubies_found == 1 && @fake_rubies_found > 1\n puts \"\\tFound #{@rubies_found} ruby and #{@fake_rubies_found} fake rubies in #{@current_city}\"\n elsif @rubies_found > 1 && @fake_rubies_found.zero?\n puts \"\\tFound #{@rubies_found} rubies in #{@current_city}\"\n elsif @rubies_found == 1 && @fake_rubies_found.zero?\n puts \"\\tFound #{@rubies_found} ruby in #{@current_city}\"\n elsif @rubies_found.zero? && @fake_rubies_found > 1\n puts \"\\tFound #{@fake_rubies_found} fake rubies in #{@current_city}\"\n elsif @rubies_found.zero? && @fake_rubies_found == 1\n puts \"\\tFound #{@fake_rubies_found} fake ruby in #{@current_city}\"\n elsif @rubies_found.zero? && @fake_rubies_found.zero?\n puts \"\\tFound no rubies or fake rubies in #{@current_city}\"\n end\n end",
"def display_findings_for_day(rubies, fake_rubies, location)\n return nil if location < 0 || location > 7\n\n # Format singulars and plurals\n if fake_rubies.zero? && rubies.zero?\n puts \"\tFound no rubies or fake rubies in #{@map[location][0]}.\"\n elsif fake_rubies == 1 && rubies.zero?\n puts \"\tFound #{fake_rubies} fake ruby in #{@map[location][0]}.\"\n elsif fake_rubies.zero? && rubies == 1\n puts \"\tFound #{rubies} ruby in #{@map[location][0]}.\"\n elsif fake_rubies > 1 && rubies.zero?\n puts \"\tFound #{fake_rubies} fake rubies in #{@map[location][0]}.\"\n elsif fake_rubies.zero? && rubies > 1\n puts \"\tFound #{rubies} rubies in #{@map[location][0]}.\"\n elsif fake_rubies == 1 && rubies == 1\n puts \"\tFound #{rubies} ruby and #{fake_rubies} fake ruby in #{@map[location][0]}.\"\n elsif fake_rubies > 1 && rubies == 1\n puts \"\tFound #{rubies} ruby and #{fake_rubies} fake rubies in #{@map[location][0]}.\"\n elsif fake_rubies == 1 && rubies > 1\n puts \"\tFound #{rubies} rubies and #{fake_rubies} fake ruby in #{@map[location][0]}.\"\n elsif fake_rubies > 1 && rubies > 1\n puts \"\tFound #{rubies} rubies and #{fake_rubies} fake rubies in #{@map[location][0]}.\"\n end\n # Return 1 if successfully displayed\n 1\n end",
"def get_to target\n calculate if @results.nil?\n @results.each do |eq, result|\n puts \"*\" * 30 if result == target.to_i\n puts \"#{eq} = #{result}\"\n puts \"*\" * 30 if result == target.to_i\n end\n\n puts \"%d equations tested\" % @equations.length\n end",
"def prospect_search(total_turns)\n @days += 1\n rubies = rand(@curr_location.max_rubies + 1)\n fakes = rand(@curr_location.max_fake_rubies + 1)\n @total_rubies += rubies\n @total_fake_rubies += fakes\n # rubocop does not like the switch without [], this is one of my \"freebies\"\n case\n when rubies.zero? && fakes.zero?\n puts \"\\t\\tFound no rubies or fake rubies in #{@curr_location.loc}.\"\n prospect_move(total_turns)\n when rubies == 1 && fakes != 1\n puts \"\\t\\tFound #{rubies} ruby and #{fakes} fake rubies at #{@curr_location.loc}.\"\n when rubies != 1 && fakes == 1\n puts \"\\t\\tFound #{rubies} rubies and #{fakes} fake ruby at #{@curr_location.loc}.\"\n when rubies == 1 && fakes == 1\n puts \"\\t\\tFound #{rubies} ruby and #{fakes} fake ruby at #{@curr_location.loc}.\"\n else\n puts \"\\t\\tFound #{rubies} rubies and #{fakes} fake rubies at #{@curr_location.loc}.\"\n end\n end",
"def test_doe_latin_hypercube_method_should_return_evenly_distributed_points_across_parameter_space_2_param_case\n @experiment_with_multiple_params.doe_info = [[\"latinHypercube\", [\"param-0\", \"param-1\"]]]\n\n\n doe_method_result = @experiment_with_multiple_params.apply_doe_methods.first\n\n\n assert_equal \"latinHypercube\", doe_method_result[0]\n assert_equal [\"param-0\", \"param-1\"], doe_method_result[1]\n assert_equal 6, doe_method_result[2].size\n\n level_counters = [ [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0] ]\n\n doe_method_result[2].each do |input_parameter_space_point|\n input_parameter_space_point.each_with_index do |value, index|\n level_counters[index][value / 20] += 1\n end\n end\n\n level_counters.each{|counter| assert_equal [1, 1, 1, 1, 1, 1], counter}\n end",
"def test_driver_checkLocation_mid\n\t\td = Driver::new(\"Driver 1\",1)\n\t\td.checkLocation\n\t\t# assert_equal d.classes, 2\n\t\td.setLocation 1 #from cathedral go to museum\n\t\td.checkLocation\n\t\tassert_equal [2,1], [d.classes,d.dinotoys]\n\t\t#assert_equal d.dinotoys, 1\n\tend",
"def test_knight_moves(knight, initial, final, msg_condition)\n puts \"\\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\\n \"\n puts \"Testing knight_moves method...\"\n puts \"\\nCondition: #{msg_condition}\"\n puts \"\\nInitial knight location = [#{knight.cur_location[0]}, #{knight.cur_location[1]}]\"\n puts \"\\nInitial: [#{initial[0]}, #{initial[1]}], Final: [#{final[0]}, #{final[1]}]\\n \"\n knight.knight_moves(initial, final)\n puts \"\\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\\n \"\nend",
"def test_real_rubies_found\n\t\ttest_main = Main.new(3, 4, 6)\n\t\ttest_graph = Graph.new(10)\n\t\ttest_main.real_rubies_found(7)\n\t\ttest_main.real_rubies_found(7)\n\t\tassert test_main.num_real_rubies, 14\n\tend",
"def test_lhurgoyfs\n assert_search_results \"t:lhurgoyf\", \"Tarmogoyf\", \"Detritivore\"\n assert_search_results \"t:lhurgoyf pow=0\"\n assert_search_results \"t:lhurgoyf tou=0\"\n assert_search_results \"t:lhurgoyf tou=1\"\n assert_search_results \"t:lhurgoyf pow>=0\"\n assert_search_results \"t:lhurgoyf tou>=0\"\n assert_search_results \"t:lhurgoyf pow<tou\", \"Tarmogoyf\"\n assert_search_results \"t:lhurgoyf pow<=tou\", \"Tarmogoyf\", \"Detritivore\"\n assert_search_results \"t:lhurgoyf pow>=tou\", \"Detritivore\"\n assert_search_results \"t:lhurgoyf pow=tou\", \"Detritivore\"\n assert_search_results \"t:lhurgoyf pow>tou\"\n end",
"def test_rubyist_display_string\r\n location = Minitest::Mock.new(\"test_location_arr\")\r\n def location.get_id(index); \"Hash Crossing\"; end\r\n assert_raises('rubyist_num must be an intenger!') { @g.new_rubyist_display('a', location) }\r\n end",
"def test_format_print_one_real\n simulator = Sim.new(nil, nil, nil)\n assert_equal simulator.ruby_format_print([1, 0]), \"\\tFound 1 ruby in Enumerable Canyon.\\n\"\n end",
"def test test_cases, f\n test_cases.each do |s, l, e|\n a = send(f, s, l)\n print \"#{f} #{s}, #{l} = #{a} ... \"\n if a == e\n puts 'PASS'\n else\n puts 'FAIL'\n end\n end\nend",
"def test_return_fr\n map = create_towns\n p1 = Prospector::new map[0]\n nfr = p1.return_fr\n assert_equal nfr, 0\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 test_truthy_finds(tests, method, options = {})\n tests.each do |test|\n matches = Ramparts.send(method, test[:text], options)\n test[:matches].each_with_index do |match_string, index|\n if matches[index].nil? || matches[index][:value].casecmp(match_string) != 0\n got_result = matches[index].nil? ? 'NIL' : matches[index][:value]\n raise \"Expected: #{match_string}\\nGot: #{got_result}\\nBlock '#{test[:text]}'\\nResult: #{matches}\"\n end\n end\n end\nend",
"def test_prospect_search_no_rubies\n \tlocation_stub = Minitest::Mock.new('Mock Location')\n \tpro = Prospector.new(1)\n \tdef location_stub.loc\n \"Laboon Lake\"\n end\n def location_stub.max_rubies\n 0\n end\n def location_stub.max_fake_rubies\n 1\n end\n def location_stub.neighbor_list\n [\"Sean's Bowser Castle\", \"Kitty's Cozy Condo\"]\n end\n pro.change_curr_location(location_stub)\n pro.prospect_search(1)\n assert pro.total_rubies == 0\n end",
"def print_verification_of_position_info\r\n #Test to see if characters are correct\r\n puts \"characters from position matrix----------start\"\r\n @list_of_word_rows.each do |word_row|\r\n word_row.position_list.each do |position|\r\n print position.character\r\n end\r\n puts \"\"\r\n end\r\n puts \"words from position matrix----------end\"\r\n puts \"\"\r\n\r\n #Test to see if word starts and ends are correct\r\n puts \"start and end of words from position matrix----------start\"\r\n @list_of_word_rows.each do |word_row|\r\n word_row.position_list.each do |position|\r\n if position.start_of_word\r\n print \"^\"\r\n print position.character\r\n print position.word_number\r\n end\r\n #If the character is a single letter word, then the char is both the start and end of the word.\r\n #Don't reprint the character, which has already been printed\r\n if position.start_of_word && position.end_of_word\r\n print \"*\"\r\n #If the character is at the end of a word, print the character\r\n elsif position.end_of_word\r\n print position.character\r\n print position.word_number\r\n print \"*\"\r\n end\r\n if !position.start_of_word && !position.end_of_word\r\n print position.character\r\n if position.character != \" \"\r\n print position.word_number\r\n end\r\n end\r\n end\r\n puts \"\"\r\n end\r\n puts \"start and end of words from position matrix----------end\"\r\n\r\n #Test to see if word numbers are correct\r\n puts \"word numbers from position matrix----------start\"\r\n @list_of_word_rows.each do |word_row|\r\n word_row.position_list.each do |position|\r\n print position.word_number.to_s + \" \"\r\n end\r\n puts \"\"\r\n end\r\n puts \"word numbers from position matrix----------end\"\r\n\r\n\r\n #Test to see if line starts and ends are correct\r\n puts \"\"\r\n puts \"start and end of lines from position matrix----------start\"\r\n @list_of_word_rows.each do |word_row|\r\n word_row.position_list.each do |position|\r\n if position.start_of_line\r\n print \"-\"\r\n elsif position.end_of_line\r\n print \"+\"\r\n else\r\n print position.character\r\n end\r\n end\r\n puts \"\"\r\n end\r\n puts \"start and end of lines from position matrix----------end\"\r\n end",
"def _test_2\n dotest(\n TestCase45a2,\n \"\"\"\n.0 - 1\n.1 - 2\ndone.\n \"\"\".strip)\n end",
"def test_ruby_count_zeros\n pros = Prospector.new(0,0,0)\n assert pros.ruby_count.eql? \"After 0 days, Rubyist #0 found:\\n\\t0 rubies.\\n\\t0 fake rubies.\\n\"\n end",
"def test_string_results_gold_zero\n mock_loc = Minitest::Mock.new(\"mock_loc\")\n\tdef mock_loc.name;\"Sutter Creek\";end\n p = Prospector.new(0, mock_loc, 0)\n\tp.silver_found = 3\n\tp.gold_found = 0\n\tp.s = 's'\n\tassert_equal 'Found 3 ounces of silver in Sutter Creek', p.string_findings\n end",
"def test_leaving_first_3_false_both_found\n p = Prospector.new(0,0,0)\n\tp.gold_found = 3\n\tp.silver_found = 4\n\tp.num_loc_visited = 3\n\trefute p.leaving?\n end",
"def test_initialize_edge\n\n dummy_loc = MiniTest::Mock.new('test_loc')\n #dummy_game = MiniTest::Mock.new('test_game')\n def dummy_loc.name; 'Test Location'; end\n #def dummy_game.print; print_day; end\n g_test = Game.new(dummy_loc, -2, -5)\n # Assert that print_day catches and reports edge case\n assert_equal -1, g_test.print_day(dummy_loc, -2, -5)\n end",
"def walkthrough_test( object)\r\n\t counter=4\r\n\t i,j =0\r\n\t \r\n\t # This Two Loops run the intire nested hash Array along\r\n\t # Ignores all fields which are empty\r\n\t # The loop goes for each position there an object through four Methods\r\n\t # The Methods returns a number of found objects in a same line\r\n\t while i < 8\r\n\t j=0\r\n\t while j < 8\r\n\t \r\n\t if @nha2[i][j] != nil\r\n\t if @nha2[i][j] == object\r\n\t\r\n\t ru1= walkhigh(i,j,object) \r\n\t if ru1==0\r\n\t # puts \"WINNER1\"\r\n\t return true\r\n\t break\r\n\t end\r\n\t \r\n\t ru2 = walkright(i,j,object)\r\n\t if ru2==0\r\n\t # puts \"WINNER2\"\r\n\t return true\r\n\t break\r\n\t end\r\n\t \r\n\t ru3 = walkleft_down(i,j,object)\r\n\t if ru3==0\r\n\t # puts \"WINNER3\"\r\n\t return true\r\n\t break\r\n\t end\r\n\t \r\n\t ru4 = walkright_down(i,j,object)\r\n\t if ru4==0\r\n\t # puts \"WINNER4\"\r\n\t return true\r\n\t break\r\n\t end\r\n\t end\r\n\t end \r\n\t j+=1\r\n\t end \r\n\t i+=1 \r\n\t end\r\n end",
"def test_perfind_evidence\r\n nodelist = @mymodel.node_list\r\n \r\n node1 = nodelist.add_node(1, 'node one', PERFIND);\r\n \r\n assert_equal(Evidence.undefined, node1.measure_to_evidence(nil))\r\n\r\n node1.value_function = ValueFunction.new(0, 100, 'degrees')\r\n\r\n assert_equal(Evidence.undefined, node1.measure_to_evidence(nil)) \r\n assert_in_delta(node1.measure_to_evidence(45.4), 0.454, 0.0001)\r\n end",
"def test_evaluate\n assert_equal(8, @LiarHand.evaluate, 'Evaluate not working for <LiarHand>, check parameters/hashmap values')\n assert_equal(7.5, @IdiotHand.evaluate, 'Evaluate not working for <IdiotHand>, check parameters/hashmap values')\n\n assert_equal(6.5, @LightHand.evaluate, 'Evaluate not working for <LightHand>, check parameters/hashmap values')\n assert_equal(0, @SpiderHand.evaluate, 'Evaluate not working for <SpiderHand>, check parameters/hashmap values')\n end",
"def test_show_rush_result\n assert_output(\"After 2 days, Rubyist 1 found:\n 10 rubies.\n 10 fake rubies.\nGoing home victorious!\\n\"){ @p.show_rush_result(2, 1, [10, 10]) }\n end",
"def test_turn_putter_fake\n pros = Prospector.new(0,0,0)\n assert pros.turn_putter(0,1).eql? \"\\tFound 1 fake ruby in Enumerable Canyon\"\n end",
"def test_end_search_0_turns\n \tpro = Prospector.new(1)\n \tpro.loop_prospector(0)\n \tassert pro.total_rubies == 0\n \tassert pro.total_fake_rubies == 0\n \tassert pro.days == 0\n \tassert pro.turns == 0\n end",
"def show_findings(curr_prosp)\n curr_prosp = curr_prosp.to_i\n return nil if curr_prosp <= 0\n puts \"After #{@total_days} days, Rubyist ##{curr_prosp} found:\" if @total_days > 1\n puts \"After #{@total_days} day, Rubyist ##{curr_prosp} found:\" if @total_days == 1\n if @total_real_rubies == 1\n puts \" #{@total_real_rubies} ruby.\"\n else\n puts \" #{@total_real_rubies} rubies.\"\n end\n if @total_fake_rubies == 1\n puts \" #{@total_fake_rubies} fake ruby.\"\n else\n puts \" #{@total_fake_rubies} fake rubies.\"\n end\n if @total_real_rubies >= 10\n puts \"Going home victorious!\"\n elsif @total_real_rubies > 0 && @total_real_rubies < 10\n puts \"Going home sad.\"\n elsif @total_real_rubies == 0\n puts \"Going home empty-handed.\"\n end\n puts \"\\n\"\n end",
"def test_confirm_point_values\n[:A,:E,:I,:O,:N,:R,:T,:L,:S,:U].each{|num| assert_equal 1, TileBag.points_for(num.to_sym)}\n\n[:D,:G].each{|num| assert_equal 2, TileBag.points_for(num.to_sym)}\n[:B,:C,:M,:P].each{|num| assert_equal 3, TileBag.points_for(num.to_sym)}\n[:F,:H,:V,:W,:Y].each{|num| assert_equal 4, TileBag.points_for(num.to_sym)}\n[:K].each{|num| assert_equal 5, TileBag.points_for(num.to_sym)} \n[:J,:X].each{|num| assert_equal 8, TileBag.points_for(num.to_sym)} \n[:Q,:Z].each{|num| assert_equal 10, TileBag.points_for(num.to_sym)} \n end",
"def test_results_zero\r\n assert_output(\"Going home empty-handed.\\n\") { @g.results(0) }\r\n end",
"def test_ut_diff_result_02\n original_source_code = OriginalSourceCode.new(\n :original_file_id => 10,\n :line_number => 349898,\n :error_line => 4564,\n :line_content => \"123456\"\n )\n assert_equal(10,original_source_code.original_file_id)\n assert_equal(349898,original_source_code.line_number)\n assert_equal(4564,original_source_code.error_line)\n assert_equal(\"123456\",original_source_code.line_content)\n end",
"def\n\t\tprint_point\n\t\tp \"(#{x}, #{y})\"\t\n\tend",
"def test_find\n @search.adjacent_points_function = ->(current) {[-0.1, 0.1].map {|x| current + x}}\n @search.cost_function = ->(x){x - 0.1}\n assert_in_delta 0.1, @search.find\n end",
"def assert_equal(type,expected, actual)\n text1=get_text(type,expected)\n text2=$array1[\"#{actual}\"] \n puts text1\n puts text2\n if text1 == text2\n puts \"given text is available\"\n elsif \n $log.error \"given #{expected} text is not displayed\"\n raise(\"given #{expected} text is not displayed\")\n end\nend",
"def inspect\n test_cases.each do |tc|\n puts tc.print\n end\n end",
"def test_results_sad\r\n assert_output(\"Going home sad.\\n\") { @g.results(9) }\r\n end",
"def test_print\r\n reader = GraphReader.new('whatever')\r\n reader.add_node(0, 'A', nil)\r\n assert_output(\"\\nNumber: 0\\nLetter: A\\nNeighbors: none\\n\") {reader.print_graph()}\r\n end",
"def test_1\n\t\tputs check_custom nil\n\t\tputs check_custom \"hi\"\n\t\tputs check_custom 'hi(there)'\n\tend",
"def test_turn_putter_real\n pros = Prospector.new(0,0,0)\n assert pros.turn_putter(1,0).eql? \"\\tFound 1 ruby in Enumerable Canyon\"\n end",
"def test_print_nil\n assert_output(\"\\tMining Results\\n\\tNo precious metals were found!\\n\") do\n @game.print_mining_results(0, 0)\n end\n end",
"def test_results_victory\r\n assert_output(\"Going home victorious!\\n\") { @g.results(10) }\r\n end",
"def test_dynamic_palisades_search_found_something\n ruby_rush=RubyRush.new(1, 2, 3)\n doubled_prng = Minitest::Mock.new('doubled prng')\n def doubled_prng.rand(seed); 2; end\n ruby_rush.prng=doubled_prng\n ruby_rush.cur_real_rb=2\n ruby_rush.cur_fake_rb=2\n ruby_rush.real_sp='rubies'\n ruby_rush.fake_sp='rubies'\n assert_output(\"\\tFound #{ruby_rush.cur_real_rb} #{ruby_rush.real_sp} and #{ruby_rush.cur_fake_rb} fake #{ruby_rush.fake_sp} in #{ruby_rush.city}.\\n\" ) {ruby_rush. dynamic_palisades_search}\n end",
"def test(msg, expected, actual)\n if expected == actual\n puts \"pass!! #{msg}\"\n else\n puts \"fail!! #{msg}\"\n end\nend",
"def test_run_zero\n sim = Simulator.new(1, 2, 1)\n sim.setup_map\n mock_prospector = Minitest::Mock.new('Mock Prospector')\n def mock_prospector.mine(_param)\n 1\n end\n\n def mock_prospector.next_location(_param, _param2)\n 1\n end\n\n def mock_prospector.location_count\n 1\n end\n assert_nil sim.run(0, mock_prospector)\n end",
"def test_print_usage\n assert_output(\"Usage:\nruby ruby_rush.rb *seed* *num_prospectors* *num_turns*\n*seed* should be an integer\n*num_prospectors* should be a non-negative integer\n*num_turns* should be a non-negative integer\\n\") { print_usage }\n end",
"def test_display_one\r\n assert_output(\"After 2 days, Rubyist #1 found:\\n\\t1 ruby.\\n\\t1 fake ruby.\\n\") { @g.display_rubies(1, 1, 1, 2) }\r\n end",
"def get_test_cases()\n test_cases = []\n test_cases.push(\"\"\"\n X|X|O|O|X|X|*\n O|O|X|O|X|O|X\n X|O|O|X|O|X|O\n O|O|X|X|X|O|X\n X|X|O|O|X|O|O\n O|O|X|X|O|X|X\n \"\"\")\n test_cases.push(\"\"\"\n X|X|O|O|X|X|*\n O|O|X|O|X|O|X\n X|O|O|X|O|X|O\n O|O|X|X|X|O|X\n X|X|O|O|X|O|O\n O|O|X|X|O|X|X\n \"\"\")\n test_cases.push(\"\"\"\n X|X|X|O|X|O|*\n X|O|O|O|X|O|X\n X|O|O|X|O|X|O\n O|O|X|X|X|O|X\n X|X|O|O|X|O|X\n O|O|X|X|O|X|X\n \"\"\"\n )\n test_cases.push(\"\"\"\n *|*|*|*|*|*|*\n *|*|*|*|*|*|*\n *|*|X|*|*|*|*\n *|O|X|*|*|*|X\n O|O|O|O|*|*|X\n O|O|X|X|X|O|X\n \"\"\")\n test_cases.push(\"\"\"\n *|*|*|*|*|*|*\n O|X|*|*|*|*|*\n X|X|*|O|*|*|O\n O|X|*|O|*|*|X\n X|O|X|X|*|O|O\n X|O|O|X|*|O|X\n \"\"\")\n test_cases.push(\"\"\"\n *|*|*|*|*|*|*\n *|*|*|*|*|*|*\n *|*|*|*|*|*|*\n X|*|*|*|*|*|*\n X|*|*|*|*|*|*\n X|*|O|O|O|O|*\n \"\"\")\n\n return test_cases\n\n end",
"def search_for_rubies(loc)\n curr_city = loc.to_i\n loop do\n @total_days += 1\n real_ruby = 0\n fake_ruby = 0\n real_ruby = @rng.rand(@table[curr_city][0]) if @table[curr_city][0] > 0\n fake_ruby = @rng.rand(@table[curr_city][1]) if @table[curr_city][1] > 0\n puts \" Found #{real_ruby} real ruby and #{fake_ruby} fake ruby in #{@map[curr_city][0]}\" if real_ruby == 1 && fake_ruby == 1\n puts \" Found #{real_ruby} real rubies and #{fake_ruby} fake ruby in #{@map[curr_city][0]}\" if real_ruby > 1 && fake_ruby == 1\n puts \" Found #{real_ruby} real ruby and #{fake_ruby} fake rubies in #{@map[curr_city][0]}\" if real_ruby == 1 && fake_ruby > 1\n puts \" Found #{real_ruby} real rubies and #{fake_ruby} fake rubies in #{@map[curr_city][0]}\" if real_ruby > 1 && fake_ruby > 1\n puts \" Found #{real_ruby} real ruby in #{@map[curr_city][0]}\" if real_ruby == 1 && fake_ruby == 0\n puts \" Found #{real_ruby} real rubies in #{@map[curr_city][0]}\" if real_ruby > 1 && fake_ruby == 0\n puts \" Found #{fake_ruby} fake ruby in #{@map[curr_city][0]}\" if real_ruby == 0 && fake_ruby == 1\n puts \" Found #{fake_ruby} fake rubies in #{@map[curr_city][0]}\" if real_ruby == 0 && fake_ruby > 1\n @total_real_rubies += real_ruby\n @total_fake_rubies += fake_ruby\n puts \" Found no rubies or fake rubies in #{@map[curr_city][0]}\" if real_ruby == 0 && fake_ruby == 0\n break if real_ruby == 0 && fake_ruby == 0\n end\n end",
"def test_next_location_negative_location\n mock_map = Minitest::Mock.new('Mock Map')\n mock_map_finder = Minitest::Mock.new('Mock Map Finder')\n joe = Prospector.new(mock_map, mock_map_finder)\n def mock_map_finder.get_location_index(_param)\n nil\n end\n assert_nil joe.next_location(-1, 1, 1)\n end",
"def testHelper arr, description, expected\n\tresult = leastOccuringValueInArray(arr)\n\tString resultType = result.class\n\t \n\tString testStatus = \"Failed\"\n\tif (leastOccuringValueInArray(arr).class == expected.class)\n\t\t(leastOccuringValueInArray(arr) == expected)? testStatus = \"Passed\" : testStatus = \"Failed\"\n\tend\n\t\n\t# Print test results\n\tputs \"| \" + testStatus + \" | \" + description + \", expected: \" + expected.to_s + \"(\" + expected.class.to_s + \")\" + \", actual: \" + result.to_s + \"(\" + resultType.to_s + \")\"\nend"
] | [
"0.68066615",
"0.6743735",
"0.6675955",
"0.6527962",
"0.63503355",
"0.6237594",
"0.6149374",
"0.6140571",
"0.61387604",
"0.60822415",
"0.60778296",
"0.60734767",
"0.59985673",
"0.59881014",
"0.5963785",
"0.5959704",
"0.59458655",
"0.592704",
"0.5903186",
"0.5887848",
"0.58857024",
"0.5881846",
"0.5855913",
"0.58463144",
"0.58463144",
"0.5813874",
"0.5811418",
"0.5777872",
"0.5752767",
"0.57392806",
"0.5728017",
"0.567678",
"0.5674775",
"0.56697047",
"0.56672484",
"0.56636673",
"0.5656403",
"0.56492877",
"0.55932534",
"0.55847085",
"0.55687565",
"0.55672204",
"0.5566126",
"0.5560402",
"0.5542675",
"0.55401194",
"0.55372024",
"0.55362964",
"0.5530046",
"0.55110645",
"0.5500344",
"0.54803425",
"0.5479569",
"0.5475006",
"0.54737115",
"0.54629457",
"0.54564095",
"0.543857",
"0.5430935",
"0.54246134",
"0.54219574",
"0.542194",
"0.54205716",
"0.54184043",
"0.54140645",
"0.53868914",
"0.53677934",
"0.53676033",
"0.53666395",
"0.5347755",
"0.5343367",
"0.53393614",
"0.5336972",
"0.5328994",
"0.5327036",
"0.5320105",
"0.531819",
"0.53038776",
"0.529807",
"0.5295056",
"0.52938294",
"0.52937925",
"0.52918863",
"0.52888244",
"0.5285869",
"0.528328",
"0.5279063",
"0.5267082",
"0.52636725",
"0.5263534",
"0.52564234",
"0.5251842",
"0.52513397",
"0.52489454",
"0.524476",
"0.52414745",
"0.5238901",
"0.52383214",
"0.52364403",
"0.52337444"
] | 0.66138405 | 3 |
This test when only found real ruby | def test_print_ruby_found_real_only
mock_location = Minitest::Mock.new('location')
def mock_location.name; 'a'; end
def plural?(x); 'ruby'; end
assert_output(" Found 1 ruby in a.\n") {
@p.print_ruby_found_in_this_location(mock_location, [1, 0])}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def target_ruby; end",
"def testNonRubyFile\n assert_raise(LoadError) do\n requireFile('NonRubyFile.so')\n end\n end",
"def testget_leveled_file_contentNonRubyFile\n assert_raise(LoadError) do\n RCodeLeveler.get_leveled_file_content('RequiredFiles/NonRubyFile.so')\n end\n end",
"def testBasicBinaryWithRuby\n execTest('Applications/Basic', [ '-r' ], 'ReleaseInfo_Exe.rb', :ExpectCalls => [\n [ 'system',\n {\n :Dir => /^.*\\/Releases\\/#{RUBY_PLATFORM}\\/UnnamedVersion\\/IncludeRuby\\/\\d\\d\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d\\/Release\\/Launch\\/linux\\/bin$/,\n :Cmd => /^allinoneruby ruby\\-#{RUBY_VERSION}\\.bin$/\n },\n { :Execute => $RBPTest_ExternalTools ? true : Proc.new { true } }\n ]\n ]) do |iReleaseDir, iReleaseInfo|\n checkReleaseInfo(iReleaseDir, iReleaseInfo)\n checkReleaseNotes(iReleaseDir, iReleaseInfo)\n lExeFileName = \"#{iReleaseDir}/Release/ExeName\"\n assert(File.exists?(lExeFileName))\n # Unless the Executable file can contain other rb files (please Crate come faster !), files are still present.\n assert(File.exists?(\"#{iReleaseDir}/Release/Main.rb\"))\n # Test it in Ruby's environment\n assert_equal(\"Ruby found on current platform. Use it directly.\nHello World\\n\", runExe(lExeFileName))\n # TODO: Test it without Ruby's environment\n end\n end",
"def check_for_executable; end",
"def testBasicBinaryWithRubyInTerminal\n execTest('Applications/Basic', [ '-r' ], 'ReleaseInfo_ExeTerm.rb', :ExpectCalls => [\n [ 'system',\n {\n :Dir => /^.*\\/Releases\\/#{RUBY_PLATFORM}\\/UnnamedVersion\\/IncludeRuby\\/\\d\\d\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d\\/Release\\/Launch\\/linux\\/bin$/,\n :Cmd => /^allinoneruby ruby\\-#{RUBY_VERSION}\\.bin$/\n },\n { :Execute => $RBPTest_ExternalTools ? true : Proc.new { true } }\n ]\n ]) do |iReleaseDir, iReleaseInfo|\n checkReleaseInfo(iReleaseDir, iReleaseInfo)\n checkReleaseNotes(iReleaseDir, iReleaseInfo)\n lExeFileName = \"#{iReleaseDir}/Release/ExeName\"\n assert(File.exists?(lExeFileName))\n # Unless the Executable file can contain other rb files (please Crate come faster !), files are still present.\n assert(File.exists?(\"#{iReleaseDir}/Release/Main.rb\"))\n # Test it in Ruby's environment\n assert_equal(\"Ruby found on current platform. Use it directly.\nHello World\\n\", runExe(lExeFileName))\n # TODO: Test it without Ruby's environment\n end\n end",
"def got_hpricot? # ERGO help tests pass without it\n require 'hpricot'\n return true\nrescue MissingSourceFile\n return false\nend",
"def test_version\n assert_match(/^Ocra \\d+(\\.\\d)+$/, `ruby #{ocra} --version`)\n end",
"def test_ruby_string_1\n pros = Prospector.new(0,0,0)\n assert pros.ruby_string(1).eql? '1 ruby'\n end",
"def jruby?; end",
"def worked_with_ruby?(c)\n c.languages_worked_with.include?('Ruby')\nend",
"def test_print_ruby_found_fake_only\n mock_location = Minitest::Mock.new('location')\n def mock_location.name; 'a'; end\n def plural?(x); 'ruby'; end\n assert_output(\" Found 1 fake ruby in a.\\n\") {\n @p.print_ruby_found_in_this_location(mock_location, [0, 1])}\n end",
"def wrong; require 'unknown_file'; end",
"def test_print_ruby_found_nothing\n mock_location = Minitest::Mock.new('location')\n def mock_location.name; 'a'; end\n assert_output(\" Found no rubies or fake rubies in a.\\n\"){\n @p.print_ruby_found_in_this_location(mock_location, [0, 0])}\n end",
"def testBasicBinary\n execTest('Applications/Basic', [], 'ReleaseInfo_Exe.rb', :ExpectCalls => [\n [ 'system',\n {\n :Dir => /^.*$/,\n :Cmd => /^exerb\\.bat --version$/\n },\n { :Execute => $RBPTest_ExternalTools ? true : Proc.new { true } }\n ],\n [ 'system',\n {\n :Dir => /^.*\\/Releases\\/#{RUBY_PLATFORM}\\/UnnamedVersion\\/Normal\\/\\d\\d\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d\\/Release$/,\n :Cmd => /^exerb\\.bat -o ExeName.exe .*\\/EXE_windows_Gen\\.rb$/\n },\n { :Execute => $RBPTest_ExternalTools ? true : Proc.new { true } }\n ],\n [ 'system',\n {\n :Dir => /^.*$/,\n :Cmd => /^.*\\/edicon\\.exe .*\\/Releases\\/#{RUBY_PLATFORM}\\/UnnamedVersion\\/Normal\\/\\d\\d\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d\\/Release\\/ExeName.exe .*\\/Icon\\.ico$/\n },\n { :Execute => $RBPTest_ExternalTools ? true : Proc.new {\n FileUtils::touch \"#{Dir.glob(\"Releases/#{RUBY_PLATFORM}/*/*/*\")[0]}/Release/ExeName.exe\"\n true\n } }\n ]\n ]) do |iReleaseDir, iReleaseInfo|\n checkReleaseInfo(iReleaseDir, iReleaseInfo)\n checkReleaseNotes(iReleaseDir, iReleaseInfo)\n lExeFileName = \"#{iReleaseDir}/Release/ExeName.exe\"\n assert(File.exists?(lExeFileName))\n # Unless the Executable file can contain other rb files (please Crate come faster !), files are still present.\n assert(File.exists?(\"#{iReleaseDir}/Release/Main.rb\"))\n if $RBPTest_ExternalTools\n # Test it in Ruby's environment\n assert_equal(\"#{getRubySignature}\nRuby found in environment. Using it directly.\n> start rubyw -w \\\"#{iReleaseDir}/Release/Main.rb\\\" \\n\", runExe(lExeFileName))\n # TODO: Test it without Ruby's environment\n end\n end\n end",
"def testBasicBinaryWithRuby\n execTest('Applications/Basic', [ '-r' ], 'ReleaseInfo_Exe.rb', :ExpectCalls => [\n [ 'system',\n {\n :Dir => /^.*$/,\n :Cmd => /^exerb\\.bat --version$/\n },\n { :Execute => $RBPTest_ExternalTools ? true : Proc.new { true } }\n ],\n [ 'system',\n {\n :Dir => /^.*\\/Releases\\/#{RUBY_PLATFORM}\\/UnnamedVersion\\/IncludeRuby\\/\\d\\d\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d\\/Release\\/Launch\\/windows\\/bin$/,\n :Cmd => /^allinoneruby\\.bat --rubyw rubyw-#{RUBY_VERSION}\\.exe$/\n },\n { :Execute => $RBPTest_ExternalTools ? true : Proc.new { true } }\n ],\n [ 'system',\n {\n :Dir => /^.*\\/Releases\\/#{RUBY_PLATFORM}\\/UnnamedVersion\\/IncludeRuby\\/\\d\\d\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d\\/Release$/,\n :Cmd => /^exerb\\.bat -o ExeName.exe .*\\/EXE_windows_Gen\\.rb$/\n },\n { :Execute => $RBPTest_ExternalTools ? true : Proc.new { true } }\n ],\n [ 'system',\n {\n :Dir => /^.*$/,\n :Cmd => /^.*\\/edicon\\.exe .*\\/Releases\\/#{RUBY_PLATFORM}\\/UnnamedVersion\\/IncludeRuby\\/\\d\\d\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d\\/Release\\/ExeName.exe .*\\/Icon\\.ico$/\n },\n { :Execute => $RBPTest_ExternalTools ? true : Proc.new {\n FileUtils::touch \"#{Dir.glob(\"Releases/#{RUBY_PLATFORM}/*/*/*\")[0]}/Release/ExeName.exe\"\n true\n } }\n ]\n ]) do |iReleaseDir, iReleaseInfo|\n checkReleaseInfo(iReleaseDir, iReleaseInfo)\n checkReleaseNotes(iReleaseDir, iReleaseInfo)\n lExeFileName = \"#{iReleaseDir}/Release/ExeName.exe\"\n assert(File.exists?(lExeFileName))\n # Unless the Executable file can contain other rb files (please Crate come faster !), files are still present.\n assert(File.exists?(\"#{iReleaseDir}/Release/Main.rb\"))\n if $RBPTest_ExternalTools\n # Test it in Ruby's environment\n assert_equal(\"#{getRubySignature}\nRuby found in environment. Using it directly.\n> start rubyw -w \\\"#{iReleaseDir}/Release/Main.rb\\\" \\n\", runExe(lExeFileName))\n # TODO: Test it without Ruby's environment\n end\n end\n end",
"def executable_real?() end",
"def testBasicBinary\n execTest('Applications/Basic', [], 'ReleaseInfo_Exe.rb') do |iReleaseDir, iReleaseInfo|\n checkReleaseInfo(iReleaseDir, iReleaseInfo)\n checkReleaseNotes(iReleaseDir, iReleaseInfo)\n lExeFileName = \"#{iReleaseDir}/Release/ExeName\"\n assert(File.exists?(lExeFileName))\n # Unless the Executable file can contain other rb files (please Crate come faster !), files are still present.\n assert(File.exists?(\"#{iReleaseDir}/Release/Main.rb\"))\n # Test it in Ruby's environment\n assert_equal(\"Ruby found on current platform. Use it directly.\nHello World\\n\", runExe(lExeFileName))\n # TODO: Test it without Ruby's environment\n end\n end",
"def ruby_engine; end",
"def ruby_engine; end",
"def test_bad_jruby_deps\n check_deps_fail BadJRubyBall unless `/usr/bin/which jruby`.chomp.empty?\n end",
"def testBasicBinaryInTerminal\n execTest('Applications/Basic', [], 'ReleaseInfo_ExeTerm.rb', :ExpectCalls => [\n [ 'system',\n {\n :Dir => /^.*$/,\n :Cmd => /^exerb\\.bat --version$/\n },\n { :Execute => $RBPTest_ExternalTools ? true : Proc.new { true } }\n ],\n [ 'system',\n {\n :Dir => /^.*\\/Releases\\/#{RUBY_PLATFORM}\\/UnnamedVersion\\/Normal\\/\\d\\d\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d\\/Release$/,\n :Cmd => /^exerb\\.bat -o ExeName.exe .*\\/EXE_windows_Gen\\.rb$/\n },\n { :Execute => $RBPTest_ExternalTools ? true : Proc.new { true } }\n ],\n [ 'system',\n {\n :Dir => /^.*$/,\n :Cmd => /^.*\\/edicon\\.exe .*\\/Releases\\/#{RUBY_PLATFORM}\\/UnnamedVersion\\/Normal\\/\\d\\d\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d\\/Release\\/ExeName.exe .*\\/Icon\\.ico$/\n },\n { :Execute => $RBPTest_ExternalTools ? true : Proc.new {\n FileUtils::touch \"#{Dir.glob(\"Releases/#{RUBY_PLATFORM}/*/*/*\")[0]}/Release/ExeName.exe\"\n true\n } }\n ]\n ]) do |iReleaseDir, iReleaseInfo|\n checkReleaseInfo(iReleaseDir, iReleaseInfo)\n checkReleaseNotes(iReleaseDir, iReleaseInfo)\n lExeFileName = \"#{iReleaseDir}/Release/ExeName.exe\"\n assert(File.exists?(lExeFileName))\n # Unless the Executable file can contain other rb files (please Crate come faster !), files are still present.\n assert(File.exists?(\"#{iReleaseDir}/Release/Main.rb\"))\n if $RBPTest_ExternalTools\n # Test it in Ruby's environment\n assert_equal(\"#{getRubySignature}\nRuby found in environment. Using it directly.\n> ruby -w \\\"#{iReleaseDir}/Release/Main.rb\\\" \\nHello World\\n\", runExe(lExeFileName))\n # TODO: Test it without Ruby's environment\n end\n end\n end",
"def testBasicBinaryWithRubyInTerminal\n execTest('Applications/Basic', [ '-r' ], 'ReleaseInfo_ExeTerm.rb', :ExpectCalls => [\n [ 'system',\n {\n :Dir => /^.*$/,\n :Cmd => /^exerb\\.bat --version$/\n },\n { :Execute => $RBPTest_ExternalTools ? true : Proc.new { true } }\n ],\n [ 'system',\n {\n :Dir => /^.*\\/Releases\\/#{RUBY_PLATFORM}\\/UnnamedVersion\\/IncludeRuby\\/\\d\\d\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d\\/Release\\/Launch\\/windows\\/bin$/,\n :Cmd => /^allinoneruby\\.bat ruby-#{RUBY_VERSION}\\.exe$/\n },\n { :Execute => $RBPTest_ExternalTools ? true : Proc.new { true } }\n ],\n [ 'system',\n {\n :Dir => /^.*\\/Releases\\/#{RUBY_PLATFORM}\\/UnnamedVersion\\/IncludeRuby\\/\\d\\d\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d\\/Release$/,\n :Cmd => /^exerb\\.bat -o ExeName.exe .*\\/EXE_windows_Gen\\.rb$/\n },\n { :Execute => $RBPTest_ExternalTools ? true : Proc.new { true } }\n ],\n [ 'system',\n {\n :Dir => /^.*$/,\n :Cmd => /^.*\\/edicon\\.exe .*\\/Releases\\/#{RUBY_PLATFORM}\\/UnnamedVersion\\/IncludeRuby\\/\\d\\d\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d\\/Release\\/ExeName.exe .*\\/Icon\\.ico$/\n },\n { :Execute => $RBPTest_ExternalTools ? true : Proc.new {\n FileUtils::touch \"#{Dir.glob(\"Releases/#{RUBY_PLATFORM}/*/*/*\")[0]}/Release/ExeName.exe\"\n true\n } }\n ]\n ]) do |iReleaseDir, iReleaseInfo|\n checkReleaseInfo(iReleaseDir, iReleaseInfo)\n checkReleaseNotes(iReleaseDir, iReleaseInfo)\n lExeFileName = \"#{iReleaseDir}/Release/ExeName.exe\"\n assert(File.exists?(lExeFileName))\n # Unless the Executable file can contain other rb files (please Crate come faster !), files are still present.\n assert(File.exists?(\"#{iReleaseDir}/Release/Main.rb\"))\n if $RBPTest_ExternalTools\n # Test it in Ruby's environment\n assert_equal(\"#{getRubySignature}\nRuby found in environment. Using it directly.\n> ruby -w \\\"#{iReleaseDir}/Release/Main.rb\\\" \\nHello World\\n\", runExe(lExeFileName))\n # TODO: Test it without Ruby's environment\n end\n end\n end",
"def test_print_ruby_found_both\n mock_location = Minitest::Mock.new('location')\n def mock_location.name; 'a'; end\n def plural?(x); 'ruby'; end\n assert_output(\" Found 1 ruby and 1 fake ruby in a.\\n\"){\n @p.print_ruby_found_in_this_location(mock_location, [1, 1])}\n end",
"def test_ruby_string_big\n pros = Prospector.new(0,0,0)\n assert pros.ruby_string(2).eql? '2 rubies'\n end",
"def testBasicBinaryInTerminal\n execTest('Applications/Basic', [], 'ReleaseInfo_ExeTerm.rb') do |iReleaseDir, iReleaseInfo|\n checkReleaseInfo(iReleaseDir, iReleaseInfo)\n checkReleaseNotes(iReleaseDir, iReleaseInfo)\n lExeFileName = \"#{iReleaseDir}/Release/ExeName\"\n assert(File.exists?(lExeFileName))\n # Unless the Executable file can contain other rb files (please Crate come faster !), files are still present.\n assert(File.exists?(\"#{iReleaseDir}/Release/Main.rb\"))\n # Test it in Ruby's environment\n assert_equal(\"Ruby found on current platform. Use it directly.\nHello World\\n\", runExe(lExeFileName))\n # TODO: Test it without Ruby's environment\n end\n end",
"def detect\n File.exist?('/tmp/ruby')\n end",
"def test_Enviroment_002_isPlatform\r\n\r\n puts2(\"\")\r\n puts2(\"#######################\")\r\n puts2(\"Testcase: test_Enviroment_002_isPlatform\")\r\n puts2(\"#######################\")\r\n\r\n puts2(\"Running Ruby for Windows: \" + is_win?.to_s)\r\n puts2(\"Running Ruby for Windows 32-bit: \" + is_win32?.to_s)\r\n puts2(\"Running Ruby for Windows 64 bit: \" + is_win64?.to_s)\r\n puts2(\"Running Ruby for Linux: \" + is_linux?.to_s)\r\n puts2(\"Running Ruby for OS/X: \" + is_osx?.to_s)\r\n puts2(\"Running on JRuby: \" + is_java?.to_s)\r\n\r\n end",
"def test_binary_rpaths\n # Find all the binaries.\n bins = Dir.glob(File.join($config[\"_embedded_root_dir\"], \"bin/**/*\"))\n bins += Dir.glob(File.join($config[\"_embedded_root_dir\"], \"sbin/**/*\"))\n bins += Dir.glob(File.join($config[\"_embedded_root_dir\"], \"lib/**/*.so\"))\n bins += Dir.glob(File.join($config[\"_embedded_root_dir\"], \"libexec/**/*.so\"))\n bins += Dir.glob(File.join($config[\"_embedded_root_dir\"], \"/apps/core/shared/vendor/**/*.so\"))\n bins.map! { |path| File.realpath(path) }\n bins.select! { |path| File.file?(path) }\n bins.reject! { |path| `file #{path}` =~ /(text executable|ASCII)/ }\n\n # Spot check to ensure our list of binaries actually includes things we\n # expect.\n assert_operator(bins.length, :>, 0)\n [\n \"/embedded/bin/ruby\",\n \"/embedded/sbin/rsyslogd\",\n \"/embedded/openresty/nginx/sbin/nginx\",\n \"/embedded/libexec/trafficserver/header_rewrite.so\",\n # LuaRock\n \"/embedded/apps/core/shared/vendor/lua/lib/lua/5.1/yaml.so\",\n # Rubygem\n \"/oj/oj.so\",\n ].each do |expected_path_end|\n assert(bins.find { |path| path.end_with?(expected_path_end) }, \"Expected #{bins.inspect} to include #{expected_path_end.inspect}\")\n end\n\n # Ensure each binary file has no rpath or runpath setting.\n bins.each do |path|\n output, _status = run_shell(\"chrpath\", \"-l\", path)\n assert_match(\"no rpath or runpath tag found\", output)\n end\n end",
"def test_rubies_found_positive\n prospector = Rubyist.new(1)\n prospector.rubies_found(2, 2)\n assert prospector.real_ruby_count == 2 && prospector.fake_ruby_count == 2\n end",
"def test_relative_loadpath_rubylibdotlib\n with_fixture 'relloadpath1' do\n with_env 'RUBYLIB' => './lib' do\n assert system('ruby', ocra, 'relloadpath1.rb', *DefaultArgs)\n assert File.exist?('relloadpath1.exe')\n assert system('relloadpath1.exe')\n end\n end\n end",
"def test_bad_jruby_deps\n check_deps_fail \"notapackage\" => :jruby if which('jruby')\n end",
"def test_bad_jruby_deps\n check_deps_fail \"notapackage\" => :jruby if which('jruby')\n end",
"def ruby_implementation\n case RUBY_ENGINE\n when /java/\n 'jruby'\n when /ruby/\n # I'm actually not sure what rubinius or maglev or other implementions would return. I don't use rubies, other than mri or jruby.\n 'mri'\n else\n nil\n end\nend",
"def test_platform_uses_ruby_platform\n stubbed = 'ENCOM OS-12'\n NewRelic::Agent::Samplers::MemorySampler.stub_const(:RUBY_PLATFORM, stubbed) do\n platform = NewRelic::Agent::Samplers::MemorySampler.platform\n\n assert_equal platform, stubbed.downcase\n end\n end",
"def ruby(code)\n code.gsub!(/puts/, '$stdout.puts')\n path_info = code.scan(/\\s(?<fs_path>\\/[^\\n]*\\/?)$/).flatten\n\n if $~\n code.gsub!(/#{$~[:fs_path]}/, %[\"#{path_info.first}\"])\n end\n\n retried = false\n\n begin\n @workspace ||= IRB::WorkSpace.new(binding)\n log 'Running Ruby code:'\n log code\n r = @workspace.evaluate(binding, code)\n\n [r, 0]\n rescue NoMethodError => ex\n %r[undefined method `(?<meth>[^']+)] =~ ex.message\n log \"NoMethodError for: #{meth}\"\n\n if retried\n raise ex\n else\n code = fix_no_method(meth, code)\n retried = true\n retry\n end\n rescue StandardError => ex\n [ex, 1]\n end\n end",
"def test_provided_example\n assert_equal \"tknk\", @system.base.name\n end",
"def check_system_python\n @candidate_pythons = lookup_local_pythons\n return 0 != @candidate_pythons.length\n end",
"def test_relative_loadpath_idotlib\n with_fixture 'relloadpath1' do\n assert system('ruby', '-I', './lib', ocra, 'relloadpath1.rb', *DefaultArgs)\n assert File.exist?('relloadpath1.exe')\n assert system('relloadpath1.exe')\n end\n end",
"def jruby?\n JRUBY\n end",
"def test_bad_rubinius_deps\n check_deps_fail BadRubiniusBall unless `/usr/bin/which rbx`.chomp.empty?\n end",
"def php?\n ::FileTest.exist?('/usr/bin/php')\n end",
"def php?\n ::FileTest.exist?('/usr/bin/php')\n end",
"def test_relative_loadpath_rubyliblib\n with_fixture 'relloadpath1' do\n with_env 'RUBYLIB' => 'lib' do\n assert system('ruby', ocra, 'relloadpath1.rb', *DefaultArgs)\n assert File.exist?('relloadpath1.exe')\n assert system('relloadpath1.exe')\n end\n end\n end",
"def test_relative_loadpath1_ilib\n with_fixture 'relloadpath1' do\n assert system('ruby', '-I', 'lib', ocra, 'relloadpath1.rb', *DefaultArgs)\n assert File.exist?('relloadpath1.exe')\n assert system('relloadpath1.exe')\n end\n end",
"def check_for_libraries; end",
"def test_bad_rubinius_deps\n check_deps_fail \"notapackage\" => :rbx if which('rbx')\n end",
"def test_bad_rubinius_deps\n check_deps_fail \"notapackage\" => :rbx if which('rbx')\n end",
"def check_source!\n raise \"#{@source_path} is not readable\" unless @source_path.readable?\n output = %x[ruby -c #{@source_path} 2>&1]\n raise \"#{@source_path} is not valid ruby:\\n#{output}\" unless $?.success?\n true\n end",
"def test_relative_loadpath2_idotdotlib\n with_fixture 'relloadpath2' do\n cd 'src' do\n assert system('ruby', '-I', '../lib', ocra, 'relloadpath2.rb', *DefaultArgs)\n assert File.exist?('relloadpath2.exe')\n assert system('relloadpath2.exe')\n end\n end\n end",
"def test_bad_chicken_deps\n check_deps_fail BadChickenBall unless `/usr/bin/which csc`.chomp.empty?\n end",
"def test_ruby18\n err = assert_compile 'ruby18.y'\n assert_warnings err, useless_terms: 1\n assert_parser_unchanged 'ruby18.y'\n end",
"def compatible_with_ruby?(current_ruby = Env.ruby)\n @used_ruby = aliased_ruby(ruby)\n\n @used_ruby == current_ruby\n end",
"def test() \n @runner.prepareForFile(@filename)\n testIfAvailable(codeFilename())\n end",
"def ruby_code?(str)\n checker = FoodCritic::ErrorChecker.new(str)\n checker.parse\n ! checker.error?\n end",
"def execute_ruby(code)\n keywords = / class | module | def | do | while | for /\n if code =~ keywords\n return \"Unmatched ends\" if code.scan(keywords).length != code.scan(/end(\\s|$)/).length\n end\n return \"Unmatched..\" if code.scan(/\\{|\\(|\\[/).length != code.scan(/\\}|\\)|\\]/).length\n return \"Unmatched quotes..\" if code.scan(/\\\"|\\'/).length % 2 != 0\n begin\n eval(code[1..-1]) || \"nil\"\n rescue => e\n \"Fail => #{e}\"\n end\n end",
"def sandbox_ruby\n unless @sandbox_ruby\n @sandbox_ruby = ENV['RS_RUBY_EXE'] ||\n File.normalize_path(File.join(RightScale::Platform.filesystem.sandbox_dir, 'Ruby', 'bin', 'ruby.exe'))\n end\n @sandbox_ruby\n end",
"def test_that_it_has_a_version_number\n refute_nil ::Malody::VERSION\n end",
"def test_print_ruby_found_nil\n mock_location = Minitest::Mock.new('location')\n def mock_location.name; 'a'; end\n def plural?(x); 'ruby'; end\n assert_raises(StandardError){@p.print_ruby_found_in_this_location(mock_location, nil)}\n end",
"def test_command_checks_for_binaries_each_time\n provider = newprovider\n\n provider.commands :testing => \"/no/such/path\"\n\n provider.stubs(:which).returns \"/no/such/path\"\n\n provider.command(:testing)\n assert_equal(\"/no/such/path\", provider.command(:testing), \"Did not return correct binary path\")\n end",
"def l(t)\n\n if ENV['RUOTE_TEST_SPLIT'].to_s == 'true'\n\n puts\n puts \"=== #{t} :\"\n puts `ruby -I. #{t} #{ARGV.join(' ')}`\n\n es = $?.exitstatus\n es = es.nil? ? 66 : es.to_s.to_i\n\n #return if es != 0 && t.match(/eft_6_/)\n exit(es) if es != 0\n\n else\n\n load(t)\n end\nend",
"def ruby\n Gem.ruby\n end",
"def fails_on_jruby\n before do\n unless SpecConfig.instance.mri?\n skip \"Fails on jruby\"\n end\n end\n end",
"def fails_on_jruby\n before do\n unless SpecConfig.instance.mri?\n skip \"Fails on jruby\"\n end\n end\n end",
"def test_rubies_found_negative\n prospector = Rubyist.new(1)\n prospector.rubies_found(-2, -2)\n assert prospector.real_ruby_count.zero? && prospector.fake_ruby_count.zero?\n end",
"def test_relloadpath4\n with_fixture 'relloadpath4' do\n cd 'src' do\n assert system('ruby', ocra, 'relloadpath4.rb', *DefaultArgs)\n assert File.exist?('relloadpath4.exe')\n assert system('relloadpath4.exe')\n end\n end\n end",
"def test_Enviroment_001_showRubyEnv\r\n\r\n puts2(\"\")\r\n puts2(\"#######################\")\r\n puts2(\"Testcase: test_Enviroment_001_showRubyEnv\")\r\n puts2(\"#######################\")\r\n\r\n puts2(\"\\nTest - display_ruby_env\")\r\n # Record info on the Ruby Environment\r\n display_ruby_env() # Record output\r\n\r\n puts2(\"\\n\\nTest - display_ruby_environment\")\r\n display_ruby_environment()\r\n\r\n puts2(\"\\n\\nTest - display_watir_env\")\r\n display_watir_env()\r\n\r\n puts2(\"\\n\\nTest - find_tmp_dir\")\r\n puts2(find_tmp_dir)\r\n\r\n end",
"def initialize(str = nil, existing = nil)\n\n @system_ruby = false\n self.env_output = {}\n str = get_alias(str)\n\n case str\n when 'system'\n @system_ruby = true\n return\n\n when '', nil\n if existing\n # find version from existing rubies\n @interpreter, @version, @patchlevel, @gemset =\n parse_ruby_string(get_existing_ruby(config_db(\"interpreter\")))\n else\n @interpreter = config_db(\"interpreter\")\n @version = config_db(interpreter, \"version\")\n @patchlevel = config_db(interpreter, version, \"patchlevel\")\n end\n\n else\n @interpreter, @version, @patchlevel, @gemset = parse_ruby_string(str)\n\n if interpreter.nil? && version\n case version\n when /^1\\.(8\\.[6-7]|9\\.[1-3])$/\n @interpreter = \"ruby\"\n when /^1\\.[3-6].*$/\n @interpreter = \"jruby\"\n when /^1\\.[0-2]\\.\\d$/\n @interpreter = \"rbx\"\n when /^\\d*$/\n @interpreter = \"maglev\"\n when /^0\\.8|nightly$/\n @interpreter = \"macruby\"\n end\n elsif interpreter.nil? && version.nil?\n log(\"Ruby string not understood: #{str}\", \"debug\")\n end\n\n if !interpreters.include?(interpreter)\n log(\"Invalid ruby interpreter: #{interpreter}\", \"debug\")\n end\n\n if existing\n i, v, p, g = parse_ruby_string(get_existing_ruby(str))\n @version ||= v\n @patchlevel ||= p\n else\n @version ||= config_db(interpreter, \"version\")\n @patchlevel ||= config_db(interpreter, version, \"patchlevel\")\n end\n end\n\n # TODO use existing to pick suitable ruby if specified\n\n @ruby_string = \"#{interpreter}\"\n @ruby_string += \"-#{version}\" if version\n if patchlevel\n if interpreter == \"ruby\"\n @patchlevel.delete!('p')\n @ruby_string += \"-p#{patchlevel}\"\n else\n @ruby_string += \"-#{patchlevel}\"\n end\n end\n\n @ruby_home = File.join(env.path, \"rubies\", ruby_string)\n @gem_base = File.join(env.gems_path, ruby_string)\n if gemset\n @gem_home = \"#{gem_base}#{env.gemset_separator}#{gemset}\"\n else\n @gem_home = gem_base\n end\n @global_gem_home = \"#{gem_base}#{env.gemset_separator}global\"\n @gem_path = \"#{gem_home}:#{global_gem_home}\"\n\n # TODO why aren't some interpreters in config/known?\n if !known?\n log(\"Unknown ruby specification: #{str} -> #{ruby_string}. Proceeding...\", \"debug\")\n end\n if !valid?\n reset\n @ruby_string = str\n log(\"Invalid ruby specificiation: #{str}\", \"debug\")\n return\n elsif existing && !installed?\n reset\n @ruby_string = str\n log(\"No installed ruby with specificiation: #{str}\", \"debug\")\n return\n end\n end",
"def ree?\n RVM::Environment.current_ruby_string =~ /ree/\n end",
"def executable?() end",
"def sample_rubies\n @sample_rubies ||= sample_mri_rubies + %w[ jruby-9.3 ]\n end",
"def conscientious_require; end",
"def test_el4r_lisp2ruby__normal\n cmp = lambda{|str| assert_equal(str, eval(el4r_lisp2ruby(str)))}\n# (mode-info-describe-function 'prin1-to-string 'elisp)\n# (string= \"\\021\" (el4r-ruby-eval (el4r-lisp2ruby \"\\021\")))\n\n cmp[ \"\" ]\n cmp[ \"a\"*9999 ]\n cmp[ '1' ]\n cmp[ 'a' ]\n cmp[ '\\\\' ]\n cmp[ '\\\\\\\\' ]\n cmp[ '\\\\\\\\\\\\' ]\n cmp[ '\"\"' ]\n cmp[ '\"' ]\n cmp[ \"''\" ]\n cmp[ '#{1}' ]\n cmp[ '\\#{1}' ]\n cmp[ '#{\\'1\\'}' ]\n cmp[ '#@a' ]\n cmp[ \"\\306\\374\\313\\334\\270\\354\" ] # NIHONGO in EUC-JP\n end",
"def ruby(rubyfile)\n instance_eval(open_file(find_file(rubyfile, RUBY)))\n end",
"def linux? ; RUBY_PLATFORM =~ /linux/i end",
"def jruby?\n defined?( RUBY_ENGINE ) and RUBY_ENGINE == 'jruby'\nend",
"def virtual_file?(name)\n [\"(irb)\", \"-e\", \"(byebug)\", \"(eval)\"].include?(name)\n end",
"def ruby_code?(str)\n str = str.to_s\n return false if str.empty?\n checker = FoodCritic::ErrorChecker.new(str)\n checker.parse\n ! checker.error?\n end",
"def test_method\n # With slashes\n code = CodeTree.determine_code_from_path([\n \"Red.herring/\", \"Foo.menu/\", \".php/\"])\n assert_equal(\"Foo.php()\", code)\n end",
"def needs_syck?\n !LanguageSupport.using_engine?('jruby') &&\n LanguageSupport.using_version?('1.9.2')\n end",
"def test_relloadpath3\n with_fixture 'relloadpath3' do\n assert system('ruby', ocra, 'relloadpath3.rb', *DefaultArgs)\n assert File.exist?('relloadpath3.exe')\n assert system('relloadpath3.exe')\n end\n end",
"def test_platform_uses_unknown_if_uname_fails\n NewRelic::Helper.stubs('run_command').with('uname -s').raises(NewRelic::CommandRunFailedError)\n NewRelic::Agent::Samplers::MemorySampler.stub_const(:RUBY_PLATFORM, 'java') do\n platform = NewRelic::Agent::Samplers::MemorySampler.platform\n\n assert_equal 'unknown', platform\n end\n end",
"def ruby_installed?(ruby)\n cmd_if %{rvm list strings | grep -q \"#{ruby}\" >/dev/null}, true\nend",
"def test_platform_uses_uname_for_jruby\n stubbed = 'MCP'\n NewRelic::Helper.stubs('run_command').with('uname -s').returns(stubbed)\n NewRelic::Agent::Samplers::MemorySampler.stub_const(:RUBY_PLATFORM, 'java') do\n platform = NewRelic::Agent::Samplers::MemorySampler.platform\n\n assert_equal platform, stubbed.downcase\n end\n end",
"def ruby?\n RUBY_ENGINE == 'jruby'\n end",
"def self_test; end",
"def self_test; end",
"def preamble\n \"// BEGIN METARUBY PREAMBLE\n#include <ruby.h>\n#define RB_COMPARE(x, y) (x) == (y) ? 0 : (x) < (y) ? -1 : 1\ntypedef char * str;\n#define case_equal_long(x, y) ((x) == (y))\n// END METARUBY PREAMBLE\n\" + self.prototypes.join('')\n end",
"def test_found_returns_false_for_commands_not_found_in_path\n Crd::Flex::Command.new 'madeupcommandname' do |s|\n assert_equal( false, s.found? )\n end\n end",
"def test_vers_class_run_variant\n assert_equal 0, run_with_args(%w(-v))\n assert_match(/Ruby BlackBag version #{Rbkb::VERSION}/, @stdout_io.string)\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 which(cmd); end",
"def which(cmd); end",
"def which(cmd); end",
"def ruby\n \"ruby1.9.3 -S\"\n end",
"def test_should_be_syntax_error\n \n dir = \"./test_case/syntax_error.rb\"\n filename = dir\n \n result = check_and_compile_file( dir , filename )\n \n assert_equal(false, result)\n \n end",
"def test_helloworld\n with_fixture 'helloworld' do\n assert system(\"ruby\", ocra, \"helloworld.rb\", *DefaultArgs)\n assert File.exist?(\"helloworld.exe\")\n assert system(\"helloworld.exe\")\n end\n end",
"def test_bad_chicken_deps\n check_deps_fail \"notapackage\" => :chicken if which('csc')\n end",
"def test_bad_chicken_deps\n check_deps_fail \"notapackage\" => :chicken if which('csc')\n end",
"def test?\n RUBYMOTION_ENV == 'test'\n end"
] | [
"0.6885015",
"0.6803522",
"0.66688156",
"0.6385414",
"0.63833076",
"0.6321077",
"0.63190633",
"0.624093",
"0.6205193",
"0.6192729",
"0.61738044",
"0.6164089",
"0.61210835",
"0.611904",
"0.61179286",
"0.6086698",
"0.6081133",
"0.6062916",
"0.6053631",
"0.6053631",
"0.6051775",
"0.6047736",
"0.60353863",
"0.60088795",
"0.6003359",
"0.5985498",
"0.5939849",
"0.5932389",
"0.59316015",
"0.5919778",
"0.5915396",
"0.59031075",
"0.59031075",
"0.5892773",
"0.5889516",
"0.58805317",
"0.5879104",
"0.5866851",
"0.5865619",
"0.58386713",
"0.58270437",
"0.58225197",
"0.58225197",
"0.58172977",
"0.58000076",
"0.5796004",
"0.5776928",
"0.5776928",
"0.5761565",
"0.57506657",
"0.56774527",
"0.5676041",
"0.56626844",
"0.5659214",
"0.56564415",
"0.5626657",
"0.56255215",
"0.56211805",
"0.5620721",
"0.5611804",
"0.56056005",
"0.560446",
"0.5599275",
"0.5599275",
"0.5593005",
"0.55670094",
"0.55661446",
"0.5563446",
"0.5558628",
"0.5556868",
"0.553992",
"0.5531897",
"0.5529146",
"0.5525335",
"0.5524377",
"0.5509352",
"0.55089694",
"0.54980105",
"0.5485913",
"0.54833",
"0.54805166",
"0.54802275",
"0.5476687",
"0.5474145",
"0.54543614",
"0.54475117",
"0.54475117",
"0.5447488",
"0.54465234",
"0.5443956",
"0.54426336",
"0.54367554",
"0.54367554",
"0.54367554",
"0.54344684",
"0.5430725",
"0.5428041",
"0.54229397",
"0.54229397",
"0.5420866"
] | 0.63802236 | 5 |
This test when found both real and fake | def test_print_ruby_found_both
mock_location = Minitest::Mock.new('location')
def mock_location.name; 'a'; end
def plural?(x); 'ruby'; end
assert_output(" Found 1 ruby and 1 fake ruby in a.\n"){
@p.print_ruby_found_in_this_location(mock_location, [1, 1])}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fake?\n @test_mode == :fake\n end",
"def __dummy_test__\n end",
"def spec; end",
"def spec; end",
"def testing\n # ...\n end",
"def real?\n true\n end",
"def mock_model_simple(model,expected=:all)\n mock_model model, :name, expected\n end",
"def fake!(&block)\n switch_test_mode(:fake, &block)\n end",
"def verify_stubbed_calls; end",
"def stubbed?\n raise NotImplementedError\n end",
"def run_fe_tests\n end",
"def should; super end",
"def fake_mode?\n mode == :fake\n end",
"def get_actual\n end",
"def mock_expected(model,expected)\n other='tag'==model ? [] : :all\n t,p ='tag'==model ? [expected,other] : [other,expected]\n mock_file_tags t\n mock_directory_pictures p\n mock_unpaired_names []\n end",
"def test_print_fake\r\n test = Prospect.new(0)\r\n test.totalfakes = 1\r\n assert_output(/\\tFound 1 fake ruby in Enumerable Canyon. /) { test.print_all_rubies(test.totalruby, test.totalfakes)}\r\n end",
"def is_real?\n real?\n end",
"def test_Complex_InstanceMethods_real?\n\t\tassert_equal(false, Complex(1,1).real?)\n\t\tassert_equal(false, Complex(1,0).real?)\n\tend",
"def test_0_dummy\n\t\tend",
"def test_turn_putter_fake\n pros = Prospector.new(0,0,0)\n assert pros.turn_putter(0,1).eql? \"\\tFound 1 fake ruby in Enumerable Canyon\"\n end",
"def __mock_reset; end",
"def self_test; end",
"def self_test; end",
"def test_random_real_ruby\n mock_rng = Minitest::Mock.new('rng')\n def mock_rng.rand(x); 1; end\n result = @l1.random_real_ruby(mock_rng)\n assert_equal result, 1 # pass\n end",
"def setup\n flexmock(Woofer).new_instances.should_receive(:woof => :grrr)\n end",
"def test_search_repo\n \tfake_instance = Dummy.new\n \t#stubbing call to search_repositories\n\n \tclass << fake_instance.client\n \t\tdef search_repositories(query, params)\n \t\t\treturn DummySearchRepositories.new (query)\n \t\tend\n \tend\n\n \tassert fake_instance.search_repo('Hello World') != { :err => 'No results found' }\n \tassert fake_instance.search_repo('Anything Else') == { :err => 'No results found' }\n end",
"def mock_model(model,method,expected)\n expected=case\n# See ActiveRecord::Base method, '==='. Another way is to use object_id:\n when DirectoryPicture==model then Picture\n when FileTag ==model then Tag\n end.all.map &method if :all==expected\n model.expects(:all).at_least_once.returns(expected.sort.reverse.\n map{|e| (p=model.new).expects(method).at_least_once.returns e; p} )\n end",
"def test_random_fake_ruby\n mock_rng = Minitest::Mock.new('rng')\n def mock_rng.rand(x); 1; end\n val = @l1.random_fake_ruby(mock_rng)\n assert_equal val, 1 # pass\n end",
"def test_prospect_search_no_fakes\n \tlocation_stub = Minitest::Mock.new('Mock Location')\n pro = Prospector.new(1)\n def location_stub.loc\n \"Laboon Lake\"\n end\n def location_stub.max_rubies\n 1\n end\n def location_stub.max_fake_rubies\n 0\n end\n def location_stub.neighbor_list\n [\"Sean's Bowser Castle\", \"Kitty's Cozy Condo\"]\n end\n pro.change_curr_location(location_stub)\n pro.prospect_search(1)\n assert pro.total_fake_rubies == 0\n end",
"def test_truth\n end",
"def test_real_and_cli\n Dir.mktmpdir do |tmpdir|\n c = HttpCache.new tmpdir\n original, res = c.cached(:Get, REAL_URI)\n assert File.exist? c.entry(REAL_URI)\n assert_equal original, File.read(c.entry(REAL_URI))\n assert_kind_of Net::HTTPOK, res\n\n cached, response_when_cached = c.cached(:Get, REAL_URI)\n assert_nil response_when_cached\n assert_equal original, cached\n\n assert_equal original, `#{HTTP_CACHE_BIN} #{REAL_URI}`\n end\n rescue StandardError, MiniTest::Assertion => e\n skip \"Real request failed: #{e}\"\n end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def test_nil_town_search_found_something\n ruby_rush=RubyRush.new(1, 2, 3)\n doubled_prng = Minitest::Mock.new('doubled prng')\n def doubled_prng.rand(seed); 3; end\n ruby_rush.prng=doubled_prng\n ruby_rush.cur_fake_rb=3\n ruby_rush.fake_sp='rubies'\n assert_output(\"\\tFound #{ruby_rush.cur_fake_rb} fake #{ruby_rush.fake_sp} in #{ruby_rush.city}.\\n\" ) {ruby_rush.nil_town_search}\n end",
"def stubs_create_wrong()\n Usuario.stub!(:find_by_ci).with(anything()).and_return(nil)\n Registro.stub!(:new).and_return(mock_registro())\n I18n.stub!(:l).with(anything(), kind_of(Hash)).and_return(\"\")\n end",
"def expected_method; 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 exact_factory\n @exact_factory\n end",
"def testear_que_no_se_ensucia_la_clase_mockeada\n PersonalHome.mockear(:cantidad_personas) do\n 100\n end\n\n respuesta = PersonalHome.new.cantidad_personas\n respuesta.deberia ser 100\n end",
"def test_print_ruby_found_fake_only\n mock_location = Minitest::Mock.new('location')\n def mock_location.name; 'a'; end\n def plural?(x); 'ruby'; end\n assert_output(\" Found 1 fake ruby in a.\\n\") {\n @p.print_ruby_found_in_this_location(mock_location, [0, 1])}\n end",
"def test_should_calculate_value_of_unshipped_orders\n Order.stubs(:find_all).returns([Order.new, Order.new, Order.new])\n Order.any_instance.stubs(:shipped_on).returns(nil)\n Order.any_instance.stubs(:total_cost).returns(10)\n assert_equal 30, Order.unshipped_value\n end",
"def test_find_fake_rubies_zero\r\n\t\tassert_equal 0, @t2.find_fake_rubies\r\n\tend",
"def stub_implementation; end",
"def test_duck_type_beach_search_found_something\n ruby_rush=RubyRush.new(1, 2, 3)\n doubled_prng = Minitest::Mock.new('doubled prng')\n def doubled_prng.rand(seed); 2; end\n ruby_rush.prng=doubled_prng\n ruby_rush.cur_real_rb=2\n ruby_rush.cur_fake_rb=2\n ruby_rush.real_sp='rubies'\n ruby_rush.fake_sp='rubies'\n assert_output(\"\\tFound #{ruby_rush.cur_real_rb} #{ruby_rush.real_sp} and #{ruby_rush.cur_fake_rb} fake #{ruby_rush.fake_sp} in #{ruby_rush.city}.\\n\" ) {ruby_rush. duck_type_beach_search}\n end",
"def verify?; raise NotImplementedError; end",
"def mock_user(name = 'Bill Gates')\n fake_id User.new(name: name, email: \"user#{rand 100}@test.com\")\n end",
"def test_fake_string_big\n pros = Prospector.new(0,0,0)\n assert pros.fake_string(2).eql? '2 fake rubies'\n end",
"def test_dynamic_palisades_search_found_something\n ruby_rush=RubyRush.new(1, 2, 3)\n doubled_prng = Minitest::Mock.new('doubled prng')\n def doubled_prng.rand(seed); 2; end\n ruby_rush.prng=doubled_prng\n ruby_rush.cur_real_rb=2\n ruby_rush.cur_fake_rb=2\n ruby_rush.real_sp='rubies'\n ruby_rush.fake_sp='rubies'\n assert_output(\"\\tFound #{ruby_rush.cur_real_rb} #{ruby_rush.real_sp} and #{ruby_rush.cur_fake_rb} fake #{ruby_rush.fake_sp} in #{ruby_rush.city}.\\n\" ) {ruby_rush. dynamic_palisades_search}\n end",
"def test_make_sure_the_testing_structure_works\n make_controller :mock\n get :index\n assert_response :success\n get :secret_ferret_brigade\n assert_response :success\n end",
"def test_time_now_is_being_mocked_correctly\n assert_equal Time.at(0), Time.now\n end",
"def mock_model_bad_names(model,expected)\n model.expects(:find_bad_names).returns expected.sort.reverse\n end",
"def test_communication_with_person_and_organisation\n raise NotImplementedError, 'Need to test a communication with both a person and an organisation'\n\n end",
"def test_random_fake_rubies\n loc1 = Location.new(\"location 1\", 1000, 10)\n res = loc1.random_fake_rubies\n assert res >= 0 && res <= 10\n end",
"def test_legacy\n # Set up legacy handlers\n setup_legacy_handling\n\n common_tests\n end",
"def graffiti_test\n end",
"def expected?\n false\n end",
"def get(*params); raise('Stub or mock required.') end",
"def test_legacy_helpers\n assert_equal @patron.primary_phone, @patron.primary_address_phone\n assert_equal @patron.secondary_phone, @patron.secondary_address_phone\n assert_nil @patron.primary_address_mobile_phone\n assert_nil @patron.secondary_address_mobile_phone\n end",
"def test_change_curr_location_any\n \tlocation_stub = Minitest::Mock.new('Mock Location')\n \tpro = Prospector.new(1)\n \tdef location_stub.loc\n \"Laboon Lake\"\n end\n def location_stub.max_rubies\n 1\n end\n def location_stub.max_fake_rubies\n 1\n end\n def location_stub.neighbor_list\n [\"Sean's Bowser Castle\", \"Kitty's Cozy Condo\"]\n end\n pro.change_curr_location(location_stub)\n assert pro.curr_location.loc == \"Laboon Lake\"\n assert pro.curr_location.max_rubies == 1\n assert pro.curr_location.max_fake_rubies == 1\n assert pro.curr_location.neighbor_list.length == 2\n assert pro.curr_location.neighbor_list.include? \"Sean's Bowser Castle\"\n assert pro.curr_location.neighbor_list.include? \"Kitty's Cozy Condo\"\n end",
"def default_test\r\n end",
"def mock_model_unpaired_names(model,expected)\n model.expects(:find_unpaired_names).at_least_once.returns(\n expected.sort.reverse)\n end",
"def flexmock_get\n @mock\n end",
"def flexmock_get\n @mock\n end",
"def get_available(*params); raise('Stub or mock required.') end",
"def test?\n false\n end",
"def test_get_contents\n\tfake_instance = Dummy.new\n\t#positive test case where repository has package.json in it\n\tassert fake_instance.get_contents(49970642, 'package.json') != false\n\t#negative test case where repository id does not have package.json in it\n\tassert fake_instance.get_contents(1,'package.json') == false\n\t#negative test case with stringified repository id\n\tassert fake_instance.get_contents('1','package.json') == false\n\t#negative test case with repository id as nil\n\tassert fake_instance.get_contents(nil,'package.json') == false\n end",
"def test_driver_goes_to_other_place\r\n\t\tdriver = Driver.new(1)\r\n\t\tdriver.curr_location = \"Monroeville\"\r\n\t\tmock_driver = Minitest::Mock::new\r\n\t\tdef mock_driver.check_driver_done; 1; end\r\n\t\tdriver_status = driver.check_driver_done(driver)\r\n\t\tassert_equal driver_status, mock_driver.check_driver_done\r\n\tend",
"def fake?\n lname == 'nobody'\n end",
"def test() @test ||= Flickr::Test.new(self) end",
"def mock_affiliate(stubs={})\n @mock_affiliate ||= mock_model(Affiliate, stubs)\n end",
"def strict_order_mocks(*mocks)\n include Hardmock\n create_mocks *mocks\nend",
"def mocked_reseller\n Reseller.new\n end",
"def should\n @should\n end",
"def should\n @should\n end",
"def should\n @should\n end",
"def test_nothing\n return true\n end",
"def should\n @should\n end",
"def test_random_fake_rubies_zero\n loc1 = Location.new(\"location 1\", 100, 0)\n assert_equal 0, loc1.random_fake_rubies\n end",
"def test_random_total_ruby\n mock_rng = Minitest::Mock.new('rng')\n def mock_rng.rand(x); 1; end\n def random_fake_ruby(mock_rng); 1; end\n def random_real_ruby(mock_rng); 1; end\n assert_equal @l1.random_total_ruby(mock_rng), [1, 1]\n end",
"def test_truth\n assert_kind_of Forwarding, forwardings(:first)\n end",
"def red!\n @adapter = Mock.new(false, Janky.app)\n end",
"def actual?\n @actual\n end",
"def mock_error_type\n _undefined\n end",
"def test_fake_rubies_found\n\t\ttest_main = Main.new(3, 4, 6)\n\t\ttest_graph = Graph.new(10)\n\t\ttest_main.fake_rubies_found(7)\n\t\ttest_main.fake_rubies_found(7)\n\t\tassert test_main.num_fake_rubies, 14\n\tend",
"def rspec_mocks_method\n prefix = @count.nil? ? 'allow' : 'expect'\n suffix = @any_instance ? '_any_instance_of' : ''\n (prefix + suffix).to_sym\n end",
"def mock_enabled?\n settings.mock || false\n end",
"def mock_enabled?\n settings.mock || false\n end",
"def test_fetch_nonexistent_input_kind\n assert_nil(@service.inputs[temporary_name()])\n end",
"def default_test\n end",
"def isreal\n ONE\n end",
"def create_registry_with_service(should_mock)\n allow_any_instance_of(Registry).to receive(:persisted?).and_return(false) if should_mock\n svc = ::Registries::CreateService.new(nil, name: \"test\", hostname: \"test.lan\", use_ssl: false)\n svc.force = true\n svc.execute\n svc\nend",
"def test_prospect_search_no_rubies\n \tlocation_stub = Minitest::Mock.new('Mock Location')\n \tpro = Prospector.new(1)\n \tdef location_stub.loc\n \"Laboon Lake\"\n end\n def location_stub.max_rubies\n 0\n end\n def location_stub.max_fake_rubies\n 1\n end\n def location_stub.neighbor_list\n [\"Sean's Bowser Castle\", \"Kitty's Cozy Condo\"]\n end\n pro.change_curr_location(location_stub)\n pro.prospect_search(1)\n assert pro.total_rubies == 0\n end",
"def fake_token auths = %w(TS S U)\n token = Java::ezbake.data.test.TestUtils.createTestToken *auths\n token.validity.setIssuedTo @ezconfig.app.getSecurityID\n token.validity.setIssuedFor(options[:service] || 'mockTargetSecurityId')\n token\nend",
"def test_search\n mock_town = Minitest::Mock.new('Town')\n def mock_town.mine; [0, 0]; end\n\n def mock_town.return_name; 'Name'; end\n\n p1 = Prospector::new mock_town\n test_i = p1.search\n assert_equal test_i, -1\n end",
"def same; end",
"def test_should_not_create_invalid_post\n Post.any_instance.stubs(:save).returns(false)\n post :create, :post => { }\n assert_response :success\n end",
"def default_test; end",
"def get_usage(*params); raise('Stub or mock required.') end",
"def test_Complex_InstanceMethods_real\n\t\tassert_equal(2, Complex(2,3).real)\n\t\tassert_equal(0, Complex::I.real)\n\tend"
] | [
"0.67413753",
"0.65053064",
"0.64594936",
"0.64594936",
"0.61468804",
"0.60906947",
"0.6087012",
"0.6079838",
"0.60143846",
"0.5928686",
"0.5917107",
"0.5916533",
"0.5913764",
"0.58741933",
"0.5872553",
"0.5860513",
"0.5859962",
"0.5855707",
"0.58170646",
"0.5805466",
"0.5786841",
"0.57793236",
"0.57793236",
"0.57433337",
"0.5733181",
"0.5717613",
"0.5697926",
"0.5665896",
"0.5655513",
"0.56304884",
"0.56126404",
"0.56092215",
"0.56092215",
"0.56092215",
"0.56092215",
"0.56057316",
"0.55921656",
"0.5587725",
"0.5572918",
"0.55709624",
"0.5565011",
"0.55559754",
"0.5555435",
"0.5552899",
"0.5533235",
"0.55292004",
"0.55179214",
"0.55062747",
"0.5504867",
"0.55010474",
"0.5496471",
"0.5474566",
"0.5467427",
"0.5465793",
"0.54652303",
"0.54603064",
"0.54590094",
"0.5443575",
"0.54417825",
"0.54285467",
"0.5418295",
"0.54111576",
"0.5411028",
"0.5410476",
"0.5410476",
"0.5407248",
"0.54064846",
"0.5405493",
"0.5403668",
"0.5401097",
"0.53940177",
"0.5384704",
"0.53834176",
"0.53796864",
"0.5377945",
"0.5377945",
"0.5377945",
"0.5368873",
"0.5355376",
"0.53490734",
"0.5337725",
"0.5328393",
"0.5323657",
"0.5322369",
"0.5319664",
"0.531251",
"0.5311666",
"0.5309986",
"0.53087384",
"0.53086764",
"0.53037214",
"0.5301953",
"0.5301444",
"0.52944964",
"0.5289749",
"0.5288707",
"0.52858627",
"0.5283",
"0.5279452",
"0.5278942",
"0.5277972"
] | 0.0 | -1 |
This test when found nothing | def test_print_ruby_found_nothing
mock_location = Minitest::Mock.new('location')
def mock_location.name; 'a'; end
assert_output(" Found no rubies or fake rubies in a.\n"){
@p.print_ruby_found_in_this_location(mock_location, [0, 0])}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_for_empty_result\n assert_not_equal @you_tube.search.length, 0\n end",
"def results?() ! find(locator(:no_results_message)) end",
"def test_missing_search_value\n key = '_id'\n val = '8098765432'\n results = User.new(key, val).search\n assert_equal results, [], 'It must return an empty array if no search result is found'\n end",
"def not_found; end",
"def no_results\n print \"0 results found. \\n\"\n end",
"def test_cant_find_single_item\n\n result=find_single_item(@warehouse_data, :zz)\n assert_equal(nil,result)\n \nend",
"def nothing_found?\n @matching_documents.nil? or @matching_documents.entries.empty?\n end",
"def search_for_no_results\n visit('/locations?keyword=asdfdsggfdg')\n end",
"def test_cant_find_single_bay\n result = find_single_bay(@warehouse_data,\"elephant\")\n assert_equal(nil,result)\nend",
"def test_find_book__missing\n\n single_book = @library1.find_book(\"tek_wars\")\n\n assert_nil(single_book)\n\n end",
"def check_for_no_results(hash_of_results)\n if hash_of_results[JSON_NUMBER_OF_RESULTS] == 0\n puts 'No results, try again'\n go\n end\n end",
"def assert_no_records_match\n sleep 2\n expect(@polaris.login_home_page.text).to include(\"No matching records found\")\n end",
"def test_supportItemNullValue\n f = ItemFilter.new(\"support\")\n new_list = @usableItems.find_all{|x| f.apply(x)}\n return new_list.size == 0\n end",
"def test_nameUsableItemNullValue\n f = UsableItemFilter.new(\"name\")\n new_list = @usableItems.find_all{|x| f.apply(x)}\n return new_list.size == 0\n end",
"def sorry_message_displayed\n expect(no_items_found).to include(\"we're sorry we couldn't find anything to match your search\")\n end",
"def test_healingItemNullValue\n f = ItemFilter.new(\"healing\")\n new_list = @usableItems.find_all{|x| f.apply(x)}\n return new_list.size == 0\n end",
"def not_found\n @not_found = yield\n end",
"def test_emptyUsableItem\n f = UsableItemFilter.new()\n new_list = [].find_all{|x| f.apply(x)}\n return new_list.size == 0\n end",
"def test_nameBaseItemNullValue\n f = BaseItemFilter.new(\"name\")\n new_list = @baseItems.find_all{|x| f.apply(x)}\n return new_list.size == 0\n end",
"def nothingToSearch? \n\t\treturn $toSearch.empty? \n\tend",
"def test_physicalAttackUsableItemNullValue\n f = UsableItemFilter.new(\"physical_attack\")\n new_list = @usableItems.find_all{|x| f.apply(x)}\n return new_list.size == 0\n end",
"def empty?(response); end",
"def test_nil_search\n assert_raises(RuntimeError) { DuckDuckGo::search(:query => nil) }\n end",
"def test_nameItemNullValue\n f = ItemFilter.new(\"name\")\n new_list = @usableItems.find_all{|x| f.apply(x)}\n return new_list.size == 0\n end",
"def test_attackItemNullValue\n f = ItemFilter.new(\"attack\")\n new_list = @usableItems.find_all{|x| f.apply(x)}\n return new_list.size == 0\n end",
"def test_supportSkillNullValue\n f = SkillFilter.new(\"support\")\n new_list = @usableItems.find_all{|x| f.apply(x)}\n return new_list.size == 0\n end",
"def test_empty\n # Empty.\n end",
"def test_nonexistence\n record_not_found = false\n begin\n not_there = User.find(999999999)\n rescue ActiveRecord::RecordNotFound\n record_not_found = true\n end\n assert record_not_found\n end",
"def test_nothing\n end",
"def test_find_rental__missing\n\n single_book = @library1.find_rental(\"tek_wars\")\n\n assert_nil(single_book)\n\n end",
"def assert_zero_result(field, value)\n res = select_by_field(results, field, value)\n expect(res.length).to eq 0\n end",
"def assert_zero_result(field, value)\n res = select_by_field(results, field, value)\n expect(res.length).to eq 0\n end",
"def test_empty_name\n result=enter_the_room(\"\", {:check_response => false})\n assert result[\"result\"]=='empty'\n assert last_response.status==503\n end",
"def test_track_id_nil\n oh = LIBRARY.tracks.find_all {|s| s.track_id == nil}\n assert oh.none?\n end",
"def empty?\n self.results.empty?\n end",
"def test_physicalAttackItemNullValue\n f = ItemFilter.new(\"physical_attack\")\n new_list = @usableItems.find_all{|x| f.apply(x)}\n return new_list.size == 0\n end",
"def display_no_data\n if Movie.find_all.count == 0 and Episode.find_all.count == 0\n log(\"no new media found\")\n end\nend",
"def test_emptyBaseItem\n f = BaseItemFilter.new()\n new_list = [].find_all{|x| f.apply(x)}\n return new_list.size == 0\n end",
"def test_nameSkillNullValue\n f = SkillFilter.new(\"name\")\n new_list = @usableItems.find_all{|x| f.apply(x)}\n return new_list.size == 0\n end",
"def tolerate_not_found\n begin\n yield\n rescue Capybara::ElementNotFound\n nil\n end\n end",
"def test_healingSkillNullValue\n f = SkillFilter.new(\"healing\")\n new_list = @usableItems.find_all{|x| f.apply(x)}\n return new_list.size == 0\n end",
"def test_emptyItem\n f = ItemFilter.new()\n new_list = [].find_all{|x| f.apply(x)}\n return new_list.size == 0\n end",
"def test_nothing\n return true\n end",
"def is_empty()\n \n end",
"def assert_no_data_at data, path, msg=nil\n msg ||= \"Data found at #{path.inspect} for #{data.inspect}\"\n found = false\n\n Path.find path, data do |d,k,p|\n found = true\n break\n end\n\n assert !found, msg\n end",
"def test_can_get_no_entries\n get '/api/entries'\n assert last_response.ok?\n assert_equal [], parse_json_resp(last_response)\n end",
"def wont_be_empty(msg=nil)\n EmptyAssay.refute!(self, :message=>msg, :backtrace=>caller)\n end",
"def test_that_find_by_url_finds_us_when_nothing_else_matches\n assert_equal @page, @root.find_by_url(\"a/page\")\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 test_attackSkillNullValue\n f = SkillFilter.new(\"attack\")\n new_list = @usableItems.find_all{|x| f.apply(x)}\n return new_list.size == 0\n end",
"def expects_none?\n count_specified? ? matches_count?(0) : false\n end",
"def test_no_query_search\n assert_raises(RuntimeError) { DuckDuckGo::search({:bad => :hash}) }\n end",
"def test_print_result\r\n assert_nil @driver.results\r\n end",
"def test_results_zero\r\n assert_output(\"Going home empty-handed.\\n\") { @g.results(0) }\r\n end",
"def test_search_user_unsuccessful\n keyword = \"\"\n expected = 1001\n response = Net::HTTP.get(URI.parse('http://localhost:3000/v1/users/search/'+keyword))\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def test_srch_back_for_nonexist_pattern\n @buffer = Buffer.new 'Now is the time for all good men to come to the aid of their country'\n @buffer.fin\n @buffer.srch_back 'xxyyzz'\n assert_eq '', @buffer.at\n end",
"def test_missing_data\n get :show, { :type => 'DataRecord', :location => 'foo' }\n assert_response :missing\n end",
"def test_physicalAttackSkillNullValue\n f = SkillFilter.new(\"physical_attack\")\n new_list = @usableItems.find_all{|x| f.apply(x)}\n return new_list.size == 0\n end",
"def missed?; end",
"def test_nothing\n end",
"def test_nothing; end",
"def test_all_pets_by_breed__not_found\n pets = pets_by_breed(@pet_shop, \"Dalmation\")\n assert_equal(0, pets.count)\n end",
"def test_emptySkill\n f = SkillFilter.new()\n new_list = [].find_all{|x| f.apply(x)}\n return new_list.size == 0\n end",
"def blank; render :plain => \"Not Found.\", :status => 404 end",
"def test_nameArmorNullValue\n f = ArmorFilter.new(\"name\")\n new_list = @baseItems.find_all{|x| f.apply(x)}\n return new_list.size == 0\n end",
"def doesnt_exist\n\t\tputs \"That item doesn't exist.\"\n\t\tget_item\n\tend",
"def test_offers_not_found\r\n get :offers, :id => '1722342xxx'\r\n assert_response :missing\r\n end",
"def test_growthItemNullValue\n f = ItemFilter.new(\"growth\")\n new_list = @usableItems.find_all{|x| f.apply(x)}\n return new_list.size == 0\n end",
"def test_nameWeaponNullValue\n f = WeaponFilter.new(\"name\")\n new_list = @baseItems.find_all{|x| f.apply(x)}\n return new_list.size == 0\n end",
"def test_get_recipe_by_name__not_found\n assert_nil(@bakery.get_recipe_by_name(\"bloomer\"))\n end",
"def test_get_non_existing\n result = @cache.get('non_existing')\n\n assert_false result.success\n assert_nil result.args\n end",
"def test_capybara_can_ensure_something_is_not_found\n on_visiting_browserkoans_test_page do\n assert_equal __(false), page.has_selector?('#not-there')\n assert_nothing_raised do\n expect(page).to_not have_selector(__('#not-there'))\n end\n end\n end",
"def test_template_object_missing\n process :nothing\n assert_nil @response.template_objects['howdy']\n end",
"def test_person_no_upcoming_movies\n peter = Person.find( people(:peter_jackson).id )\n assert_equal true, peter.upcoming_movies.empty?\n end",
"def empty\n @count == 0\n end",
"def test_returns_no_matches\n records = Book.multi_solr_search \"not found\", :models => [Movie, Category]\n assert_equal [], records.docs\n assert_equal 0, records.total\n end",
"def test_0750_none?\n @@log.debug \"test_0750_none? starts\" if @@log.debug?\n assert_respond_to(@list, :none?, \"test_0750_none?_respond\")\n # All false gives true\n result = @list.none? {|obj| false }\n assert(result, \"test_0750_none?_false\")\n # All true gives false\n result = @list.none? {|obj| true }\n assert(result == false, \"test_0750_none?_truea\")\n # Any true gives false\n result = @list.none? {|obj| obj.ndata == 2 ? true : false }\n assert(result == false, \"test_0750_none?_true1\")\n @@log.debug \"test_0750_none? ends\" if @@log.debug?\n end",
"def test_empty_str\n assert_equal(\"\", @target.find_first_non_repeating(\"\"))\n end",
"def test_find_route_empty\n @south_america = Init.set_up_map('../JSON/test_data.json')\n santiago = @south_america.vertices[@south_america.metros['santiago']]\n route = santiago.find_route(@south_america.metros['bogota'])\n assert_equal(0, route.length)\n assert_instance_of(Array, route)\n end",
"def test_kindArmorNullValue\n f = ArmorFilter.new(\"kind\")\n new_list = @baseItems.find_all{|x| f.apply(x)}\n return new_list.size == 0\n end",
"def empty?\n total_count == 0\n end",
"def empty?\n total_count == 0\n end",
"def found?\n @found ||= !(self.result[\"Ares_odpovedi\"][\"Odpoved\"][\"Pocet_zaznamu\"] == '0' ||\n self.result[\"Ares_odpovedi\"][\"Odpoved\"][\"error\"])\n end",
"def test_01_fresh_basquet_is_empty\n muffinland_fresh_DB.should == \"New basquet w 0 items.\"\n end",
"def test_read_all_info_without_name\n get '/v1/read_all?data=eyAiQ291bnRyeSI6ICJCcmF6aWwiIH0='\n assert last_response.body.include?('Name field was not found in JSON')\n end",
"def parse_not_found\n if @input.match?(/% Object \"(.*)\" not found in database\\n/)\n while @input.scan(/%(.*)\\n/) # strip junk\n end\n @ast[\"NotFound\"] = true\n end\n end",
"def empty?() end",
"def empty?() end",
"def empty?() end",
"def test_falsy_finds(tests, method, options = {})\n tests.each do |test|\n matches = Ramparts.send(method, test, options)\n expect(matches.length).to eq(0), \"Expected empty array, got #{matches.length} for '#{test}'\"\n end\nend"
] | [
"0.6882303",
"0.68776333",
"0.68085444",
"0.68068045",
"0.67878693",
"0.6727451",
"0.66969925",
"0.6641532",
"0.66000116",
"0.65393806",
"0.6535918",
"0.64996576",
"0.64570075",
"0.6428928",
"0.6403459",
"0.64022905",
"0.6396129",
"0.6373394",
"0.6364813",
"0.63471556",
"0.6330661",
"0.63296497",
"0.6321456",
"0.6319256",
"0.63176674",
"0.6309406",
"0.62932986",
"0.62910455",
"0.6290079",
"0.628559",
"0.62801653",
"0.62801653",
"0.62647915",
"0.6234358",
"0.62073",
"0.6206224",
"0.620432",
"0.6202551",
"0.61991584",
"0.6195451",
"0.61833686",
"0.6180587",
"0.617995",
"0.61782885",
"0.617247",
"0.61662614",
"0.61555636",
"0.6149724",
"0.6146437",
"0.6146437",
"0.6146437",
"0.6146437",
"0.6146437",
"0.6146437",
"0.6146437",
"0.6146437",
"0.6146437",
"0.6146437",
"0.6146437",
"0.6146437",
"0.61454546",
"0.614502",
"0.61298627",
"0.6111573",
"0.6102353",
"0.6097963",
"0.60979515",
"0.60843414",
"0.60744935",
"0.6072518",
"0.6066706",
"0.6064951",
"0.6046371",
"0.6045626",
"0.60452825",
"0.60452735",
"0.6036619",
"0.6033336",
"0.60310096",
"0.60286885",
"0.60096914",
"0.6002693",
"0.6002166",
"0.5991058",
"0.59780353",
"0.59780234",
"0.5965338",
"0.59648085",
"0.5963983",
"0.596109",
"0.5959986",
"0.59597623",
"0.59597623",
"0.5959337",
"0.5948153",
"0.59452593",
"0.5941005",
"0.5930111",
"0.5930111",
"0.5930111",
"0.5924033"
] | 0.0 | -1 |
This test when argument is nil EDGE CASE | def test_print_ruby_found_nil
mock_location = Minitest::Mock.new('location')
def mock_location.name; 'a'; end
def plural?(x); 'ruby'; end
assert_raises(StandardError){@p.print_ruby_found_in_this_location(mock_location, nil)}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_has_edge_no_edge\n assert(@graph.has_edge('b', 'd') == false)\n end",
"def test_has_edge_no_vertices\n assert(@graph.has_edge('vertex1', 'vertex2') == false)\n end",
"def test_nil_args\n refute check_args(nil)\n end",
"def test_has_edges_when_empty\n graph = Graph.new\n\n assert(graph.has_edges() == false)\n end",
"def test_via_nil_string\r\n assert_equal 'Fifth Ave', @driver.via('nil', 'nil')\r\n end",
"def test_check_if_vertex_is_source_when_it_doesnt_exist\n assert(@dgraph.check_if_vertex_is_source('no_vertex') == false)\n end",
"def test_has_node_dummy_with_obj\n nonexistent_node = Node.new(1, [2])\n refute @graph.node?(nonexistent_node)\n end",
"def test_add_edge_no_vertices\n graph = Graph.new\n\n exception = assert_raises GraphError do\n graph.add_edge('a','b')\n end\n\n assert_equal('No edges can be added to an empty graph', exception.message)\n end",
"def test_convert_word_nil\n arr = nil\n assert_nil @grapher.convert_word(arr)\n end",
"def test_remove_edge\n @graph.remove_edge('a','b')\n\n # 0 and 1 are indexes of vertex a and vertex b respectively\n assert(@graph.vertices[0].neighbours[1] == nil && @graph.vertices[1].neighbours[0] == nil)\n end",
"def assertNilTest value\n assertNil value\n end",
"def test_input_target_is_nil\n Crd::Spec.new 'Testing' do |s|\n assert_nil( s.input )\n end\n end",
"def test_add_edge\n @dgraph.add_edge('a', 'b');\n\n # 0 and 1 are indexes of vertex a and vertex b respectively\n assert(@dgraph.vertices[0].neighbours[1] == true && @dgraph.vertices[1].neighbours[0] == nil)\n end",
"def test_add_node_invalid\r\n reader = GraphReader.new('whatever')\r\n assert_nil reader.add_node(nil, nil, [])\r\n end",
"def test_location_nil\n assert_raises StandardError do\n @loc1.add_neighbor nil\n end\n end",
"def test_check_if_vertex_is_source_when_not_source\n assert(@dgraph.check_if_vertex_is_source('c') == false && @dgraph.check_if_vertex_is_source('d') == false)\n end",
"def test_args_check_nil\n\t\targs_checker = ArgsChecker::new\n\t\tarr = nil\n\t\tassert_raises(\"I need one number bud, try again\") { args_checker.check_args arr }\n\tend",
"def test_remove_edge_first_vertex_missing\n\n exception = assert_raises GraphError do\n @dgraph.remove_edge('z','a')\n end\n\n assert_equal('Edge removal error. First vertex could not be found', exception.message)\n end",
"def test_remove_edge_first_vertex_missing\n\n exception = assert_raises GraphError do\n @graph.remove_edge('z','a')\n end\n\n assert_equal('Edge removal error. First vertex could not be found', exception.message)\n end",
"def test_remove_edge\n @dgraph.add_edge('a', 'b');\n @dgraph.remove_edge('a','b')\n\n # 0 and 1 are indexes of vertex a and vertex b respectively\n assert(@dgraph.vertices[0].neighbours[1] == nil)\n end",
"def wont_be_nil(msg=nil)\n NilAssay.refute!(self, :message=>msg, :backtrace=>caller)\n end",
"def test_add_edge_first_vertex_missing\n exception = assert_raises GraphError do\n @graph.add_edge('z','b')\n end\n\n assert_equal('Edge cannot be added. First vertex could not be found', exception.message)\n end",
"def test_connected_false \n \ttest_neighbor = Node.new(4, \"d\")\n\n \tassert_nil @n.connected?\n end",
"def on_nil(node)\n :false\n end",
"def test_no_arg\n\tassert_output(nil, abort) {GoldRush.argchecker(-1)}\n end",
"def test_permute_isnil\n word = nil\n assert_nil @grapher.permute(word)\n end",
"def test_no_arg\n\tassert_output(nil, abort) {GoldRush.argchecker()}\n end",
"def test_next_no_neighbors\r\n\t\tassert_nil @t.next\r\n\tend",
"def test_with_node_none\r\n link1 = @linklist.add_link(@node1, @node2)\r\n link2 = @linklist.add_link(@node2, @node3) \r\n \r\n assert(@linklist.with_node(@node4).length == 0)\r\n end",
"def test_has_edge\n @graph.add_edge('a', 'b');\n\n assert(@graph.has_edge('a', 'b') == true)\n end",
"def test_remove_edge_second_vertex_missing\n\n exception = assert_raises GraphError do\n @dgraph.remove_edge('a','z')\n end\n\n assert_equal('Edge removal error. Second vertex could not be found', exception.message)\n end",
"def test_graph_to_s_incomplete\n sut_graph = Graph.new\n sut_graph.name=\"test_graph\" \n #sut_graph.type=:digraph\n sut_graph.node_style=:ellipse\n \n sut_graph.add_edge(\"TEST1\" , \"TEST2\" , \"take_me_to_test_2\")\n assert_raises RuntimeError do\n returned_obj = sut_graph.to_s\n end # end assert\n end",
"def test_get_node_invalid\r\n reader = GraphReader.new('small_graph.txt')\r\n reader.create_graph()\r\n assert_nil reader.get_node(-1) \r\n end",
"def test_add_edge_second_vertex_missing\n\n exception = assert_raises GraphError do\n @graph.add_edge('a','z')\n end\n\n assert_equal('Edge cannot be added. Second vertex could not be found', exception.message)\n end",
"def test_find_vertex\n found_vertex = @graph.find_vertex('a')\n\n assert(found_vertex != nil && found_vertex.name == 'a')\n end",
"def test_remove_edge_second_vertex_missing\n\n exception = assert_raises GraphError do\n @graph.remove_edge('a','z')\n end\n\n assert_equal('Edge removal error. Second vertex could not be found', exception.message)\n end",
"def test_has_edges_vertices_only\n vertex_a = Vertex.new('a')\n vertex_b = Vertex.new('b')\n vertex_c = Vertex.new('c')\n graph = Graph.new\n graph.add_vertex(vertex_a).add_vertex(vertex_b).add_vertex(vertex_c)\n\n assert(graph.has_edges() == false)\n end",
"def test_print_start_nil\n assert_raises(StandardError) { print_start(nil) } # pass\n end",
"def test_new_graph_not_nil\n refute_nil(@graph)\n assert_kind_of(Graph, @graph)\n end",
"def nil?() end",
"def nil?() end",
"def nullG(g, gi, gv)\n not state(VARG, g, gi, gv)\nend",
"def test_nil_search\n assert_raises(RuntimeError) { DuckDuckGo::search(:query => nil) }\n end",
"def notTopEdge?\n @y.positive? ? self : nil\n end",
"def test_node_starts_with_empty_branches\n node = Node.new(50, \"movie a\")\n refute node.left_node\n refute node.right_node\n end",
"def has_edge?(vertex1, vertex2)\n\tend",
"def assert_src_is_not_nil(src, version, edition)\n if src.nil?\n raise 'The ISO download source is empty! '\\\n \"Set the node['visualstudio']['#{version}']['#{edition}']['source'] \" \\\n 'or node[\\'visualstudio\\'][\\'source\\'] attribute and run again!'\n end\n end",
"def test_to_s_empty_graph\n graph = Graph.new\n\n assert(graph.to_s == '')\n end",
"def left_edge?\n x == 0\n end",
"def test_neg_prospectors\n\t\trefute check_args([1, -1])\n\tend",
"def blank?(vertex)\n graph[*vertex] == BLANK\n end",
"def nil_node(t)\n raise NotImplementedError\n end",
"def test_output_target_is_nil\n Crd::Spec.new 'Testing' do |s|\n assert_nil( s.output )\n end\n end",
"def edge_net?(network_name:)\n @networks_nodes[network_name].nil? || @networks_nodes[network_name].length == 1\n end",
"def test_add_edge\n assert_equal(\"e1\", @e[0][:name])\n assert_equal(\"v1\", @e[1][:name])\n assert_equal(\"v2\", @e[2][:name])\n assert_equal(1, @e[0][:id])\n assert_equal(1, @g.e_id)\n assert_equal(1, @g.size)\n assert_raise(ArgumentError) { @g.add_edge( {:name=>\"e1\"}, \"v1\", {:name=>\"v2\"}) }\n assert_raise(ArgumentError) { @g.add_edge( {:name=>\"e1\"}, {:name=>\"v1\"}, \"v2\") }\n assert_raise(ArgumentError) { @g.add_edge( {:name=>\"e1\"}, \"v1\", \"v2\") }\n assert_raise(ArgumentError) { @g.add_edge( \"e1\", \"v1\", \"v2\") }\n assert_raise(ArgumentError) { @g.add_edge( \"e1\", {:name=>\"v1\"}, \"v2\") }\n end",
"def test_random_neighbor_no_connections\n assert_nil @loc1.random_neighbor\n end",
"def must_be_nil(msg=nil)\n NilAssay.assert!(self, :message=>msg, :backtrace=>caller)\n end",
"def assertNilWithMessageTest value, message\n assertNil value, message\n end",
"def test_invalid_integer_argument\n assert_raises \"TypeError: Invalid command line arguments.\" do\n @grapher.make_graph([1])\n end\n end",
"def Range3dIsNull(arg0)\n ret = _invoke(1610744078, [arg0], [VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def test_nil\n value = nil\n assert_nil value\n end",
"def test_nil\n value = nil\n assert_nil value\n end",
"def test_check_if_vertex_is_source\n @dgraph = DirectedGraph.new\n vertex_a = Vertex.new('a')\n vertex_b = Vertex.new('b')\n vertex_c = Vertex.new('c')\n vertex_d = Vertex.new('d')\n @dgraph.add_vertex(vertex_a).add_vertex(vertex_b).add_vertex(vertex_c).add_vertex(vertex_d)\n @dgraph.add_edge('a', 'd').add_edge('d', 'c')\n\n assert(@dgraph.check_if_vertex_is_source('a') == true && @dgraph.check_if_vertex_is_source('b') == true)\n end",
"def refute_nil(exp, msg=nil)\n #opts[:backtrace] ||= caller\n NilFailure.refute(exp, :message=>msg, :backtrace=>caller)\n end",
"def test_via_empty_string\r\n assert_equal 'Fifth Ave', @driver.via('', '')\r\n end",
"def test_nodes_is_empty\n\t\tassert_equal [], @location.nodes\n\tend",
"def test_missing_argument_invalid_argument\n\t\tc = Check.new\n\t\trefute c.check_arguments([1,1,'s'])\n\tend",
"def test_zero_prospectors\n\t\tassert check_args([1, 0])\n\tend",
"def test_check_coins_alpah\r\n assert_nil @g.check_coins('a')\r\n end",
"def test_add_edge\n @graph.add_edge('a', 'b');\n vertex_a = @graph.find_vertex('a')\n vertex_b = @graph.find_vertex('b')\n\n # 0 and 1 are indexes of vertex a and vertex b respectively\n assert(@graph.vertices[0].neighbours[1] == true && @graph.vertices[1].neighbours[0] == true)\n end",
"def get_edge_value(x, y)\n raise\n end",
"def test_random_neighbor_with_no_neighbors\n \tloc = Location.new('Lonely City')\n \tassert_nil loc.random_neighbor?\n end",
"def test_empty_branch\n #puts \"---------------test_branch-----------------\"\n t1 = t2 = nil\n GraphBuilder::Builder.build do |b|\n t1 = b.add(Thing1.new)\n b.branch do \n end\n t2 = b.add(Thing2.new)\n end\n\n r = Thing.links([t1,t2])\n assert_equal 1, r.size\n assert r.include? [t1,t2]\n end",
"def edge?(i,j)\n\t\tif(edge(i,j) != @no_edge_val)\n\t\t\treturn true\n\t\tend\n\t\treturn false\n\tend",
"def refute_nil(exp, msg=nil)\n NilAssay.refute!(exp, :message=>msg, :backtrace=>caller)\n end",
"def test_check_block_num_unequal\r\n assert_nil nil, @g.check_block_num(1, 0)\r\n end",
"def test_missing_required_params_one\n assert_raises(ArgumentError) { AzureVirtualNetworkPeering.new(resource_group: \"some_r_g\") }\n end",
"def has_vertex?(vertex)\n\tend",
"def test_noneuclideon\n\t\tassert_raise( RuntimeError ) { @room.connect(1, Direction::NORTH, Door.new(0)) }\n\tend",
"def assert_nil(exp, msg=nil)\n NilAssay.assert!(exp, :message=>msg, :backtrace=>caller)\n end",
"def safe_navigation(node)\n s(:begin,\n s(:or,\n s(:send,\n s(:send, node, :nil?),\n :!),\n s(:nil)))\n end",
"def test_initialize\n assert_equal(@vertex.edges.length, 0)\n assert_instance_of(Vertex, @vertex)\n end",
"def assert_proc_or_nil *args\n args.each{|a| assert{a.nil? || a.is_a?(Proc)}}\n end",
"def wont_be_empty(msg=nil)\n EmptyAssay.refute!(self, :message=>msg, :backtrace=>caller)\n end",
"def check_not_nil(data)\n data.should_not be_nil \n end",
"def test_has_edges\n graph = Graph.new\n vertex_a = Vertex.new('a')\n vertex_b = Vertex.new('b')\n vertex_c = Vertex.new('c')\n graph.add_vertex(vertex_a).add_vertex(vertex_b).add_vertex(vertex_c)\n graph.add_edge('b','c')\n\n assert(graph.has_edges() == true)\n end",
"def test_min_edgecases\n point = nil\n assert_nothing_raised do\n bbox = Geom::BoundingBox.new\n bbox.add [0,0,0]\n bbox.add [100,100,100]\n point = bbox.min\n end\n expected_point = Geom::Point3d.new 0,0,0\n assert_equal(expected_point, point,\n 'Failed in test_min_edgecases: positive point' )\n\n assert_nothing_raised do\n bbox = Geom::BoundingBox.new\n bbox.add [-10,-10,-10]\n bbox.add [-100,-100,-100]\n point = bbox.min\n end\n expected_point = Geom::Point3d.new -100,-100,-100\n assert_equal(expected_point, point,\n 'Failed in test_min_edgecases: negative point' )\n \n assert_nothing_raised do\n bbox = Geom::BoundingBox.new\n point = bbox.min\n end\n # Empty boxes should return very large positive numbers\n x_very_small = point.x > 1000000000000000000000000\n y_very_small = point.y > 1000000000000000000000000\n z_very_small = point.z > 1000000000000000000000000\n assert_equal(true, x_very_small,\n 'Failed in test_min_edgecases: empty bb x' )\n assert_equal(true, y_very_small,\n 'Failed in test_min_edgecases: empty bb y' )\n assert_equal(true, z_very_small,\n 'Failed in test_min_edgecases: empty bb z' )\n end",
"def validate!\n fail '-- error: nil elements detected' unless nodes.all? && edges.all?\n\n unless nodes.all?(&:name)\n causer = nodes.detect{|e| !e.name}\n fail \"-- error: node without name @#{causer}\"\n end\n end",
"def internal_vertex?(v)\n not pred(v).empty? and not succ(v).empty?\n end",
"def edge\n :first if first?\n :last if last?\n nil\n end",
"def none?\n fail NotImplementedError\n end",
"def test_top_edge_enumerated_left_to_right\n assert_equal [0, 1, 0, 1, 0], @p.edge(:top)\n end",
"def test_location_no_neighbors\n assert_equal @l1.neighbors, [] # pass\n end",
"def nil?() true; end",
"def test_print_empty\n assert_output(\"Empty graph!\\n\") { @graph.print }\n end",
"def test_topOnEmptyStack\n assert_nil(@stack.top)\n end",
"def true(_argvs)\n return nil\n end",
"def null?; false end",
"def check_add_edge(anEdge)\n anEdge\n end",
"def test_empty\r\n args = Args.new\r\n assert_equal false, args.check_args(\" \")\r\n end",
"def test_location_connections_empty\n assert @loc1.neighbors.empty?\n end"
] | [
"0.71505594",
"0.70078087",
"0.6634852",
"0.662769",
"0.6485943",
"0.64254147",
"0.6422998",
"0.6360296",
"0.6326705",
"0.63161576",
"0.62704766",
"0.6255437",
"0.6251999",
"0.6228068",
"0.6221162",
"0.62035376",
"0.6185076",
"0.61512774",
"0.611913",
"0.6115905",
"0.6098258",
"0.60736704",
"0.6067566",
"0.606589",
"0.60597825",
"0.6044484",
"0.6025019",
"0.5948622",
"0.5945245",
"0.59433836",
"0.5941476",
"0.59365904",
"0.5928731",
"0.5920152",
"0.5911198",
"0.5898226",
"0.5882668",
"0.5848255",
"0.584662",
"0.5843791",
"0.5843791",
"0.58241165",
"0.5823779",
"0.5816177",
"0.5806954",
"0.58047664",
"0.57922864",
"0.57649195",
"0.5738685",
"0.57242024",
"0.57226706",
"0.57036453",
"0.5700702",
"0.5678907",
"0.56743336",
"0.5672597",
"0.566591",
"0.56535524",
"0.565132",
"0.5651197",
"0.5649445",
"0.5649445",
"0.5610786",
"0.5591527",
"0.5587735",
"0.55767643",
"0.5567877",
"0.55590117",
"0.55585825",
"0.55515957",
"0.55499065",
"0.5538198",
"0.5537664",
"0.5528111",
"0.5525326",
"0.5513605",
"0.5510534",
"0.54953444",
"0.5489743",
"0.5488863",
"0.5482758",
"0.5482056",
"0.5466126",
"0.5455017",
"0.5444656",
"0.5437091",
"0.54362756",
"0.543247",
"0.5430241",
"0.54286486",
"0.54282224",
"0.5424216",
"0.54100925",
"0.5403363",
"0.5401393",
"0.54008937",
"0.53978384",
"0.5390874",
"0.5387245",
"0.5385265",
"0.538521"
] | 0.0 | -1 |
UNIT TESTS FOR print_heading(x, y) Equivalence classes: p_location & c_location is int p_location & c_location is float p_location & c_location is string p_location & c_location is nil (EDGE CASE) This test when p_location & c_location is int | def test_print_heading_int
assert_output("Heading from 1 to 2\n") {@p.print_heading(1, 2)}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_print_heading_float\n assert_output(\"Heading from 1.1 to 1.2\\n\"){@p.print_heading(1.1, 1.2)}\n end",
"def print_heading(p_location, c_location)\n puts \"Heading from #{p_location} to #{c_location}\"\n end",
"def test_print_heading_string\n assert_output(\"Heading from a to b\\n\"){@p.print_heading('a', 'b')}\n end",
"def test_print_heading_nil\n assert_output(\"Heading from to \\n\"){@p.print_heading(nil, nil)}\n end",
"def test_print_location\n \t@gold_rush.initialize(2, 2)\n \tassert_equal \"Heading from Sutter Creek to Angels Camp, holding 1 ounce of gold and 0 ounces of silver.\", @gold_rush.print_location(@prospectors[0], 0)\n end",
"def report\n if (@position_x.is_a? Integer) && (@position_x.is_a? Integer) && (ToyEnums::ALL_DIRECTION.include? @current_rotation)\n puts [@position_x, @position_y, @current_rotation].join(',')\n else\n raise ToyEnums::MSG_ERROR\n end\n end",
"def report\n return 'Not on table' if @position.nil? || @direction.nil?\n\n \"#{@position[:x]},#{@position[:y]},#{@direction.to_s.upcase}\"\n end",
"def display_piece_by_location(piece, location)\nif location == 2 || location == 5\nprint_piece(piece, \"\\n\\t\")\nprint_separator_line\nelsif location == 8\nprint_piece(piece, \"\\n\")\nelse\nprint_piece(piece, SEPARATOR[:vertical])\nend\nend",
"def test_scenario1 \n r = robot\n r.move(table)\n assert_equal('0,1,NORTH', r.report)\n end",
"def report\n check_placement\n\n \"#{x},#{y},#{direction}\"\n end",
"def print_heading(content, other)\n puts \"=\" * content.length\n puts \"#{content}\"\n puts \"=\" * content.length\n puts \"=\" * other.length\n puts \"#{other}\"\n puts \"=\" * other.length\nend",
"def report_location\n return \"#{@coords_x} #{@coords_y} #{@orientation}\" if @alive\n return 'ROVER LOST' unless @alive\n end",
"def test_driver_checkLocation_mid\n\t\td = Driver::new(\"Driver 1\",1)\n\t\td.checkLocation\n\t\t# assert_equal d.classes, 2\n\t\td.setLocation 1 #from cathedral go to museum\n\t\td.checkLocation\n\t\tassert_equal [2,1], [d.classes,d.dinotoys]\n\t\t#assert_equal d.dinotoys, 1\n\tend",
"def test_movement_printing_two_way\r\n\t\tdriver = Driver::new(\"Driver 1\")\r\n\t\thospital = Location::new(\"Hospital\", \"Foo St.\", \"Fourth Ave.\")\r\n\t\tmuseum = Location::new(\"Museum\", \"Bar St.\", \"Fifth Ave.\")\r\n\t\tcathedral = Location::new(\"Cathedral\", \"Bar St.\", \"Fourth Ave.\")\r\n\t\r\n\t\thospital.new_one_way cathedral\r\n\t\thospital.new_two_way museum\r\n\r\n\t\tdriver.current_location(hospital)\r\n\r\n\t\tdriver_move_print(driver, 1)\r\n\tend",
"def test_driver_setLocation_cathedral\n\t\td = Driver::new(\"Driver 1\",0)\n\t\td.setLocation 0 #hospital to cathedral\n\t\tassert_equal d.getLocation, 1\n\tend",
"def test_driver_setLocation_hospital\n\t\td = Driver::new(\"Driver 1\",2)\n\t\td.setLocation 1 #hillman to hospital\n\t\tassert_equal d.getLocation, 0\n\tend",
"def _Heading\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_SetextHeading)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_AtxHeading)\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_Heading unless _tmp\n return _tmp\n end",
"def print_verification_of_position_info\r\n #Test to see if characters are correct\r\n puts \"characters from position matrix----------start\"\r\n @list_of_word_rows.each do |word_row|\r\n word_row.position_list.each do |position|\r\n print position.character\r\n end\r\n puts \"\"\r\n end\r\n puts \"words from position matrix----------end\"\r\n puts \"\"\r\n\r\n #Test to see if word starts and ends are correct\r\n puts \"start and end of words from position matrix----------start\"\r\n @list_of_word_rows.each do |word_row|\r\n word_row.position_list.each do |position|\r\n if position.start_of_word\r\n print \"^\"\r\n print position.character\r\n print position.word_number\r\n end\r\n #If the character is a single letter word, then the char is both the start and end of the word.\r\n #Don't reprint the character, which has already been printed\r\n if position.start_of_word && position.end_of_word\r\n print \"*\"\r\n #If the character is at the end of a word, print the character\r\n elsif position.end_of_word\r\n print position.character\r\n print position.word_number\r\n print \"*\"\r\n end\r\n if !position.start_of_word && !position.end_of_word\r\n print position.character\r\n if position.character != \" \"\r\n print position.word_number\r\n end\r\n end\r\n end\r\n puts \"\"\r\n end\r\n puts \"start and end of words from position matrix----------end\"\r\n\r\n #Test to see if word numbers are correct\r\n puts \"word numbers from position matrix----------start\"\r\n @list_of_word_rows.each do |word_row|\r\n word_row.position_list.each do |position|\r\n print position.word_number.to_s + \" \"\r\n end\r\n puts \"\"\r\n end\r\n puts \"word numbers from position matrix----------end\"\r\n\r\n\r\n #Test to see if line starts and ends are correct\r\n puts \"\"\r\n puts \"start and end of lines from position matrix----------start\"\r\n @list_of_word_rows.each do |word_row|\r\n word_row.position_list.each do |position|\r\n if position.start_of_line\r\n print \"-\"\r\n elsif position.end_of_line\r\n print \"+\"\r\n else\r\n print position.character\r\n end\r\n end\r\n puts \"\"\r\n end\r\n puts \"start and end of lines from position matrix----------end\"\r\n end",
"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_print_some_both_types\n\t\tp = Print.new\n\t\tassert_output(\"\\tFound 1 ruby and 2 fake rubies in Town.\\n\") {p.print_day([1,2],'Town')}\n\tend",
"def test_day_output_several_real\r\n location = Minitest::Mock.new(\"test_location_arr\")\r\n def location.get_id(index); \"Hash Crossing\"; end\r\n assert_output(\"\\tFound 2 rubies in Hash Crossing.\\n\") { @g.day_output([2, 0], 3, location) }\r\n end",
"def test_scenario3\n r = Robot.new(1, 2, 'EAST')\n r.move(table)\n r.move(table)\n r.turn_left\n r.move(table)\n assert_equal('3,3,NORTH', r.report)\n end",
"def location_heading\n LOCATION_HEADING\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 test_print_one_type\n\t\tp = Print.new\n\t\tassert_output(\"\\tFound 1 ruby in Town.\\n\") {p.print_day([1,0],'Town')}\n\tend",
"def test_driver_setLocation_hillman\n\t\td = Driver::new(\"Driver 1\",0)\n\t\td.setLocation 1 #museum to hillman\n\t\tassert_equal d.getLocation, 2\n\tend",
"def report\n return \"Not on board\" if @position.nil? or @direction.nil?\n\n \"#{@position[:x]},#{@position[:y]},#{@direction.to_s.upcase}\"\n end",
"def report\n return \"Not on board\" if @position.nil? or @direction.nil?\n\n \"#{@position[:x]},#{@position[:y]},#{@direction.to_s.upcase}\"\n end",
"def h(heading)\n puts \"\"\n puts \"-\"*10\n puts heading\n puts \"-\"*10\nend",
"def report_robot_details details\r\n\tprint(\"\\nCurrent position details\")\r\n\tprintf(\"\\nFORMAT : (X,Y) - Face Direction => (%d,%d) - %s\", details.x, details.y, DIRECTIONS[details.f])\r\nend",
"def determine_heading(new_position)\n case $track[[new_position[0], new_position[1]]]\n when \"\\\\\"\n if @direction == :right || @direction == :left\n turn_right\n else\n turn_left\n end\n when \"/\"\n if @direction == :right || @direction == :left\n turn_left\n else\n turn_right\n end\n when \"+\"\n # turn order goes left -> straight -> right\n if @last_turn_direction == :right\n @last_turn_direction = :left\n turn_left\n elsif @last_turn_direction == :left\n @last_turn_direction = :straight\n # no turn necessary\n else # last turn was straight\n @last_turn_direction = :right\n turn_right\n end\n end\n end",
"def test_for_not_cathedral\n testLocation = LocationNode.new(\"Hillman\",nil,nil,nil,nil)\n assert_equal false, incrementClass(testLocation)\n end",
"def test_name_is_hillman\n\t\tassert_equal \"Hillman\", @location.name\n\tend",
"def test_move_str\n mock_loc = Minitest::Mock.new \"mock_loc\"\n\tdef mock_loc.name;\"previous location\";end\n\tmock_loc2 = Minitest::Mock.new \"mock_loc2\"\n\tdef mock_loc2.name;\"next location\";end\n\tmap = Map.new\n\tmap.nodes = [mock_loc, mock_loc2]\n\tdummy_rng = Minitest::Mock.new(\"dummy_rng\")\n\tdef mock_loc.choose_neighbor(a);1;end\n p = Prospector.new(0, mock_loc, 0)\n\tp.total_gold = 1\n\tp.total_silver = 1\n\tassert p.move(dummy_rng, map), \"Heading from previous location to next location \"\\\n \"holding 1 ounce of gold and \"\\\n\t\"#1 ounce of silver\"\n end",
"def test_driver_checkLocation_start\n\t\td = Driver::new(\"Driver 1\",1)\n\t\td.checkLocation\n\t\tassert_equal d.classes, 2\n\tend",
"def test_location_name\n assert_equal @l1.name, 'a' # pass\n end",
"def test_top_left_one_unit_per_floor_no_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 3\n args_hash['level'] = 'Top'\n args_hash['corridor_position'] = 'None'\n args_hash['horz_location'] = 'Left'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 2, 'ShadingSurface' => 6, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 1 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end",
"def test_top_left_two_unit_per_floor_no_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 6\n args_hash['level'] = 'Top'\n args_hash['corridor_position'] = 'None'\n args_hash['horz_location'] = 'Left'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 2, 'ShadingSurface' => 6, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 2 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end",
"def test_top_mid_six_unit_per_floor_double_ext_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 18\n args_hash['level'] = 'Top'\n args_hash['corridor_position'] = 'Double Exterior'\n args_hash['horz_location'] = 'Middle'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 3, 'ShadingSurface' => 7, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 4 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end",
"def test_day_output_one\r\n location = Minitest::Mock.new(\"test_location_arr\")\r\n def location.get_id(index); \"Nil Town\"; end\r\n assert_output(\"\\tFound 1 ruby and 1 fake ruby in Nil Town.\\n\") { @g.day_output([1, 1], 3, location) }\r\n end",
"def position\n puts \"X: #{@x_coord}\"\n puts \"Y: #{@y_coord}\"\n puts \"Direction: #{@direction}\"\n end",
"def test_top_left_two_unit_per_floor_single_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 6\n args_hash['level'] = 'Top'\n args_hash['corridor_position'] = 'Single Exterior (Front)'\n args_hash['horz_location'] = 'Left'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 3, 'ShadingSurface' => 7, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 2 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end",
"def output\n puts \"#{@coord_x} #{@coord_y} #{@direction}\"\nend",
"def test_bot_left_two_unit_per_floor_single_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 6\n args_hash['level'] = 'Bottom'\n args_hash['corridor_position'] = 'Single Exterior (Front)'\n args_hash['horz_location'] = 'Left'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 2, 'ShadingSurface' => 3, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 2 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end",
"def test_rubyist_display\r\n location = Minitest::Mock.new(\"test_location_arr\")\r\n def location.get_id(index); \"Hash Crossing\"; end\r\n assert_output(\"Rubyist #1 starting in Hash Crossing.\\n\") { @g.new_rubyist_display(1, location) }\r\n end",
"def test_location_change\r\n location = Minitest::Mock.new(\"test_location_arr\")\r\n def location.get_id(index); \"Hash Crossing\"; end\r\n assert_output(\"Heading from Hash Crossing to Hash Crossing.\\n\") { @g.location_change(location, 0, 0)}\r\n end",
"def test\n # triangle inequality theorem\n if ( ((@a+@b)>@c) && ((@a+@c)>@b) && ((@b+@c)>@a) )\n if (@a==@b && @b==@c)\n @type = \"equilateral\"\n @base = @a\n @height = sqrt((@c**2) - (@a/2.0)**2) # pythagoras\n elsif ((@a*@a + @b*@b) == @c*@c)\n @type = \"right\"\n @base = @a\n @height = @b\n elsif (@a == @b) # smaller sides are equal\n @type = \"isosceles\"\n @base = @c # base is larger side\n @height = sqrt(@b**2 - (@c/2.0)**2)\n elsif (@b == @c) # larger sides are equal\n @type = \"isosceles\"\n @base = @a # base is smaller side\n @height = sqrt(@c**2 - @a**2)\n else\n @type = \"scalene\"\n @base = @c\n \n # simplified algebra used to find height of scalene\n x = (@a**2 + @c**2 - @b**2) / (2.0*@c)\n @height = sqrt(@a**2 - x**2)\n \n end\n @valid = true\n else\n @type = \"not a triangle\"\n @valid = false\n end\n end",
"def test_top_left_one_unit_per_floor_single_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 3\n args_hash['level'] = 'Top'\n args_hash['corridor_position'] = 'Single Exterior (Front)'\n args_hash['horz_location'] = 'Left'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 3, 'ShadingSurface' => 7, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 1 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end",
"def test_bot_left_two_unit_per_floor_no_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 6\n args_hash['level'] = 'Bottom'\n args_hash['corridor_position'] = 'None'\n args_hash['horz_location'] = 'Left'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 1, 'ShadingSurface' => 2, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 2 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end",
"def move (direction)\n\n [email protected]_valid_move @xpos, @ypos\n\n if direction == 'north'\n @ypos += 1\n elsif direction == 'east'\n @xpos += 1\n elsif direction == 'south'\n @ypos -= 1\n elsif direction == 'west'\n @xpos -= 1\n end\n\n else\n puts \"that's not a valid move\"\n end\n\n def report\n \"My co-ordinates are #{@xpos}, #{@ypos}\"\n end\nend",
"def calculate_heading()\n @heading[:x], @heading[:y] = Params::directional_vector @angle\n end",
"def guess_heading(node)\n return nil if node.font_size == nil\n [*1...HEADING_DEPTH].each do |heading|\n return \"h#{heading}\" if node.font_size >= h(heading)\n end\n nil\n end",
"def report\n\t\tputs \"My current location is (#{@x}, #{@y}) facing #{@robot_direction}.\"\n\tend",
"def test_bot_left_one_unit_per_floor_single_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 3\n args_hash['level'] = 'Bottom'\n args_hash['corridor_position'] = 'Single Exterior (Front)'\n args_hash['horz_location'] = 'Left'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 2, 'ShadingSurface' => 3, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 1 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end",
"def test_getLocation_string\n\t\td = Driver::new(\"Driver 1\",0);\n\t\tdef d.getLocation; d.location=\"string\",\"string\"; end\n\t\tassert_raises (\"Invalid location\") {d.getLocation}\n\tend",
"def test_bot_left_one_unit_per_floor_no_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 3\n args_hash['level'] = 'Bottom'\n args_hash['corridor_position'] = 'None'\n args_hash['horz_location'] = 'Left'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 1, 'ShadingSurface' => 2, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 1 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end",
"def validate_heading(heading)\n if !heading[:heading_level].is_a?(Integer)\n return false\n end\n if heading[:heading_level] < 0\n return false\n end\n return true\nend",
"def test_movement_check_one_way\r\n\t\tdriver = Driver::new(\"Driver 1\")\r\n\t\thospital = Location::new(\"Hospital\", \"Foo St.\", \"Fourth Ave.\")\r\n\t\tmuseum = Location::new(\"Museum\", \"Bar St.\", \"Fifth Ave.\")\r\n\t\tcathedral = Location::new(\"Cathedral\", \"Bar St.\", \"Fourth Ave.\")\r\n\t\r\n\t\thospital.new_one_way cathedral\r\n\t\thospital.new_two_way museum\r\n\r\n\t\tdriver.current_location(hospital)\r\n\t\tdriver_move(driver, 0)\r\n\t\tassert_equal cathedral, driver.location\r\n\tend",
"def\n\t\tprint_point\n\t\tp \"(#{x}, #{y})\"\t\n\tend",
"def test_bot_mid_six_unit_per_floor_double_ext_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 18\n args_hash['level'] = 'Bottom'\n args_hash['corridor_position'] = 'Double Exterior'\n args_hash['horz_location'] = 'Middle'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 2, 'ShadingSurface' => 3, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 4 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end",
"def test_getLocation_pos_invalid\n\t\td = Driver::new(\"Driver 1\",0);\n\t\tdef d.getLocation; d.location=999,999; end\n\t\tassert_raises (\"Invalid location\") {d.getLocation}\n\tend",
"def test_top_left_two_unit_per_floor_double_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 6\n args_hash['level'] = 'Top'\n args_hash['corridor_position'] = 'Double-Loaded Interior'\n args_hash['horz_location'] = 'None'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 12, 'ThermalZone' => 2, 'Space' => 2, 'SpaceType' => 2, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 2, 'ShadingSurface' => 8, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 5 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end",
"def test_bot_left_two_unit_per_floor_double_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 6\n args_hash['level'] = 'Bottom'\n args_hash['corridor_position'] = 'Double-Loaded Interior'\n args_hash['horz_location'] = 'None'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 12, 'ThermalZone' => 2, 'Space' => 2, 'SpaceType' => 2, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 1, 'ShadingSurface' => 2, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 5 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end",
"def _SetextHeading\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_SetextHeading1)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_SetextHeading2)\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_SetextHeading unless _tmp\n return _tmp\n end",
"def printTestExpectedOutput( fp )\n\t\tfp.printf( \"%s\\t\", @name ) if @name\n\t\tmissing = countMissing()\n\t\tfp.printf( \"%s:%s:%d:%d\\t\",\n\t\t\t\tmissing < @vector.length ? \"I\" : \"?\",\n\t\t\t\tdegenerate? ? \"!\" : \"-\", \n\t\t\t\t@cats, \n\t\t\t\tmissing )\n\t\tfp.puts( @vector.collect { |x| x.nil? ? OUTPUT_NA_MARKER : x }.join(\"\\t\") )\n\tend",
"def printTestExpectedOutput( fp )\n\t\tfp.printf( \"%s\\t\", @name ) if @name\n\t\tmissing = countMissing()\n\t\tfp.printf( \"%s:%s:%d:%d\\t\",\n\t\t\t\tmissing < @vector.length ? \"I\" : \"?\",\n\t\t\t\tdegenerate? ? \"!\" : \"-\", \n\t\t\t\t@cats, \n\t\t\t\tmissing )\n\t\tfp.puts( @vector.collect { |x| x.nil? ? OUTPUT_NA_MARKER : x }.join(\"\\t\") )\n\tend",
"def printProbe\n puts \"Your origin was (#{@x},#{@y},#{@z})\"\n puts \"Traveled #{@traveled_distance}\"\n puts \"Visited #{@visited_stars}\"\n puts \"Explored #{@explored_planets}\"\n puts \"Remaining fuel #{@fuel}\"\n end",
"def test_location_1\r\n\t\tdriver = Driver::new(\"Driver\")\r\n\t\t\r\n\t\thillman = Location.new(\"Hillman\", \"Foo St.\", \"Fifth Ave.\")\r\n\t\thospital = Location.new(\"Hospital\", \"Foo St.\", \"Fourth Ave.\")\r\n\t\tmuseum = Location.new(\"Museum\", \"Bar St.\", \"Fifth Ave.\")\r\n\t\tcathedral = Location.new(\"Cathedral\", \"Bar St.\", \"Fourth Ave.\")\r\n\t\t\r\n\t\tlocations = [hillman, hospital, cathedral, museum]\r\n\t\t\r\n\t\trandom_start_location(driver, 1, locations)\r\n\t\tassert_equal hospital, driver.location\r\n\tend",
"def test_rubyist_display_string\r\n location = Minitest::Mock.new(\"test_location_arr\")\r\n def location.get_id(index); \"Hash Crossing\"; end\r\n assert_raises('rubyist_num must be an intenger!') { @g.new_rubyist_display('a', location) }\r\n end",
"def position\n return [@x, @y, @heading]\n end",
"def test_day_output_several_both\r\n location = Minitest::Mock.new(\"test_location_arr\")\r\n def location.get_id(index); \"Matzburg\"; end\r\n assert_output(\"\\tFound 2 rubies and 2 fake rubies in Matzburg.\\n\") { @g.day_output([2, 2], 3, location) }\r\n end",
"def test_showResults\n\t\td = Driver::new(\"Driver 1\",0)\n\t\tassert_output (\"Driver 1 obtained 0 books!\\nDriver 1 obtained 0 dinosaur toys!\\nDriver 1 attended 1 class!\\n\") {d.showResults}\n\t\td.setLocation 0 #from hospital to cathedral\n\t\td.checkLocation\n\t\tassert_output (\"Driver 1 obtained 0 books!\\nDriver 1 obtained 0 dinosaur toys!\\nDriver 1 attended 2 classes!\\n\") {d.showResults}\n\t\td.setLocation 1 #from cathedral to museum\n\t\td.checkLocation\n\t\tassert_output (\"Driver 1 obtained 0 books!\\nDriver 1 obtained 1 dinosaur toy!\\nDriver 1 attended 2 classes!\\n\") {d.showResults}\n\t\td.setLocation 1 #from museum to hillman\n\t\td.checkLocation\n\t\tassert_output (\"Driver 1 obtained 1 book!\\nDriver 1 obtained 1 dinosaur toy!\\nDriver 1 attended 2 classes!\\n\") {d.showResults}\n\t\td.setLocation 0 #from hillman to downtown\n\t\td.checkLocation\n\t\tassert_output (\"Driver 1 obtained 1 book!\\nDriver 1 obtained 1 dinosaur toy!\\nDriver 1 attended 2 classes!\\n\") {d.showResults}\n\tend",
"def test_location_2\r\n\t\tdriver = Driver::new(\"Driver\")\r\n\t\t\r\n\t\thillman = Location.new(\"Hillman\", \"Foo St.\", \"Fifth Ave.\")\r\n\t\thospital = Location.new(\"Hospital\", \"Foo St.\", \"Fourth Ave.\")\r\n\t\tmuseum = Location.new(\"Museum\", \"Bar St.\", \"Fifth Ave.\")\r\n\t\tcathedral = Location.new(\"Cathedral\", \"Bar St.\", \"Fourth Ave.\")\r\n\t\t\r\n\t\tlocations = [hillman, hospital, cathedral, museum]\r\n\t\t\r\n\t\trandom_start_location(driver, 2, locations)\r\n\t\tassert_equal cathedral, driver.location\r\n\tend",
"def report\n return nil unless placed?\n [ @x, @y, direction.upcase ].join(',')\n end",
"def execute\n return unless @robot.table\n x = @robot.coordinate.x\n y = @robot.coordinate.y\n direction = @robot.direction.to_s.upcase\n @out.puts(\"#{x},#{y},#{direction}\")\n end",
"def test_bot_left_four_unit_per_floor_double_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 12\n args_hash['level'] = 'Bottom'\n args_hash['corridor_position'] = 'Double-Loaded Interior'\n args_hash['horz_location'] = 'Left'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 12, 'ThermalZone' => 2, 'Space' => 2, 'SpaceType' => 2, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 1, 'ShadingSurface' => 2, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 7 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end",
"def print_output(expected, actual)\n puts \"expect: \" + expected.robust\n puts \"actual: \" + actual.robust\nend",
"def print_heading(content)\n puts \"=\" * content.length\n puts content\n puts \"=\" * content.length\nend",
"def test_top_left_four_unit_per_floor_double_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 12\n args_hash['level'] = 'Top'\n args_hash['corridor_position'] = 'Double-Loaded Interior'\n args_hash['horz_location'] = 'Left'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 12, 'ThermalZone' => 2, 'Space' => 2, 'SpaceType' => 2, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 2, 'ShadingSurface' => 8, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 7 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end",
"def debug_output(x, y)\n\t\t\tputs \"left eye #{@left_eye_width}\"\n\t\t\tputs \"glabella #{@glabella_width}\"\n\t\t\tputs \"right eye #{@right_eye_width}\"\n\t\t\tputs \"mouth #{x}, #{y}\"\n\t\tend",
"def test_top_two_unit_per_floor_exterior_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 6\n args_hash['level'] = 'Top'\n args_hash['corridor_position'] = 'Double Exterior'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 3, 'ShadingSurface' => 7, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 2 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end",
"def test_new_location\n\t\t@new_driver.location 'Cathedral'\n\t\tassert_equal 'Hillman', @new_driver.location('Hillman')\n\tend",
"def test_one_way_is_location\r\n \thillman = Location::new(\"Hillman\", nil, nil)\r\n\t\tdowntown = Location::new(\"Downtown\", nil, nil)\r\n\t\thillman.new_one_way(downtown)\r\n\t\tassert hillman.one_way.is_a?(Location)\r\n\tend",
"def draw_heading(data_type, y)\n set_data_font(:heading)\n clear_and_draw_text(40, y, contents_width - 80, line_height, \n QuestData::VOCAB[data_type], QuestData::HEADING_ALIGN[data_type])\n reset_font_settings\n end",
"def test_locations_of_fourth_ave\n\t\tassert_equal \"Cathedral\", @road2.locations[0]\n\tend",
"def test_top_mid_three_unit_per_floor_double_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 9\n args_hash['level'] = 'Top'\n args_hash['corridor_position'] = 'Double-Loaded Interior'\n args_hash['horz_location'] = 'Middle'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 3, 'ShadingSurface' => 7, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 3 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end",
"def report\n check_placed\n \"#{position},#{facing}\"\n end",
"def print_heading\n @report_file.puts\n @report_file.puts(' ##### ######')\n @report_file.puts(' # # ## # ###### #### # # ###### ##### #### ##### #####')\n @report_file.puts(' # # # # # # # # # # # # # # # #')\n @report_file.puts(' ##### # # # ##### #### ###### ##### # # # # # # #')\n @report_file.puts(' # ###### # # # # # # ##### # # ##### #')\n @report_file.puts(' # # # # # # # # # # # # # # # # #')\n @report_file.puts(' ##### # # ###### ###### #### # # ###### # #### # # #')\n @report_file.puts('********************************************************************************')\n @report_file.puts\n end",
"def print_location\n\t\[email protected]_point\t\n\tend",
"def test_top_mid_six_unit_per_floor_double_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 18\n args_hash['level'] = 'Top'\n args_hash['corridor_position'] = 'Double-Loaded Interior'\n args_hash['horz_location'] = 'Middle'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 12, 'ThermalZone' => 2, 'Space' => 2, 'SpaceType' => 2, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 2, 'ShadingSurface' => 8, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 9 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end",
"def test_bot_two_unit_per_floor_exterior_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 6\n args_hash['level'] = 'Bottom'\n args_hash['corridor_position'] = 'Double Exterior'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 2, 'ShadingSurface' => 3, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 2 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end",
"def test_print_location_starting\n\t\ttest_main = Main.new(3, 1, 6)\n\t\tmocked_Graph = MiniTest::Mock.new(\"mocked graph\")\n\t\tmocked_Graph.expect(:get_curr_loc, Node.new(\"Enumerable Canyon\", 4, 5, 10))\n\t\ttest_main.print_location(mocked_Graph, 0)\n\t\tassert mocked_Graph\n\tend",
"def test_header(test_name)\n puts \"\\n====================================================================\"\n puts \"====================================================================\\n\"\n puts \"\\n #{test_name}\"\n puts \"\\n====================================================================\"\n puts \"====================================================================\\n\"\nend",
"def print_space(location_relative_to_msg)\n odd_height_correction = \n (vertical_blank_space.odd? && location_relative_to_msg == :after ? 1 : 0)\n puts \"\\n\" * ((vertical_blank_space / 2) + odd_height_correction)\n end",
"def guess_heading(node)\n return nil if node.font_size.nil?\n\n [*1...HEADING_DEPTH].each do |heading|\n return \"h#{heading}\" if node.font_size >= h(heading)\n end\n nil\n end",
"def print\n\t\tputs \"(#{@x},\" + \"#{@y})\"\n\tend",
"def test_two_way_is_location\r\n \thillman = Location::new(\"Hillman\", nil, nil)\r\n\t\thospital = Location::new(\"Hospital\", nil, nil)\r\n\t\thillman.new_two_way(hospital)\r\n\t\tassert hillman.two_way.is_a?(Location)\r\n\tend",
"def look()\n puts \"A%s [Door] lies north of you leading to %s,\" % [@door_status, @door_leads]\n puts \"A%s [Fireplace] is along the west wall\" % [@fireplace_status]\n puts \"A [Table] is in the center of the room%s\" % [@table_stuff] \n puts \"A%s grandfather styled [Clock]%s is in the north-east corner of the room\" % [@clock_status, @clock_hands]\n puts \"A%s [Trapdoor] is against the south wall\" % [@trapdoor_status]\n puts \"A pile of wooden [Logs] is in the south-east corner of the room\" #put logs in firepalce evry so often or bad things happen\nend",
"def test_top_one_unit_per_floor_no_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 3\n args_hash['level'] = 'Top'\n args_hash['corridor_position'] = 'None'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 2, 'ShadingSurface' => 6, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 1 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end",
"def test_doe_latin_hypercube_method_should_return_evenly_distributed_points_across_parameter_space_5_param_case\n @experiment_with_multiple_params.doe_info = [[\"latinHypercube\", [\"param-0\", \"param-1\", \"param-2\", \"param-3\", \"param-4\"]]]\n\n\n doe_method_result = @experiment_with_multiple_params.apply_doe_methods.first\n\n\n\n assert_equal \"latinHypercube\", doe_method_result[0]\n assert_equal [\"param-0\", \"param-1\", \"param-2\", \"param-3\", \"param-4\"], doe_method_result[1]\n assert_equal 6, doe_method_result[2].size\n\n level_counters = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]\n\n doe_method_result[2].each do |input_parameter_space_point|\n input_parameter_space_point.each_with_index do |value, index|\n level_counters[index][value / 20] += 1\n end\n end\n\n level_counters.each { |counter| assert_equal [1, 1, 1, 1, 1, 1], counter }\n end"
] | [
"0.68202645",
"0.6547389",
"0.6141124",
"0.5978521",
"0.56970406",
"0.55034757",
"0.549947",
"0.54888195",
"0.5483786",
"0.54391265",
"0.5429799",
"0.542439",
"0.5386995",
"0.5320929",
"0.5316112",
"0.53054094",
"0.53051925",
"0.52602935",
"0.5222202",
"0.5188348",
"0.51551145",
"0.5138917",
"0.5116844",
"0.51120293",
"0.51073277",
"0.5096785",
"0.5079787",
"0.5079787",
"0.5074061",
"0.50542253",
"0.5046041",
"0.5038313",
"0.5034996",
"0.5034966",
"0.5034375",
"0.5026972",
"0.50239295",
"0.50227296",
"0.5016114",
"0.50140464",
"0.5010938",
"0.5000711",
"0.49957114",
"0.49871507",
"0.49844307",
"0.4982292",
"0.49731702",
"0.4972513",
"0.49602976",
"0.49591646",
"0.49455798",
"0.49451882",
"0.49358794",
"0.493099",
"0.49265012",
"0.49238226",
"0.4923807",
"0.4910261",
"0.4905235",
"0.49042237",
"0.49008635",
"0.48963472",
"0.48925984",
"0.48865613",
"0.48864573",
"0.48864573",
"0.48861614",
"0.48802567",
"0.48793542",
"0.4875689",
"0.48679936",
"0.48631778",
"0.4857097",
"0.4852944",
"0.48416832",
"0.48379818",
"0.48379597",
"0.48365858",
"0.48355088",
"0.48338476",
"0.48267955",
"0.48190477",
"0.48178458",
"0.48089057",
"0.47954974",
"0.47926423",
"0.47917628",
"0.4789858",
"0.47863743",
"0.47753352",
"0.47746798",
"0.47688904",
"0.47602785",
"0.47536558",
"0.47535667",
"0.47511637",
"0.47510487",
"0.47433272",
"0.47414824",
"0.47334248"
] | 0.6503349 | 2 |
This test when plocation & c_location is float | def test_print_heading_float
assert_output("Heading from 1.1 to 1.2\n"){@p.print_heading(1.1, 1.2)}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Float(p0) end",
"def test_set_y_as_float\n obj = Geom::Point3d.new\n obj.y = 1000.0\n result = obj.y\n expected = 1000.0\n assert_equal(expected, result, 'expected does not match result.')\n end",
"def test_that_px_return_is_accurate\n end",
"def test_set_x_as_float\n obj = Geom::Point3d.new\n obj.x = 1000.0\n result = obj.x\n expected = 1000.0\n assert_equal(expected, result, 'Expected does not match result.')\n end",
"def test_set_z_as_float\n obj = Geom::Point3d.new\n obj.z = 1000.0\n result = obj.z\n expected = 1000.0\n assert_equal(expected, result, 'expected does not match result.')\n end",
"def test_getLocation_pos_invalid\n\t\td = Driver::new(\"Driver 1\",0);\n\t\tdef d.getLocation; d.location=999,999; end\n\t\tassert_raises (\"Invalid location\") {d.getLocation}\n\tend",
"def fix_location\n self.location = self.location.map(&:to_f)\n end",
"def check_coordinates(trace)\n coordinates = trace[:coordinates] || trace.coordinates\n\n coordinates.each do |c|\n lat = c[:latitude] || c.latitude\n long = c[:longitude] || c.longitude\n\n expect(lat).to be_a(Float)\n expect(long).to be_a(Float)\n end\n end",
"def coordinate?(value)\n !! value.to_f\n end",
"def should_be_float?(field_info, field)\n field_info[\"type\"] == \"REAL\"\n end",
"def float?\n @kind == :float_lit || @kind == :float_exp_lit\n end",
"def gecos=(p0) end",
"def expect_float(value, field, subfield)\n return true if value.blank?\n return true if value.is_a?(Float)\n errors.add(field, \"#{subfield} must be a float if present\")\n false\n end",
"def are_floats?(x,y)\n return x.is_a?(Float) && y.is_a?(Float)\n end",
"def test_002_convert_float2\r\n\tresult = convert_float( '')\r\n\tassert close_enough( 0.0, result )\r\n end",
"def test_update_location_errors\n params = update_params_from_loc(locations(:albion))\n params[:location][:north] = 100\n update_location_error(params)\n end",
"def test_nodes_of_museum\n\t\tassert_equal @location, @location2.nodes[0]\n\tend",
"def sanity_check_ballot_coords\n \n end",
"def constituency_loc_real(constituency)\n begin\n # Use the TWFY API to get the data\n location = TWFY_CLIENT.geometry name: constituency\n {lat: location.centre_lat, lng: location.centre_lon}\n rescue\n # Return (0,0) in case of failure\n {lat: 0, lng: 0}\n end\nend",
"def test_tip_method\n assert_equal(0.15, @check_test.tip_calc)\n end",
"def test_mine_sutter_creek\r\n\t@test_prospector.current_location = 'Sutter Creek'\r\n\t@test_prospector.mine\r\n\tassert_operator 2, :>=, @test_prospector.current_gold\r\n\tassert_equal 0, @test_prospector.current_silver\r\n\tassert_operator 2, :>=, @test_prospector.total_gold\r\n\tassert_equal 0, @test_prospector.total_silver\r\n end",
"def test_driver_setLocation_cathedral\n\t\td = Driver::new(\"Driver 1\",0)\n\t\td.setLocation 0 #hospital to cathedral\n\t\tassert_equal d.getLocation, 1\n\tend",
"def test_float_literal\n check(C::FloatLiteral, <<-EOS)\n |1.0\n EOS\n end",
"def float!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 14 )\n\n\n\n type = FLOAT\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 35:8: 'cortable'\n match( \"cortable\" )\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__, 14 )\n\n\n end",
"def test_addition\n float_emulation_context\n each_pair(@test_float_data) do |x, y|\n z = x + y\n assert_equal z, (BinNum(x)+BinNum(y)).to_f\n end\n end",
"def float?\n self.class.float?(self)\n end",
"def test_player_coord_input\n # true if finalize_ship_coords == true\n @ship.valid_coords = finalize_ship_coords(@player_orientation,\n @player_base_coords)\n end",
"def check_float(a, b)\n #tolerance = 1e-12\n tolerance = 1e-2\n a = a.to_f\n b = b.to_f\n if a.finite? and b.finite?\n (a-b).abs < tolerance\n else\n true\n end\n end",
"def type_float!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 35 )\n\n\n\n type = TYPE_FLOAT\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 211:13: 'float'\n match( \"float\" )\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__, 35 )\n\n\n end",
"def float?(object)\n return true if Float(object)\n rescue \n return false\nend",
"def float?\n !!Float(self)\n rescue ArgumentError, TypeError\n false\n end",
"def numeric?; float?; end",
"def lat_f\n lat.to_f\n end",
"def test_positive_float\n\n @values_positive_float.each { |x|\n assert_in_delta(Math::log(x), ln(x))\n }\n\n end",
"def test_distance_in_km\r\n third_party_distance_in_km = 313.92 # http://boulter.com/gps/distance/?from=53.3381985%2C+-6.2592576&to=51.92893%2C+-10.27699&units=k\r\n margin_of_error_in_km = 2\r\n\r\n args = 51.92893, -10.27699, 53.3381985, -6.2592576\r\n assert_in_delta(third_party_distance_in_km, CustomerFinder.send(:distance_in_km, *args), margin_of_error_in_km)\r\n end",
"def float?\n type == \"FLOAT\" || type == \"FLOAT64\"\n end",
"def value_ok(unit, value_to_convert)\n is_ok = case unit\n when :celsius then\n begin\n celsius_min = -273.15\n value_to_convert > celsius_min\n end\n when :fahrenheit then\n begin\n fahrenheit_min = -459.67\n value_to_convert > fahrenheit_min\n end\n when :kelvin then\n begin\n kelvin_min = 0\n value_to_convert > kelvin_min\n end\n else false\n end\n is_ok\nend",
"def test_getLocation_neg_invalid\n\t\td = Driver::new(\"Driver 1\",0);\n\t\tdef d.getLocation; d.location=-999,-999; end\n\t\tassert_raises (\"Invalid location\") {d.getLocation}\n\tend",
"def test_verified_by_fai_distance\n start = { latitude: 44.34980359273743, longitude: 12.17773479543761 }\n finish = { latitude: 44.35679018739903, longitude: 12.21939248804523 }\n\n distance = Vincenty.distance_between_points(start, finish)\n\n assert_in_delta 3410.841, distance, 0.001\n end",
"def has_location?\n # Since we require presence of both lat&lon, checking for one\n # property is good enough.\n lat.present?\n end",
"def check_float(a, b)\n tolerance = 1e-12\n a = a.to_f\n b = b.to_f\n if a.finite? and b.finite?\n (a-b).abs < tolerance\n else\n true\n end\nend",
"def is_nearby(user_latitude,user_longitude, bus_latitude, bus_longitude)\n (user_longitude - bus_longitude).abs <= 0.01 && (user_latitude - bus_latitude).abs \nend",
"def test_float9\n token, value, rest = @c.lex(\" 0xabcdef.123p-17L boondocks\")\n assert_equal(:float, token)\n assert_equal('0xabcdef.123p-17L', value)\n assert_equal(' boondocks', rest)\n end",
"def ==(f)\n self.toFloat() == f.toFloat()\n end",
"def ==(f)\n self.toFloat() == f.toFloat()\n end",
"def field_test(accuracy)\n distance = (@mapsize - @measurement_border) / accuracy.to_f\n locations = []\n @test_area.float_step(distance) do |x|\n @test_area.float_step(distance) do |y|\n locations.push [x, y]\n end\n end\n locations.shuffle.each do |l|\n test(*l)\n end\n end",
"def test_set_y_as_fixnum\n obj = Geom::Point3d.new\n obj.y = 1000\n result = obj.y\n expected = 1000\n assert_equal(expected, result, 'expected does not match result.')\n end",
"def test_lat_lon_format\n note = build(:note, :latitude => 0.00004 * GeoRecord::SCALE, :longitude => 0.00008 * GeoRecord::SCALE)\n\n assert_equal \"0.0000400\", note.lat.to_s\n assert_equal \"0.0000800\", note.lon.to_s\n end",
"def float3?(input)\n Float(input) rescue false\nend",
"def to_float!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 11 )\n\n type = TO_FLOAT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 313:11: 'float:'\n match( \"float:\" )\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__, 11 )\n\n end",
"def test_set_z_as_fixnum\n obj = Geom::Point3d.new\n obj.z = 1000\n result = obj.z\n expected = 1000\n assert_equal(expected, result, 'expected does not match result.')\n end",
"def check_for_float(company)\n float(company) unless\n company.floated? ||\n (initial_offering.percentage_owned(company) > BigDecimal.new('0.5'))\n end",
"def *(float)\n\t\treturn FuzzyVariable.new(@value*float.to_f, @domain)\n\tend",
"def test_driver_checkLocation_mid\n\t\td = Driver::new(\"Driver 1\",1)\n\t\td.checkLocation\n\t\t# assert_equal d.classes, 2\n\t\td.setLocation 1 #from cathedral go to museum\n\t\td.checkLocation\n\t\tassert_equal [2,1], [d.classes,d.dinotoys]\n\t\t#assert_equal d.dinotoys, 1\n\tend",
"def test_change_curr_location_any\n \tlocation_stub = Minitest::Mock.new('Mock Location')\n \tpro = Prospector.new(1)\n \tdef location_stub.loc\n \"Laboon Lake\"\n end\n def location_stub.max_rubies\n 1\n end\n def location_stub.max_fake_rubies\n 1\n end\n def location_stub.neighbor_list\n [\"Sean's Bowser Castle\", \"Kitty's Cozy Condo\"]\n end\n pro.change_curr_location(location_stub)\n assert pro.curr_location.loc == \"Laboon Lake\"\n assert pro.curr_location.max_rubies == 1\n assert pro.curr_location.max_fake_rubies == 1\n assert pro.curr_location.neighbor_list.length == 2\n assert pro.curr_location.neighbor_list.include? \"Sean's Bowser Castle\"\n assert pro.curr_location.neighbor_list.include? \"Kitty's Cozy Condo\"\n end",
"def assert_floatable *args\n args.each do |var|\n assert do\n var.not_nil? && var.is_a?(Numeric)\n end\n end\n end",
"def test_set_x_as_fixnum\n obj = Geom::Point3d.new\n obj.x = 1000\n result = obj.x\n expected = 1000\n assert_equal(expected, result, 'Expected does not match result.')\n end",
"def test_location_change\r\n location = Minitest::Mock.new(\"test_location_arr\")\r\n def location.get_id(index); \"Hash Crossing\"; end\r\n assert_output(\"Heading from Hash Crossing to Hash Crossing.\\n\") { @g.location_change(location, 0, 0)}\r\n end",
"def point_match(point, nominal)\n point[0].should be_within(0.01).of(nominal[0])\n point[1].should eq nominal[1]\nend",
"def match_float( val )\n\t\treturn Float( val ) rescue nil\n\tend",
"def test_special_float\n tokenizer = Tokenizer.new\n tokenizer.text = \"20.0 0.0\"\n tokenizer.tokenize\n tokens = tokenizer.tokens\n\n #test type of token\n assert_equal(\"FloatToken\", tokens.last.class.name)\n\n #test values\n assert_equal(\"20.0\", tokens.first.val)\n assert_equal(\"0.0\", tokens.last.val)\n\n #test position\n assert_equal(5, tokens.last.start_index)\n assert_equal(8, tokens.last.end_index)\n end",
"def initialize_float(field_info, field)\n if should_be_float?(field_info, field) && !self.send(field).blank?\n update_value_of_variable(field, self.send(field).to_f)\n end\n field\n end",
"def test_distance_to_point_left_below\n point1 = Point.new(3, 4)\n point2 = Point.new(0, 0)\n assert_equal 5, point1.distance_to(point2)\n end",
"def test_float9\n token, value, rest = @c.lex(\" 0xabcdef.123p-17boondocks\")\n assert_equal(:float, token)\n assert_equal('0xabcdef.123p-17', value)\n assert_equal(' boondocks', rest)\n end",
"def is_float?\n\t\tFloat(self) != nil rescue false\n\tend",
"def check_float(a, b)\n tolerance = Math::TOLERANCE\n a = a.to_f\n b = b.to_f\n if a.finite? and b.finite?\n (a-b).abs < tolerance\n else\n true\n end\nend",
"def check_float(a, b)\n tolerance = Math::TOLERANCE\n a = a.to_f\n b = b.to_f\n if a.finite? and b.finite?\n (a-b).abs < tolerance\n else\n true\n end\nend",
"def test_new_location_low\r\n random = Minitest::Mock.new(\"test_random\")\r\n location = Minitest::Mock.new(\"test_location_arr\")\r\n assert_raises('Invalid Index!') { @g.new_location(-1, random, location) }\r\n end",
"def float\n r = little? ? @data.byteslice(@pos, 4).unpack('e')[0] : @data.byteslice(@pos, 4).unpack('g')[0]\n @pos += 4\n r\n end",
"def test_distance_to_one_deg\n start = { latitude: 0.0, longitude: 0.0 }\n finish = { latitude: 0.0, longitude: 1.0 }\n\n distance = Vincenty.distance_between_points(start, finish)\n\n assert_in_delta 111_319.491, distance, 0.001\n end",
"def test_is_valid\n\t\ttest_main = Main.new(3, 4, 6)\n\t\tassert_equal test_main.valid_location(\"Enumberable Canyon\"), 0\n\tend",
"def test_lat_lon_xml_format\n tracepoint = build(:tracepoint, :latitude => 0.00004 * GeoRecord::SCALE, :longitude => 0.00008 * GeoRecord::SCALE)\n\n assert_match /lat=\"0.0000400\"/, tracepoint.to_xml_node.to_s\n assert_match /lon=\"0.0000800\"/, tracepoint.to_xml_node.to_s\n end",
"def test_Arithmetic_Sample05\n assert(3.0 < Float::MAX)\n assert(Float::MAX == Float::MAX)\n end",
"def filter_locations_tu(points)\n filter_locations(points, 15.9.within(0.07), 50.57.within(0.1))\nend",
"def is_xy?(); @type == GRT_XY; end",
"def test_new_location\n\t\t@new_driver.location 'Cathedral'\n\t\tassert_equal 'Hillman', @new_driver.location('Hillman')\n\tend",
"def test_locations_of_fourth_ave\n\t\tassert_equal \"Cathedral\", @road2.locations[0]\n\tend",
"def test_driver_setLocation_museum\n\t\td = Driver::new(\"Driver 1\",1)\n\t\td.setLocation 1 #cathedral to museum\n\t\tassert_equal d.getLocation, 3\n\tend",
"def test_it_can_find_average_invoices_per_merchant\n # assert_equal 10.49, @sa_real.average_invoices_per_merchant\n assert_equal 1.5, @sa.average_invoices_per_merchant\n assert_instance_of Float, @sa.average_invoices_per_merchant\n end",
"def coordquery(p)\r\nend",
"def test_print_start_float\n assert_raises(StandardError) { print_start(1.2) } # pass\n end",
"def float_val?(val)\n !!(val =~ /\\A[-+]?\\d+(\\.\\d+)?\\z/)\n end",
"def is_float?\n self.to_f.to_s == self\n end",
"def isFloat?\n !!Float(exp) rescue false\n end",
"def is_float?(input)\n input.to_f.to_s == input\nend",
"def latlng_good?\n self.addr_latlng && self.addr_latlng.lat && self.addr_latlng.lng\n end",
"def pixel_per_meter? = unit == 'pixel-per-meter'",
"def float!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 27 )\n\n\n\n type = FLOAT\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 192:8: INTEGER '.' INTEGER\n integer!\n\n match( 0x2e )\n\n integer!\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__, 27 )\n\n\n end",
"def test_volume_of_sphere()\n volume = volume_of_sphere(10)\n assert_equal(4188.79, volume)\nend",
"def resembles_latlng?\n !!coordinates\n end",
"def test_print_location_starting\n\t\ttest_main = Main.new(3, 1, 6)\n\t\tmocked_Graph = MiniTest::Mock.new(\"mocked graph\")\n\t\tmocked_Graph.expect(:get_curr_loc, Node.new(\"Enumerable Canyon\", 4, 5, 10))\n\t\ttest_main.print_location(mocked_Graph, 0)\n\t\tassert mocked_Graph\n\tend",
"def filter_locations_bu(points)\n filter_locations(points, 16.06.within(0.07), 50.41.within(0.1))\nend",
"def location_changed!\n east = location.east_units\n west = location.west_units\n\n north = location.north_units\n south = location.south_units\n\n # NOTE: expectation is 1 of the paired directions will be zero.\n calculate_location_opposite east: east, west: west, north: north, south: south\n calculate_location_right east: east, west: west, north: north, south: south\n calculate_location_left\n end",
"def test_should_multiply_by_a_Fixnum_or_Float\n currency1 = Currency.new(\"USD\", 4.0)\n\n assert_equal Currency.new(\"USD\", 12.0), currency1 * 3\n end",
"def numeric_check(first_num)\n Float(first_num) != nil rescue false\nend",
"def float?\n !!strip.match(/^-?\\d+\\.\\d+$/)\n end",
"def float?(field)\n self.send(field).is_a? Float\n end",
"def test_distance_to_point_right_up\n point1 = Point.new(0, 0)\n point2 = Point.new(1, 1)\n assert_equal Math.sqrt(2), point1.distance_to(point2)\n end",
"def check_real(field_info, field)\n if should_be_float?(field_info, field) && !float?(field)\n add_float_message_to_errors(field)\n end\n end",
"def compute_position\n # The negative and the ninety are the fudge to compensate for our map.\n lat = @latitude_radians = radians(-@latitude)\n long = @longitude_radians = radians(@longitude + 90)\n radius = $app.globe.diameter / 2.0 - 23\n @x = radius * cos(lat) * sin(long)\n @y = radius * sin(lat)\n @z = radius * cos(lat) * cos(long)\n end"
] | [
"0.63382536",
"0.5950707",
"0.5931596",
"0.59093416",
"0.58271664",
"0.577655",
"0.56678456",
"0.55483425",
"0.55479413",
"0.54888403",
"0.54647756",
"0.545712",
"0.53431904",
"0.5321244",
"0.5310455",
"0.5304073",
"0.5290183",
"0.5278883",
"0.52777004",
"0.5248554",
"0.52435833",
"0.5230926",
"0.5227482",
"0.52114",
"0.5203148",
"0.51961786",
"0.51857424",
"0.51734555",
"0.516955",
"0.51617044",
"0.51468253",
"0.51417166",
"0.5140142",
"0.5139908",
"0.5138259",
"0.5133985",
"0.51253587",
"0.5121937",
"0.512184",
"0.51182574",
"0.510763",
"0.5105373",
"0.51020527",
"0.50973016",
"0.50973016",
"0.50919926",
"0.50689536",
"0.50581235",
"0.50578177",
"0.5055239",
"0.5050278",
"0.50477445",
"0.504322",
"0.50398564",
"0.5035543",
"0.5024815",
"0.5023106",
"0.5020717",
"0.50141835",
"0.5005977",
"0.5001353",
"0.4989114",
"0.49882352",
"0.49867758",
"0.49755502",
"0.49629134",
"0.49629134",
"0.49623713",
"0.49602658",
"0.49576753",
"0.49532142",
"0.49493253",
"0.494737",
"0.49456674",
"0.49432376",
"0.49423355",
"0.49403504",
"0.49395943",
"0.49364027",
"0.49302506",
"0.49257165",
"0.49225888",
"0.491887",
"0.49185967",
"0.49141565",
"0.4910589",
"0.49055254",
"0.49041128",
"0.49029723",
"0.4897511",
"0.48960996",
"0.48938045",
"0.4893339",
"0.48862308",
"0.48848593",
"0.4883757",
"0.4880796",
"0.48742092",
"0.48730555",
"0.48637357"
] | 0.5132593 | 36 |
This test when plocation & c_location is string | def test_print_heading_string
assert_output("Heading from a to b\n"){@p.print_heading('a', 'b')}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_getLocation_string\n\t\td = Driver::new(\"Driver 1\",0);\n\t\tdef d.getLocation; d.location=\"string\",\"string\"; end\n\t\tassert_raises (\"Invalid location\") {d.getLocation}\n\tend",
"def test_new_location\n\t\t@new_driver.location 'Cathedral'\n\t\tassert_equal 'Hillman', @new_driver.location('Hillman')\n\tend",
"def test_nil_location\n\t\t@new_driver.location 'Cathedral'\n\t\tassert_equal 'Cathedral', @new_driver.location(nil)\n\tend",
"def test_job_location\n job = Job.new(title: 'Senior Developer',\n location: 'San Francisco, CA',\n description: 'Python node scala stuff senior 5+ years')\n\n return job.location == :San_Francisco\n end",
"def test_new_location_name\n assert_equal \"location 1\", @loc1.name\n end",
"def test_getLocation_pos_invalid\n\t\td = Driver::new(\"Driver 1\",0);\n\t\tdef d.getLocation; d.location=999,999; end\n\t\tassert_raises (\"Invalid location\") {d.getLocation}\n\tend",
"def test_location_name\n assert_equal @l1.name, 'a' # pass\n end",
"def test_locations_of_fourth_ave\n\t\tassert_equal \"Cathedral\", @road2.locations[0]\n\tend",
"def test_driver_setLocation_cathedral\n\t\td = Driver::new(\"Driver 1\",0)\n\t\td.setLocation 0 #hospital to cathedral\n\t\tassert_equal d.getLocation, 1\n\tend",
"def test_update_location_name_errors\n params = update_params_from_loc(locations(:albion))\n params[:location][:display_name] = \"Somewhere Dubious\"\n update_location_error(params)\n end",
"def test_initial_location\n\tassert_equal \"Sutter Creek\", @gold_rush.set_location\n end",
"def getTestLocation\n return 'DummyLocation'\n end",
"def test_print_location\n \t@gold_rush.initialize(2, 2)\n \tassert_equal \"Heading from Sutter Creek to Angels Camp, holding 1 ounce of gold and 0 ounces of silver.\", @gold_rush.print_location(@prospectors[0], 0)\n end",
"def other_loc(location)\n\t\t# uses location class equals method (TODO)\n\t\tif location == loc1\n\t\t\tloc2\n\t\telse\n\t\t\tloc1\n\t\tend\n\tend",
"def test_driver_setLocation_museum\n\t\td = Driver::new(\"Driver 1\",1)\n\t\td.setLocation 1 #cathedral to museum\n\t\tassert_equal d.getLocation, 3\n\tend",
"def test_location_2\r\n\t\tdriver = Driver::new(\"Driver\")\r\n\t\t\r\n\t\thillman = Location.new(\"Hillman\", \"Foo St.\", \"Fifth Ave.\")\r\n\t\thospital = Location.new(\"Hospital\", \"Foo St.\", \"Fourth Ave.\")\r\n\t\tmuseum = Location.new(\"Museum\", \"Bar St.\", \"Fifth Ave.\")\r\n\t\tcathedral = Location.new(\"Cathedral\", \"Bar St.\", \"Fourth Ave.\")\r\n\t\t\r\n\t\tlocations = [hillman, hospital, cathedral, museum]\r\n\t\t\r\n\t\trandom_start_location(driver, 2, locations)\r\n\t\tassert_equal cathedral, driver.location\r\n\tend",
"def test_location_change_string_new\r\n location = Minitest::Mock.new(\"test_location_arr\")\r\n def location.get_id(index); \"Hash Crossing\"; end\r\n assert_raises('index must be an integer!') { @g.location_change(location, 0, 'a')}\r\n end",
"def test_move_str\n mock_loc = Minitest::Mock.new \"mock_loc\"\n\tdef mock_loc.name;\"previous location\";end\n\tmock_loc2 = Minitest::Mock.new \"mock_loc2\"\n\tdef mock_loc2.name;\"next location\";end\n\tmap = Map.new\n\tmap.nodes = [mock_loc, mock_loc2]\n\tdummy_rng = Minitest::Mock.new(\"dummy_rng\")\n\tdef mock_loc.choose_neighbor(a);1;end\n p = Prospector.new(0, mock_loc, 0)\n\tp.total_gold = 1\n\tp.total_silver = 1\n\tassert p.move(dummy_rng, map), \"Heading from previous location to next location \"\\\n \"holding 1 ounce of gold and \"\\\n\t\"#1 ounce of silver\"\n end",
"def test_location_1\r\n\t\tdriver = Driver::new(\"Driver\")\r\n\t\t\r\n\t\thillman = Location.new(\"Hillman\", \"Foo St.\", \"Fifth Ave.\")\r\n\t\thospital = Location.new(\"Hospital\", \"Foo St.\", \"Fourth Ave.\")\r\n\t\tmuseum = Location.new(\"Museum\", \"Bar St.\", \"Fifth Ave.\")\r\n\t\tcathedral = Location.new(\"Cathedral\", \"Bar St.\", \"Fourth Ave.\")\r\n\t\t\r\n\t\tlocations = [hillman, hospital, cathedral, museum]\r\n\t\t\r\n\t\trandom_start_location(driver, 1, locations)\r\n\t\tassert_equal hospital, driver.location\r\n\tend",
"def detect_location\n if self.text\n LOCATION_PATTERNS.find { |p| self.text[p] }\n self.location = Location.geocode($1) if $1\n self.zip = location.postal_code if !self.zip && (self.location && location.postal_code)\n end\n if !self.location && self.zip\n self.location = Location.geocode(self.zip)\n end\n self.location = self.reporter.location if !self.location && self.reporter && self.reporter.location\n ll, self.location_accuracy = self.latlon.split(/:/) if self.latlon\n true\n end",
"def detect_location\n if self.text\n LOCATION_PATTERNS.find { |p| self.text[p] }\n self.location = Location.geocode($1) if $1\n self.zip = location.postal_code if !self.zip && (self.location && location.postal_code)\n end\n if !self.location && self.zip\n self.location = Location.geocode(self.zip)\n end\n self.location = self.reporter.location if !self.location && self.reporter && self.reporter.location\n ll, self.location_accuracy = self.latlon.split(/:/) if self.latlon\n true\n end",
"def loc; end",
"def loc; end",
"def loc; end",
"def assert_google_location(data, loc)\n assert_equal :google, loc.geocoder\n assert_equal :hash, loc.raw_data_format\n\n assert_equal attribute_matching(\"locality\", data), loc.city\n assert_equal attribute_matching(\"administrative_area_level_1\", data), loc.state\n assert_equal attribute_matching(\"postal_code\", data), loc.post_code\n assert_equal attribute_matching(\"country\", data, :short_name), loc.country_code\n assert_equal data[\"geometry\"][\"location\"][\"lat\"], loc.lat\n assert_equal data[\"geometry\"][\"location\"][\"lng\"], loc.lng\n end",
"def test_get_location_contains\n locations = LocationRelation.new\n locations.add_location Location.new('test_location_2', 0, 0)\n assert_equal 'test_location_2', locations.get_location('test_location_2').name_reader\n end",
"def locationPosition _args\n \"locationPosition _args;\" \n end",
"def pfind(name, location)\n result = nil\n [name, name.upcase, name.downcase].each do |n|\n next if result\n result = location[n].first if location[n] && location[n].size > 0\n end\n STDERR.puts \"found #{result} for #{name}\" if $test\n\n result\nend",
"def test_one_way_is_location\r\n \thillman = Location::new(\"Hillman\", nil, nil)\r\n\t\tdowntown = Location::new(\"Downtown\", nil, nil)\r\n\t\thillman.new_one_way(downtown)\r\n\t\tassert hillman.one_way.is_a?(Location)\r\n\tend",
"def test_fun_city_locs\n\t@city = GoldRush::new\n\tassert_equal \"El Dorado Canyon\", @city.dorado.location\n\tassert_equal \"Midas\", @city.midas.location\n\tassert_equal \"Virginia City\", @city.virginia.location\n\tassert_equal \"Nevada City\", @city.nevada.location\n\tassert_equal \"Coloma\", @city.coloma.location\n\tassert_equal \"Angels Camp\", @city.angels.location\n\tassert_equal \"Sutter Creek\", @city.sutter.location\n end",
"def location=(_arg0); end",
"def test_name_is_hillman\n\t\tassert_equal \"Hillman\", @location.name\n\tend",
"def locationNull \n \"locationNull\" \n end",
"def test_location_detection\n # Google geocoder isn't returning the postal code?\n # assert_equal \"80303\", @twitter_reporter.reports.create(:body => 'Long wait in #80303').location.postal_code\n \n assert_equal \"Boston, MA 02130, USA\", @twitter_reporter.reports.create(:body => 'Insane lines at #zip-02130').location.address\n assert_equal \"90 Church Rd, Arnold, MD 21012, USA\", @twitter_reporter.reports.create(:body => 'L:90 Church Road, Arnold, MD: bad situation').location.address\n # assert_equal \"21804\", @twitter_reporter.reports.create(:body => '#zip21804 weird stuff happening').location.postal_code\n assert_equal \"Church Hill\", @twitter_reporter.reports.create(:body => 'Things are off in L:Church Hill, MD').location.locality\n # assert_equal \"94107\", @twitter_reporter.reports.create(:body => 'No 94107 worries!').location.postal_code\n # assert_equal \"21012\", @twitter_reporter.reports.create(:body => 'going swimmingly l:21012-2423').zip\n assert_equal \"Severna Park, MD, USA\", @twitter_reporter.reports.create(:body => 'Long lines at l:severna park senior HS').location.address\n assert_equal \"New York 11215, USA\", @twitter_reporter.reports.create(:body => 'wait:105 in Park Slope, Brooklyn zip11215 #votereport').location.address\n assert_equal \"Courthouse, Virginia, USA\", @twitter_reporter.reports.create(:body => 'no joy and long wait in l:courthouse, va').location.address\n # with mis-spelling:\n assert_equal \"Boulder, CO, USA\", @twitter_reporter.reports.create(:body => 'long lines at courthouse L:Bolder CO').location.address\n end",
"def compare_locations?(locatin_from, location_to)\n\t\t# location_to.title == locatin_from.title &&\n\t\tlocation_to.city == locatin_from.city &&\t\t\n\t\tlocation_to.custom_address == locatin_from.custom_address &&\n\t\t# location_to.custom_address_use == locatin_from.custom_address_use &&\n\t\t# location_to.gmap_use == locatin_from.gmap_use &&\n\t\t# location_to.gmaps == locatin_from.gmaps &&\n\t\tlocation_to.latitude == locatin_from.latitude &&\n\t\tlocation_to.longitude == locatin_from.longitude\n\t\t# location_to.title == locatin_from.title\n end",
"def test_is_valid_2\n\t\ttest_main = Main.new(3, 4, 6)\n\t\tassert_equal test_main.valid_location(\"Animal Beach\"), -1\n\tend",
"def x_occi_location\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 19 )\n location = nil\n uri27 = nil\n\n begin\n # at line 108:4: X_OCCI_LOCATION_KEY COLON ( WS )? uri ( SEMICOLON )?\n match( X_OCCI_LOCATION_KEY, TOKENS_FOLLOWING_X_OCCI_LOCATION_KEY_IN_x_occi_location_809 )\n match( COLON, TOKENS_FOLLOWING_COLON_IN_x_occi_location_811 )\n # at line 108:30: ( WS )?\n alt_29 = 2\n look_29_0 = @input.peek( 1 )\n\n if ( look_29_0 == WS )\n alt_29 = 1\n end\n case alt_29\n when 1\n # at line 108:30: WS\n match( WS, TOKENS_FOLLOWING_WS_IN_x_occi_location_813 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_uri_IN_x_occi_location_816 )\n uri27 = uri\n @state.following.pop\n # at line 108:38: ( SEMICOLON )?\n alt_30 = 2\n look_30_0 = @input.peek( 1 )\n\n if ( look_30_0 == SEMICOLON )\n alt_30 = 1\n end\n case alt_30\n when 1\n # at line 108:38: SEMICOLON\n match( SEMICOLON, TOKENS_FOLLOWING_SEMICOLON_IN_x_occi_location_818 )\n\n end\n # --> action\n location = URI.parse(( uri27 && @input.to_s( uri27.start, uri27.stop ) )) \n # <-- action\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 19 )\n\n end\n \n return location\n end",
"def test_location_change\r\n location = Minitest::Mock.new(\"test_location_arr\")\r\n def location.get_id(index); \"Hash Crossing\"; end\r\n assert_output(\"Heading from Hash Crossing to Hash Crossing.\\n\") { @g.location_change(location, 0, 0)}\r\n end",
"def test_location_3\r\n\t\tdriver = Driver::new(\"Driver\")\r\n\t\t\r\n\t\thillman = Location.new(\"Hillman\", \"Foo St.\", \"Fifth Ave.\")\r\n\t\thospital = Location.new(\"Hospital\", \"Foo St.\", \"Fourth Ave.\")\r\n\t\tmuseum = Location.new(\"Museum\", \"Bar St.\", \"Fifth Ave.\")\r\n\t\tcathedral = Location.new(\"Cathedral\", \"Bar St.\", \"Fourth Ave.\")\r\n\t\t\r\n\t\tlocations = [hillman, hospital, cathedral, museum]\r\n\t\t\r\n\t\trandom_start_location(driver, 3, locations)\r\n\t\tassert_equal museum, driver.location\r\n\tend",
"def test_update_location_errors\n params = update_params_from_loc(locations(:albion))\n params[:location][:north] = 100\n update_location_error(params)\n end",
"def verify_locations(test_data)\n locations = test_data[CoreUseOfCollectionsData::LOCATION_LIST.name] || [{CoreUseOfCollectionsData::LOCATION.name => ''}]\n locations.each_with_index { |location, index| verify_values_match(location[CoreUseOfCollectionsData::LOCATION.name], element_value(location_input index)) }\n end",
"def taken?(location)\n position(location) != \" \"\n end",
"def test_change_curr_location_any\n \tlocation_stub = Minitest::Mock.new('Mock Location')\n \tpro = Prospector.new(1)\n \tdef location_stub.loc\n \"Laboon Lake\"\n end\n def location_stub.max_rubies\n 1\n end\n def location_stub.max_fake_rubies\n 1\n end\n def location_stub.neighbor_list\n [\"Sean's Bowser Castle\", \"Kitty's Cozy Condo\"]\n end\n pro.change_curr_location(location_stub)\n assert pro.curr_location.loc == \"Laboon Lake\"\n assert pro.curr_location.max_rubies == 1\n assert pro.curr_location.max_fake_rubies == 1\n assert pro.curr_location.neighbor_list.length == 2\n assert pro.curr_location.neighbor_list.include? \"Sean's Bowser Castle\"\n assert pro.curr_location.neighbor_list.include? \"Kitty's Cozy Condo\"\n end",
"def test_location_0\r\n\t\tdriver = Driver::new(\"Driver\")\r\n\t\t\r\n\t\thillman = Location.new(\"Hillman\", \"Foo St.\", \"Fifth Ave.\")\r\n\t\thospital = Location.new(\"Hospital\", \"Foo St.\", \"Fourth Ave.\")\r\n\t\tmuseum = Location.new(\"Museum\", \"Bar St.\", \"Fifth Ave.\")\r\n\t\tcathedral = Location.new(\"Cathedral\", \"Bar St.\", \"Fourth Ave.\")\r\n\t\t\r\n\t\tlocations = [hillman, hospital, cathedral, museum]\r\n\t\t\r\n\t\trandom_start_location(driver, 0, locations)\r\n\t\tassert_equal hillman, driver.location\r\n\tend",
"def x_occi_location\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 19 )\n uri = nil\n location28 = nil\n\n begin\n # at line 134:4: 'X-OCCI-Location' ':' ( WS )? location ( ';' )?\n match(T__27, TOKENS_FOLLOWING_T__27_IN_x_occi_location_763)\n match(T__10, TOKENS_FOLLOWING_T__10_IN_x_occi_location_765)\n # at line 134:26: ( WS )?\n alt_30 = 2\n look_30_0 = @input.peek(1)\n\n if (look_30_0 == WS)\n alt_30 = 1\n end\n case alt_30\n when 1\n # at line 134:26: WS\n match(WS, TOKENS_FOLLOWING_WS_IN_x_occi_location_767)\n\n end\n @state.following.push(TOKENS_FOLLOWING_location_IN_x_occi_location_770)\n location28 = location\n @state.following.pop\n # at line 134:39: ( ';' )?\n alt_31 = 2\n look_31_0 = @input.peek(1)\n\n if (look_31_0 == T__11)\n alt_31 = 1\n end\n case alt_31\n when 1\n # at line 134:39: ';'\n match(T__11, TOKENS_FOLLOWING_T__11_IN_x_occi_location_772)\n\n end\n # --> action\n uri = URI.parse((location28 && @input.to_s(location28.start, location28.stop)))\n # <-- action\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 19 )\n\n end\n\n return uri\n end",
"def location\n if questioning.question.qtype_name == 'location' && !value.blank?\n value.split(' ')\n else\n nil\n end\n end",
"def test_nodes_of_museum\n\t\tassert_equal @location, @location2.nodes[0]\n\tend",
"def test_driver_get_place\n\t\tloc = Location::new(\"Location\", [\"Place\"])\n\t\tdriv = Driver::new(1, loc)\n\t\tassert_equal loc, driv.get_place\n\tend",
"def test_string_results_neither_zero\n mock_loc = Minitest::Mock.new(\"mock_loc\")\n\tdef mock_loc.name;'Sutter Creek';end\n p = Prospector.new(0, mock_loc, 0)\n\tp.silver_found = 3\n\tp.gold_found = 3\n\tp.s = 's'\n\tp.sg = 's'\n\tassert_equal 'Found 3 ounces of gold and 3 ounces of silver in Sutter Creek', p.string_findings\n end",
"def return_location(location, line)\n\t\n\nend",
"def test_name\r\n library = Location::new(\"Library\", nil, nil)\r\n assert_equal \"Library\", library.name\r\n end",
"def test_json_location_name\n load_location_setup\n assert_equal \"test\", @json_location.name\n end",
"def verify_locations(test_data)\n locations = test_data[UseOfCollections::LOCATION_LIST.name] || [{ UseOfCollections::LOCATION.name => ''}]\n locations.each_with_index { |location, index| verify_values_match(location[UseOfCollections::LOCATION.name], element_value(location_input index)) }\n end",
"def test_get_location_empty\n assert_nil @mp.get_location(\"test\")\n end",
"def test_location_change_string_old\r\n location = Minitest::Mock.new(\"test_location_arr\")\r\n def location.get_id(index); \"Hash Crossing\"; end\r\n assert_raises('old_index must be an integer!') { @g.location_change(location, 'a', 1)}\r\n end",
"def test_driver_setLocation_hospital\n\t\td = Driver::new(\"Driver 1\",2)\n\t\td.setLocation 1 #hillman to hospital\n\t\tassert_equal d.getLocation, 0\n\tend",
"def test_two_way_is_location\r\n \thillman = Location::new(\"Hillman\", nil, nil)\r\n\t\thospital = Location::new(\"Hospital\", nil, nil)\r\n\t\thillman.new_two_way(hospital)\r\n\t\tassert hillman.two_way.is_a?(Location)\r\n\tend",
"def load_location_from_httpu_data(data)\r\n debug data\r\n data.gsub(/LOCATION:([^\\r\\n]+)/i) do |i| @igd_location_descr = $1.strip end\r\n debug \"IGD location : #@igd_location_descr\"\r\n @igd_location = @igd_location_descr.split('/')[0, 3].join('/')\r\n return true\r\n end",
"def test_driver_setLocation_hillman\n\t\td = Driver::new(\"Driver 1\",0)\n\t\td.setLocation 1 #museum to hillman\n\t\tassert_equal d.getLocation, 2\n\tend",
"def location!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 26 )\n\n type = LOCATION\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 160:11: 'location'\n match( \"location\" )\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__, 26 )\n\n end",
"def test_construct_location_simple\n count = Location.count\n params = barton_flats_params\n display_name = params[:display_name]\n post_requires_login(:create_location, params)\n assert_response(:action => :show_location)\n assert_equal(count + 1, Location.count)\n assert_equal(10 + @new_pts, @rolf.reload.contribution)\n loc = assigns(:location)\n assert_equal(display_name, loc.display_name) # Make sure it's the right Location\n loc = Location.find_by_name_or_reverse_name(display_name)\n assert_nil(loc.description)\n assert_not_nil(loc.rss_log)\n end",
"def test_getLocation_neg_invalid\n\t\td = Driver::new(\"Driver 1\",0);\n\t\tdef d.getLocation; d.location=-999,-999; end\n\t\tassert_raises (\"Invalid location\") {d.getLocation}\n\tend",
"def test_street_connection\r\n\t\thillman = Location::new(\"Hillman\", \"Foo St.\", nil)\r\n\t\tassert_equal \"Foo St.\", hillman.street\r\n\tend",
"def parse_location(text)\n if text =~ /[a-zA-Z]/\n return location(text)\n else\n return text\n end\nend",
"def test_rubyist_display_string\r\n location = Minitest::Mock.new(\"test_location_arr\")\r\n def location.get_id(index); \"Hash Crossing\"; end\r\n assert_raises('rubyist_num must be an intenger!') { @g.new_rubyist_display('a', location) }\r\n end",
"def test_get_location_bad_input\n assert_raises 'Improper typing of location input argument in method get_location' do\n locations = LocationRelation.new\n locations.get_location 55\n end\n end",
"def location_string\n if location\n str = location.name\n str += \", \" + location_text unless location_text.blank?\n else\n str = location_text\n end\n str\n end",
"def location\n # and call a private getter method within\n puts \"I live on #{address.split[1]} street.\"\n end",
"def my_location\n\t\t\"#{address}, #{city}, GA\"\n\tend",
"def test_cathedral_start_location\r\n\t\trand_val = Minitest::Mock::new\r\n\t\toakland = City::new\r\n\t\tdef rand_val.get_start_location; 2; end\r\n\t\tstart_loc = oakland.all_locations[rand_val.get_start_location]\r\n\t\tassert_equal start_loc, \"Hillman\"\r\n\tend",
"def test_driver_start_getLocation_out_city\n\t\td = Driver::new(\"Driver 1\",-1)\n\t\tassert_equal d.getLocation, -1\n\tend",
"def test_is_valid\n\t\ttest_main = Main.new(3, 4, 6)\n\t\tassert_equal test_main.valid_location(\"Enumberable Canyon\"), 0\n\tend",
"def string=(p0) end",
"def test_driver_start_getLocation_cathedral\n\t\td = Driver::new(\"Driver 1\",1)\n\t\tassert_equal d.getLocation, 1\n\tend",
"def get_location\n\n end",
"def test_get_location_index_valid\n finder = MapLocationFinder.new\n assert_equal 4, finder.get_location_index(\"Matzburg\")\n end",
"def store_location expected_location, variable_name\r\n command 'storeLocation', expected_location, variable_name\r\n end",
"def location_s\n self.location.to_s\n end",
"def test_museum_start_location\r\n\t\trand_val = Minitest::Mock::new\r\n\t\toakland = City::new\r\n\t\tdef rand_val.get_start_location; 1; end\r\n\t\tstart_loc = oakland.all_locations[rand_val.get_start_location]\r\n\t\tassert_equal start_loc, \"Cathedral\"\r\n\tend",
"def location_code\n text(data.at_xpath(\"#{data_root}/did/physloc\"))\n end",
"def x_occi_location_key!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 9 )\n\n type = X_OCCI_LOCATION_KEY\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 137:4: 'X-OCCI-Location'\n match( \"X-OCCI-Location\" )\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__, 9 )\n\n end",
"def test_other_start_location_false\r\n\t\tmock_driver = Minitest::Mock::new\r\n\t\tdef mock_driver.get_start_location; 3; end\r\n\t\toakland = City::new\r\n\t\tstart_loc = oakland.all_locations[mock_driver.get_start_location]\r\n\t\trefute_includes start_loc, oakland.downtown[0]\r\n\t\trefute_includes start_loc, oakland.monro[0]\r\n\tend",
"def location=(v)\n raise \"Improper format\" if v && v.to_s !~ /[a-z]{2}/\n @location = v\n end",
"def test_add_location_bad_input\n assert_raises 'Improper typing of location input in method add_location' do\n locations = LocationRelation.new\n locations.add_location Location.new('test_location_1')\n end\n end",
"def test_driver_start_getLocation_museum\n\t\td = Driver::new(\"Driver 1\",3)\n\t\tassert_equal d.getLocation, 3\n\tend",
"def test_location_new_not_nil\r\n library = Location::new(\"Library\", nil, nil)\r\n refute_nil library\r\n end",
"def category_location\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 8 )\n value = nil\n location15 = nil\n\n begin\n # at line 78:39: ';' ( WS )? 'location' '=' '\\\"' location '\\\"'\n match(T__11, TOKENS_FOLLOWING_T__11_IN_category_location_318)\n # at line 78:43: ( WS )?\n alt_12 = 2\n look_12_0 = @input.peek(1)\n\n if (look_12_0 == WS)\n alt_12 = 1\n end\n case alt_12\n when 1\n # at line 78:43: WS\n match(WS, TOKENS_FOLLOWING_WS_IN_category_location_320)\n\n end\n match(T__18, TOKENS_FOLLOWING_T__18_IN_category_location_323)\n match(T__13, TOKENS_FOLLOWING_T__13_IN_category_location_325)\n match(T__14, TOKENS_FOLLOWING_T__14_IN_category_location_327)\n @state.following.push(TOKENS_FOLLOWING_location_IN_category_location_329)\n location15 = location\n @state.following.pop\n match(T__14, TOKENS_FOLLOWING_T__14_IN_category_location_331)\n # --> action\n value = (location15 && @input.to_s(location15.start, location15.stop))\n # <-- action\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 8 )\n\n end\n\n return value\n end",
"def location\n # TODO Check this\n # return poi.location unless poi.nil?\n # return place.location unless place.nil?\n return get_location\n end",
"def test_for_not_museum\n testLocation = LocationNode.new(\"Hillman\",nil,nil,nil,nil)\n assert_equal false, incrementToy(testLocation)\n end",
"def full_location; end",
"def test_location_not_connected\n refute @loc1.connected? @loc2\n end",
"def test_driver_checkLocation_mid\n\t\td = Driver::new(\"Driver 1\",1)\n\t\td.checkLocation\n\t\t# assert_equal d.classes, 2\n\t\td.setLocation 1 #from cathedral go to museum\n\t\td.checkLocation\n\t\tassert_equal [2,1], [d.classes,d.dinotoys]\n\t\t#assert_equal d.dinotoys, 1\n\tend",
"def physical_location_str\n mods_ng_xml._location.physicalLocation.map(&:text).find do |text|\n text =~ /.*(Series)|(Accession)|(Folder)|(Box).*/i\n end\n end",
"def test_day_output_string_location\r\n location = Minitest::Mock.new(\"test_location_arr\")\r\n assert_raises('Index must be a integer!') { @g.day_output([1, 1], 'matt', location) }\r\n end",
"def test_get_location_index_invalid\n finder = MapLocationFinder.new\n assert_nil finder.get_location_index(\"INVALID LOCATION\")\n end",
"def location\n\t\t@location\n\tend",
"def format_campus_location(campus)\n # TODO (Step 2) - Fix, not showing name.\n \"Flatiron #{campus[:name]}\"\nend",
"def location_description\n LOCATION_DESCRIPTION\n end",
"def location_string_from_feature(feature)\n location = feature.locations.first\n location_string = location.range.to_s\n if location.strand == -1 #negative strand\n location_string = \"complement(#{location_string})\"\n end\n location_string\nend",
"def string_at?(line, column)\n node = node_at(line, column)\n # @todo raise InvalidOffset or InvalidRange or something?\n return false if node.nil?\n node.type == :str or node.type == :dstr\n end",
"def test_valid_maps\r\n test = Prospect.new(0)\r\n assert_equal test.loc.name, 'Matzburg'\r\n end"
] | [
"0.6807698",
"0.6642619",
"0.65418285",
"0.6290512",
"0.6233848",
"0.6146799",
"0.6135825",
"0.6095846",
"0.60549414",
"0.6047841",
"0.59614074",
"0.59530735",
"0.5932694",
"0.5925589",
"0.5862508",
"0.5859755",
"0.58303416",
"0.5815342",
"0.57628417",
"0.5755477",
"0.5755477",
"0.5749622",
"0.5749622",
"0.5749622",
"0.5735512",
"0.57230425",
"0.5714855",
"0.5690806",
"0.5690585",
"0.56791705",
"0.56651247",
"0.56605744",
"0.5640105",
"0.5633771",
"0.5631703",
"0.5619546",
"0.5619477",
"0.56168544",
"0.5607163",
"0.5606924",
"0.5603696",
"0.5598072",
"0.55875814",
"0.55760616",
"0.557412",
"0.5560894",
"0.55575526",
"0.55563974",
"0.55544204",
"0.555378",
"0.5548848",
"0.5543712",
"0.5543387",
"0.5541562",
"0.5536912",
"0.55238754",
"0.55224353",
"0.55190325",
"0.54971683",
"0.549031",
"0.5488751",
"0.5480581",
"0.54764146",
"0.5474028",
"0.5467702",
"0.54624474",
"0.5460245",
"0.5455964",
"0.5455167",
"0.5445066",
"0.54418975",
"0.54273355",
"0.5426679",
"0.5425747",
"0.5417809",
"0.54025686",
"0.5397264",
"0.53927654",
"0.53863007",
"0.5374842",
"0.5367157",
"0.536696",
"0.5364072",
"0.5362643",
"0.5343266",
"0.5342687",
"0.5342348",
"0.5321963",
"0.531866",
"0.531076",
"0.53064185",
"0.530395",
"0.53009343",
"0.5289355",
"0.528584",
"0.5264881",
"0.52614367",
"0.52605176",
"0.5251792",
"0.5239859",
"0.5237278"
] | 0.0 | -1 |
This test when plocation & c_location is string EDGE CASE | def test_print_heading_nil
assert_output("Heading from to \n"){@p.print_heading(nil, nil)}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_locations_of_fourth_ave\n\t\tassert_equal \"Cathedral\", @road2.locations[0]\n\tend",
"def test_getLocation_string\n\t\td = Driver::new(\"Driver 1\",0);\n\t\tdef d.getLocation; d.location=\"string\",\"string\"; end\n\t\tassert_raises (\"Invalid location\") {d.getLocation}\n\tend",
"def test_nodes_of_museum\n\t\tassert_equal @location, @location2.nodes[0]\n\tend",
"def test_new_location\n\t\t@new_driver.location 'Cathedral'\n\t\tassert_equal 'Hillman', @new_driver.location('Hillman')\n\tend",
"def test_nil_location\n\t\t@new_driver.location 'Cathedral'\n\t\tassert_equal 'Cathedral', @new_driver.location(nil)\n\tend",
"def compare_locations?(locatin_from, location_to)\n\t\t# location_to.title == locatin_from.title &&\n\t\tlocation_to.city == locatin_from.city &&\t\t\n\t\tlocation_to.custom_address == locatin_from.custom_address &&\n\t\t# location_to.custom_address_use == locatin_from.custom_address_use &&\n\t\t# location_to.gmap_use == locatin_from.gmap_use &&\n\t\t# location_to.gmaps == locatin_from.gmaps &&\n\t\tlocation_to.latitude == locatin_from.latitude &&\n\t\tlocation_to.longitude == locatin_from.longitude\n\t\t# location_to.title == locatin_from.title\n end",
"def test_new_location_name\n assert_equal \"location 1\", @loc1.name\n end",
"def test_location_2\r\n\t\tdriver = Driver::new(\"Driver\")\r\n\t\t\r\n\t\thillman = Location.new(\"Hillman\", \"Foo St.\", \"Fifth Ave.\")\r\n\t\thospital = Location.new(\"Hospital\", \"Foo St.\", \"Fourth Ave.\")\r\n\t\tmuseum = Location.new(\"Museum\", \"Bar St.\", \"Fifth Ave.\")\r\n\t\tcathedral = Location.new(\"Cathedral\", \"Bar St.\", \"Fourth Ave.\")\r\n\t\t\r\n\t\tlocations = [hillman, hospital, cathedral, museum]\r\n\t\t\r\n\t\trandom_start_location(driver, 2, locations)\r\n\t\tassert_equal cathedral, driver.location\r\n\tend",
"def test_location_name\n assert_equal @l1.name, 'a' # pass\n end",
"def test_getLocation_pos_invalid\n\t\td = Driver::new(\"Driver 1\",0);\n\t\tdef d.getLocation; d.location=999,999; end\n\t\tassert_raises (\"Invalid location\") {d.getLocation}\n\tend",
"def test_compare_string_overlap_defs\n v1 = Vertex.new(\"speech\", 2, 1, 0, 0, 1, \"NN\")\n v2 = Vertex.new(\"delivering\", 2, 1, 0, 0, 1, \"VB\")\n assert_equal(1, instance.compare_strings(v1, v2, speller))#no POS is considered for hypernyms and hyponyms\n end",
"def test_location_not_connected\n refute @loc1.connected? @loc2\n end",
"def test_driver_setLocation_cathedral\n\t\td = Driver::new(\"Driver 1\",0)\n\t\td.setLocation 0 #hospital to cathedral\n\t\tassert_equal d.getLocation, 1\n\tend",
"def test_one_way_is_location\r\n \thillman = Location::new(\"Hillman\", nil, nil)\r\n\t\tdowntown = Location::new(\"Downtown\", nil, nil)\r\n\t\thillman.new_one_way(downtown)\r\n\t\tassert hillman.one_way.is_a?(Location)\r\n\tend",
"def assert_google_location(data, loc)\n assert_equal :google, loc.geocoder\n assert_equal :hash, loc.raw_data_format\n\n assert_equal attribute_matching(\"locality\", data), loc.city\n assert_equal attribute_matching(\"administrative_area_level_1\", data), loc.state\n assert_equal attribute_matching(\"postal_code\", data), loc.post_code\n assert_equal attribute_matching(\"country\", data, :short_name), loc.country_code\n assert_equal data[\"geometry\"][\"location\"][\"lat\"], loc.lat\n assert_equal data[\"geometry\"][\"location\"][\"lng\"], loc.lng\n end",
"def test_two_way_is_location\r\n \thillman = Location::new(\"Hillman\", nil, nil)\r\n\t\thospital = Location::new(\"Hospital\", nil, nil)\r\n\t\thillman.new_two_way(hospital)\r\n\t\tassert hillman.two_way.is_a?(Location)\r\n\tend",
"def other_loc(location)\n\t\t# uses location class equals method (TODO)\n\t\tif location == loc1\n\t\t\tloc2\n\t\telse\n\t\t\tloc1\n\t\tend\n\tend",
"def test_fun_city_locs\n\t@city = GoldRush::new\n\tassert_equal \"El Dorado Canyon\", @city.dorado.location\n\tassert_equal \"Midas\", @city.midas.location\n\tassert_equal \"Virginia City\", @city.virginia.location\n\tassert_equal \"Nevada City\", @city.nevada.location\n\tassert_equal \"Coloma\", @city.coloma.location\n\tassert_equal \"Angels Camp\", @city.angels.location\n\tassert_equal \"Sutter Creek\", @city.sutter.location\n end",
"def test_update_location_name_errors\n params = update_params_from_loc(locations(:albion))\n params[:location][:display_name] = \"Somewhere Dubious\"\n update_location_error(params)\n end",
"def test_location_other_connect\n @loc1.add_neighbor @loc2\n assert @loc2.connected? @loc1\n end",
"def test_location_1\r\n\t\tdriver = Driver::new(\"Driver\")\r\n\t\t\r\n\t\thillman = Location.new(\"Hillman\", \"Foo St.\", \"Fifth Ave.\")\r\n\t\thospital = Location.new(\"Hospital\", \"Foo St.\", \"Fourth Ave.\")\r\n\t\tmuseum = Location.new(\"Museum\", \"Bar St.\", \"Fifth Ave.\")\r\n\t\tcathedral = Location.new(\"Cathedral\", \"Bar St.\", \"Fourth Ave.\")\r\n\t\t\r\n\t\tlocations = [hillman, hospital, cathedral, museum]\r\n\t\t\r\n\t\trandom_start_location(driver, 1, locations)\r\n\t\tassert_equal hospital, driver.location\r\n\tend",
"def test_job_location\n job = Job.new(title: 'Senior Developer',\n location: 'San Francisco, CA',\n description: 'Python node scala stuff senior 5+ years')\n\n return job.location == :San_Francisco\n end",
"def test_valid_city_name\n answer = MapGraph.new\n assert_equal 6, answer.get_index_and_city_name('Dynamic Palisades')\n end",
"def location_string_from_feature(feature)\n location = feature.locations.first\n location_string = location.range.to_s\n if location.strand == -1 #negative strand\n location_string = \"complement(#{location_string})\"\n end\n location_string\nend",
"def x_occi_location\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 19 )\n location = nil\n uri27 = nil\n\n begin\n # at line 108:4: X_OCCI_LOCATION_KEY COLON ( WS )? uri ( SEMICOLON )?\n match( X_OCCI_LOCATION_KEY, TOKENS_FOLLOWING_X_OCCI_LOCATION_KEY_IN_x_occi_location_809 )\n match( COLON, TOKENS_FOLLOWING_COLON_IN_x_occi_location_811 )\n # at line 108:30: ( WS )?\n alt_29 = 2\n look_29_0 = @input.peek( 1 )\n\n if ( look_29_0 == WS )\n alt_29 = 1\n end\n case alt_29\n when 1\n # at line 108:30: WS\n match( WS, TOKENS_FOLLOWING_WS_IN_x_occi_location_813 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_uri_IN_x_occi_location_816 )\n uri27 = uri\n @state.following.pop\n # at line 108:38: ( SEMICOLON )?\n alt_30 = 2\n look_30_0 = @input.peek( 1 )\n\n if ( look_30_0 == SEMICOLON )\n alt_30 = 1\n end\n case alt_30\n when 1\n # at line 108:38: SEMICOLON\n match( SEMICOLON, TOKENS_FOLLOWING_SEMICOLON_IN_x_occi_location_818 )\n\n end\n # --> action\n location = URI.parse(( uri27 && @input.to_s( uri27.start, uri27.stop ) )) \n # <-- action\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 19 )\n\n end\n \n return location\n end",
"def test_print_location\n \t@gold_rush.initialize(2, 2)\n \tassert_equal \"Heading from Sutter Creek to Angels Camp, holding 1 ounce of gold and 0 ounces of silver.\", @gold_rush.print_location(@prospectors[0], 0)\n end",
"def test_name_is_hillman\n\t\tassert_equal \"Hillman\", @location.name\n\tend",
"def test_move_str\n mock_loc = Minitest::Mock.new \"mock_loc\"\n\tdef mock_loc.name;\"previous location\";end\n\tmock_loc2 = Minitest::Mock.new \"mock_loc2\"\n\tdef mock_loc2.name;\"next location\";end\n\tmap = Map.new\n\tmap.nodes = [mock_loc, mock_loc2]\n\tdummy_rng = Minitest::Mock.new(\"dummy_rng\")\n\tdef mock_loc.choose_neighbor(a);1;end\n p = Prospector.new(0, mock_loc, 0)\n\tp.total_gold = 1\n\tp.total_silver = 1\n\tassert p.move(dummy_rng, map), \"Heading from previous location to next location \"\\\n \"holding 1 ounce of gold and \"\\\n\t\"#1 ounce of silver\"\n end",
"def test_initial_location\n\tassert_equal \"Sutter Creek\", @gold_rush.set_location\n end",
"def test_possible_location_from_cathedral_if_rand_is_one\r\n\t\toakland = City::new\r\n\t\trand_val = 1\r\n\t\tmuseum = oakland.generate_cathedral_locs(oakland, rand_val)\r\n\r\n\t\tassert_equal museum[0], \"Museum\"\r\n\t\tassert_equal museum[1][0], \"Bar St.\"\r\n\tend",
"def test_driver_setLocation_museum\n\t\td = Driver::new(\"Driver 1\",1)\n\t\td.setLocation 1 #cathedral to museum\n\t\tassert_equal d.getLocation, 3\n\tend",
"def test_location_is_connected\n @loc1.add_neighbor @loc2\n assert @loc1.connected? @loc2\n end",
"def test_for_not_museum\n testLocation = LocationNode.new(\"Hillman\",nil,nil,nil,nil)\n assert_equal false, incrementToy(testLocation)\n end",
"def test_get_location_contains\n locations = LocationRelation.new\n locations.add_location Location.new('test_location_2', 0, 0)\n assert_equal 'test_location_2', locations.get_location('test_location_2').name_reader\n end",
"def x_occi_location\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 19 )\n uri = nil\n location28 = nil\n\n begin\n # at line 134:4: 'X-OCCI-Location' ':' ( WS )? location ( ';' )?\n match(T__27, TOKENS_FOLLOWING_T__27_IN_x_occi_location_763)\n match(T__10, TOKENS_FOLLOWING_T__10_IN_x_occi_location_765)\n # at line 134:26: ( WS )?\n alt_30 = 2\n look_30_0 = @input.peek(1)\n\n if (look_30_0 == WS)\n alt_30 = 1\n end\n case alt_30\n when 1\n # at line 134:26: WS\n match(WS, TOKENS_FOLLOWING_WS_IN_x_occi_location_767)\n\n end\n @state.following.push(TOKENS_FOLLOWING_location_IN_x_occi_location_770)\n location28 = location\n @state.following.pop\n # at line 134:39: ( ';' )?\n alt_31 = 2\n look_31_0 = @input.peek(1)\n\n if (look_31_0 == T__11)\n alt_31 = 1\n end\n case alt_31\n when 1\n # at line 134:39: ';'\n match(T__11, TOKENS_FOLLOWING_T__11_IN_x_occi_location_772)\n\n end\n # --> action\n uri = URI.parse((location28 && @input.to_s(location28.start, location28.stop)))\n # <-- action\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 19 )\n\n end\n\n return uri\n end",
"def test_street_connection\r\n\t\thillman = Location::new(\"Hillman\", \"Foo St.\", nil)\r\n\t\tassert_equal \"Foo St.\", hillman.street\r\n\tend",
"def test_location_detection\n # Google geocoder isn't returning the postal code?\n # assert_equal \"80303\", @twitter_reporter.reports.create(:body => 'Long wait in #80303').location.postal_code\n \n assert_equal \"Boston, MA 02130, USA\", @twitter_reporter.reports.create(:body => 'Insane lines at #zip-02130').location.address\n assert_equal \"90 Church Rd, Arnold, MD 21012, USA\", @twitter_reporter.reports.create(:body => 'L:90 Church Road, Arnold, MD: bad situation').location.address\n # assert_equal \"21804\", @twitter_reporter.reports.create(:body => '#zip21804 weird stuff happening').location.postal_code\n assert_equal \"Church Hill\", @twitter_reporter.reports.create(:body => 'Things are off in L:Church Hill, MD').location.locality\n # assert_equal \"94107\", @twitter_reporter.reports.create(:body => 'No 94107 worries!').location.postal_code\n # assert_equal \"21012\", @twitter_reporter.reports.create(:body => 'going swimmingly l:21012-2423').zip\n assert_equal \"Severna Park, MD, USA\", @twitter_reporter.reports.create(:body => 'Long lines at l:severna park senior HS').location.address\n assert_equal \"New York 11215, USA\", @twitter_reporter.reports.create(:body => 'wait:105 in Park Slope, Brooklyn zip11215 #votereport').location.address\n assert_equal \"Courthouse, Virginia, USA\", @twitter_reporter.reports.create(:body => 'no joy and long wait in l:courthouse, va').location.address\n # with mis-spelling:\n assert_equal \"Boulder, CO, USA\", @twitter_reporter.reports.create(:body => 'long lines at courthouse L:Bolder CO').location.address\n end",
"def test_possible_location_from_museum_if_rand_is_zero\r\n\t\toakland = City::new\r\n\t\trand_val = 0\r\n\t\tcathedral = oakland.generate_museum_locs(oakland, rand_val)\r\n\r\n\t\tassert_equal cathedral[0], \"Cathedral\"\r\n\t\tassert_equal cathedral[1][0], \"Bar St.\"\r\n\tend",
"def test_location_self_connect\n @loc1.add_neighbor @loc2\n assert @loc1.connected? @loc2\n end",
"def test_location_3\r\n\t\tdriver = Driver::new(\"Driver\")\r\n\t\t\r\n\t\thillman = Location.new(\"Hillman\", \"Foo St.\", \"Fifth Ave.\")\r\n\t\thospital = Location.new(\"Hospital\", \"Foo St.\", \"Fourth Ave.\")\r\n\t\tmuseum = Location.new(\"Museum\", \"Bar St.\", \"Fifth Ave.\")\r\n\t\tcathedral = Location.new(\"Cathedral\", \"Bar St.\", \"Fourth Ave.\")\r\n\t\t\r\n\t\tlocations = [hillman, hospital, cathedral, museum]\r\n\t\t\r\n\t\trandom_start_location(driver, 3, locations)\r\n\t\tassert_equal museum, driver.location\r\n\tend",
"def test_update_location_errors\n params = update_params_from_loc(locations(:albion))\n params[:location][:north] = 100\n update_location_error(params)\n end",
"def test_accessing_node_name\n\t\tassert_equal \"Hillman\", @location2.nodes[0].name\n\tend",
"def verify_locations(test_data)\n locations = test_data[CoreUseOfCollectionsData::LOCATION_LIST.name] || [{CoreUseOfCollectionsData::LOCATION.name => ''}]\n locations.each_with_index { |location, index| verify_values_match(location[CoreUseOfCollectionsData::LOCATION.name], element_value(location_input index)) }\n end",
"def test_location_get_neighbors\n\t\tneighbors_1 = [\"Hogwarts\"]\n\t\tloc = Location::new(\"Location\", neighbors_1)\n\t\tassert_equal neighbors_1, loc.get_neighbors\n\tend",
"def potential_neighbor_strings\n\n north_node_x = @x\n north_node_y = @y + 1\n\n east_node_x = @x + 1\n east_node_y = @y\n\n south_node_x = @x\n south_node_y = @y - 1\n\n west_node_x = @x - 1\n west_node_y = @y \n\n check_potential_neighbor_nodes_validity([{x: west_node_x, y: west_node_y}, {x: north_node_x, y: north_node_y}, {x: east_node_x, y: east_node_y}, {x: south_node_x, y: south_node_y}])\n end",
"def test_location_0\r\n\t\tdriver = Driver::new(\"Driver\")\r\n\t\t\r\n\t\thillman = Location.new(\"Hillman\", \"Foo St.\", \"Fifth Ave.\")\r\n\t\thospital = Location.new(\"Hospital\", \"Foo St.\", \"Fourth Ave.\")\r\n\t\tmuseum = Location.new(\"Museum\", \"Bar St.\", \"Fifth Ave.\")\r\n\t\tcathedral = Location.new(\"Cathedral\", \"Bar St.\", \"Fourth Ave.\")\r\n\t\t\r\n\t\tlocations = [hillman, hospital, cathedral, museum]\r\n\t\t\r\n\t\trandom_start_location(driver, 0, locations)\r\n\t\tassert_equal hillman, driver.location\r\n\tend",
"def test_if_output_splits_elements_into_strings\n assert_equal [[\"A\", \"A\"], [\"1\", \"2\"]], @board.parse_coordinates([\"A1\", \"A2\"])\n end",
"def test_get_location_bad_input\n assert_raises 'Improper typing of location input argument in method get_location' do\n locations = LocationRelation.new\n locations.get_location 55\n end\n end",
"def verify_locations(test_data)\n locations = test_data[UseOfCollections::LOCATION_LIST.name] || [{ UseOfCollections::LOCATION.name => ''}]\n locations.each_with_index { |location, index| verify_values_match(location[UseOfCollections::LOCATION.name], element_value(location_input index)) }\n end",
"def test_driver_checkLocation_mid\n\t\td = Driver::new(\"Driver 1\",1)\n\t\td.checkLocation\n\t\t# assert_equal d.classes, 2\n\t\td.setLocation 1 #from cathedral go to museum\n\t\td.checkLocation\n\t\tassert_equal [2,1], [d.classes,d.dinotoys]\n\t\t#assert_equal d.dinotoys, 1\n\tend",
"def category_location\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 8 )\n value = nil\n location15 = nil\n\n begin\n # at line 78:39: ';' ( WS )? 'location' '=' '\\\"' location '\\\"'\n match(T__11, TOKENS_FOLLOWING_T__11_IN_category_location_318)\n # at line 78:43: ( WS )?\n alt_12 = 2\n look_12_0 = @input.peek(1)\n\n if (look_12_0 == WS)\n alt_12 = 1\n end\n case alt_12\n when 1\n # at line 78:43: WS\n match(WS, TOKENS_FOLLOWING_WS_IN_category_location_320)\n\n end\n match(T__18, TOKENS_FOLLOWING_T__18_IN_category_location_323)\n match(T__13, TOKENS_FOLLOWING_T__13_IN_category_location_325)\n match(T__14, TOKENS_FOLLOWING_T__14_IN_category_location_327)\n @state.following.push(TOKENS_FOLLOWING_location_IN_category_location_329)\n location15 = location\n @state.following.pop\n match(T__14, TOKENS_FOLLOWING_T__14_IN_category_location_331)\n # --> action\n value = (location15 && @input.to_s(location15.start, location15.stop))\n # <-- action\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 8 )\n\n end\n\n return value\n end",
"def coordinate?(s)\n COORDINATE_RE.match(s.to_s)\n end",
"def test_is_valid_2\n\t\ttest_main = Main.new(3, 4, 6)\n\t\tassert_equal test_main.valid_location(\"Animal Beach\"), -1\n\tend",
"def test_getLocation_neg_invalid\n\t\td = Driver::new(\"Driver 1\",0);\n\t\tdef d.getLocation; d.location=-999,-999; end\n\t\tassert_raises (\"Invalid location\") {d.getLocation}\n\tend",
"def test_add_location_bad_input\n assert_raises 'Improper typing of location input in method add_location' do\n locations = LocationRelation.new\n locations.add_location Location.new('test_location_1')\n end\n end",
"def test_location_connections_empty\n assert @loc1.neighbors.empty?\n end",
"def isAdjacent(piece, location)\n if piece.instance_of?(Piece) && location.instance_of?(Location) && piece.location != nil\n x1 = piece.location.coordinates[0]\n y1 = piece.location.coordinates[1]\n x2 = location.coordinates[0]\n y2 = location.coordinates[1]\n adjacent = false\n if ((x1.between?(0,6)) && (y1.between?(0,6)) &&\n (x2.between?(0,6)) && (y2.between?(0,6)))\n #concatenate coordinates into strings for case statement\n pieceCoordinates = \"#{x1}#{y1}\"\n locationCoordinates = \"#{x2}#{y2}\"\n case pieceCoordinates\n when \"00\"\n case locationCoordinates\n when \"30\", \"03\"\n adjacent = true\n else\n end\n when \"03\"\n case locationCoordinates\n when \"00\", \"13\", \"06\"\n adjacent = true\n else\n end\n when \"06\"\n case locationCoordinates\n when \"03\", \"36\"\n adjacent = true\n else\n end\n when \"11\"\n case locationCoordinates\n when \"13\", \"31\"\n adjacent = true\n else\n end\n when \"13\"\n case locationCoordinates\n when \"03\", \"11\", \"15\", \"23\"\n adjacent = true\n else\n end\n when \"15\"\n case locationCoordinates\n when \"13\", \"35\"\n adjacent = true\n else\n end\n when \"22\"\n case locationCoordinates\n when \"23\", \"32\"\n adjacent = true\n else\n end\n when \"23\"\n case locationCoordinates\n when \"13\", \"22\", \"24\"\n adjacent = true\n else\n end\n when \"24\"\n case locationCoordinates\n when \"23\", \"34\"\n adjacent = true\n else\n end\n when \"30\"\n case locationCoordinates\n when \"00\", \"31\", \"60\"\n adjacent = true\n else\n end\n when \"31\"\n case locationCoordinates\n when \"30\", \"11\", \"32\", \"51\"\n adjacent = true\n else\n end\n when \"32\"\n case locationCoordinates\n when \"22\", \"31\", \"42\"\n adjacent = true\n else\n end\n when \"34\"\n case locationCoordinates\n when \"24\", \"35\", \"44\"\n adjacent = true\n else\n end\n when \"35\"\n case locationCoordinates\n when \"15\", \"34\", \"36\", \"55\"\n adjacent = true\n else\n end\n when \"36\"\n case locationCoordinates\n when \"06\", \"35\", \"66\"\n adjacent = true\n else\n end\n when \"42\"\n case locationCoordinates\n when \"32\", \"43\"\n adjacent = true\n else\n end\n when \"43\"\n case locationCoordinates\n when \"42\", \"44\", \"53\"\n adjacent = true\n else\n end\n when \"44\"\n case locationCoordinates\n when \"34\", \"43\"\n adjacent = true\n else\n end\n when \"51\"\n case locationCoordinates\n when \"31\", \"53\"\n adjacent = true\n else\n end\n when \"53\"\n case locationCoordinates\n when \"43\", \"55\", \"63\", \"51\"\n adjacent = true\n else\n end\n when \"55\"\n case locationCoordinates\n when \"35\", \"53\"\n adjacent = true\n else\n end\n when \"60\"\n case locationCoordinates\n when \"03\", \"63\"\n adjacent = true\n else\n end\n when \"63\"\n case locationCoordinates\n when \"60\", \"53\", \"66\"\n adjacent = true\n else\n end\n when \"66\"\n case locationCoordinates\n when \"36\", \"63\"\n adjacent = true\n else\n end\n else\n end\n end\n end\n adjacent\n end",
"def location_code\n text(data.at_xpath(\"#{data_root}/did/physloc\"))\n end",
"def test_other_start_location_false\r\n\t\tmock_driver = Minitest::Mock::new\r\n\t\tdef mock_driver.get_start_location; 3; end\r\n\t\toakland = City::new\r\n\t\tstart_loc = oakland.all_locations[mock_driver.get_start_location]\r\n\t\trefute_includes start_loc, oakland.downtown[0]\r\n\t\trefute_includes start_loc, oakland.monro[0]\r\n\tend",
"def test_valid_maps\r\n test = Prospect.new(0)\r\n assert_equal test.loc.name, 'Matzburg'\r\n end",
"def location\n if questioning.question.qtype_name == 'location' && !value.blank?\n value.split(' ')\n else\n nil\n end\n end",
"def test_driver_setLocation_hillman\n\t\td = Driver::new(\"Driver 1\",0)\n\t\td.setLocation 1 #museum to hillman\n\t\tassert_equal d.getLocation, 2\n\tend",
"def test_for_not_cathedral\n testLocation = LocationNode.new(\"Hillman\",nil,nil,nil,nil)\n assert_equal false, incrementClass(testLocation)\n end",
"def getTestLocation\n return 'DummyLocation'\n end",
"def locationNull \n \"locationNull\" \n end",
"def test_driver_setLocation_monroeville_downtown\n\t\t#testing downtown gives the same result as monroeville\n\t\td = Driver::new(\"Driver 1\",1)\n\t\td.setLocation 0\n\t\tassert_equal d.getLocation, -1\n\tend",
"def test_querry\n assert_equal(get_city_info('TY', @my_graph), 'noCity', 'output wrong')\n assert_not_equal(get_city_info('TYO', @my_graph), 'noCity', 'output wrong')\n end",
"def detect_location\n if self.text\n LOCATION_PATTERNS.find { |p| self.text[p] }\n self.location = Location.geocode($1) if $1\n self.zip = location.postal_code if !self.zip && (self.location && location.postal_code)\n end\n if !self.location && self.zip\n self.location = Location.geocode(self.zip)\n end\n self.location = self.reporter.location if !self.location && self.reporter && self.reporter.location\n ll, self.location_accuracy = self.latlon.split(/:/) if self.latlon\n true\n end",
"def detect_location\n if self.text\n LOCATION_PATTERNS.find { |p| self.text[p] }\n self.location = Location.geocode($1) if $1\n self.zip = location.postal_code if !self.zip && (self.location && location.postal_code)\n end\n if !self.location && self.zip\n self.location = Location.geocode(self.zip)\n end\n self.location = self.reporter.location if !self.location && self.reporter && self.reporter.location\n ll, self.location_accuracy = self.latlon.split(/:/) if self.latlon\n true\n end",
"def test_possible_location_from_museum_if_rand_is_one\r\n\t\toakland = City::new\r\n\t\trand_val = 1\r\n\t\thillman = oakland.generate_museum_locs(oakland, rand_val)\r\n\r\n\t\tassert_equal hillman[0], \"Hillman\"\r\n\t\tassert_equal hillman[1][0], \"Fifth Ave.\"\r\n\tend",
"def see_surrounding(location: [0,0])\n if valid_location(location[0], location[1]-1)\n reveal_location(loc: [location[0], location[1]-1])\n end\n if valid_location(location[0], location[1]+1)\n reveal_location(loc: [location[0], location[1]+1])\n end\n if valid_location(location[0]-1, location[1])\n reveal_location(loc: [location[0]-1, location[1]])\n end\n if valid_location(location[0]+1, location[1])\n reveal_location(loc: [location[0]+1, location[1]])\n end\n end",
"def location_code\n # find the closest location\n location = area || city || province\n location.post_code\n end",
"def display_piece_by_location(piece, location)\nif location == 2 || location == 5\nprint_piece(piece, \"\\n\\t\")\nprint_separator_line\nelsif location == 8\nprint_piece(piece, \"\\n\")\nelse\nprint_piece(piece, SEPARATOR[:vertical])\nend\nend",
"def test_invalid_city_name\n answer = MapGraph.new\n assert_nil answer.get_index_and_city_name('Pittsburgh')\n end",
"def category_location\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 8 )\n value = nil\n uri15 = nil\n\n begin\n # at line 51:39: SEMICOLON ( WS )? LOCATION EQUALS QUOTE uri QUOTE\n match( SEMICOLON, TOKENS_FOLLOWING_SEMICOLON_IN_category_location_315 )\n # at line 51:49: ( WS )?\n alt_12 = 2\n look_12_0 = @input.peek( 1 )\n\n if ( look_12_0 == WS )\n alt_12 = 1\n end\n case alt_12\n when 1\n # at line 51:49: WS\n match( WS, TOKENS_FOLLOWING_WS_IN_category_location_317 )\n\n end\n match( LOCATION, TOKENS_FOLLOWING_LOCATION_IN_category_location_320 )\n match( EQUALS, TOKENS_FOLLOWING_EQUALS_IN_category_location_322 )\n match( QUOTE, TOKENS_FOLLOWING_QUOTE_IN_category_location_324 )\n @state.following.push( TOKENS_FOLLOWING_uri_IN_category_location_326 )\n uri15 = uri\n @state.following.pop\n match( QUOTE, TOKENS_FOLLOWING_QUOTE_IN_category_location_328 )\n # --> action\n value = ( uri15 && @input.to_s( uri15.start, uri15.stop ) ) \n # <-- action\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 8 )\n\n end\n \n return value\n end",
"def test_is_valid\n\t\ttest_main = Main.new(3, 4, 6)\n\t\tassert_equal test_main.valid_location(\"Enumberable Canyon\"), 0\n\tend",
"def test_location_change_string_new\r\n location = Minitest::Mock.new(\"test_location_arr\")\r\n def location.get_id(index); \"Hash Crossing\"; end\r\n assert_raises('index must be an integer!') { @g.location_change(location, 0, 'a')}\r\n end",
"def test_driver_get_place\n\t\tloc = Location::new(\"Location\", [\"Place\"])\n\t\tdriv = Driver::new(1, loc)\n\t\tassert_equal loc, driv.get_place\n\tend",
"def test_construct_location_simple\n count = Location.count\n params = barton_flats_params\n display_name = params[:display_name]\n post_requires_login(:create_location, params)\n assert_response(:action => :show_location)\n assert_equal(count + 1, Location.count)\n assert_equal(10 + @new_pts, @rolf.reload.contribution)\n loc = assigns(:location)\n assert_equal(display_name, loc.display_name) # Make sure it's the right Location\n loc = Location.find_by_name_or_reverse_name(display_name)\n assert_nil(loc.description)\n assert_not_nil(loc.rss_log)\n end",
"def load_location_from_httpu_data(data)\r\n debug data\r\n data.gsub(/LOCATION:([^\\r\\n]+)/i) do |i| @igd_location_descr = $1.strip end\r\n debug \"IGD location : #@igd_location_descr\"\r\n @igd_location = @igd_location_descr.split('/')[0, 3].join('/')\r\n return true\r\n end",
"def convert_input_into_location(input)\n\t\tx = input[0]\n\t\tcase x\n\t\twhen 'a'\n\t\t\tx = 1\n\t\twhen 'b'\n\t\t\tx = 2\n\t\twhen 'c'\n\t\t\tx = 3\n\t\twhen 'd'\n\t\t\tx = 4\n\t\twhen 'e'\n\t\t\tx = 5\n\t\twhen 'f'\n\t\t\tx = 6\n\t\twhen 'g'\n\t\t\tx = 7\n\t\twhen 'h'\n\t\t\tx = 8\n\t\telse\n\t\t\treturn false\n\t\tend\n\t\ty = input[1]\n\t\tcase y\n\t\twhen '1'\n\t\t\ty = 8\n\t\twhen '2'\n\t\t\ty = 7\n\t\twhen '3'\n\t\t\ty = 6\n\t\twhen '4'\n\t\t\ty = 5\n\t\twhen '5'\n\t\t\ty = 4\n\t\twhen '6'\n\t\t\ty = 3\n\t\twhen '7'\n\t\t\ty = 2\n\t\twhen '8'\n\t\t\ty = 1\n\t\telse\n\t\t\treturn false\n\t\tend\n\t\t[x,y]\n\tend",
"def test_driver_setLocation_hospital\n\t\td = Driver::new(\"Driver 1\",2)\n\t\td.setLocation 1 #hillman to hospital\n\t\tassert_equal d.getLocation, 0\n\tend",
"def test_driver_drive_change_place\n\t\tloc1 = Location::new(\"Location\", [\"Place\"])\n\t\tdriv = Driver::new(1, loc1)\n\t\trefute_equal loc1, driv.drive\n\tend",
"def test_change_curr_location_any\n \tlocation_stub = Minitest::Mock.new('Mock Location')\n \tpro = Prospector.new(1)\n \tdef location_stub.loc\n \"Laboon Lake\"\n end\n def location_stub.max_rubies\n 1\n end\n def location_stub.max_fake_rubies\n 1\n end\n def location_stub.neighbor_list\n [\"Sean's Bowser Castle\", \"Kitty's Cozy Condo\"]\n end\n pro.change_curr_location(location_stub)\n assert pro.curr_location.loc == \"Laboon Lake\"\n assert pro.curr_location.max_rubies == 1\n assert pro.curr_location.max_fake_rubies == 1\n assert pro.curr_location.neighbor_list.length == 2\n assert pro.curr_location.neighbor_list.include? \"Sean's Bowser Castle\"\n assert pro.curr_location.neighbor_list.include? \"Kitty's Cozy Condo\"\n end",
"def test_address_validation\n response = nil\n assert_nothing_raised do\n #response = @carrier_prod.validate_addresses({'address_from' => @locations[:ottawa], 'address_to' => @locations[:beverly_hills]}, :test=>false)\n @carrier_prod.validate_addresses({'address_from' => Location.new(\n :country => 'US',\n :state => 'TX',\n :city => 'Houston',\n :address1 => '11811 North Freeway',\n :address2 => 'suite 500',\n :zip => '77060'), \n 'address_to' => Location.new(:country => 'US',\n :state => 'NY',\n :city => 'Brooklyn',\n :address1 => '7 Balfour pl',\n :address2 => 'Apt E3',\n :zip => '11225')})\n end\n end",
"def location\n [city, state, zip_code].join(\" \")\n end",
"def location\n [city, state, zip_code].join(\" \")\n end",
"def location\n [city, state, zip_code].join(\" \")\n end",
"def test_gem_handles_weird_chars_without_exceptions\r\n assert_nothing_raised do\r\n assert_equal \"DE\", Autometal::Geoip.new('78.46.60.181').country\r\n assert_equal \"SE\", Autometal::Geoip.new('81.237.231.174').country\r\n end\r\n end",
"def diagnostics\n loc = scour 5902\n address = /2501 West Memorial, Oklahoma City, OK.*73134/\n raise \"AMC address not parsing correctly: #{loc.address} expected to equal #{address}\" unless loc.address =~ address\n end",
"def test_duck_type_beach_neighbors\n assert_equal ['Enumerable Canyon', 'Matzburg'], @l.duck_type_beach['neighbors']\n end",
"def my_location\n\t\t\"#{address}, #{city}, GA\"\n\tend",
"def test_location_has_neighbors\n @l1.add_neighbors([@l2, @l3])\n assert_equal @l1.neighbors, [@l2, @l3] # pass\n end",
"def locations_to_coverage_and_placenames\n [lambda {|d|\n d.locations? and d.locations.size > 0 },\n lambda {|d|\n d.coverage = d.locations.select {|l|\n l.north? and l.east? and l.south? and l.west?\n }.map {\n |l|\n { :north => l.north, :east => l.east, :south => l.south, :west => l.west }\n }\n d.placenames = d.locations.map {|l| l.area}.map {|area|\n case area\n when \"dronning_maud_land\"\n {\"placename\"=>\"Dronning Maud Land\", \"country\" => \"AQ\" }\n when \"svalbard\"\n {\"placename\"=>\"Svalbard\", \"country\" => \"NO\" }\n else {\"placename\"=>area}\n end\n }.select{|p|not p.nil? and not p[\"placename\"] =~ /norway|arctic|antartic/ }.uniq\n d.delete :locations\n d\n }]\n end",
"def parse_location(text)\n if text =~ /[a-zA-Z]/\n return location(text)\n else\n return text\n end\nend",
"def test_location_change\r\n location = Minitest::Mock.new(\"test_location_arr\")\r\n def location.get_id(index); \"Hash Crossing\"; end\r\n assert_output(\"Heading from Hash Crossing to Hash Crossing.\\n\") { @g.location_change(location, 0, 0)}\r\n end",
"def location!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 26 )\n\n type = LOCATION\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 160:11: 'location'\n match( \"location\" )\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__, 26 )\n\n end",
"def physical_location_str\n mods_ng_xml._location.physicalLocation.map(&:text).find do |text|\n text =~ /.*(Series)|(Accession)|(Folder)|(Box).*/i\n end\n end",
"def validLocation(collectable, str, ave)\n oldLoc = Location.find(collectable.location_id)\n a = oldLoc.ave\n st = oldLoc.street\n\n if(Location.find_by(ave: \"#{a.to_i + ave}\"))\n new_ave = a.to_i + ave\n else\n new_ave = a.to_i - ave\n end\n\n if(Location.find_by(street: \"#{st.to_i + str}\"))\n new_str = st.to_i + str\n else\n new_str = st.to_i - str\n end\n\n Location.find_by(street: new_str, ave: new_ave)\nend",
"def test_lat_lon_xml_format\n tracepoint = build(:tracepoint, :latitude => 0.00004 * GeoRecord::SCALE, :longitude => 0.00008 * GeoRecord::SCALE)\n\n assert_match /lat=\"0.0000400\"/, tracepoint.to_xml_node.to_s\n assert_match /lon=\"0.0000800\"/, tracepoint.to_xml_node.to_s\n end",
"def x_occi_location_key!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 9 )\n\n type = X_OCCI_LOCATION_KEY\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 137:4: 'X-OCCI-Location'\n match( \"X-OCCI-Location\" )\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__, 9 )\n\n end"
] | [
"0.64605343",
"0.6340142",
"0.6240623",
"0.61671096",
"0.5950059",
"0.58482087",
"0.5822723",
"0.5799633",
"0.57785743",
"0.57510465",
"0.5735888",
"0.57333225",
"0.5730655",
"0.56955725",
"0.5674328",
"0.5665815",
"0.56634897",
"0.5632169",
"0.5628813",
"0.5627095",
"0.56203264",
"0.5618519",
"0.56087637",
"0.55932695",
"0.55866843",
"0.55750936",
"0.55721116",
"0.55654925",
"0.55580395",
"0.5556695",
"0.5553889",
"0.553712",
"0.5527875",
"0.55253536",
"0.55249333",
"0.55130893",
"0.55098736",
"0.55030215",
"0.54941684",
"0.54880685",
"0.5481922",
"0.54805493",
"0.5455557",
"0.5442637",
"0.54393595",
"0.5439286",
"0.5434727",
"0.5425072",
"0.542438",
"0.5424198",
"0.5402207",
"0.5395078",
"0.5378363",
"0.5371668",
"0.5369464",
"0.5357856",
"0.5355096",
"0.53348565",
"0.5333474",
"0.53238755",
"0.53078127",
"0.5303613",
"0.5297854",
"0.52960914",
"0.5293221",
"0.5290864",
"0.528837",
"0.526449",
"0.526449",
"0.52395684",
"0.5228443",
"0.5226688",
"0.52215296",
"0.52152985",
"0.52116096",
"0.52088434",
"0.52065367",
"0.520572",
"0.520276",
"0.5197273",
"0.5196932",
"0.51927245",
"0.5188137",
"0.518773",
"0.51867306",
"0.517756",
"0.517756",
"0.517756",
"0.5173826",
"0.51712507",
"0.51674414",
"0.5166376",
"0.5156639",
"0.515511",
"0.51402116",
"0.5137238",
"0.512361",
"0.51196563",
"0.5106731",
"0.51063466",
"0.5092622"
] | 0.0 | -1 |
UNIT TEST FOR plural?(x) Equivalence classes: num = nil, raise num = string, raise num = float, output num = 0, nil (EDGE CASE) num = 1, ruby num = 2, rubies This is test when argument is nil | def test_plural_nil
assert_raises(StandardError) {@p.plural?(nil)}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_plural_zero\n assert_nil @p.plural?(0) # pass\n end",
"def test_plural_float\n assert_raises(StandardError) {@p.plural?(nil)}\n end",
"def test_plural_int\n assert_equal @p.plural?(1), 'ruby'\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 plural?(num)\n return 'ruby' if num == 1\n return 'rubies' if num > 1\n end",
"def test_plural_int2\n assert_equal @p.plural?(2), 'rubies'\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 pluralizer(num,noun)\n p num > 1 ? \"#{num} #{noun}s\" : nil\nend",
"def test_plural_string\n assert_raises(StandardError) {@p.plural?('1')}\n end",
"def plural(n)\n n != 1\nend",
"def pluralizer(noun, num)\n if num > 1\n \"#{num} #{noun}s\"\n elsif num === 1\n \"#{num} #{noun}\"\n elsif num === 0\n \"zero #{noun}s\"\n else\n \"Please enter a whole number\"\n end\nend",
"def pluralizer(noun, num)\n if num > 1\n \"#{num} #{noun}s\"\n elsif num === 1\n \"#{num} #{noun}\"\n elsif num === 0\n \"zero #{noun}s\"\n else\n \"Please enter a whole number\"\n end\nend",
"def test_format_print_two_plural\n simulator = Sim.new(nil, nil, nil)\n assert_equal simulator.ruby_format_print([2, 2]), \"\\tFound 2 rubies and 2 fake rubies in Enumerable Canyon.\\n\"\n end",
"def pluralizer string, n\n if n == 1 \n puts \"#{n} #{string}\"\n elsif n > 1 || n==0\n puts \"#{n} #{string}s\"\n end\nend",
"def pluralizer animal, number\n if number == 1\n puts \"there is #{number} #{animal}\"\n elsif number >= 2 || number == 0\n puts \"there are #{number} #{animal}s\"\n else \n puts 'is that a number?'\n end\nend",
"def pluralizer(num,noun)\n p noun == \"sheep\" ? \"#{num} #{noun}\" : noun == \"geese\" ? \"#{num} #{noun}\" :\n num == 1 && noun == \"child\" ? \"#{num} #{noun}\" : noun == \"child\" ? \"#{num} #{noun}ren\" :\n noun == \"children\" ? \"#{num} child\" : num == 1 && noun == \"people\" ? \"#{num} person\" :\n num > 1 ? \"#{num} #{noun}s\" : nil\nend",
"def pluralizer (noun, number)\n if number == 0 || number == 1\n puts \"#{number} #{noun}\"\n elsif number > 1\n puts \"#{number} #{noun}s\"\n else \n puts \"Please enter a valid positive number\"\n end\nend",
"def pluralize(count, singular, plural_arg = T.unsafe(nil), plural: T.unsafe(nil), locale: T.unsafe(nil)); end",
"def pluralizer number,noun\n if number <= 0\n \"No #{noun}\"\n elsif number == 1\n \"#{number} #{noun}\" \n else\n \"#{number} #{noun}s\"\n end\nend",
"def plural(n)\n n == 1 ? \"#{n} bottle\" : \"#{n} bottles\"\nend",
"def pluralizer num,name\n \n if num >= 2\n p \"#{num} #{name}s.\"\n else\n p \"1 #{name}.\"\n end\nend",
"def pluralizer num, noun\n if num != 1\n \"#{num} #{noun}s\"\n else \"#{num} #{noun}\"\n end\nend",
"def pluralize(count, singular, plural)\n word = count == 1 ? singular : plural\n \"#{count || 0} #{word}\"\nend",
"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_pluralize_one\n assert_equal \"book\", @d.pluralize(\"book\", 1)\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_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 pluralizer num, noun\n if num != 1\n \"#{num} #{noun}s\"\n elsif num == 1 \n \"#{num} #{noun}\"\n elsif num != 1 && noun == goose\n \"#{num}, geese\"\n end\nend",
"def pluralizer num, noun\n if num == 1\n \"#{num} #{noun}\"\n else\n \"#{num} #{noun}s\"\n end\nend",
"def plural_rub(rubies)\r\n ret = if rubies == 1\r\n 'ruby'\r\n elsif rubies < 0 # No logical reason for negative rubies\r\n nil\r\n else\r\n 'rubies'\r\n end\r\n ret\r\n rescue ArgumentError\r\n 'Non-integer argument given'\r\n end",
"def pluralizer (num, noun)\n return \"#{num} #{noun}\" if num == 1\n return \"#{num} geese\" if noun == \"goose\"\n return \"#{num} sheep\" if noun == \"sheep\"\n return \"#{num} #{noun}s\"\nend",
"def pluralize(number_of_bottles)\n if number_of_bottles > 1\n \"#{number_of_bottles} bottles\"\n elsif number_of_bottles == 1\n \"1 bottle\"\n else\n \"No more bottles\"\n end\nend",
"def pluralize(number, text)\n if number != 1\n return number, text + \"s\"\n else\n return number, text\n \n end\n \nend",
"def pluralizer (noun, num)\n if num > 1 && noun.include?('goose')\n puts \"#{num}, geese\"\n elsif num > 1\n puts \"#{num}, #{noun}s\"\n else\n puts \"#{num}, #{noun}\"\n end\nend",
"def assertPlural( singular, plural, altplural, comment )\n\t\trval, pl_noun, pl_verb, pl, pl_val, altpl_val = [nil] * 6\n\n\t\tisNv = false\n\t\tcase comment\n\t\twhen /verb/i\n\t\t\tisNv = 'verb'\n\t\twhen /noun/i\n\t\t\tisNv = 'noun'\n\t\tend\n\n\t\top = \"Pluralizing '#{singular}': \"\n\t\tassert_nothing_raised( op + \"plural verb\" ) {\n\t\t\tpl_verb = singular.en.plural_verb\n\t\t}\n\t\tassert_nothing_raised( op + \"plural noun\" ) {\n\t\t\tpl_noun = singular.en.plural_noun\n\t\t}\n\t\tassert_nothing_raised( op + \"plural\" ) {\n\t\t\tpl = singular.en.plural\n\t\t}\n\n\t\tif !altplural.nil? && !altplural.empty?\n\t\t\tbegin\n\t\t\t\tassert_nothing_raised( op + \"classical\" ) {\n\t\t\t\t\tLinguistics::classical = true\n\t\t\t\t\taltpl_val = singular.en.plural\n\t\t\t\t}\n\t\t\tensure\n\t\t\t\tLinguistics::classical = false\n\t\t\tend\n\t\tend\n\n\t\tpl_val = isNv ? (isNv == \"noun\" ? pl_noun : pl_verb) : pl\n\n\t\tassert_equal plural, pl_val, \"Plural of '#{singular}'\"\n\t\tassert_equal altplural, altpl_val,\n\t\t\t\"Classical plural of '#{singular}'\" unless\n\t\t\taltplural.nil? or altplural.empty?\n\tend",
"def pluralizer animal, number\n if number == 1\n puts \"there is #{number} #{animal}\"\n elsif animal == 'child' \n puts \"there are #{number} children\"\n elsif animal == 'person' \n puts \"there are #{number} people\"\n elsif animal == 'goose' \n puts \"there are #{number} geese\"\n elsif number >= 2 || number == 0\n puts \"there are #{number} #{animal}s\"\n else \n puts 'is that a number?'\n end\nend",
"def pluralizer_2 (noun, number)\n if noun == \"foot\" && number > 1\n puts \"#{number} feet\"\n elsif noun == \"family\" && number > 1\n puts \"#{number} families\"\n elsif noun == \"person\" && number > 1\n puts \"#{number} people\"\n elsif number == 0 || number == 1\n puts \"#{number} #{noun}\"\n elsif number > 1\n puts \"#{number} #{noun}s\"\n else \n puts \"Please enter a valid positive number and noun\"\n end\nend",
"def test_check_plural_total\n ruby_rush=RubyRush.new(1, 2, 3)\n ruby_rush.real_rb=0\n ruby_rush.fake_rb=1\n assert_equal \"rubies,ruby\", ruby_rush.check_plural_total\n ruby_rush.total_real_sp='ruby'\n ruby_rush.total_fake_sp='ruby'\n ruby_rush.real_rb=1\n ruby_rush.fake_rb=0\n assert_equal \"ruby,rubies\", ruby_rush.check_plural_total\n ruby_rush.total_real_sp='ruby'\n ruby_rush.total_fake_sp='ruby'\n ruby_rush.real_rb=2\n ruby_rush.fake_rb=2\n assert_equal \"rubies,rubies\", ruby_rush.check_plural_total\n ruby_rush.real_sp='ruby'\n ruby_rush.fake_sp='ruby'\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 plural(n, item)\n n == 1 ? \"#{n} #{item}\" : \"#{n} #{item}s\"\nend",
"def pluralizerPlus(noun, num)\n if noun.match?(/goose|child|person/i) && num != 1\n noun.downcase === \"goose\" ? noun = \"geese\" : nil\n noun.downcase === \"child\" ? noun = \"children\" : nil\n noun.downcase === \"person\" ? noun = \"people\" : nil\n end\n if num > 1 && noun.match?(/geese|children|people/i)\n \"#{num} #{noun}\"\n elsif num > 1\n \"#{num} #{noun}s\"\n elsif num === 1\n \"#{num} #{noun}\"\n elsif num === 0 && noun.match?(/geese|children|people/i)\n \"zero #{noun}\"\n elsif num === 0\n \"zero #{noun}s\"\n else\n \"Please enter a whole number\"\n end\nend",
"def pluralizer (num, noun)\n return \"#{num} #{noun}\"\n return \"#{num} geese\" if noun == \"goose\"\n return \"#{num} sheep\" if noun == \"sheep\"\n return \"#{num} #{noun}s\"\nend",
"def test_print_books_plural\n\t\tassert_output(\"Driver 1 obtained 3 books!\\n\") { print_books(3,1) }\n\tend",
"def pluralizer string, number\n if n == 1 \n puts \"#{number} #{string}\"\n elsif string == \"person\"\n puts \"#{number} people\"\n elsif string == \"child\"\n puts \"#{number} children\"\n elsif string == \"goose\"\n puts \"#{number} geese\"\n elsif n > 1 \n puts \"#{number} #{string}s\"\n end\nend",
"def pluralize(bottles, text)\n return text + 's' if bottles != 1\n text\nend",
"def test_silver_without_gold_plural\n seed = 10\n id = 1\n pros = Prospector.new id, seed\n max_silver = 3\n max_gold = 0\n actual = pros.get_msg_search_first_3_ir 'Midas', max_gold, max_silver\n expected = \"Found 3 ounces of silver in Midas.\\n\"\n assert_equal expected, actual, 'check it should be correct\\n'\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 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 pluralizer number,noun\n if number <= 0\n \"No #{noun}\"\n elsif number == 1\n \"#{number} #{noun}\" \n else\n if noun.downcase == 'geese'\n noun = 'goose'\n elsif noun.downcase == 'child'\n noun = 'children'\n elsif noun.downcase == 'person'\n noun = 'people'\n else\n noun = noun.concat('s')\n end\n \"#{number} #{noun}\"\n end\nend",
"def plural(palavra)\n \"#{palavra}s\"\nend",
"def plural(input)\n input>1 ? 's' : ''\n end",
"def test_check_plural\n ruby_rush=RubyRush.new(1, 2, 3)\n ruby_rush.cur_real_rb=0\n ruby_rush.cur_fake_rb=1\n assert_equal \"rubies,ruby\", ruby_rush.check_plural\n ruby_rush.real_sp='ruby'\n ruby_rush.fake_sp='ruby'\n ruby_rush.cur_real_rb=1\n ruby_rush.cur_fake_rb=0\n assert_equal \"ruby,rubies\", ruby_rush.check_plural\n ruby_rush.real_sp='ruby'\n ruby_rush.fake_sp='ruby'\n ruby_rush.cur_real_rb=2\n ruby_rush.cur_fake_rb=2\n assert_equal \"rubies,rubies\", ruby_rush.check_plural\n ruby_rush.real_sp='ruby'\n ruby_rush.fake_sp='ruby'\n \n end",
"def test_gold_without_silver_plural\n seed = 10\n id = 1\n pros = Prospector.new id, seed\n max_silver = 0\n max_gold = 3\n actual = pros.get_msg_search_first_3_ir 'Midas', max_gold, max_silver\n expected = \"Found 3 ounces of gold in Midas.\\n\"\n assert_equal expected, actual\n end",
"def test_print_classes_plural\n\t\tassert_output(\"Driver 1 attended 4 classes!\\n\") { print_classes(4,1) }\n\tend",
"def simple_pluralize count, singular, plural=nil\n ((count == 1 || count =~ /^1(\\.0+)?$/) ? singular : (plural || singular.pluralize))\n end",
"def pluralize(n, str)\n \"#{n} #{str + (n == 1 ? \"\" : \"s\")}\"\nend",
"def pluralize(word, nb)\n if (nb > 1)\n return \"#{word}s\"\n else\n return \"#{word}\"\n end\nend",
"def pluralize(count, singular, plural = nil)\n \"#{count} \" + if count == 1\n singular\n elsif plural\n plural\n elsif Object.const_defined?(\"Inflector\")\n Inflector.pluralize(singular)\n else\n singular + \"s\"\n end\n end",
"def pluralise(number, word)\n return (number > 1)? \"#{number} #{word}s\" : \"#{number} #{word}\"\nend",
"def is_plural?(value)\n\t(value > 1) || (value < 1)\nend",
"def pluralize(n, singular, plural=nil)\n if n == 1 \n \"1 #{singular}\"\n elsif plural\n \"#{n} #{plural}\"\n else\n \"#{n} #{singular}s\"\n end\n end",
"def plural(int, str)\r\n return \"#{int} #{str}s\" unless int == 1\r\n \"#{int} #{str}\"\r\n end",
"def plural(*args)\n TextHelper.pluralize(*args)\n end",
"def pluralize(count, singular, plural = nil)\n \"#{count || 0} \" + (count == 1 ? singular : (plural || singular.pluralize))\n end",
"def plural_every(int, str)\r\n return \"#{int} #{str}s\" unless int == 1\r\n \"#{str}\"\r\n end",
"def pluralize(count, singular, plural_arg = nil, plural: plural_arg, locale: I18n.locale)\n word = if count == 1 || count.to_s.match?(/^1(\\.0+)?$/)\n singular\n else\n plural || singular.pluralize(locale)\n end\n\n \"#{count || 0} #{word}\"\n end",
"def pluralizer(num, obj)\n obj.downcase!\n if num > 1\n if obj == \"sheep\"\n return \"#{num} #{obj}\"\n elsif obj == \"goose\"\n return \"#{num} geese\"\n elsif obj == \"child\"\n return \"#{num} children\"\n elsif obj == \"person\"\n return \"#{num} people\"\n elsif obj == \"species\"\n return \"#{num} #{obj}\"\n else\n return \"#{num} #{obj}s\"\n end\n else\n return \"#{num} #{obj}\"\n end\nend",
"def plural(num,str)\n\n num_str = number_format(num)\n if num == 1\n return num_str + ' ' + str\n else\n return num_str + ' ' + str.pluralize\n end \n \n end",
"def pluralize(count, singular, plural)\n word = count == 1 ? singular : plural\n \"#{count || 0} #{word}\"\n end",
"def test_trip_plural_both_types\n p = Print.new\n assert_output(\"After 23 days, Rubyist 1 found:\\n\\t5 rubies.\\n\\t7 fake rubies.\\nGoing home sad.\\n\") {p.print_trip([5,7],23,1)}\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 default_pluralizer(count)\n count == 1 ? :one : :other\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 declension(singular, plural, count)\n count == 1 ? singular : plural\n end",
"def pluralize(count, singular, plural = nil)\n \"#{count || 0} \" + ((count == 1 || count == '1') ? singular : (plural || singular.pluralize))\n end",
"def pluralize(count, singular, plural = nil)\n \"#{count || 0} \" + ((count == 1 || count == '1') ? singular : (plural || singular.pluralize))\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 pluralize(word); end",
"def test_print_items_classes_word_is_plural_and_exclamation_point\r\n\t\tdriver = Driver.new(1)\r\n\t\tdriver.num_classes = 3\r\n\t\tplural_sentence = driver.print_items(driver)[2]\r\n\t\tassert_includes plural_sentence, \"classes!\"\r\n\tend",
"def pluralize(l_string) #count, singular, plural = nil)\n # map the arguments like in the original pluralize method\n count, singular, plural = l_string.split(',').map{ |arg| arg.strip}\n\n \"#{count} \" + if count == 1 || count == '1'\n singular\n elsif plural\n plural\n elsif Object.const_defined?(\"Inflector\")\n Inflector.pluralize(singular)\n else\n singular + \"s\"\n end\n end",
"def test_pluralization\r\n GLoc.add_localized_strings :en, :_gloc_rule_default => %[|n| case n; when 0 then '_none'; when 1 then '_single'; else '_many'; end], :a_single => '%d man', :a_many => '%d men', :a_none => 'No men'\r\n GLoc.add_localized_strings :en, :_gloc_rule_asd => %[|n| n<10 ? '_few' : '_heaps'], :a_few => 'a few men (%d)', :a_heaps=> 'soo many men'\r\n set_language :en\r\n\r\n assert_equal 'No men', lwr(:a, 0)\r\n assert_equal '1 man', lwr(:a, 1)\r\n assert_equal '3 men', lwr(:a, 3)\r\n assert_equal '20 men', lwr(:a, 20)\r\n\r\n assert_equal 'a few men (0)', lwr_(:asd, :a, 0)\r\n assert_equal 'a few men (1)', lwr_(:asd, :a, 1)\r\n assert_equal 'a few men (3)', lwr_(:asd, :a, 3)\r\n assert_equal 'soo many men', lwr_(:asd, :a, 12)\r\n assert_equal 'soo many men', lwr_(:asd, :a, 20)\r\n \r\n end",
"def pluralize(word)\n return word + \"s\" if pluralize?\n word\nend",
"def pluralize\n p = self[ :plural ]\n p = ! scalar? if p.nil?\n p = 's' if p == false\n p = 'p' if p == true\n p.to_s\n end",
"def pluralize(num, item)\n if item == :warning && num != 1\n \"#{num} Warnings\"\n else\n \"#{num} #{item.capitalize}\"\n end\n end",
"def pluralize(singularStr, num)\n if num == 1\n return singularStr\n else\n if singularStr[-1] == \"s\" # singularStr[-1] returns last character of string\n return \"#{singularStr}es\"\n else\n return \"#{singularStr}s\"\n end\n end\n end",
"def plural(int, str)\n return \"#{int} #{str.pluralize}\" unless int == 1\n \"#{int} #{str.singularize}\"\n end",
"def plural(int, str)\n return \"#{int} #{str.pluralize}\" unless int == 1\n \"#{int} #{str.singularize}\"\n end",
"def plural(int, str)\n return \"#{int} #{str.pluralize}\" unless int == 1\n \"#{int} #{str.singularize}\"\n end",
"def plural(int, str)\n return \"#{int} #{str.pluralize}\" unless int == 1\n \"#{int} #{str.singularize}\"\n end",
"def plural?\n self == self.pluralize\n end",
"def pluralize(count)\n if custom?\n # todo: make a search from the custom inflector, if doesn't match, simply fallback to @name\n # something like OurInflector.pluralize(@name) || @name\n return @custom_name\n else\n (count == 1 || count =~ /^1([\\.,]0+)?$/) ? \n I18n.t(\"units.#{@yaml}\", :count => 1) : I18n.t(\"units.#{@yaml}\", :count => count)\n end\n end",
"def pluralize amount, singular\n \"#{amount} #{singular}#{amount == 1 ? '' : 's'}\"\n end",
"def pluralize_word(count, singular, plural = nil)\n ((count == 1 || count == '1') ? singular : (plural || singular.pluralize))\n end",
"def plural\n return word if word.to_s.empty?\n\n find_match(Inflection.configuration.plurals[:noun]) ||\n (uncountable? && word) || find_match(Nouns.plurals) || word\n end",
"def test_m_greater_1\n assert_not_nil \"troubles\" =~ PorterStemmer::Porter1::MGR1\n assert_not_nil \"private\" =~ PorterStemmer::Porter1::MGR1\n assert_not_nil \"oaten\" =~ PorterStemmer::Porter1::MGR1\n assert_not_nil \"orrery\" =~ PorterStemmer::Porter1::MGR1\n assert_not_nil \"crepuscular\" =~ PorterStemmer::Porter1::MGR1\n end",
"def pluralizer\n @number = params[:num].to_i\n @noun = params[:noun]\n if @noun.downcase == 'moose' && @number >1\n @noun = 'moose'\n elsif @noun.downcase == 'goose' && @number >1\n @noun = 'geese'\n elsif @noun.downcase == 'child' && @number >1\n @noun = 'children'\n elsif @number > 1\n @noun = @noun + 's'\n end\n render \"pluralizer.html.erb\"\nend",
"def test_ruby_count_zeros\n pros = Prospector.new(0,0,0)\n assert pros.ruby_count.eql? \"After 0 days, Rubyist #0 found:\\n\\t0 rubies.\\n\\t0 fake rubies.\\n\"\n end",
"def pluralize(count, singular, plural_arg=nil, plural: plural_arg, locale: I18n.locale)\n self.class.pluralize(count, singular, plural_arg, plural: plural, locale: locale)\n end",
"def pluralize(count, word)\n \"#{word}#{'s' unless count.to_f == 1}\"\n end",
"def normalize_count( count, default=2 )\n\t\treturn default if count.nil? # Default to plural\n\t\tif /^(#{PL_count_one})$/i =~ count.to_s ||\n\t\t ( Linguistics::EN.classical? && /^(#{PL_count_zero})$/ =~ count.to_s )\n\t\t\treturn 1\n\t\telse\n\t\t\treturn default\n\t\tend\n\tend"
] | [
"0.7791284",
"0.7627199",
"0.76071376",
"0.7541795",
"0.7407258",
"0.7384064",
"0.7323171",
"0.72481453",
"0.7199416",
"0.7174054",
"0.7129958",
"0.7129958",
"0.69237715",
"0.6913732",
"0.69008666",
"0.6876962",
"0.6868373",
"0.6867691",
"0.68649095",
"0.68616617",
"0.68326074",
"0.6753644",
"0.6745941",
"0.67355967",
"0.6732361",
"0.6703555",
"0.66973704",
"0.6694866",
"0.6694216",
"0.66932374",
"0.6674065",
"0.6668622",
"0.66386557",
"0.6619945",
"0.6619445",
"0.660832",
"0.6591537",
"0.6586147",
"0.6574195",
"0.65694404",
"0.65691036",
"0.6509938",
"0.64981014",
"0.6474721",
"0.64683867",
"0.64570147",
"0.6442476",
"0.64114356",
"0.6406016",
"0.6400395",
"0.6371547",
"0.63623613",
"0.6360248",
"0.6355053",
"0.6335732",
"0.632294",
"0.6298566",
"0.629741",
"0.6283641",
"0.62749445",
"0.6273608",
"0.62610596",
"0.62529874",
"0.6224111",
"0.62172425",
"0.6212916",
"0.6206495",
"0.6198886",
"0.61961883",
"0.6179735",
"0.61681914",
"0.61615914",
"0.61498207",
"0.61299837",
"0.6084503",
"0.6084503",
"0.6054234",
"0.6036332",
"0.6018996",
"0.59945315",
"0.599104",
"0.5985153",
"0.5967876",
"0.59556043",
"0.5925814",
"0.59173524",
"0.59173524",
"0.59173524",
"0.5917266",
"0.5911144",
"0.5909558",
"0.5903738",
"0.5887952",
"0.58744746",
"0.58305097",
"0.5815334",
"0.58128375",
"0.5806084",
"0.58045405",
"0.5801377"
] | 0.72552925 | 7 |
This is test when argument is string | def test_plural_string
assert_raises(StandardError) {@p.plural?('1')}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_string_argument\n\t\tc = Check.new\n\t\tassert c.check_arguments([1,'1',1])\n\tend",
"def test_arg_check_2string\n \t@args = ArgumentCheck.new\n \tassert_equal(false, @args.arg_check(['poop', 'poopy']))\n end",
"def test_string\n args = Arguments.new\n assert_equal false, args.check_args(\"puppy\")\n end",
"def string?(input)\n input.class == String\nend",
"def string?\n !@arg[:textValue].nil?\n end",
"def string_check(arg)\n return arg if arg.is_a?(String)\n return arg.send(:to_str) if arg.respond_to?(:to_str, true) # MRI honors it, even if private\n return arg.to_path if arg.respond_to?(:to_path)\n raise TypeError\n end",
"def test_check_args_invalid_string\n args = CheckArgs.new\n assert_equal false, args.check_args(['HI'])\n end",
"def value?(value) value.is_a?(String) end",
"def should_be_string(data)\n if data.class != String\n raise \"Data needs to be a string; you passed in a #{data.class}: #{data}\"\n end\n end",
"def is_string(input)\n input.kind_of?(String)\n end",
"def test_check_args_invalid_string2\n args = CheckArgs.new\n assert_equal false, args.check_args(['HI', 4, 'There'])\n end",
"def test_arg_check_3string\n \t@args = ArgumentCheck.new\n \tassert_equal(false, @args.arg_check(['poop', 'poopy', 'poopypoop']))\n end",
"def expect_string name, value\n expect_type name,\n value, \n \"string\",\n String\n end",
"def require_string(value)\n if value.nil? == true || value.to_s.empty?\n log_error_and_raise(\"expected string value, got nil or empty string\")\n end\n\n if value.is_a?(String) != true\n log_error_and_raise(\"expected string value, got #{value.class}, #{value.inspect}\")\n end\n\n end",
"def is_string?(); @type == GRT_STRING; end",
"def valid_string?(field, param)\n true\n end",
"def test_check_num_args_string1\n args = CheckNumArgs.new\n assert_equal false, args.check_args(['HELLO'])\n end",
"def valid_argument? name, type\n if name.nil? || name.empty? || name == type\n shell.say(\"ERROR: Invalid/missing argument.\") and false\n else\n true\n end\n end",
"def test_check_num_args_string2\n args = CheckNumArgs.new\n assert_equal false, args.check_args(['HELLO', 'THERE'])\n end",
"def expected_type\n 'string'\n end",
"def validate_string( str )\r\n if str.kind_of?(String)\r\n return true\r\n else\r\n puts \"#{self.class}:check_string: Error: Input must be a string.\"\r\n return false\r\n end\r\n end",
"def isText _args\n \"isText _args;\" \n end",
"def hello(name)\n\n if name.is_a? String\n \"Hello, #{name}\"\n end\nend",
"def string?(str)\n str.is_a?(String)\n end",
"def string?\n type == \"STRING\"\n end",
"def string?(description)\n description.type == :str\n end",
"def string?(string, &block)\n string !~ /\\0/ && runner( String, string, &block )\n end",
"def test_palindrome_parameter_string\n err = assert_raises InvalidStringError do\n Palindrome.new('Hola mundo')\n end\n assert_match 'The argunment is a String', err.message\n end",
"def validate_string(value)\n raise CustomErrors::FilterArgumentError, 'Value must be a string' unless value.is_a?(String)\n end",
"def test_js_type_string(t)\n\treturn t.class == String\nend",
"def test_check_num_args_string3\n args = CheckNumArgs.new\n assert_equal false, args.check_args(['HELLO', 'THERE', 'KENOBI'])\n end",
"def check_string(param, default, options = {})\n allowed = options[:allowed]\n if (param && allowed.class == Regexp && param =~ allowed)\n param\n elsif (param && allowed.class == Array && allowed.include?(param))\n param\n elsif (param && allowed.class == String && allowed == param)\n param\n else\n default\n end\n end",
"def compatible_string(value, label: 'Argument')\n unless value.is_a? String\n raise ArgumentError, \"#{label} must be a String\"\n end\n\n unless value.length >= 2\n raise ArgumentError, \"#{label} must be 2 or more characters long\"\n end\n\n unless value.length < @max_input_length\n raise ArgumentError, \"#{label} must be less than #{@max_input_length} characters long\"\n end\n\n value.downcase\n end",
"def isIntegerString?(string)\n Integer(string)\n return true\nrescue ArgumentError\n return false\nend",
"def valid_string?(string)\n if string.class == String\n string\n else\n false\n end\nend",
"def is_strtype?(); @type == GRT_STRTYPE; end",
"def string(str); end",
"def test_missing_argument_invalid_argument\n\t\tc = Check.new\n\t\trefute c.check_arguments([1,1,'s'])\n\tend",
"def test_arg_check_turns_valid\n ret = arg_check_turns '1'\n assert_equal ret, 0\n end",
"def test_does_say_hello_work\n if (\"hello\" == say_hello)\n puts \"Passed\"\n else\n puts \"Failed\"\n end\nend",
"def string?\n data_type == String\n end",
"def test_arg_check_prospectors_valid\n ret = arg_check_prospectors '1'\n assert_equal ret, 0\n end",
"def double_quotes_required?(string); end",
"def double_quotes_required?(string); end",
"def is_string()\n res = super(context,self)\n return res\n end",
"def is_valid? argument\n argument.to_s.to_i == argument\nend",
"def valid_param?(val)\n !val.nil? && val.is_a?(String) && !val.empty?\nend",
"def safe_string?(param)\n return true unless param\n (param =~ %r{^[A-Za-z0-9._-]+$}) != nil\nend",
"def expects_argument?\n true\n end",
"def validate_string(arg)\n arg.split(\"\").each do |i|\n if(i != '0' && i !='1')\n puts \"The input argument contain(s) characters other than 0 and 1. Please correct!\"\n return false\n end\n end\n end",
"def string?; end",
"def first_validate_arg(arg)\n if(arg.length != length)\n puts \"The length of the string is not correct. Your input length is #{arg.length} but the length needs to be #{length}\"\n self.valid = false\n return false\n else\n arg.split(\"\").each do |i|\n if(i != '0' && i !='1')\n puts \"The input argument contain(s) characters other than 0 and 1. Please correct!\"\n self.valid = false\n return false\n end\n end\n end\n return true\n end",
"def match(str = T.unsafe(nil)); end",
"def match(str = T.unsafe(nil)); end",
"def is_string\n return @is_string\n end",
"def is_ustring?(); @type == GRT_USTRING; end",
"def provided?\n [email protected]?\n end",
"def test_arguments\n\texpect_error(42, /illegal argument/)\n\texpect_error([], /illegal argument/)\n\n\tbegin\n\t # We already tested tempfile arguments elsewhere (see\n\t # test_from_tempfile).\n\t str = StringSubclass.new('abc') # should be OK\n\trescue NQXML::ParserError => ex\n\t assert_fail(\"unexpected parser error on line #{ex.line}: #{$!}\")\n\tend\n end",
"def valid_string_and_reg_ex?(char_string, reg_exp)\n str_flag = is_string?(char_string)\n regex_flag = is_reg_exp?(reg_exp) \n puts \"First argument should be a String.\" unless(str_flag)\n puts \"Second argument should be a Regular Expression.\" unless(regex_flag)\n str_flag && regex_flag\nend",
"def test_wrong_argument_type\n assert_raises \"name should be a string\" do\n pl = Place::new 12\n end\n end",
"def right_type?\n ARGV[0].is_a?(String) && ARGV[1].is_number? && ARGV[2].is_number?\n end",
"def is_strname?(); @type == GRT_STRNAME; end",
"def slug?(arg)\n false if Integer(arg)\n rescue ArgumentError, TypeError\n true\n end",
"def username_arg_ok? username\n return false if username.nil?\n return false unless (1..16) === username.length\n return false unless username.match /\\A[0-9a-zA-Z]*\\z/\n \n # oh? okay, all good.\n true\n end",
"def test_string_sanity\n assert(!'foo'.respond_to?(:uri), \"Someone added an 'uri' method to the String class. This will cause problems.\")\n end",
"def test_one_arg\n assert_true ArrayPatternMatcher.new(1) === [1]\n assert_true ArrayPatternMatcher.new(Integer) === [1]\n assert_true ArrayPatternMatcher.new(/\\s/) === [' ']\n assert_true ArrayPatternMatcher.new(String) === [' ']\n assert_false ArrayPatternMatcher.new(Integer) === []\n assert_false ArrayPatternMatcher.new(Integer) === [' ']\n assert_false ArrayPatternMatcher.new(String) === ' '\n assert_false ArrayPatternMatcher.new(Array) === ' '\n end",
"def test_fake_string_0\n pros = Prospector.new(0,0,0)\n assert pros.fake_string(0).eql? ''\n end",
"def is_s?\n true if String(self) rescue false\n end",
"def test_empty\r\n args = Args.new\r\n assert_equal false, args.check_args(\" \")\r\n end",
"def test_assert_string_returns_true\n secret_word = \"cat\"\n assert_equal(true, get_word?(secret_word))\n end",
"def only_with_a_string(value)\r\n if value.is_a?(String)\r\n yield(value)\r\n return self\r\n else\r\n raise ArgumentError, 'only string values are accepted'\r\n end\r\n end",
"def test_via_numeric_string\r\n assert_equal 'Fifth Ave', @driver.via(123, 456)\r\n end",
"def string(value)\n message = \"Invalid typeface: must be a string\"\n raise ArgumentError, message unless value.is_a?(String)\n end",
"def string=(_arg0); end",
"def test_ruby_string_0\n pros = Prospector.new(0,0,0)\n assert pros.ruby_string(0).eql? ''\n end",
"def argument?; end",
"def test_string_and_integer_argument\n assert_output(\"Usage:\\nruby word_finder.rb *name_of_file*\\n*name_of_file* should be a file\\n\") {@grapher.make_graph(['wordlist.txt', 1])}\n end",
"def integer?(string)\n b = Integer(string)\n return b\nrescue ArgumentError\n return false\nend",
"def nmap_validate_arg(str)\n # Check for existence\n if str.nil? || str.empty?\n print_error \"Missing nmap argument\"\n return false\n end\n # Check for quote balance\n if !(str.scan(/'/).size % 2).zero? or !(str.scan(/\"/).size % 2).zero?\n print_error \"Unbalanced quotes in nmap argument: #{str}\"\n return false\n end\n # Check for characters that enable badness\n disallowed_characters = /([\\x00-\\x19\\x21\\x23-\\x26\\x28\\x29\\x3b\\x3e\\x60\\x7b\\x7c\\x7d\\x7e-\\xff])/n\n badchar = str[disallowed_characters]\n if badchar\n print_error \"Malformed nmap arguments (contains '#{badchar}'): #{str}\"\n return false\n end\n # Check for commas outside of quoted arguments\n quoted_22 = /\\x22[^\\x22]*\\x22/n\n requoted_str = str.tr('\\'','\"')\n if requoted_str.split(quoted_22).join[/,/]\n print_error \"Malformed nmap arguments (unquoted comma): #{str}\"\n return false\n end\n return true\nend",
"def test_string_param()\n # Parameters for the API call\n string = 'l;asd;asdwe[2304&&;\\'.d??\\\\a\\\\\\\\\\\\;sd//'\n\n # Perform the API call through the SDK function\n result = self.class.controller.string_param(string)\n\n # Test response code\n assert_equal(@response_catcher.response.status_code, 200)\n\n # Test whether the captured response is as we expected\n assert_not_nil(result)\n expected_body = JSON.parse('{\"passed\":true}')\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 isok(input)\n # make sure that the input does not contain system ''\n ! input.downcase.include? 'system'\n end",
"def spec\n string_match_operator\n string_element_reference_regexp\n string_byteslice\n string_scan\n string_unary_minus\n string_reverse\n string_tr\n\n true\nend",
"def string?\n @kind == :double_string_lit || @kind == :single_string_lit\n end",
"def who_is_it?(name=\"Bob\")\n name\nend",
"def is_string?\n @name.is_a?(String) && @stack.empty?\n end",
"def correct?(str)\n str = str.is_a?(String) ? str : str.to_s\n str == (@answer.is_a?(String) ? @answer : @answer.to_s) # don't change @answer type\n end",
"def is_func(str)\n\tstr == \"\\\\\"\nend",
"def validate(type,input)\n if input.nil? then return false end\n if !(input.is_a? String) then return false end\n case type\n when 'Integer'\n return !(input.match(INTEGER_FORMAT).nil?)\n when 'String'\n return (input.length <= 1024)\n when 'Mail'\n return !(input.match(MAIL_FORMAT).nil?)\n end\nend",
"def param_check_string(_param, _display, _value)\n critical_error('the param_check_string method was not overridden after being included in a database class')\n end",
"def test_type_check\n assert_raise(ArgumentError) {Complejo.new('1','1')}\n end",
"def test_arg_check_oneArg\n \t@args = ArgumentCheck.new\n \tassert_equal(true, @args.arg_check([1]))\n end",
"def input_string; end",
"def test? value\n ! type.test( value )\n end",
"def checkTypo(arg,regex)\r\n return !(arg=~regex)\r\nend",
"def str(str); end",
"def str(str); end",
"def test_ruby_string_1\n pros = Prospector.new(0,0,0)\n assert pros.ruby_string(1).eql? '1 ruby'\n end",
"def test_negative\r\n args = Args.new\r\n assert_equal false, args.check_args(\"hello\")\r\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 test_include_accepts_arguments_it_annouce\n s = Sample.new << ['+ a b a b', '+ a b', '- a', '+']\n assert_equal true, s.include?('+ a b a b')\n assert_equal true, s.include?(InputString.new('a b a b',true))\n assert_equal true, s.include?(ADL::parse_string('+ a b a b'))\n assert_equal true, s.include?(['+ a b a b', '+ a b'])\n assert_equal true, s.include?(s)\n end",
"def =~(obj)\n `if (obj.$flags & $rb.T_STRING) {\n $rb.raise(VM.TypeError, \"type mismatch: String given\");\n }`\n\n obj =~ self\n end"
] | [
"0.79087615",
"0.7774432",
"0.7694724",
"0.7398407",
"0.73502505",
"0.723945",
"0.7170603",
"0.71640295",
"0.7157925",
"0.7156593",
"0.71093017",
"0.7016032",
"0.7002829",
"0.6866893",
"0.68579733",
"0.6769648",
"0.67623407",
"0.6730276",
"0.6684669",
"0.668405",
"0.6581949",
"0.6540838",
"0.65200585",
"0.6491002",
"0.6457255",
"0.6446333",
"0.6444247",
"0.6378136",
"0.6374805",
"0.63736033",
"0.63519704",
"0.63312393",
"0.6328651",
"0.63233954",
"0.6322631",
"0.6313483",
"0.63134277",
"0.6309669",
"0.6300019",
"0.6285162",
"0.62603974",
"0.62485915",
"0.6245438",
"0.6245438",
"0.6235937",
"0.61620903",
"0.6151211",
"0.6146426",
"0.61258334",
"0.6119638",
"0.6109831",
"0.61077034",
"0.60791385",
"0.60791385",
"0.60726655",
"0.60549146",
"0.6048897",
"0.604598",
"0.60419226",
"0.60379654",
"0.6024266",
"0.601201",
"0.6009068",
"0.5996719",
"0.5971352",
"0.596188",
"0.59597844",
"0.5957553",
"0.5956561",
"0.5948171",
"0.5945507",
"0.59301245",
"0.5924208",
"0.5921212",
"0.5878569",
"0.58718264",
"0.5870198",
"0.58632344",
"0.5851305",
"0.5847332",
"0.5846112",
"0.584198",
"0.58404374",
"0.58358234",
"0.58340174",
"0.5823933",
"0.5791537",
"0.5784144",
"0.5781017",
"0.57794523",
"0.57773274",
"0.5763373",
"0.57610226",
"0.57597876",
"0.5758211",
"0.5758211",
"0.5755623",
"0.5755487",
"0.5755346",
"0.5752719",
"0.5744768"
] | 0.0 | -1 |
This is test when argument is float | def test_plural_float
assert_raises(StandardError) {@p.plural?(nil)}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_float?(input)\n input.to_f.to_s == input\nend",
"def expect_float(value, field, subfield)\n return true if value.blank?\n return true if value.is_a?(Float)\n errors.add(field, \"#{subfield} must be a float if present\")\n false\n end",
"def assert_floatable *args\n args.each do |var|\n assert do\n var.not_nil? && var.is_a?(Numeric)\n end\n end\n end",
"def float?(num)\n num.to_f.to_s == num\nend",
"def float?(object)\n return true if Float(object)\n rescue \n return false\nend",
"def float?(num)\n num == num.to_f.to_s\nend",
"def float?(num)\n num.to_f().to_s()==num\nend",
"def is_float?\n self.to_f.to_s == self\n end",
"def isFloat?\n !!Float(exp) rescue false\n end",
"def float?\n !!Float(self)\n rescue ArgumentError, TypeError\n false\n end",
"def should_be_float?(field_info, field)\n field_info[\"type\"] == \"REAL\"\n end",
"def float3?(input)\n Float(input) rescue false\nend",
"def float_val?(val)\n !!(val =~ /\\A[-+]?\\d+(\\.\\d+)?\\z/)\n end",
"def valid_float_number?(num)\n num.to_f.to_s == num\nend",
"def float?\n self.class.float?(self)\n end",
"def is_float(answer)\n float_answer = answer.to_f\n if float_answer == 0.0\n float_answer = nil\n end\n [float_answer, \"#{answer} must be a valid float.\"]\nend",
"def float?\n !!strip.match(/^-?\\d+\\.\\d+$/)\n end",
"def float?\n @kind == :float_lit || @kind == :float_exp_lit\n end",
"def check_float(a, b)\n #tolerance = 1e-12\n tolerance = 1e-2\n a = a.to_f\n b = b.to_f\n if a.finite? and b.finite?\n (a-b).abs < tolerance\n else\n true\n end\n end",
"def float?(field)\n self.send(field).is_a? Float\n end",
"def match_float( val )\n\t\treturn Float( val ) rescue nil\n\tend",
"def test_002_convert_float2\r\n\tresult = convert_float( '')\r\n\tassert close_enough( 0.0, result )\r\n end",
"def numeric_check(first_num)\n Float(first_num) != nil rescue false\nend",
"def is_valid_float_param(param_name)\n # this is the equivalent one-liner ruby-style\n # true if Float params[param_name] rescue false\n begin\n Float(params[param_name])\n return true\n rescue\n return false\n end\n end",
"def float?\n type == \"FLOAT\" || type == \"FLOAT64\"\n end",
"def is_float?\n\t\tFloat(self) != nil rescue false\n\tend",
"def are_floats?(x,y)\n return x.is_a?(Float) && y.is_a?(Float)\n end",
"def verifica(numero)\n true if (Float(numero)) && (Float(numero) > 1.0) rescue false\nend",
"def check_float(a, b)\n tolerance = 1e-12\n a = a.to_f\n b = b.to_f\n if a.finite? and b.finite?\n (a-b).abs < tolerance\n else\n true\n end\nend",
"def numeric?(object)\n true if Float(object) rescue false\nend",
"def check_float(a, b)\n tolerance = Math::TOLERANCE\n a = a.to_f\n b = b.to_f\n if a.finite? and b.finite?\n (a-b).abs < tolerance\n else\n true\n end\nend",
"def check_float(a, b)\n tolerance = Math::TOLERANCE\n a = a.to_f\n b = b.to_f\n if a.finite? and b.finite?\n (a-b).abs < tolerance\n else\n true\n end\nend",
"def float_check(num)\n\tif num.include?(\".\")\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend",
"def float_check(num)\n\tif num.include?(\".\")\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend",
"def numeric(x)\n true if Float(x) rescue false\n end",
"def numeric?; float?; end",
"def is_numeric?(val)\n Float val rescue false\n end",
"def float2?(input)\n /\\d/.match(input) && /^-?\\d*\\.?\\d*$/.match(input)\nend",
"def check_for_float(company)\n float(company) unless\n company.floated? ||\n (initial_offering.percentage_owned(company) > BigDecimal.new('0.5'))\n end",
"def check_real(field_info, field)\n if should_be_float?(field_info, field) && !float?(field)\n add_float_message_to_errors(field)\n end\n end",
"def numeric?\n !!Float(self) rescue false\n end",
"def float?(str)\n true if Float(str) rescue false\n end",
"def expect_integer_or_float(value, field, subfield)\n return true if value.blank?\n return true if value.is_a?(Integer) || value.is_a?(Float)\n errors.add(field, \"#{subfield} must be an integer or float if present\")\n false\n end",
"def float?(string)\n b = Float(string.tr(',', '.'))\n return b\nrescue ArgumentError\n return false\nend",
"def check_float(param, default, options = {})\n min = (options[:min] ? param.to_f >= options[:min] : true)\n max = (options[:max] ? param.to_f <= options[:max] : true)\n\n if (param && param.strip =~ /^-?[0-9]+(\\.[0-9]+)?$/ && min && max)\n param.to_f\n else\n default\n end\n end",
"def is_f?\n !!(self =~ /^[-+]?[0-9,]+\\.[0-9]+$/)\n end",
"def value_is_float?(string)\n return false if string.scan(/\\./).length != 1\n sides = string.split('.')\n return sides[0].numeric? && sides[1].numeric? && sides[1].to_i >= 0\n end",
"def float?(num)\n /\\d/.match(num) && /^-?\\d*\\.?\\d*$/.match(num) ? true : false\nend",
"def float?(word)\n (word.to_f.to_s != word) && word\n end",
"def operand?(str)\n\t\ttrue if Float(str) rescue false\n end",
"def Float(p0) end",
"def numeric?(num)\n !!Float(num) rescue false\nend",
"def like_f?\n return false unless self.to_f?\n\n num = self.without_leading_zeros\n (num.to_i != num.to_f) || num.include?(\".\")\n end",
"def numeric(input)\n return Float(input) != nil rescue false\n end",
"def is_number(num)\n true if Float(num) rescue false\nend",
"def to_Float\n begin\n fl = Float stripn\n return fl\n rescue ArgumentError\n return false\n end\n end",
"def ==(f)\n self.toFloat() == f.toFloat()\n end",
"def ==(f)\n self.toFloat() == f.toFloat()\n end",
"def test_print_start_float\n assert_raises(StandardError) { print_start(1.2) } # pass\n end",
"def is_digit?(input)\n !!Float(input) rescue false\nend",
"def validate_float(inFloat) \n\t returnValue = []\n\t if nil == inFloat\n\t\t returnValue << \"cannot be null \"\n\t else\n\t\t begin \n\t\t\t Float(inFloat)\n\t\t\t returnValue = nil \n\t\t rescue Exception => err \n\t\t\t returnValue = \" #{err.message }\" \n\t\t end \n\t end\n\t returnValue\n end",
"def numeric?(input)\n !Float(input).nil?\n rescue\n false\n end",
"def test_positive_float\n\n @values_positive_float.each { |x|\n assert_in_delta(Math::log(x), ln(x))\n }\n\n end",
"def numeric?(object)\n \t\ttrue if Float(object) rescue false\n\tend",
"def test_Arithmetic_Sample05\n assert(3.0 < Float::MAX)\n assert(Float::MAX == Float::MAX)\n end",
"def is_number?(i)\n true if Float(i) rescue false\nend",
"def is_number?(i)\n true if Float(i) rescue false\nend",
"def is_numeric?(value)\n !!Float(value) rescue false \n end",
"def is_numeric?\n begin Float(self)\n true \n end\n rescue\n false\n end",
"def test_NilClass_InstanceMethod_to_f\n\t\tassert_equal(0.0, nil.to_f)\n\tend",
"def is_number?(input)\n true if Float(input) rescue false\n end",
"def test_negative_float\n\n @values_positive_float.each { |x|\n assert_in_delta(Math::log(x), ln(x))\n }\n\n end",
"def is_number?(string)\n true if Float(string) rescue false #need to understand this\nend",
"def is_number(string)\r\n\ttrue if Float(string) rescue false\r\nend",
"def is_num(num)\n #First convert num to float or integer . If it is not a number, result will be 0.0. Convert that back in to string to confirm that it matches\n num.to_f.to_s == num || num.to_i.to_s == num\nend",
"def is_number? string\n true if Float(string) rescue false\nend",
"def number?(input)\n #edge case, doesn't deal with 1. or 1.30 it either adds a zero or takes one off\n input.to_i.to_s == input || input.to_f.to_s == input\nend",
"def numeric?(object)\n true if Float(object) rescue false\n end",
"def test_it_can_find_average_invoices_per_merchant\n # assert_equal 10.49, @sa_real.average_invoices_per_merchant\n assert_equal 1.5, @sa.average_invoices_per_merchant\n assert_instance_of Float, @sa.average_invoices_per_merchant\n end",
"def test_should_multiply_by_a_Fixnum_or_Float\n currency1 = Currency.new(\"USD\", 4.0)\n\n assert_equal Currency.new(\"USD\", 12.0), currency1 * 3\n end",
"def float(limit = nil)\n Validation.new { |d| d.is_a?(Float) && in_range?(d, limit) }\n end",
"def number?(num)\n integer?(num) || float?(num)\nend",
"def fahrenheit? = unit == 'fahrenheit'",
"def valid_num?(input)\n integer?(input) || float?(input)\nend",
"def test_float_literal\n check(C::FloatLiteral, <<-EOS)\n |1.0\n EOS\n end",
"def float?(num)\n num.to_f.to_s == num # converts num to interger and back to string and then compares this with num.\n\n #num.match(/\\d/) # this asks is input num has any letters in it.\nend",
"def float?(num)\n num.to_f.to_s == num # converts num to interger and back to string and then compares this with num.\n\n #num.match(/\\d/) # this asks is input num has any letters in it.\nend",
"def is_num_float(num_string)\n !(num_string !~ /^\\s*[+-]?((\\d+_?)*\\d+(\\.(\\d+_?)*\\d+)?|\\.(\\d+_?)*\\d+)(\\s*|([eE][+-]?(\\d+_?)*\\d+)\\s*)$/)\nend",
"def check_type (num)\n # convert to float if validated number contains a decimal\n if num =~ /\\./\n return num = Float(num)\n else\n return num = Integer(num)\n end\nend",
"def valid_number?(num)\n integer?(num) || float?(num)\nend",
"def check_number_operand(operator, operand)\n unless operand.is_a?(Float)\n raise LoxRuntimeError.new(operator, \"Operand must be a number.\")\n end\n end",
"def test_set_x_as_float\n obj = Geom::Point3d.new\n obj.x = 1000.0\n result = obj.x\n expected = 1000.0\n assert_equal(expected, result, 'Expected does not match result.')\n end",
"def is_number(str)\n true if Float(str)\nrescue StandardError\n false\nend",
"def type_float!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 35 )\n\n\n\n type = TYPE_FLOAT\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 211:13: 'float'\n match( \"float\" )\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__, 35 )\n\n\n end",
"def parse(v)\n ((float = Float(v)) && (float % 1.0 == 0) ? float.to_i : float) rescue v\nend",
"def number?\n\t\ttrue if Float(string) rescue false\n\tend",
"def test_13_multiple_integers_and_floats\r\n\r\n results = divide(284.182, 3.2, 19, 0.01928, 39.2944)\r\n\r\n assert_equal(6.16958, results)\r\n\r\n end",
"def is_number?(variable)\n true if Float(variable) rescue false\n end",
"def represents_f?\n f_value = self.to_f\n # is this not equal to zero and also not actually an integer?\n if (f_value != 0) && (f_value.to_s == self)\n true\n else\n false\n end\n end",
"def assert_flequal(exp, actual, msg='')\r\n if exp == 0.0\r\n error = 1e-7\r\n else\r\n error = exp.abs/1e7\r\n end\r\n \r\n assert((exp - actual).abs < error, \r\n \"#{msg} Expected #{'%f' % exp} got #{'%f' % actual}\")\r\n end",
"def is_number? token\n Float(token) && true rescue false\n end"
] | [
"0.7816875",
"0.7639962",
"0.75670135",
"0.7542371",
"0.7528992",
"0.7497348",
"0.7452879",
"0.7447892",
"0.7410901",
"0.74067193",
"0.7391274",
"0.73643905",
"0.7355525",
"0.73177963",
"0.72912925",
"0.7222796",
"0.72143734",
"0.7184208",
"0.7174543",
"0.7138671",
"0.71155274",
"0.71071637",
"0.7104007",
"0.7092257",
"0.70878166",
"0.7086075",
"0.7055179",
"0.70426315",
"0.7023002",
"0.69902635",
"0.69875747",
"0.69875747",
"0.6979027",
"0.6979027",
"0.6974089",
"0.6959934",
"0.6952171",
"0.6946158",
"0.6939484",
"0.6913894",
"0.6911929",
"0.68995863",
"0.68886054",
"0.68796796",
"0.6871992",
"0.6868706",
"0.6853804",
"0.6850602",
"0.68420255",
"0.68392944",
"0.6837857",
"0.6820187",
"0.68016607",
"0.6771012",
"0.67661107",
"0.6756519",
"0.67364603",
"0.67364603",
"0.67314994",
"0.6729747",
"0.6717566",
"0.67161715",
"0.6695665",
"0.6683423",
"0.6663937",
"0.6658884",
"0.6658884",
"0.6634034",
"0.66002256",
"0.6577126",
"0.6551321",
"0.65350014",
"0.64553493",
"0.64456767",
"0.64427805",
"0.6441322",
"0.64314014",
"0.64087045",
"0.6405261",
"0.6401947",
"0.63835585",
"0.63691485",
"0.6363784",
"0.6359905",
"0.6358931",
"0.63490486",
"0.63490486",
"0.63317895",
"0.63127196",
"0.62940466",
"0.62832",
"0.62786543",
"0.62412196",
"0.62373304",
"0.6236906",
"0.6236204",
"0.6235667",
"0.6234174",
"0.6227872",
"0.62245274",
"0.62173104"
] | 0.0 | -1 |
This test when argument is 0 EDGE CASE | def test_plural_zero
assert_nil @p.plural?(0) # pass
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_has_edge_no_edge\n assert(@graph.has_edge('b', 'd') == false)\n end",
"def test_has_edge_no_vertices\n assert(@graph.has_edge('vertex1', 'vertex2') == false)\n end",
"def left_edge?\n x == 0\n end",
"def test_add_edge\n @dgraph.add_edge('a', 'b');\n\n # 0 and 1 are indexes of vertex a and vertex b respectively\n assert(@dgraph.vertices[0].neighbours[1] == true && @dgraph.vertices[1].neighbours[0] == nil)\n end",
"def test_has_edges_when_empty\n graph = Graph.new\n\n assert(graph.has_edges() == false)\n end",
"def test_zero_prospectors\n\t\tassert check_args([1, 0])\n\tend",
"def test_top_edge_enumerated_left_to_right\n assert_equal [0, 1, 0, 1, 0], @p.edge(:top)\n end",
"def test_add_edge\n @graph.add_edge('a', 'b');\n vertex_a = @graph.find_vertex('a')\n vertex_b = @graph.find_vertex('b')\n\n # 0 and 1 are indexes of vertex a and vertex b respectively\n assert(@graph.vertices[0].neighbours[1] == true && @graph.vertices[1].neighbours[0] == true)\n end",
"def test_zero\r\n args = Args.new\r\n assert_equal false, args.check_args(0)\r\n end",
"def test_has_edge\n @graph.add_edge('a', 'b');\n\n assert(@graph.has_edge('a', 'b') == true)\n end",
"def test_remove_edge\n @graph.remove_edge('a','b')\n\n # 0 and 1 are indexes of vertex a and vertex b respectively\n assert(@graph.vertices[0].neighbours[1] == nil && @graph.vertices[1].neighbours[0] == nil)\n end",
"def test_check_if_vertex_is_source_when_it_doesnt_exist\n assert(@dgraph.check_if_vertex_is_source('no_vertex') == false)\n end",
"def test_add_edge_no_vertices\n graph = Graph.new\n\n exception = assert_raises GraphError do\n graph.add_edge('a','b')\n end\n\n assert_equal('No edges can be added to an empty graph', exception.message)\n end",
"def test_zero\n args = Arguments.new\n assert_equal false, args.check_args(0)\n end",
"def test_check_if_vertex_is_source_when_not_source\n assert(@dgraph.check_if_vertex_is_source('c') == false && @dgraph.check_if_vertex_is_source('d') == false)\n end",
"def test_has_edges_vertices_only\n vertex_a = Vertex.new('a')\n vertex_b = Vertex.new('b')\n vertex_c = Vertex.new('c')\n graph = Graph.new\n graph.add_vertex(vertex_a).add_vertex(vertex_b).add_vertex(vertex_c)\n\n assert(graph.has_edges() == false)\n end",
"def test_num_neighbors_zero\r\n\t\tassert_equal 0, @t.num_neighbors\r\n\tend",
"def test_remove_edge\n @dgraph.add_edge('a', 'b');\n @dgraph.remove_edge('a','b')\n\n # 0 and 1 are indexes of vertex a and vertex b respectively\n assert(@dgraph.vertices[0].neighbours[1] == nil)\n end",
"def test_remove_edge_first_vertex_missing\n\n exception = assert_raises GraphError do\n @dgraph.remove_edge('z','a')\n end\n\n assert_equal('Edge removal error. First vertex could not be found', exception.message)\n end",
"def has_edge?(vertex1, vertex2)\n\tend",
"def test_remove_edge_first_vertex_missing\n\n exception = assert_raises GraphError do\n @graph.remove_edge('z','a')\n end\n\n assert_equal('Edge removal error. First vertex could not be found', exception.message)\n end",
"def test_neg_prospectors\n\t\trefute check_args([1, -1])\n\tend",
"def test_add_edge_first_vertex_missing\n exception = assert_raises GraphError do\n @graph.add_edge('z','b')\n end\n\n assert_equal('Edge cannot be added. First vertex could not be found', exception.message)\n end",
"def test_add_edge_with_cycles\n @graph.add_edge('a', 'b');\n @graph.add_edge('b', 'c');\n @graph.add_edge('c', 'a');\n\n # 0 and 2 are indexes of vertex a and vertex c respectively\n assert(@graph.vertices[0].neighbours[2] == true && @graph.vertices[2].neighbours[0] == true)\n end",
"def test_remove_edge_second_vertex_missing\n\n exception = assert_raises GraphError do\n @dgraph.remove_edge('a','z')\n end\n\n assert_equal('Edge removal error. Second vertex could not be found', exception.message)\n end",
"def test_layover\n @vertex.add_destination(Edge.new('', 3000))\n layover = 2.166666667 - (0.166666667)\n assert_equal(@vertex.layover, layover)\n @vertex.add_destination(Edge.new('', 4000))\n @vertex.add_destination(Edge.new('', 1000))\n layover = 2.166666667 - (0.166666667 * 3)\n assert_equal(@vertex.layover, layover)\n end",
"def test_add_edge_second_vertex_missing\n\n exception = assert_raises GraphError do\n @graph.add_edge('a','z')\n end\n\n assert_equal('Edge cannot be added. Second vertex could not be found', exception.message)\n end",
"def test_remove_edge_second_vertex_missing\n\n exception = assert_raises GraphError do\n @graph.remove_edge('a','z')\n end\n\n assert_equal('Edge removal error. Second vertex could not be found', exception.message)\n end",
"def test_check_coins_zero\r\n assert_nil @g.check_coins('0')\r\n end",
"def test_06\n @dg = DiGraph.new([5,9],[0,3],[3,8],[8,9],[9,0])\n @paths = Hash.new\n @paths[5] = [9]\n @paths[0] = [3]\n @paths[3] = [8]\n @paths[8] = [9]\n @paths[9] = [0]\n @nodes = @paths.keys\n received_dg = @dg.strongly_connected_component_including_node(0);\n filled_dg = DiGraph.new(*fill(0));\n if (not filled_dg.equal?(received_dg))\n puts \"test_06 failed...\"\n puts \"DiGraph => #{@dg.to_s}\"\n puts \"node => 0\"\n puts \"expected => #{filled_dg.to_s}\"\n puts \"received => #{received_dg.to_s}\"\n end\n assert_equal(true,filled_dg.equal?(received_dg))\n end",
"def test_invalid_integer_argument\n assert_raises \"TypeError: Invalid command line arguments.\" do\n @grapher.make_graph([1])\n end\n end",
"def valid_edge(x, y)\n if x < m and x > 0 and y < n and y > 0 and maze_mat[x][y] == 0\n return true\n end\n false\n end",
"def test_has_edges\n graph = Graph.new\n vertex_a = Vertex.new('a')\n vertex_b = Vertex.new('b')\n vertex_c = Vertex.new('c')\n graph.add_vertex(vertex_a).add_vertex(vertex_b).add_vertex(vertex_c)\n graph.add_edge('b','c')\n\n assert(graph.has_edges() == true)\n end",
"def test_find_vertex\n found_vertex = @graph.find_vertex('a')\n\n assert(found_vertex != nil && found_vertex.name == 'a')\n end",
"def test_05\n @dg = DiGraph.new([0,7],[1,9],[1,4],[7,4],[7,0],[7,9],[3,7],[9,4],[9,7],[9,9],[4,1],[4,4],[4,7])\n @paths = Hash.new\n @paths[0] = [7]\n @paths[1] = [9,4]\n @paths[7] = [4,0,9]\n @paths[3] = [7]\n @paths[9] = [4,7,9]\n @paths[4] = [1,4,7]\n @nodes = @paths.keys\n received_dg = @dg.strongly_connected_component_including_node(0);\n filled_dg = DiGraph.new(*fill(0));\n if (not filled_dg.equal?(received_dg))\n puts \"test_05 failed...\"\n puts \"DiGraph => #{@dg.to_s}\"\n puts \"node => 0\"\n puts \"expected => #{filled_dg.to_s}\"\n puts \"received => #{received_dg.to_s}\"\n end\n assert_equal(true,filled_dg.equal?(received_dg))\n end",
"def test_home_message_negative\n\t\ttest_main = Main.new(3, 1, 6)\n\t\tmocked_Graph = MiniTest::Mock.new(\"mocked graph\")\n\t\tmocked_Graph.expect(:get_curr_loc, Node.new(\"Enumerable Canyon\", 4, 5, 10))\n\t\ttest_main.real_rubies_found(-2)\n\t\ttest_main.home_message\n\t\tassert mocked_Graph\n\tend",
"def test_num_transactions_correct_0_true\n assert @bv.num_transactions_correct(0, [0])\n end",
"def test_check_args_invalid_zero\n args = CheckArgs.new\n assert_equal false, args.check_args([2, 0, 0])\n end",
"def internal_vertex?(v)\n not pred(v).empty? and not succ(v).empty?\n end",
"def test_initialize\n assert_equal(@vertex.edges.length, 0)\n assert_instance_of(Vertex, @vertex)\n end",
"def test(list)\n complete = list.to_a\n 1.upto(list.level) do |l|\n #if anything in the higher layer wasn't in layer 0\n difference = list.to_a(nil,nil,nil,l) - complete\n puts \"test failed level #{l} ,inconsistent node(s) #{difference}\" if (difference.count != 0)\n end\n puts \"test complete\"\nend",
"def test_008_phase\n assert_equal 'edge', @me.phase\n end",
"def test_connected_false \n \ttest_neighbor = Node.new(4, \"d\")\n\n \tassert_nil @n.connected?\n end",
"def test_depth_zero\n bbox = nil\n assert_nothing_raised do\n bbox = Geom::BoundingBox.new\n bbox = bbox.add [100,100,100]\n bbox = bbox.add [200,200,100]\n end\n assert_equal(0, bbox.depth,\n 'Failed in test_depth_zero' )\n end",
"def test_graph_to_s_incomplete\n sut_graph = Graph.new\n sut_graph.name=\"test_graph\" \n #sut_graph.type=:digraph\n sut_graph.node_style=:ellipse\n \n sut_graph.add_edge(\"TEST1\" , \"TEST2\" , \"take_me_to_test_2\")\n assert_raises RuntimeError do\n returned_obj = sut_graph.to_s\n end # end assert\n end",
"def test_check_if_vertex_is_source\n @dgraph = DirectedGraph.new\n vertex_a = Vertex.new('a')\n vertex_b = Vertex.new('b')\n vertex_c = Vertex.new('c')\n vertex_d = Vertex.new('d')\n @dgraph.add_vertex(vertex_a).add_vertex(vertex_b).add_vertex(vertex_c).add_vertex(vertex_d)\n @dgraph.add_edge('a', 'd').add_edge('d', 'c')\n\n assert(@dgraph.check_if_vertex_is_source('a') == true && @dgraph.check_if_vertex_is_source('b') == true)\n end",
"def test_neither_element_is_zero\n\t\tp = Print.new\n\t\trefute(p.one_type_is_zero?([1,1]))\n\tend",
"def test_min_edgecases\n point = nil\n assert_nothing_raised do\n bbox = Geom::BoundingBox.new\n bbox.add [0,0,0]\n bbox.add [100,100,100]\n point = bbox.min\n end\n expected_point = Geom::Point3d.new 0,0,0\n assert_equal(expected_point, point,\n 'Failed in test_min_edgecases: positive point' )\n\n assert_nothing_raised do\n bbox = Geom::BoundingBox.new\n bbox.add [-10,-10,-10]\n bbox.add [-100,-100,-100]\n point = bbox.min\n end\n expected_point = Geom::Point3d.new -100,-100,-100\n assert_equal(expected_point, point,\n 'Failed in test_min_edgecases: negative point' )\n \n assert_nothing_raised do\n bbox = Geom::BoundingBox.new\n point = bbox.min\n end\n # Empty boxes should return very large positive numbers\n x_very_small = point.x > 1000000000000000000000000\n y_very_small = point.y > 1000000000000000000000000\n z_very_small = point.z > 1000000000000000000000000\n assert_equal(true, x_very_small,\n 'Failed in test_min_edgecases: empty bb x' )\n assert_equal(true, y_very_small,\n 'Failed in test_min_edgecases: empty bb y' )\n assert_equal(true, z_very_small,\n 'Failed in test_min_edgecases: empty bb z' )\n end",
"def test_check_num_args_invalid_zero\n args = CheckNumArgs.new\n assert_equal false, args.check_args([0,0,0])\n end",
"def test_add_edge\n assert_equal(\"e1\", @e[0][:name])\n assert_equal(\"v1\", @e[1][:name])\n assert_equal(\"v2\", @e[2][:name])\n assert_equal(1, @e[0][:id])\n assert_equal(1, @g.e_id)\n assert_equal(1, @g.size)\n assert_raise(ArgumentError) { @g.add_edge( {:name=>\"e1\"}, \"v1\", {:name=>\"v2\"}) }\n assert_raise(ArgumentError) { @g.add_edge( {:name=>\"e1\"}, {:name=>\"v1\"}, \"v2\") }\n assert_raise(ArgumentError) { @g.add_edge( {:name=>\"e1\"}, \"v1\", \"v2\") }\n assert_raise(ArgumentError) { @g.add_edge( \"e1\", \"v1\", \"v2\") }\n assert_raise(ArgumentError) { @g.add_edge( \"e1\", {:name=>\"v1\"}, \"v2\") }\n end",
"def test_in_edges_on_examples\n assert_equal(@small_dfa.ith_edges(4), @small_dfa.in_edges(0,true))\n assert_equal(@small_dfa.ith_edges(0,5), @small_dfa.in_edges(1,true))\n assert_equal(@small_dfa.ith_edges(1,3), @small_dfa.in_edges(2,true))\n assert_equal(@small_dfa.ith_edges(2), @small_dfa.in_edges(3,true))\n\n assert_equal(@small_nfa.ith_edges(5), @small_nfa.in_edges(0,true))\n assert_equal(@small_nfa.ith_edges(0,1,6), @small_nfa.in_edges(1,true))\n assert_equal(@small_nfa.ith_edges(2), @small_nfa.in_edges(2,true))\n assert_equal(@small_nfa.ith_edges(3,4), @small_nfa.in_edges(3,true))\n end",
"def test_out_edges_on_examples\n assert_equal(@small_dfa.ith_edges(0), @small_dfa.out_edges(0,true))\n assert_equal(@small_dfa.ith_edges(1,2,5), @small_dfa.out_edges(1,true))\n assert_equal(@small_dfa.ith_edges(4), @small_dfa.out_edges(2,true))\n assert_equal(@small_dfa.ith_edges(3), @small_dfa.out_edges(3,true))\n\n assert_equal(@small_nfa.ith_edges(0), @small_nfa.out_edges(0,true))\n assert_equal(@small_nfa.ith_edges(1,2,3), @small_nfa.out_edges(1,true))\n assert_equal(@small_nfa.ith_edges(4,6), @small_nfa.out_edges(2,true))\n assert_equal(@small_nfa.ith_edges(5), @small_nfa.out_edges(3,true))\n end",
"def get_edge_value(x, y)\n raise\n end",
"def test_has_node_dummy_with_obj\n nonexistent_node = Node.new(1, [2])\n refute @graph.node?(nonexistent_node)\n end",
"def test_calculate_negative\n \tassert_equal '0', @gold_rush.calculate(-1, 0)\n end",
"def test_max_edgecases\n point = nil\n assert_nothing_raised do\n bbox = Geom::BoundingBox.new\n bbox.add [0,0,0]\n bbox.add [100,100,100]\n point = bbox.max\n end\n expected_point = Geom::Point3d.new 100,100,100\n assert_equal(expected_point, point,\n 'Failed in test_max_edgecases: positive point' )\n\n assert_nothing_raised do\n bbox = Geom::BoundingBox.new\n bbox.add [-10,-10,-10]\n bbox.add [-100,-100,-100]\n point = bbox.max\n end\n expected_point = Geom::Point3d.new -10,-10,-10\n assert_equal(expected_point, point,\n 'Failed in test_max_edgecases: negative point' )\n \n assert_nothing_raised do\n bbox = Geom::BoundingBox.new\n point = bbox.max\n end\n # Empty boxes should return very large negative numbers\n x_very_small = point.x < -1000000000000000000000000\n y_very_small = point.y < -1000000000000000000000000\n z_very_small = point.z < -1000000000000000000000000\n assert_equal(true, x_very_small,\n 'Failed in test_max_edgecases: empty bb x' )\n assert_equal(true, y_very_small,\n 'Failed in test_max_edgecases: empty bb y' )\n assert_equal(true, z_very_small,\n 'Failed in test_max_edgecases: empty bb z' )\n end",
"def test_num_transactions_correct_0_true\n assert_equal(false, @bv.num_transactions_correct?(0, [0,1]))\n end",
"def is_vertex(id)\n # YOUR WORK HERE\n end",
"def test_negative_argument\n\t\tc = Check.new\n\t\trefute c.check_arguments([1,1,-2])\n\tend",
"def test_07\n @dg = DiGraph.new([0,0],[6,0],[6,8],[2,6],[8,8],[3,4],[3,2],[3,9],[9,4],[9,6],[4,3],[4,8])\n @paths = Hash.new\n @paths[0] = [0]\n @paths[6] = [0,8]\n @paths[2] = [6]\n @paths[8] = [8]\n @paths[3] = [4,2,9]\n @paths[9] = [4,6]\n @paths[4] = [3,8]\n @nodes = @paths.keys\n received_dg = @dg.strongly_connected_component_including_node(6);\n filled_dg = DiGraph.new(*fill(6));\n if (not filled_dg.equal?(received_dg))\n puts \"test_07 failed...\"\n puts \"DiGraph => #{@dg.to_s}\"\n puts \"node => 6\"\n puts \"expected => #{filled_dg.to_s}\"\n puts \"received => #{received_dg.to_s}\"\n end\n assert_equal(true,filled_dg.equal?(received_dg))\n end",
"def test_num_transactions_correct_not_0_true\n assert @bv.num_transactions_correct?(1, [0,2,3])\n end",
"def has_vertex?(vertex)\n\tend",
"def test_check_block_num_unequal\r\n assert_nil nil, @g.check_block_num(1, 0)\r\n end",
"def test_ith_edge_on_examples\n @examples.each do |fa|\n edges = []\n 0.upto(fa.edge_count-1) do |i|\n edges << fa.ith_edge(i)\n end\n assert_equal(fa.edges, edges)\n end\n end",
"def test_add_destination\n assert_equal(@vertex.edges.length, 0)\n @vertex.add_destination(Edge.new('', 4000))\n @vertex.add_destination(Edge.new('', 4000))\n @vertex.add_destination(Edge.new('', 4000))\n assert_equal(@vertex.edges.length, 3)\n end",
"def edge?(i,j)\n\t\tif(edge(i,j) != @no_edge_val)\n\t\t\treturn true\n\t\tend\n\t\treturn false\n\tend",
"def notTopEdge?\n @y.positive? ? self : nil\n end",
"def test_nonzero_arguments\n args_checker = ArgsChecker.new\n arr = [1]\n assert_equal false, args_checker.check_mode(arr)\n end",
"def test_with_element_LT_0; show([[-1]]) end",
"def test_edge_count_on_examples\n assert_equal(6, @small_dfa.edge_count)\n assert_equal(7, @small_nfa.edge_count)\n end",
"def test_node_starts_with_empty_branches\n node = Node.new(50, \"movie a\")\n refute node.left_node\n refute node.right_node\n end",
"def test_edges_on_examples\n assert_equal(6,@small_dfa.edges.size)\n assert_equal(7,@small_nfa.edges.size)\n end",
"def test_graph_edges\n test_g = Graph.new\n test_g.add_edge(\"a\", \"b\")\n puts \"assert adding edge to a graph adds its nodes too\"\n assert (test_g.contains(\"a\"))\n\n puts \"assert that edges are directed, ie not symmetric relation\"\n assert test_g.has_edge(\"a\",\"b\")\n assert !(test_g.has_edge(\"b\",\"a\"))\n end",
"def get_vertex_value(x)\n raise\n end",
"def test_drop_edges_detects_invalid_edges\n s0, s1, e01, e10, e11 = nil\n fa = Automaton.new do |fa|\n s0 = fa.add_state(:initial => true)\n s1 = fa.add_state\n e10 = fa.connect(s1, s0, 'b')\n e01 = fa.connect(s0, s1, 'a')\n e11 = fa.connect(s1, s1, 'a')\n end\n\n fa.drop_edge(e10)\n assert_raise ArgumentError do\n fa.drop_edges(e11,e10)\n end\n assert_equal(2, fa.state_count)\n assert_equal(2, fa.edge_count)\n end",
"def is_fit?(edge)\n @vertices.any?{|v| v.node == edge.node1.node || v.node == edge.node2.node}\n end",
"def test_divisione_per_zero\r\n assert_raises ZeroDivisionError do\r\n @calc.divisione(1, 0)\r\n end\r\n end",
"def test_num_neighbors_nonzero\r\n\t\[email protected]_neighbor @t2\r\n\t\tassert_equal 1, @t.num_neighbors\r\n\tend",
"def other_vertex(vertex1)\n end",
"def other_vertex(vertex1)\n end",
"def test_check_num_args_invalid_negative\n args = CheckNumArgs.new\n assert_equal false, args.check_args([0,-1,-1])\n end",
"def test_no_arg\n\tassert_output(nil, abort) {GoldRush.argchecker(-1)}\n end",
"def test_get_node_invalid\r\n reader = GraphReader.new('small_graph.txt')\r\n reader.create_graph()\r\n assert_nil reader.get_node(-1) \r\n end",
"def weighted_edge?(e)\n e.is_a?(Array) &&\n e.length == 3 &&\n e[0, 2].all? { |i| i.is_a?(Integer) } &&\n e[2].is_a?(Numeric)\n end",
"def edgeCross(currEdge,vertexIn)\n if (vertexIn[currEdge[0]] == 1) and (vertexIn[currEdge[1]] == 0)\n return true\n elsif (vertexIn[currEdge[0]] == 0) and (vertexIn[currEdge[1]] == 1)\n return true\n else\n return false\n end\nend",
"def test_ith_edges_on_examples\n assert_equal(@small_dfa.edges, @small_dfa.ith_edges(0,1,2,3,4,5))\n assert_equal([@small_dfa.ith_edge(1)], @small_dfa.ith_edges(1))\n assert_equal([@small_dfa.ith_edge(1), @small_dfa.ith_edge(4)], @small_dfa.ith_edges(1,4))\n assert_equal(@small_nfa.edges, @small_nfa.ith_edges(0,1,2,3,4,5,6))\n assert_equal([@small_nfa.ith_edge(1)], @small_nfa.ith_edges(1))\n assert_equal([@small_nfa.ith_edge(1), @small_nfa.ith_edge(4)], @small_nfa.ith_edges(1,4))\n end",
"def test_neg_check_success\n assert_nil neg_check(['0', '0', '0']) # pass\n assert_nil neg_check(['0', '2', '3'])# pass\n end",
"def test_int_check_pass\n assert_equal int_check([]), true # EDGE CASE\n assert_equal int_check(['1']), true # pass\n assert_equal int_check(['1', '1']), true # pass\n assert_equal int_check(['1', '1', '1']), true # pass\n end",
"def test_num_transactions_correct_false_not_0_false\n assert_equal(false, @bv.num_transactions_correct?(0, []))\n end",
"def test_shortest_flight\n @vertex.add_destination(Edge.new('', 3000))\n @vertex.add_destination(Edge.new('', 4000))\n @vertex.add_destination(Edge.new('', 1000))\n shortest_flight = @vertex.shortest_flight\n assert_equal(shortest_flight.distance, 1000)\n assert_instance_of(Edge, shortest_flight)\n end",
"def check_integrity(list)\n complete = list.to_a\n 1.upto(list.level) do |l|\n #if anything in the higher layer wasn't in layer 0\n difference = list.to_a(nil,nil,nil,l) - complete\n puts \"stray node found in level: #{l} which is #{list.to_a(nil,nil,nil,l)}\" if !difference.empty? \n expect(difference).to match_array([])\n end\nend",
"def test_negative\r\n args = Args.new\r\n assert_equal false, args.check_args(\"hello\")\r\n end",
"def test_divide_by_zero\n calc = RpnCalc.new\n calc.enter(1)\n calc.enter(0)\n assert_raise(ZeroDivisionError) do\n calc.enter('/')\n end\n end",
"def out_neighbors(vertex)\n\tend",
"def test_add_node_invalid\r\n reader = GraphReader.new('whatever')\r\n assert_nil reader.add_node(nil, nil, [])\r\n end",
"def test_neighbour_count\n # Empty\n @game.state=[[0,0,0],[0,0,0],[0,0,0]]\n assert_equal 0,@game.neighbour_count(0,0)\n assert_equal 0,@game.neighbour_count(1,1)\n\n # One cell, check all neighbours, check proper edge wrapping\n @game.state=[[0,0,0],[0,1,0],[0,0,0]]\n assert_equal 1,@game.neighbour_count(0,2),'0,2'\n assert_equal 1,@game.neighbour_count(0,0),'0,0'\n assert_equal 1,@game.neighbour_count(0,1),'0,1'\n assert_equal 1,@game.neighbour_count(1,0),'1,0'\n assert_equal 0,@game.neighbour_count(1,1),'1,1' # Don't count self\n assert_equal 1,@game.neighbour_count(1,2),'1,2'\n assert_equal 1,@game.neighbour_count(2,0),'2,0'\n assert_equal 1,@game.neighbour_count(2,1),'2,1'\n assert_equal 1,@game.neighbour_count(2,2),'2,2'\n\n # Eight cells, check all neighbours, check proper edge wrapping\n @game.state=[[1,1,1],[1,0,1],[1,1,1]]\n assert_equal 7,@game.neighbour_count(0,2),'0,2'\n assert_equal 7,@game.neighbour_count(0,0),'0,0'\n assert_equal 7,@game.neighbour_count(0,1),'0,1'\n assert_equal 7,@game.neighbour_count(1,0),'1,0'\n assert_equal 8,@game.neighbour_count(1,1),'1,1' # Only cell with 8\n assert_equal 7,@game.neighbour_count(1,2),'1,2'\n assert_equal 7,@game.neighbour_count(2,0),'2,0'\n assert_equal 7,@game.neighbour_count(2,1),'2,1'\n assert_equal 7,@game.neighbour_count(2,2),'2,2'\n end",
"def test_with_node_none\r\n link1 = @linklist.add_link(@node1, @node2)\r\n link2 = @linklist.add_link(@node2, @node3) \r\n \r\n assert(@linklist.with_node(@node4).length == 0)\r\n end",
"def cliquishness(node)\n neighbors = @graph[node].keys\n sg = subgraph(neighbors)\n if sg.graph.size != 0\n edges = sg.edges\n nodes = neighbors.size\n complete = (nodes * (nodes - 1))\n return edges.quo(complete)\n else\n return 0.0\n end\n end",
"def test_check_coins_alpah\r\n assert_nil @g.check_coins('a')\r\n end",
"def test_check_seed_valid_int_negative\n test_args = [-1, 2, 3]\n args = Args.new test_args\n assert_equal(-1, args.check_seed(test_args[0]))\n end",
"def test_positive\r\n args = Args.new\r\n assert_equal false, args.check_args(6)\r\n end"
] | [
"0.7012968",
"0.69316167",
"0.6673757",
"0.6487532",
"0.6445666",
"0.63026214",
"0.62940925",
"0.6287029",
"0.6257546",
"0.62526953",
"0.62267804",
"0.62019813",
"0.61909556",
"0.6190218",
"0.6151867",
"0.61216295",
"0.6097385",
"0.60625404",
"0.60580665",
"0.6057023",
"0.6038875",
"0.602978",
"0.6019783",
"0.59949934",
"0.5994339",
"0.5977949",
"0.59762156",
"0.5965929",
"0.5955281",
"0.5947686",
"0.5925934",
"0.59218466",
"0.5907402",
"0.5884001",
"0.58816534",
"0.5864382",
"0.58637846",
"0.5853734",
"0.5834303",
"0.5831844",
"0.5825373",
"0.5823173",
"0.5819817",
"0.5800464",
"0.57916486",
"0.57774687",
"0.5772847",
"0.57597566",
"0.5752922",
"0.5746289",
"0.57334673",
"0.5728713",
"0.57276803",
"0.57209444",
"0.56764305",
"0.5672506",
"0.5650242",
"0.5648628",
"0.56476665",
"0.56389153",
"0.56360054",
"0.5627331",
"0.56236374",
"0.5609812",
"0.55936587",
"0.5584999",
"0.5572447",
"0.5571487",
"0.5571234",
"0.5557364",
"0.5534189",
"0.5528681",
"0.5526849",
"0.5523108",
"0.55223715",
"0.5516138",
"0.5510313",
"0.55078185",
"0.55073416",
"0.55073416",
"0.5505245",
"0.5495495",
"0.54691887",
"0.5446061",
"0.5444461",
"0.54301053",
"0.5413816",
"0.54128647",
"0.5409523",
"0.5402667",
"0.5402355",
"0.53953457",
"0.53951955",
"0.53939927",
"0.53939116",
"0.5385949",
"0.5378456",
"0.5375095",
"0.5374684",
"0.53655726",
"0.5362697"
] | 0.0 | -1 |
This test when argument is 1 | def test_plural_int
assert_equal @p.plural?(1), 'ruby'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_one_ints\n args = Arguments.new\n assert_equal false, args.check_args([1])\n end",
"def test_arg_check_oneArg\n \t@args = ArgumentCheck.new\n \tassert_equal(true, @args.arg_check([1]))\n end",
"def test_zero_prospectors\n\t\tassert check_args([1, 0])\n\tend",
"def test_two_proper_args\n assert check_args([1, 1])\n end",
"def test_two_ints\n args = Arguments.new\n assert_equal false, args.check_args([1, 2])\n end",
"def test_positive\r\n args = Args.new\r\n assert_equal false, args.check_args(6)\r\n end",
"def test_positive\n args = Arguments.new\n assert_equal false, args.check_args(5)\n end",
"def test_string_argument\n\t\tc = Check.new\n\t\tassert c.check_arguments([1,'1',1])\n\tend",
"def test_arg_check_prospectors_valid\n ret = arg_check_prospectors '1'\n assert_equal ret, 0\n end",
"def test_two_valid_arguments\n\t\tc = Check.new\n\t\trefute c.check_arguments([1,1])\n\tend",
"def test_check_num_args_invalid2\n args = CheckNumArgs.new\n assert_equal false, args.check_args([1])\n end",
"def test_zero\n args = Arguments.new\n assert_equal false, args.check_args(0)\n end",
"def test_arg_check_turns_valid\n ret = arg_check_turns '1'\n assert_equal ret, 0\n end",
"def test_check_num_args_valid2\n args = CheckNumArgs.new\n args.check_args([1,1,1])\n assert_kind_of Integer, 1\n end",
"def test_zero\r\n args = Args.new\r\n assert_equal false, args.check_args(0)\r\n end",
"def test_no_arg\n\tassert_output(nil, abort) {GoldRush.argchecker(-1)}\n end",
"def test_missing_argument_invalid_argument\n\t\tc = Check.new\n\t\trefute c.check_arguments([1,1,'s'])\n\tend",
"def test_three_ints\n args = Arguments.new\n assert_equal true, args.check_args([1, 2, 3])\n end",
"def test_double_argument\n\t\tc = Check.new\n\t\tassert c.check_arguments([1,1.2,1])\n\tend",
"def test_check_num_args_string1\n args = CheckNumArgs.new\n assert_equal false, args.check_args(['HELLO'])\n end",
"def test_arg_check_prospectors_negative\n def exit(x); 1; end\n ret = arg_check_prospectors '-1'\n assert_equal ret, -3\n end",
"def test_args_check_less\n\t\targs_checker = ArgsChecker::new\n\t\tarr = []\n\t\tassert_raises(\"I need one number bud, try again\") { args_checker.check_args arr }\n\tend",
"def test_check_num_args_valid\n args = CheckNumArgs.new\n assert_equal true, args.check_args([1,1,1])\n end",
"def test_arg_check_2string\n \t@args = ArgumentCheck.new\n \tassert_equal(false, @args.arg_check(['poop', 'poopy']))\n end",
"def ptest(*args)\n ptest?(*args) ? ONE : ZERO\n end",
"def test_check_args_invalid_zero\n args = CheckArgs.new\n assert_equal false, args.check_args([2, 0, 0])\n end",
"def test_neg_prospectors\n\t\trefute check_args([1, -1])\n\tend",
"def test_check_num_args_string2\n args = CheckNumArgs.new\n assert_equal false, args.check_args(['HELLO', 'THERE'])\n end",
"def test_check_num_args_invalid3\n args = CheckNumArgs.new\n assert_equal false, args.check_args([1, 2])\n end",
"def test_no_arg\n\tassert_output(nil, abort) {GoldRush.argchecker()}\n end",
"def test_arg_check_3string\n \t@args = ArgumentCheck.new\n \tassert_equal(false, @args.arg_check(['poop', 'poopy', 'poopypoop']))\n end",
"def test_arg_check_turns_negative\n def exit(x); 1; end\n ret = arg_check_turns '-1'\n assert_equal ret, -4\n end",
"def test_check_num_args_invalid_zero\n args = CheckNumArgs.new\n assert_equal false, args.check_args([0,0,0])\n end",
"def test_arg_check_seed_valid\n ret = arg_check_seed '1'\n assert_equal ret, 0\n end",
"def test_check_num_args_string3\n args = CheckNumArgs.new\n assert_equal false, args.check_args(['HELLO', 'THERE', 'KENOBI'])\n end",
"def check_args(args)\n begin\n results = [Integer(args[0]), Integer(args[1])] \n rescue ArgumentError, TypeError\n puts 'Invalid input.' \n end\n args.count == 2 && results[1] >= 1\nrescue StandardError\n false\nend",
"def test_nonzero_arguments\n args_checker = ArgsChecker.new\n arr = [1]\n assert_equal false, args_checker.check_mode(arr)\n end",
"def test_negative\r\n args = Args.new\r\n assert_equal false, args.check_args(\"hello\")\r\n end",
"def test_arg_check_length_fail\n def exit(x); 1; end;\n ret = arg_check_length 2\n assert_equal ret, -1\n end",
"def test_check_num_args_invalid_negative\n args = CheckNumArgs.new\n assert_equal false, args.check_args([0,-1,-1])\n end",
"def argument?; end",
"def test_check_args_invalid2\n args = CheckArgs.new\n assert_equal false, args.check_args([1, 2])\n end",
"def test_arg_check_prospectors_decimal\n def exit(x); 1; end\n ret = arg_check_prospectors '1.6'\n assert_equal ret, -3\n end",
"def passed?; end",
"def passed?; end",
"def passed?; end",
"def test_check_seed_valid_int_negative\n test_args = [-1, 2, 3]\n args = Args.new test_args\n assert_equal(-1, args.check_seed(test_args[0]))\n end",
"def test_check_args_valid\n args = CheckArgs.new\n assert_equal true, args.check_args([-5, 2, 3])\n end",
"def test_negative_argument\n\t\tc = Check.new\n\t\trefute c.check_arguments([1,1,-2])\n\tend",
"def test_check_args_false\n c = Checker.new\n assert_equal false, c.check_args([1, 1, 1, 1])\n assert_equal false, c.check_args([1,1])\n assert_equal false, c.check_args(['something', 111])\n assert_equal false, c.check_args([1, -1, 1])\n assert_equal false, c.check_args([1, 1, -1])\n end",
"def test_match\n assert_equal(2, add(1,1))\n end",
"def expects_argument?\n true\n end",
"def test_arg_check_seed_decimal\n def exit(x); 1; end\n ret = arg_check_seed '1.6'\n assert_equal ret, -2\n end",
"def test_check_coins_true\r\n assert_equal 1, @g.check_coins('1')\r\n end",
"def tests=(_arg0); end",
"def tests=(_arg0); end",
"def test_args_check_greater\n\t\targs_checker = ArgsChecker::new\n\t\tarr = [2, 4]\n\t\tassert_raises(\"I need one number bud, try again\") { args_checker.check_args arr }\n\tend",
"def wrong_num_parameters?\n (ARGV.size != 1)\n end",
"def method (*args)\n\t\tif args.length > 2\n\t\t\tputs \"More than two\"\n\t\tend\n\tend",
"def test_arg_check_turns_decimal\n def exit(x); 1; end\n ret = arg_check_turns '1.6'\n assert_equal ret, -4\n end",
"def test_args_check_nil\n\t\targs_checker = ArgsChecker::new\n\t\tarr = nil\n\t\tassert_raises(\"I need one number bud, try again\") { args_checker.check_args arr }\n\tend",
"def test_check_args_invalid_string2\n args = CheckArgs.new\n assert_equal false, args.check_args(['HI', 4, 'There'])\n end",
"def stest_method_1(test); end",
"def test_match\n\t\tassert_equal(2,add(1,1))\n\tend",
"def mandatory_argument_should_exist(command, arg_name, arg_list, arg_number)\n expect { @helper.run_test_omnibus_command(command, arg_list) }\n .to raise_error(SystemExit) { |e| expect(e.status).to eq(1) }\n end",
"def test_nil_args\n refute check_args(nil)\n end",
"def test_string\n args = Arguments.new\n assert_equal false, args.check_args(\"puppy\")\n end",
"def test_first_example\n assert_equal(0, purple([\"+1\", \"-1\"]))\n end",
"def example_passed(_)\n end",
"def check_args(arguments)\r\n if arguments.length != 3\r\n puts 'There must be exactly three arguments: *seed*, *num_prospectors*, *num_turns*'\r\n return false\r\n elsif arguments[1].to_i.negative? || arguments[2].to_i.negative?\r\n puts 'Usage:'\r\n puts 'ruby ruby_rush.rb *seed* *num_prospectors* *num_turns*'\r\n puts '*seed* should be an integer'\r\n puts '*num_prospectors* should be a non-negative integer'\r\n puts '*num_turns* should be a non-negative integer'\r\n return false\r\n end\r\n true\r\nend",
"def first_arg\n expect :call, :attrasgn, :safe_call, :safe_attrasgn\n self[3]\n end",
"def test_add_option03b\n assert_nothing_raised( Exception ) { \n ArgumentManager.add_option(\n [ 'j' ],\n :type => :integer\n )\n }\n end",
"def test1(array)\n\tputs \"Test1: Should take an array as argument -> \"\n\tarray.class == Array ? true : false\nend",
"def test1(array)\n\tputs \"Test1: Should take an array as argument -> \"\n\tarray.class == Array ? true : false\nend",
"def test_one_ruby_test\r\n rubyArr = [1,1]\r\n seed = 10\r\n r = Random.new(seed)\r\n numReturn = mine(rubyArr, r)\r\n if numReturn == 0 || numReturn == 1\r\n assert true\r\n end\r\n end",
"def test_add_option03a\n assert_nothing_raised( Exception ) { \n ArgumentManager.add_option(\n [ 'i' ],\n :type => :integer,\n :df_int => 0\n )\n }\n end",
"def test_abnormal_usage\n test_args = [-9, -9, -9]\n args = Args.new test_args\n\n args.stub(:exit, 1) do\n assert_output(\"Usage:\\nruby ruby_rush.rb *seed* *num_prospectors* *num_turns\\n*seed* should be an integer\\n*num_prospectors* should be a non-negative integer\\n*num_turns* should be a non-negative integer\\n\"){args.validate_args}\n end\n end",
"def test_execute_with_string_arg\n assert_equal 0, MM2.execute(\"--version\")\n assert_equal 1, MM2.execute(\"--lh 3\")\n # After executing the \"--version\" command, the verbosity is changed to 3.\n # To prevent test_get_verbose from failing, set it back to 1.\n MM2.verbose = 1\n end",
"def check_solution(test_number, argument, expected)\n actual = fields(argument)\n if actual != expected\n puts \"Test ##{test_number}: Incorrect value: got #{actual}, expected #{expected}\"\n return false\n end\n\n puts \"Test ##{test_number}: Correct\"\n return true\nend",
"def test_check_args_invalid_string\n args = CheckArgs.new\n assert_equal false, args.check_args(['HI'])\n end",
"def test_s_one\n p = Prospector.new(0, 0, 0)\n assert p.s?(1), ''\n end",
"def test_no_argument_case\n result = interpret 'one=->(a) { true };%one(1)'\n assert result\n end",
"def test(arg = nil)\n puts \"test\"\n end",
"def example_passed(example)\n end",
"def test_check_args_invalid_negative\n args = CheckArgs.new\n assert_equal false, args.check_args([6, -2, -3])\n end",
"def arguments_valid?\n # TO DO - implement your real logic here\n true if @arguments.length == 1 \n end",
"def verify_sub=(_arg0); end",
"def verify_sub=(_arg0); end",
"def arguments_valid?\n true if @arguments.size >= 1 \n end",
"def second_arg\n expect :call, :attrasgn, :safe_call, :safe_attrasgn\n self[4]\n end",
"def assert_1\n raise \"Invalid argument\" unless yield\nend",
"def test_sub\n assert_equal( 1, 2-1 )\n end",
"def test_positive_int\n cfg = ReqArgCfg.new(:id).as(:positive_int)\n assert_raises ArgumentError do\n ReqArg.new('0', cfg)\n end\n end",
"def check_args(args)\n args.count == 2 && args[0].to_i > 0 && args[1].to_i > 0\n rescue StandardError\n false\n end",
"def test_empty\r\n args = Args.new\r\n assert_equal false, args.check_args(\" \")\r\n end",
"def arguments_valid?\n # TODO - implement your real logic here\n true # if @arguments.length == 1\n end",
"def test_it_should_take_no_arguments\n assert_equal(0, cli_class.instance_method(:generate).arity)\n end",
"def verify_iss=(_arg0); end",
"def verify_iss=(_arg0); end",
"def test1ActionTwiceDifferentParameters\n executeTest(\n 'DummyUser',\n {\n 'DummyTool' => {\n 'DummyActionWithParams' => [\n [ 'Param11', 'Param21' ],\n [ 'Param12', 'Param22' ]\n ]\n }\n }\n )\n end",
"def test_invalid_integer_argument\n assert_raises \"TypeError: Invalid command line arguments.\" do\n @grapher.make_graph([1])\n end\n end"
] | [
"0.7622138",
"0.743615",
"0.7195343",
"0.70547104",
"0.7014577",
"0.6915063",
"0.68871063",
"0.6840762",
"0.6839033",
"0.68043566",
"0.67905796",
"0.679016",
"0.67880607",
"0.6786294",
"0.6784588",
"0.6754007",
"0.67511725",
"0.6744973",
"0.6741394",
"0.67299134",
"0.66457766",
"0.66195494",
"0.6598673",
"0.65291166",
"0.65270805",
"0.6526309",
"0.6524454",
"0.6521998",
"0.6479379",
"0.647739",
"0.6474401",
"0.6465049",
"0.6460683",
"0.6390685",
"0.6385101",
"0.63832736",
"0.63796437",
"0.63639003",
"0.63385856",
"0.6267072",
"0.6262122",
"0.62566686",
"0.6246046",
"0.62369746",
"0.62369746",
"0.62369746",
"0.62220526",
"0.621636",
"0.6207892",
"0.62062794",
"0.61792874",
"0.6162001",
"0.61397004",
"0.6126335",
"0.61254835",
"0.61254835",
"0.61176574",
"0.6104791",
"0.6104221",
"0.60969156",
"0.6089142",
"0.60786647",
"0.6073512",
"0.60602474",
"0.60553586",
"0.6050772",
"0.6045995",
"0.6018016",
"0.601455",
"0.6006232",
"0.60028976",
"0.6001609",
"0.5993679",
"0.5993679",
"0.59828323",
"0.59682626",
"0.596649",
"0.5965478",
"0.59654146",
"0.5951291",
"0.5944648",
"0.59432924",
"0.5941398",
"0.593981",
"0.59173423",
"0.5895307",
"0.5892232",
"0.5892232",
"0.58920485",
"0.58815736",
"0.58664167",
"0.585962",
"0.5856881",
"0.58528745",
"0.58403313",
"0.5837822",
"0.5830625",
"0.58299124",
"0.58299124",
"0.5829599",
"0.5823894"
] | 0.0 | -1 |
This test when argument is 2 | def test_plural_int2
assert_equal @p.plural?(2), 'rubies'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_two_proper_args\n assert check_args([1, 1])\n end",
"def test_two_ints\n args = Arguments.new\n assert_equal false, args.check_args([1, 2])\n end",
"def method (*args)\n\t\tif args.length > 2\n\t\t\tputs \"More than two\"\n\t\tend\n\tend",
"def test_two_valid_arguments\n\t\tc = Check.new\n\t\trefute c.check_arguments([1,1])\n\tend",
"def test_one_ints\n args = Arguments.new\n assert_equal false, args.check_args([1])\n end",
"def test_double_argument\n\t\tc = Check.new\n\t\tassert c.check_arguments([1,1.2,1])\n\tend",
"def second_arg\n expect :call, :attrasgn, :safe_call, :safe_attrasgn\n self[4]\n end",
"def test_check_num_args_invalid2\n args = CheckNumArgs.new\n assert_equal false, args.check_args([1])\n end",
"def test_arg_check_oneArg\n \t@args = ArgumentCheck.new\n \tassert_equal(true, @args.arg_check([1]))\n end",
"def test_zero_prospectors\n\t\tassert check_args([1, 0])\n\tend",
"def test_check_num_args_valid2\n args = CheckNumArgs.new\n args.check_args([1,1,1])\n assert_kind_of Integer, 1\n end",
"def test_three_ints\n args = Arguments.new\n assert_equal true, args.check_args([1, 2, 3])\n end",
"def test_check_num_args_invalid3\n args = CheckNumArgs.new\n assert_equal false, args.check_args([1, 2])\n end",
"def test_arg_check_turns_valid\n ret = arg_check_turns '1'\n assert_equal ret, 0\n end",
"def test_check_num_args_string1\n args = CheckNumArgs.new\n assert_equal false, args.check_args(['HELLO'])\n end",
"def test_arg_check_prospectors_valid\n ret = arg_check_prospectors '1'\n assert_equal ret, 0\n end",
"def test_arg_check_prospectors_negative\n def exit(x); 1; end\n ret = arg_check_prospectors '-1'\n assert_equal ret, -3\n end",
"def test_neg_prospectors\n\t\trefute check_args([1, -1])\n\tend",
"def test_check_num_args_string2\n args = CheckNumArgs.new\n assert_equal false, args.check_args(['HELLO', 'THERE'])\n end",
"def test_arg_check_2string\n \t@args = ArgumentCheck.new\n \tassert_equal(false, @args.arg_check(['poop', 'poopy']))\n end",
"def test_arg_check_3string\n \t@args = ArgumentCheck.new\n \tassert_equal(false, @args.arg_check(['poop', 'poopy', 'poopypoop']))\n end",
"def test_positive\r\n args = Args.new\r\n assert_equal false, args.check_args(6)\r\n end",
"def test_check_num_args_valid\n args = CheckNumArgs.new\n assert_equal true, args.check_args([1,1,1])\n end",
"def test_positive\n args = Arguments.new\n assert_equal false, args.check_args(5)\n end",
"def test_arg_check_length_fail\n def exit(x); 1; end;\n ret = arg_check_length 2\n assert_equal ret, -1\n end",
"def test_match\n assert_equal(2, add(1,1))\n end",
"def test_check_args_invalid2\n args = CheckArgs.new\n assert_equal false, args.check_args([1, 2])\n end",
"def test_args_check_less\n\t\targs_checker = ArgsChecker::new\n\t\tarr = []\n\t\tassert_raises(\"I need one number bud, try again\") { args_checker.check_args arr }\n\tend",
"def test_check_num_args_string3\n args = CheckNumArgs.new\n assert_equal false, args.check_args(['HELLO', 'THERE', 'KENOBI'])\n end",
"def check_args(args)\n begin\n results = [Integer(args[0]), Integer(args[1])] \n rescue ArgumentError, TypeError\n puts 'Invalid input.' \n end\n args.count == 2 && results[1] >= 1\nrescue StandardError\n false\nend",
"def test_sub\n assert_equal( 1, 2-1 )\n end",
"def test_match\n\t\tassert_equal(2,add(1,1))\n\tend",
"def test_args_check_greater\n\t\targs_checker = ArgsChecker::new\n\t\tarr = [2, 4]\n\t\tassert_raises(\"I need one number bud, try again\") { args_checker.check_args arr }\n\tend",
"def test_arg_check_turns_negative\n def exit(x); 1; end\n ret = arg_check_turns '-1'\n assert_equal ret, -4\n end",
"def test1ActionTwiceDifferentParameters\n executeTest(\n 'DummyUser',\n {\n 'DummyTool' => {\n 'DummyActionWithParams' => [\n [ 'Param11', 'Param21' ],\n [ 'Param12', 'Param22' ]\n ]\n }\n }\n )\n end",
"def test_string_argument\n\t\tc = Check.new\n\t\tassert c.check_arguments([1,'1',1])\n\tend",
"def test_missing_argument_invalid_argument\n\t\tc = Check.new\n\t\trefute c.check_arguments([1,1,'s'])\n\tend",
"def test_check_args_invalid_zero\n args = CheckArgs.new\n assert_equal false, args.check_args([2, 0, 0])\n end",
"def test_execute_with_string_arg\n assert_equal 0, MM2.execute(\"--version\")\n assert_equal 1, MM2.execute(\"--lh 3\")\n # After executing the \"--version\" command, the verbosity is changed to 3.\n # To prevent test_get_verbose from failing, set it back to 1.\n MM2.verbose = 1\n end",
"def foo(a, b)\n :two_args\n end",
"def test_arg_check_prospectors_decimal\n def exit(x); 1; end\n ret = arg_check_prospectors '1.6'\n assert_equal ret, -3\n end",
"def test_no_arg\n\tassert_output(nil, abort) {GoldRush.argchecker(-1)}\n end",
"def test_check_num_args_invalid_negative\n args = CheckNumArgs.new\n assert_equal false, args.check_args([0,-1,-1])\n end",
"def test_check_num_args_invalid_zero\n args = CheckNumArgs.new\n assert_equal false, args.check_args([0,0,0])\n end",
"def test_multiplies_two_numbers\n\t\tassert_equal 9, multiply(3,3)\n\tend",
"def test_negative\r\n args = Args.new\r\n assert_equal false, args.check_args(\"hello\")\r\n end",
"def test_check_args_valid\n args = CheckArgs.new\n assert_equal true, args.check_args([-5, 2, 3])\n end",
"def stest_method_1(test); end",
"def test_add_option03b\n assert_nothing_raised( Exception ) { \n ArgumentManager.add_option(\n [ 'j' ],\n :type => :integer\n )\n }\n end",
"def test_addition_of_two_number\n # assert_raises \"Invalid values.\" do\n magic_ball = MagicBall.new\n puts \"--------------\"\n puts magic_ball.addition(5, 5)\n puts \"--------------\"\n assert magic_ball.addition(5, 5), 10\n # assert addition == 10\n # end\n end",
"def test_check_args_invalid_string2\n args = CheckArgs.new\n assert_equal false, args.check_args(['HI', 4, 'There'])\n end",
"def test_zero\n args = Arguments.new\n assert_equal false, args.check_args(0)\n end",
"def test_first_example\n assert_equal(0, purple([\"+1\", \"-1\"]))\n end",
"def test_arg_check_turns_decimal\n def exit(x); 1; end\n ret = arg_check_turns '1.6'\n assert_equal ret, -4\n end",
"def test_negative_argument\n\t\tc = Check.new\n\t\trefute c.check_arguments([1,1,-2])\n\tend",
"def test_arg_check_seed_valid\n ret = arg_check_seed '1'\n assert_equal ret, 0\n end",
"def test_zero\r\n args = Args.new\r\n assert_equal false, args.check_args(0)\r\n end",
"def test_check_args_false\n c = Checker.new\n assert_equal false, c.check_args([1, 1, 1, 1])\n assert_equal false, c.check_args([1,1])\n assert_equal false, c.check_args(['something', 111])\n assert_equal false, c.check_args([1, -1, 1])\n assert_equal false, c.check_args([1, 1, -1])\n end",
"def test_correct_extra_arg\n a_parse = Argparser.new\n assert !a_parse.correct?([-20, 5, 1, 0])\n end",
"def test_exercise_1122\n verify_method :exercise_1122,\n :with => [{\n params: [0, [0, 1, 2, 3, 4, 5]],\n expect: \"lo: 0, hi: 5\\n\\tlo: 0, hi: 1\\n\"\n },\n {\n params: [5, [0, 1, 2, 3, 4, 5]],\n expect: \"lo: 0, hi: 5\\n\\tlo: 3, hi: 5\\n\\t\\tlo: 5, hi: 5\\n\"\n }]\n end",
"def test_more_than_one_variable\n assert_equal(20,minus(80,40,20))\t\n end",
"def test_check_seed_valid_int_negative\n test_args = [-1, 2, 3]\n args = Args.new test_args\n assert_equal(-1, args.check_seed(test_args[0]))\n end",
"def test_arg_check_seed_decimal\n def exit(x); 1; end\n ret = arg_check_seed '1.6'\n assert_equal ret, -2\n end",
"def test_two_rubies_test\r\n rubyArr = [2,2]\r\n seed = 10\r\n r = Random.new(seed)\r\n numReturn = mine(rubyArr, r)\r\n if numReturn == 0 || numReturn == 1 || numReturn == 2\r\n assert true\r\n end\r\n end",
"def first_argument_index\n 2\n end",
"def assert_1\n raise \"Invalid argument\" unless yield\nend",
"def tests=(_arg0); end",
"def tests=(_arg0); end",
"def test_no_arg\n\tassert_output(nil, abort) {GoldRush.argchecker()}\n end",
"def two\n end",
"def test_check_in_two_guests\n @room1.guest_check_in(@guest1)\n @room1.guest_check_in(@guest2)\n assert_equal(2, @room1.guests_number())\n end",
"def test_check_args_invalid_negative\n args = CheckArgs.new\n assert_equal false, args.check_args([6, -2, -3])\n end",
"def test_check_num\n assert_raises SystemExit do\n assert_output 'Line 2: Invalid block number 1, should be 2\\nBLOCKCHAIN INVALID' do\n block_no = '1'\n line_no = '2'\n @verify.check_num(block_no, line_no)\n end\n end\n end",
"def check_args(args)\n args.count == 2 && args[0].to_i > 0 && args[1].to_i > 0\n rescue StandardError\n false\n end",
"def ptest(*args)\n ptest?(*args) ? ONE : ZERO\n end",
"def test_exercise_1113\n verify_method :exercise_1113,\n :with => [{param: [[0]], expect: [[0]]},\n {param: [[0, 1]],\n expect: [[0],\n [1]]},\n {param: [[0, 1],\n [2, 3]],\n expect: [[0, 2],\n [1, 3]]}]\n\n end",
"def test_abnormal_usage\n test_args = [-9, -9, -9]\n args = Args.new test_args\n\n args.stub(:exit, 1) do\n assert_output(\"Usage:\\nruby ruby_rush.rb *seed* *num_prospectors* *num_turns\\n*seed* should be an integer\\n*num_prospectors* should be a non-negative integer\\n*num_turns* should be a non-negative integer\\n\"){args.validate_args}\n end\n end",
"def _test_2\n dotest(\n TestCase45a2,\n \"\"\"\n.0 - 1\n.1 - 2\ndone.\n \"\"\".strip)\n end",
"def test_player2_should_win\n\t\tresult = Rule.new.determine_outcome_from_tosses(\"s\", \"r\")\n\t\tassert_equal(1, result)\n\tend",
"def example_passed(_)\n end",
"def test_nonzero_arguments\n args_checker = ArgsChecker.new\n arr = [1]\n assert_equal false, args_checker.check_mode(arr)\n end",
"def test_check_coins_true\r\n assert_equal 1, @g.check_coins('1')\r\n end",
"def test_get_version_number\n assert_equal 3, ChangeLogs.get_version_number(1,'test')\n end",
"def what_am_i arg arg2\n \nend",
"def test_add_option03a\n assert_nothing_raised( Exception ) { \n ArgumentManager.add_option(\n [ 'i' ],\n :type => :integer,\n :df_int => 0\n )\n }\n end",
"def arity; 2; end",
"def method_args_test(a,b)\n a + b + yield\n end",
"def check_usage # (1)\n unless ARGV.length == 2 \n puts \"Cannot Proceed With The Operation: Please provide 2 textfile to compare\"\n exit\n end\nend",
"def test_print_books_negative\n\t\tassert_raises(\"Cannot have fewer than 0 books\") { print_books(-1,-1) }\n\tend",
"def test_exercise_1124\n verify_method :exercise_1124,\n :with => [{params: [1111111, 1234567], expect: 1},\n {params: [33 * 7, 33 * 23], expect: 33},\n {params: [41 * 13, 41 * 29], expect: 41}]\n\n end",
"def test_check_block_num_equal\r\n assert_equal true, @g.check_block_num(1, 1)\r\n end",
"def test_bad_argument\n assert_equal 1, go_with_args(%w(--this_is_really_redonculouslywrong))\n assert_match(/Error: bad arguments/, @stderr_io.string )\n end",
"def puts_two(*args)\n arg1, arg2 = args\n puts \"wth 1 #{arg1} 2 #{arg2}\"\n arg2 = arg2 + 1\n arg1 = arg1 + \"woots\"\nend",
"def verify_sub=(_arg0); end",
"def verify_sub=(_arg0); end",
"def test_duck_has_2_legs\n assert_equal(2,@duck.num_legs)\n end",
"def check_solution(test_number, argument, expected)\n actual = fields(argument)\n if actual != expected\n puts \"Test ##{test_number}: Incorrect value: got #{actual}, expected #{expected}\"\n return false\n end\n\n puts \"Test ##{test_number}: Correct\"\n return true\nend",
"def test_add_option03f\n assert_raise( RuntimeError ) { \n ArgumentManager.add_option(\n [ 'n' ],\n :type => :integer,\n :min => +1,\n :max => -1\n )\n } \n end",
"def check_args(arguments)\r\n if arguments.length != 3\r\n puts 'There must be exactly three arguments: *seed*, *num_prospectors*, *num_turns*'\r\n return false\r\n elsif arguments[1].to_i.negative? || arguments[2].to_i.negative?\r\n puts 'Usage:'\r\n puts 'ruby ruby_rush.rb *seed* *num_prospectors* *num_turns*'\r\n puts '*seed* should be an integer'\r\n puts '*num_prospectors* should be a non-negative integer'\r\n puts '*num_turns* should be a non-negative integer'\r\n return false\r\n end\r\n true\r\nend",
"def value_odd_not_true\n assert value.odd?, 'value is not odd'\nend",
"def test_add_two(number)\nputs add_two(1)\nputs add_two(1.0)\nputs add_two(nil)\nputs add_two({})\nputs add_two([])\nputs add_two(false)\nend"
] | [
"0.72483855",
"0.71668065",
"0.6878214",
"0.68528855",
"0.68295324",
"0.68191093",
"0.6785881",
"0.6750832",
"0.673654",
"0.66523933",
"0.66133225",
"0.65546674",
"0.6458871",
"0.6458053",
"0.64373255",
"0.6428041",
"0.6426829",
"0.6420906",
"0.6400976",
"0.6395065",
"0.63244915",
"0.63181",
"0.63159376",
"0.629731",
"0.62927383",
"0.62705886",
"0.62532127",
"0.6249088",
"0.62453216",
"0.6238427",
"0.6234701",
"0.6218544",
"0.6189216",
"0.61847603",
"0.61475396",
"0.61341935",
"0.6118054",
"0.6054704",
"0.6035549",
"0.60001856",
"0.59996796",
"0.59956294",
"0.5972232",
"0.5968755",
"0.5966246",
"0.59453803",
"0.5937514",
"0.5922683",
"0.5922072",
"0.5909449",
"0.5896207",
"0.5886554",
"0.5885483",
"0.58847594",
"0.5883249",
"0.58778",
"0.58465064",
"0.5840921",
"0.5837309",
"0.58289033",
"0.58224666",
"0.5815867",
"0.58036584",
"0.5786472",
"0.5776081",
"0.57509214",
"0.5739262",
"0.5739262",
"0.57365274",
"0.5733007",
"0.5730186",
"0.5727833",
"0.5723465",
"0.5719577",
"0.5713598",
"0.5713286",
"0.57031065",
"0.56935996",
"0.5688798",
"0.56801164",
"0.5678643",
"0.56660634",
"0.5662657",
"0.56597704",
"0.5655302",
"0.56531453",
"0.5651297",
"0.5651091",
"0.5644031",
"0.5642578",
"0.5634899",
"0.5634178",
"0.5627597",
"0.5627332",
"0.5627332",
"0.5625027",
"0.5617647",
"0.56167454",
"0.5614029",
"0.56065154",
"0.56034994"
] | 0.0 | -1 |
UNIT TESTS FOR mood?(x) Equvalent classes: total = nil (EDGE CASE) total = 0 total = 1 total = 5 total = 9 total = 10 total = 100 This test when found no ruby | def test_mood1
assert_equal @p.mood?([0, 0]), 'empty-handed.'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mood?(total_ruby_found)\n total_real = total_ruby_found[0]\n return 'victorious!' if total_real >= 10\n return 'sad.' if total_real >= 1 && total_real <= 9\n return 'empty-handed.' if total_real.zero?\n end",
"def test_mood6\n assert_equal @p.mood?([100, 0]), 'victorious!'\n end",
"def test_mood5\n assert_equal @p.mood?([10, 0]), 'victorious!'\n end",
"def test_mood4\n assert_equal @p.mood?([9, 0]), 'sad.'\n end",
"def test_mood3\n assert_equal @p.mood?([5, 0]), 'sad.'\n end",
"def test_total_turns_1\n \tpro = Prospector.new(1)\n \tpro.prospect_move(1)\n \tassert pro.total_rubies == 0\n \tassert pro.total_fake_rubies == 0\n end",
"def test_mood2\n assert_equal @p.mood?([1, 0]), 'sad.'\n end",
"def test_ruby_count_zeros\n pros = Prospector.new(0,0,0)\n assert pros.ruby_count.eql? \"After 0 days, Rubyist #0 found:\\n\\t0 rubies.\\n\\t0 fake rubies.\\n\"\n end",
"def test_end_search_0_turns\n \tpro = Prospector.new(1)\n \tpro.loop_prospector(0)\n \tassert pro.total_rubies == 0\n \tassert pro.total_fake_rubies == 0\n \tassert pro.days == 0\n \tassert pro.turns == 0\n end",
"def test_m_greater_1\n assert_not_nil \"troubles\" =~ PorterStemmer::Porter1::MGR1\n assert_not_nil \"private\" =~ PorterStemmer::Porter1::MGR1\n assert_not_nil \"oaten\" =~ PorterStemmer::Porter1::MGR1\n assert_not_nil \"orrery\" =~ PorterStemmer::Porter1::MGR1\n assert_not_nil \"crepuscular\" =~ PorterStemmer::Porter1::MGR1\n end",
"def mood\n #it \"has a method 'mood' that returns 'happy' when the user is more happy than nauseous\" do\n if self.happiness && self.nausea\n if self.happiness > self.nausea\n \"happy\"\n #it \"has a method 'mood' that returns 'sad' when the user is more nauseous than happy\" do\n elsif self.happiness < self.nausea\n \"sad\"\n end\n end\n end",
"def test\n\t\t##\n\t\t# Possible outcomes for each test. Do all tests and count the outcome\n\t\t##\n\t\twinLoss = {win: 0, loss: 0, sorted: 0, unsorted: 0}\n\t\t@xData[:test].each{|test|\n\t\t\t#Get the truth\n\t\t\tsorted \t\t= test.sort{|a,b| a <=> b}\n\t\t\t#Take an educated guess\n\t\t\tprediction\t= @machine.run(test).first.round\n\t\t\t##\n\t\t\t# Record outcomes\n\t\t\t##\n\t\t\t#If it is classed as sorted and is sorted\n\t\t\tif prediction == 1 && test == sorted \n\t\t\t\twinLoss[:win] \t\t+= 1\n\t\t\t\twinLoss[:sorted]\t+= 1\n\t\t\t#If it's classed as unsorted and is unsorted\n\t\t\telsif prediction == 0 && test != sorted\n\t\t\t\twinLoss[:win] \t\t+= 1\n\t\t\t\twinLoss[:unsorted]\t+= 1\n\t\t\t#A loos. You've broke something somewhere (probably)\n\t\t\telse\n\t\t\t\twinLoss[:loss] \t\t+= 1\n\t\t\tend\n\t\t}\n\t\t#Print the results\n\t\tputs \"Iterations: #{@iterations}\\nMAX_MSE: #{@maxError}\\n\\t#{winLoss}\" # proof\n\tend",
"def prospect_search(total_turns)\n @days += 1\n rubies = rand(@curr_location.max_rubies + 1)\n fakes = rand(@curr_location.max_fake_rubies + 1)\n @total_rubies += rubies\n @total_fake_rubies += fakes\n # rubocop does not like the switch without [], this is one of my \"freebies\"\n case\n when rubies.zero? && fakes.zero?\n puts \"\\t\\tFound no rubies or fake rubies in #{@curr_location.loc}.\"\n prospect_move(total_turns)\n when rubies == 1 && fakes != 1\n puts \"\\t\\tFound #{rubies} ruby and #{fakes} fake rubies at #{@curr_location.loc}.\"\n when rubies != 1 && fakes == 1\n puts \"\\t\\tFound #{rubies} rubies and #{fakes} fake ruby at #{@curr_location.loc}.\"\n when rubies == 1 && fakes == 1\n puts \"\\t\\tFound #{rubies} ruby and #{fakes} fake ruby at #{@curr_location.loc}.\"\n else\n puts \"\\t\\tFound #{rubies} rubies and #{fakes} fake rubies at #{@curr_location.loc}.\"\n end\n end",
"def test_truthy_count(tests, method, options = {})\n tests.each do |test|\n matches = Ramparts.send(method, test[:text], options)\n expect(matches)\n .to eq(test[:matches].length),\n \"Expected #{test[:matches].length}, got #{matches} for '#{test[:text]}'\"\n end\nend",
"def test_contains_13_eachsuit\n assert true == false\n end",
"def percent_satisfied(content)\n if ['yes', 'extremely likely', 'very satisfied'].include?(content)\n 100\n elsif ['somewhat likely', 'satisfied'].include?(content)\n 80\n elsif ['neutral'].include?(content)\n 60\n elsif ['not very likely', 'dissatisfied'].include?(content)\n 40\n elsif ['not at all likely', 'very dissatisfied'].include?(content)\n 20\n elsif ['no'].include?(content)\n 0\n else\n 0\n end\n end",
"def test_falsy_count(tests, method, options = {})\n tests.each do |test|\n matches = Ramparts.send(method, test, options)\n expect(matches).to eq(0), \"Expected empty array, got #{matches} for '#{test}'\"\n end\nend",
"def hypothesis6(countsXmajor) \n\tcriteria = 0\n\teuks = 0\n\teuks += 1 if countsXmajor['Sr'] >= 0.25\n\teuks += 1 if countsXmajor['Pl'] >= 0.25\n\teuks += 1 if countsXmajor['Op'] >= 0.25\n\teuks += 1 if countsXmajor['EE'] >= 0.25\n\teuks += 1 if countsXmajor['Am'] >= 0.25\n\teuks += 1 if countsXmajor['Ex'] >= 0.25\t\n\tcriteria += 1 if countsXmajor['Ba'] < 0.25\n\tcriteria += 1 if countsXmajor['Za'] < 0.25\n\tcriteria += 1 if euks >= 5\n\tif criteria == 3\n\t\treturn 1\n\telse\n\t\treturn 0 \n\tend\nend",
"def count_tests\n Dir.entries(@path.to_s + \"sandbox\").each do |currFile|\n isFile = currFile.to_s =~ /\\.java$|\\.py$|\\.c$|\\.cpp$|\\.js$|\\.php$|\\.rb$|\\.hs$|\\.clj$|\\.go$|\\.scala$|\\.coffee$|\\.cs$|\\.groovy$\\.erl$/i\n\n unless isFile.nil?\n file = @path.to_s + \"sandbox/\" + currFile.to_s\n begin\n case @language.to_s\n when \"Java-1.8_JUnit\"\n if File.open(file).read.scan(/junit/).count > 0\n @totaltests += File.open(file).read.scan(/@Test/).count\n end\n when \"Java-1.8_Mockito\"\n if File.open(file).read.scan(/org\\.mockito/).count > 0\n @totaltests += File.open(file).read.scan(/@Test/).count\n end\n when \"Java-1.8_Powermockito\"\n if File.open(file).read.scan(/org\\.powermock/).count > 0\n @totaltests += File.open(file).read.scan(/@Test/).count\n end\n when \"Java-1.8_Approval\"\n if File.open(file).read.scan(/org\\.approvaltests/).count > 0\n @totaltests += File.open(file).read.scan(/@Test/).count\n end\n when \"Python-unittest\"\n if File.open(file).read.scan(/unittest/).count > 0\n @totaltests += File.open(file).read.scan(/def /).count\n end\n when \"Python-pytest\"\n if file.include?\"test\"\n @totaltests += File.open(file).read.scan(/def /).count\n end\n when \"Ruby-TestUnit\"\n if File.open(file).read.scan(/test\\/unit/).count > 0\n @totaltests += File.open(file).read.scan(/def /).count\n end\n when \"Ruby-Rspec\"\n if File.open(file).read.scan(/describe/).count > 0\n @totaltests += File.open(file).read.scan(/it /).count\n end\n when \"C++-assert\"\n if File.open(file).read.scan(/cassert/).count > 0\n @totaltests += File.open(file).read.scan(/static void /).count\n end\n when \"C++-GoogleTest\"\n if File.open(file).read.scan(/gtest\\.h/).count > 0\n @totaltests += File.open(file).read.scan(/TEST\\(/).count\n end\n when \"C++-CppUTest\"\n if File.open(file).read.scan(/CppUTest/).count > 0\n @totaltests += File.open(file).read.scan(/TEST\\(/).count\n end\n when \"C++-Catch\"\n if File.open(file).read.scan(/catch\\.hpp/).count > 0\n @totaltests += File.open(file).read.scan(/TEST_CASE\\(/).count\n end\n when \"C-assert\"\n if File.open(file).read.scan(/assert\\.h/).count > 0\n @totaltests += File.open(file).read.scan(/static void /).count\n end\n when \"Go-testing\"\n if File.open(file).read.scan(/testing/).count > 0\n @totaltests += File.open(file).read.scan(/func /).count\n end\n when \"Javascript-assert\"\n if File.open(file).read.scan(/assert/).count > 0\n @totaltests += File.open(file).read.scan(/assert/).count - 2 #2 extra because of library include line\n end\n when \"C#-NUnit\"\n if File.open(file).read.scan(/NUnit\\.Framework/).count > 0\n @totaltests += File.open(file).read.scan(/\\[Test\\]/).count\n end\n when \"PHP-PHPUnit\"\n if File.open(file).read.scan(/PHPUnit_Framework_TestCase/).count > 0\n @totaltests += File.open(file).read.scan(/function /).count\n end\n when \"Perl-TestSimple\"\n if File.open(file).read.scan(/use Test/).count > 0\n @totaltests += File.open(file).read.scan(/is/).count\n end\n when \"CoffeeScript-jasmine\"\n if File.open(file).read.scan(/jasmine-node/).count > 0\n @totaltests += File.open(file).read.scan(/it/).count\n end\n when \"Erlang-eunit\"\n if File.open(file).read.scan(/eunit\\.hrl/).count > 0\n @totaltests += File.open(file).read.scan(/test\\(\\)/).count\n end\n when \"Haskell-hunit\"\n if File.open(file).read.scan(/Test\\.HUnit/).count > 0\n @totaltests += File.open(file).read.scan(/TestCase/).count\n end\n when \"Scala-scalatest\"\n if File.open(file).read.scan(/org\\.scalatest/).count > 0\n @totaltests += File.open(file).read.scan(/test\\(/).count\n end\n when \"Clojure-.test\"\n if File.open(file).read.scan(/clojure\\.test/).count > 0\n @totaltests += File.open(file).read.scan(/deftest/).count\n end\n when \"Groovy-JUnit\"\n if File.open(file).read.scan(/org\\.junit/).count > 0\n @totaltests += File.open(file).read.scan(/@Test/).count\n end\n when \"Groovy-Spock\"\n if File.open(file).read.scan(/spock\\.lang/).count > 0\n @totaltests += File.open(file).read.scan(/def /).count - 1 #1 extra because of object def\n end\n else\n @totaltests = \"NA\"\n end\n rescue\n puts \"Error: Reading in count_tests\"\n end\n end\n end\nend",
"def test_player1_should_win\n\t\tresult = Rule.new.determine_outcome_from_tosses(\"r\", \"s\")\n\t\tassert_equal(0, result)\n\tend",
"def test_rand_gold_nevada\n # max gold between 0 and 5\n prng = Random.new(15)\n pros = Prospector.new 1, prng\n map = Map.new\n 200.times do\n actual = pros.get_ran_gold map.cities[0].id, prng, map.cities[0].max_gold\n assert_operator 5, :>=, actual\n assert_operator 0, :<=, actual\n end\n end",
"def test_69_cents #tests the coins that should be returned to total 69 cents\n \t\n\tassert_equal(2, $quarters)\n\tassert_equal(1, $dimes)\n\tassert_equal(1, $nickels)\n\tassert_equal(4, $pennies)\nend",
"def test_count_fish__3_fish()\n actual = @river1.count_fish()\n assert_equal(5, actual)\n end",
"def hypothesis1(countsXmajor) \n\tcriteria = 0\n\teuks = 0\n\teuks += 1 if countsXmajor['Sr'] >= 0.25\n\teuks += 1 if countsXmajor['Pl'] >= 0.25\n\teuks += 1 if countsXmajor['Op'] >= 0.25\n\teuks += 1 if countsXmajor['EE'] >= 0.25\n\teuks += 1 if countsXmajor['Am'] >= 0.25\n\teuks += 1 if countsXmajor['Ex'] >= 0.25\t\t\n\tcriteria += 1 if countsXmajor['Ba'] >= 0.25 \n\tcriteria += 1 if countsXmajor['Za'] >= 0.25 \n\tcriteria += 1 if euks >= 5\n\tif criteria == 3\n\t\treturn 1\n\telse\n\t\treturn 0 \n\tend\nend",
"def test_size\n @results.map {|node_name, classes|\n classes.size\n }.reduce(:+) || 0\n end",
"def test_both_players_level_and_exceed_defcon\n scenario us: 4, ussr: 4, defcon: 3\n assert_no_award\n end",
"def test\n false_good, true_bad = get_counts(@testing_bad)\n true_good, false_bad = get_counts(@testing_good)\n\n correct = true_good.length + true_bad.length\n total = correct + false_bad.length + false_good.length\n ratio = format_ratio(1.0 * correct / total)\n\n bad_total = false_good.length + true_bad.length\n bad_ratio = format_ratio(1.0 * true_bad.length / bad_total)\n\n good_total = true_good.length + false_bad.length\n good_ratio = format_ratio(1.0 * true_good.length / good_total)\n\n puts \"Accuracy: #{ratio} (#{correct} of #{total})\"\n\n puts \"Bad commit accuracy: #{bad_ratio} (#{true_bad.length} of #{bad_total})\"\n print_failures(true_bad)\n\n puts \"Good commit accuracy: #{good_ratio} (#{true_good.length} of #{good_total})\"\n print_failures(true_good)\n end",
"def test_any_chance_of_working \n assert_equal(true, credit_cards(:cc_no_statuses_live).any_chance_of_working?)\n assert_equal(true, credit_cards(:cc_no_statuses_live).any_chance_of_working?(true))\n\n assert_equal(false, credit_cards(:cc_no_statuses_expired).any_chance_of_working?)\n assert_equal(true, credit_cards(:cc_no_statuses_expired).any_chance_of_working?(true))\n\n assert_equal(false, credit_cards(:cc_one_status_expired).any_chance_of_working?)\n assert_equal(true, credit_cards(:cc_one_status_expired).any_chance_of_working?(true))\n\n assert_equal(false, credit_cards(:cc_one_status_expired).any_chance_of_working?)\n assert_equal(true, credit_cards(:cc_one_status_expired).any_chance_of_working?(true))\n\n assert_equal(true, credit_cards(:cc_one_status_gateway).any_chance_of_working?)\n assert_equal(true, credit_cards(:cc_one_status_gateway).any_chance_of_working?(true))\n\n assert_equal(false, credit_cards(:cc_one_status_addrnomatch).any_chance_of_working?)\n assert_equal(false, credit_cards(:cc_one_status_addrnomatch).any_chance_of_working?(true))\n \n end",
"def test_amount_gold_silver\n\tassert_equal 0, @gold_rush.prospector.num_gold\n\tassert_equal 0, @gold_rush.prospector.num_silver\n end",
"def test_returns_strength_value_halved\n skip\n end",
"def test_gold_without_silver_singular\n seed = 10\n id = 1\n prng = Random.new(seed)\n pros = Prospector.new id, prng\n max_silver = 0\n max_gold = 1\n actual = pros.get_msg_search_first_3_ir 'Midas', max_gold, max_silver\n expected = \"Found 1 ounce of gold in Midas.\\n\"\n assert_equal expected, actual, 'check it should be correct\\n'\n end",
"def test_has_teen\n\t\tassert_equal false, @m.has_teen?(1, 2, 3)\n\t\tassert_equal true, @m.has_teen?(0, 10, 14)\n\t\tassert_equal false, @m.has_teen?(21, 8, 8)\n\tend",
"def test_suma\n \t\tassert_equal(@mr,(@mq+@mp)) #dispersas\n \t\tassert_equal(@c,(@a+@b)) #fraccionales\n\t\tassert_equal(@md,(@ma+@mz)) #densa\n \tend",
"def hypothesis5(countsXmajor) \n\tcriteria = 0\n\tphotoeuks = 0\n\tnonPhotoeuks = 0\n\tphotoeuks += 1 if countsXmajor['Sr'] >= 0.25\n\tphotoeuks += 1 if countsXmajor['Pl'] >= 0.25\n\tphotoeuks += 1 if countsXmajor['EE'] >= 0.25\n\tnonPhotoeuks += 1 if countsXmajor['Op'] >= 0.25\n\tnonPhotoeuks += 1 if countsXmajor['Am'] >= 0.25\n\tnonPhotoeuks += 1 if countsXmajor['Ex'] >= 0.25\t\t\n\tcriteria += 1 if countsXmajor['Ba'] >= 0\n\tcriteria += 1 if countsXmajor['Za'] < 0.25\n\tcriteria += 1 if photoeuks == 3\n\tcriteria += 1 if nonPhotoeuks == 0\n\tif criteria == 4\n\t\treturn 1\n\telse\n\t\treturn 0 \n\tend\nend",
"def check_for_tautology\n counter = 0\n random_decision = Decider.new(@propositional_statement, @random_truth_values).evaluate_expression\n if random_decision == false\n what_simulator_tells = \"False\"\n elsif random_decision == true\n @possible_truth_tables.each do |possible_truth_table|\n counter += 1\n decision = Decider.new(@propositional_statement, possible_truth_table).evaluate_expression\n if decision == false\n what_simulator_tells = \"False\"\n break\n elsif decision == true && counter == @max_truth_tables\n what_simulator_tells = \"True\"\n break\n end\n end\n end\n what_simulator_tells\n end",
"def test_find_rubies_nonzero\r\n\t\tassert_includes [email protected]_rubies, @t.find_rubies\r\n\tend",
"def test_case_count\n scenario_count + outlines.reduce(0) { |outline_sum, outline|\n outline_sum += outline.examples.reduce(0) { |example_sum, example|\n example_sum += example.rows.count\n }\n }\n end",
"def test_intialize\r\n\tassert_equal 0, @test_prospector.current_gold\r\n\tassert_equal 0, @test_prospector.current_silver\r\n\tassert_equal 0, @test_prospector.total_gold\r\n\tassert_equal 0, @test_prospector.total_silver\r\n\tassert_equal 0, @test_prospector.move_count\r\n\tassert_nil @test_prospector.previous_location\r\n\tassert_equal 0, @test_prospector.num_days\r\n\tassert_equal 'Sutter Creek', @test_prospector.current_location\r\n end",
"def test_find_fake_rubies_nonzero\r\n\t\tassert_includes [email protected]_fake_rubies, @t.find_fake_rubies\r\n\tend",
"def test_results_sad\r\n assert_output(\"Going home sad.\\n\") { @g.results(9) }\r\n end",
"def test_has_teen\n\t\tassert_equal true, @m.has_teen(13)\n\t\tassert_equal true, @m.has_teen(19)\n\t\tassert_equal false, @m.has_teen(12)\n\t\tassert_equal false, @m.has_teen(20)\n\tend",
"def total_score(play)\n sum = 0;\n play.decision_array.each_with_index{|v, i|\n sum += 1 if v == decision_array[i] && i != 0 # exclude an example\n }\n sum\n end",
"def test_skill_bonus_no_modifiers\n c = characters(:flappy)\n assert_equal(0, c.total_skill_bonus(skills(:endurance)))\n end",
"def mood\n if self.nausea > self.happiness\n \"sad\"\n else\n \"happy\"\n end\n end",
"def test_total_weight\n assert_equal(0 , @wp00.total_weight)\n assert_equal(384, @wp01.total_weight)\n assert_equal(576, @wp02.total_weight)\n end",
"def test_it_can_find_golden_items_from_threshold\n threshold = 605_1\n assert_equal 5, @sa.find_golden_items(@se.items.all, threshold).count\n end",
"def test_is_steam_when_above_100()\n result = water_description(120)\n assert_equal(\"steam\",result)\n end",
"def test_silver_without_gold_singular\n seed = 10\n id = 1\n pros = Prospector.new id, seed\n max_silver = 1\n max_gold = 0\n actual = pros.get_msg_search_first_3_ir 'Midas', max_gold, max_silver\n expected = \"Found 1 ounce of silver in Midas.\\n\"\n assert_equal expected, actual\n end",
"def test_returns_strength_value_times_2\n dice_roll = hero_movement(5*2, \"elf\")\n assert_equal(10, dice_roll)\nend",
"def hypothesis2(countsXmajor) \n\tcriteria = 0\n\teuks = 0\n\teuks += 1 if countsXmajor['Sr'] >= 0.25\n\teuks += 1 if countsXmajor['Pl'] >= 0.25\n\teuks += 1 if countsXmajor['Op'] >= 0.25\n\teuks += 1 if countsXmajor['EE'] >= 0.25\n\teuks += 1 if countsXmajor['Am'] >= 0.25\n\teuks += 1 if countsXmajor['Ex'] >= 0.25\t\t\n\tcriteria += 1 if countsXmajor['Ba'] < 0.25 \n\tcriteria += 1 if countsXmajor['Za'] >= 0.25 \n\tcriteria += 1 if euks >= 5\n\tif criteria == 3\n\t\treturn 1\n\telse\n\t\treturn 0 \n\tend\nend",
"def hypothesis3(countsXmajor) \n\tcriteria = 0\n\teuks = 0\n\teuks += 1 if countsXmajor['Sr'] >= 0.25\n\teuks += 1 if countsXmajor['Pl'] >= 0.25\n\teuks += 1 if countsXmajor['Op'] >= 0.25\n\teuks += 1 if countsXmajor['EE'] >= 0.25\n\teuks += 1 if countsXmajor['Am'] >= 0.25\n\teuks += 1 if countsXmajor['Ex'] >= 0.25\t\t\n\tcriteria += 1 if countsXmajor['Ba'] >= 0.25 \n\tcriteria += 1 if countsXmajor['Za'] < 0.25 \n\tcriteria += 1 if euks >= 5\n\tif criteria == 3\n\t\treturn 1\n\telse\n\t\treturn 0 \n\tend\nend",
"def test_score_working\n assert_equal score(\"abcdef\"), (1 + 3 + 3 + 2 + 1 + 4)\n assert_equal score(\"zebra\"), (10 + 1 + 3 + 1 + 1)\n end",
"def test_espresso_more_effective\n hipster = Human.new \"Hipster\"\n espresso = Espresso.new \"Espresso\"\n\n hipster.buy espresso\n assert espresso.drinks_before_empty == 1\n\n hipster.drink!\n assert (hipster.alertness > 0.4)\n\n end",
"def test_mine_sutter_creek\r\n\t@test_prospector.current_location = 'Sutter Creek'\r\n\t@test_prospector.mine\r\n\tassert_operator 2, :>=, @test_prospector.current_gold\r\n\tassert_equal 0, @test_prospector.current_silver\r\n\tassert_operator 2, :>=, @test_prospector.total_gold\r\n\tassert_equal 0, @test_prospector.total_silver\r\n end",
"def test_acts_of_homonymy\n create_some_test_data\n assert_equal 0, @s1.acts_of_homonymy_for_ref.size \n assert_equal 1, @s5.acts_of_homonymy_for_ref.size\n assert_equal [[@ontology_classes[3], @ontology_classes[4]]], @s5.acts_of_homonymy_for_ref\n end",
"def test_prospect_gold_positive\n\t prng = Minitest::Mock.new\n\t def prng.rand(num); 1; end\n\t\tcity = City.new(\"Fake City\", 7, 0, prng)\n\t\tcheck = city.prospect_gold\n\t\tassert_includes (0..7), check\n\tend",
"def test_predefined_answers_is_not_empty\n refute_empty Predictor::ANSWERS\n end",
"def test_results_sad_one\r\n assert_output(\"Going home sad.\\n\") { @g.results(1) }\r\n end",
"def test_robot_keeps_track_of_number_of_preformed_operators\n subject = Robot.new\n\n subject.name\n subject.name\n subject.reset\n subject.name\n subject.name\n\n assert_equal 5, subject.instruction_count\n end",
"def test_cases; end",
"def tests_given(achievement, user)\n number = achievement.settings['quantity']\n user.learning_tests.size >= number\n end",
"def test_silver_without_gold_plural\n seed = 10\n id = 1\n pros = Prospector.new id, seed\n max_silver = 3\n max_gold = 0\n actual = pros.get_msg_search_first_3_ir 'Midas', max_gold, max_silver\n expected = \"Found 3 ounces of silver in Midas.\\n\"\n assert_equal expected, actual, 'check it should be correct\\n'\n end",
"def test_gold_without_silver_plural\n seed = 10\n id = 1\n pros = Prospector.new id, seed\n max_silver = 0\n max_gold = 3\n actual = pros.get_msg_search_first_3_ir 'Midas', max_gold, max_silver\n expected = \"Found 3 ounces of gold in Midas.\\n\"\n assert_equal expected, actual\n end",
"def analyzeTestSet(testFile, tree, positiveValue, outcomeField)\r\n\tcorrectCount = 0\r\n\tincorrectCount = 0\r\n\ttext = File.open(testFile).read\r\n\ttext.gsub!(/\\r\\n?/, \"\\n\")\r\n\ttext.each_line do |line|\r\n\t\tfeatureArray = line.split(\",\")\r\n\t\tfeatureArray.last.delete!(\"\\n\")\r\n\t\t# remove whitespace from features\r\n\t\tfeatureArray.each do |feature|\r\n\t\t\tfeature.lstrip!\r\n\t\tend\r\n\r\n\t\tfeatureValues = Array.new\r\n\t\tfor i in 0..featureArray.size-1\r\n\t\t\tif i != outcomeField\r\n\t\t\t\tfeatureValues.push(featureArray[i].to_i) \r\n\t\t\tend\r\n\t\tend\r\n\t\texample = Example.new(featureValues)\r\n\t\tthisValue = featureArray[outcomeField]\r\n\t\tdecision = decide(tree, example)\r\n\t\tif decision == true\r\n\t\t\tif thisValue.eql?(positiveValue)\r\n\t\t\t\tputs \"CORRECT\"\r\n\t\t\t\tcorrectCount += 1\r\n\t\t\telse\r\n\t\t\t\tputs \"INCORRECT\"\r\n\t\t\t\tincorrectCount += 1\r\n\t\t\tend\r\n\t\telse\r\n\t\t\tif thisValue != positiveValue\r\n\t\t\t\tputs \"CORRECT\"\r\n\t\t\t\tcorrectCount += 1\r\n\t\t\telse \r\n\t\t\t\tputs \"INCORRECT\"\r\n\t\t\t\tincorrectCount += 1\r\n\t\t\tend\r\n\t\tend\r\n\tend\r\n\tpercentage = (correctCount.to_f / (correctCount + incorrectCount))\r\n\tputs \"Accuracy: \" + percentage.to_s + \" on test data\"\r\nend",
"def test_cards_total()\n assert_equal(\"You have a total of 4\", @cardgame.cards_total([@card1, @card2]))\n end",
"def mood\n if self.happiness && self.nausea\n mood = self.happiness - self.nausea\n mood > 0 ? \"happy\" : \"sad\"\n end\nend",
"def test_both_players_exceed_defcon\n scenario us: 4, ussr: 5, defcon: 3\n assert_no_award\n end",
"def test_print_classes_plural\n\t\tassert_output(\"Driver 1 attended 4 classes!\\n\") { print_classes(4,1) }\n\tend",
"def test_contains_four_eachface\n assert true == false\n end",
"def test_exercise_115\n verify_method :exercise_115,\n :with => [{param: [0.8, 0.8], expect: true},\n {param: [0.1, 0.1], expect: true},\n {param: [0.9, 0.9], expect: true},\n {param: [1, 1], expect: false},\n {param: [0, 0], expect: false}]\n end",
"def test_unranked_recall\n\n add_test_judgements \n add_unranked_query_result\n assert_equal(1.0, @query_result.statistics[:recall])\n \n end",
"def test_game_scores_incomplete_strikes\n fs = FrameSet::incomplete_strikes\n # score = game.score_game(fs)\n # assert_equal(120, score)\n end",
"def runner\nwelcome\nn = initial_round\nhit?(n)\nend",
"def test_m_equal_1\n assert_not_nil \"trouble\" =~ PorterStemmer::Porter1::MEQ1\n assert_not_nil \"oats\" =~ PorterStemmer::Porter1::MEQ1\n assert_not_nil \"trees\" =~ PorterStemmer::Porter1::MEQ1\n assert_not_nil \"ivy\" =~ PorterStemmer::Porter1::MEQ1\n end",
"def hypothesis4(countsXmajor) \n\tcriteria = 0\n\tphotoeuks = 0\n\tnonPhotoeuks = 0\n\tphotoeuks += 1 if countsXmajor['Sr'] >= 0.25\n\tphotoeuks += 1 if countsXmajor['Pl'] >= 0.25\n\tphotoeuks += 1 if countsXmajor['EE'] >= 0.25\n\tnonPhotoeuks += 1 if countsXmajor['Op'] >= 0.25\n\tnonPhotoeuks += 1 if countsXmajor['Am'] >= 0.25\n\tnonPhotoeuks += 1 if countsXmajor['Ex'] >= 0.25\t\t\n\tcriteria += 1 if countsXmajor['Ba'] >= 0\n\tcriteria += 1 if countsXmajor['Za'] < 0.25\n\tcriteria += 1 if photoeuks >= 2\n\tcriteria += 1 if nonPhotoeuks == 0\n\tif criteria == 4\n\t\treturn 1\n\telse\n\t\treturn 0 \n\tend\nend",
"def mood\n if self.nausea && self.happiness\n self.nausea > self.happiness ? (return \"sad\") : (return \"happy\")\n end\n end",
"def test_coded_chrs\n assert_equal 5, @mk.coded_chrs.count\n end",
"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 can_train_footman?\n gold >= 135 && food >= 2\n end",
"def can_train_footman?\n gold >= 135 && food >= 2\n end",
"def search_health_pack \n health_pack = rand(1..6)\n\n if health_pack == 1 \n puts \"Tu n'as rien trouvé !\"\n\n elsif health_pack == 6 \n if @life_points >= 20 \n @life_points = 100\n else\n @life_points + 80\n end\n puts \"Wahouuu, tu as trouvé un pack de +80 points de vie !\"\n\n else \n if @life_points >= 50\n @life_points = 100\n else \n @life_points + 50\n end\n puts \"Bravo, tu as trouvé un pack de +50 points de vie !\"\n end\n end",
"def goals_against()\n\t self.as_regular_contestants.select{|c| c.opponent.score}.collect{|c| c.opponent.score}.inject{|gf, c| gf + c} || 0\n\tend",
"def test\n\t\tvar = if @a >= @b+@c or @b >= @a+@c or @c >= @b+@a then 5\n\t\telsif @a == @b and @a == @c then var = 1\n\t\telsif @a**2 == @b**2 + @c**2 or @b**2 == @a**2 + @c**2 or\n\t\t\t@c**2 == @b**2 + @a**2 then var = 4\n\t\telsif @a == @b or @a == @c or @b == @c then var = 2\n\t\telse var = 3\n\t\tend\n\n\t\treturn var\n\tend",
"def psh_bonuses(roll)\n case roll\n when 1..5\n @@skills << \"Brawling\"\n puts \"Brawling skill\"\n when 6..10\n @@skills << \"Stealth\"\n puts \"Stealth skill\"\n when 11..15\n @@skills << \"Weapons Expert\"\n puts \"Wpn expert!\"\n when 16..20\n @@skills << \"Dodge\"\n puts \"Dodge skill\"\n when 21..37\n @@endurance += 1\n @@strength += 1\n @@agility += 1\n @@accuracy += 1\n @@willpower += 1\n @@intelligence += 1\n @@perception += 1\n @@appearance += 1\n puts \"+1 to each attribute\"\n when 38..44\n @@endurance += (d(6) + d(6))\n puts \"+2d6 endurance\"\n when 45..51\n @@strength += (d(6) + d(6))\n puts \"+2d6 strength\"\n when 52..58\n @@agility += (d(6) + d(6))\n puts \"+2d6 agility\"\n when 59..65\n @@accuracy += (d(6) + d(6))\n puts \"+2d6 accuracy\"\n when 66..74\n @@intelligence += (d(6) + d(6) + d(6))\n puts \"+3d6 intelligence\"\n when 75..83\n @@willpower += (d(6) + d(6))\n puts \"+2d6 willpower\"\n when 84..90\n @@appearance += (d(6) + d(6) + d(6))\n puts \"+3d6 appearance\"\n when 91..97\n @@skills << \"Martial Arts\"\n puts \"Martial arts skill!\"\n when 98..99\n @@endurance += 2\n @@strength += 2\n @@agility += 2\n @@accuracy += 2\n @@willpower += 2\n @@intelligence += 2\n @@perception += 2\n @@appearance += 2\n puts \"+2 to each attribute\"\n when 100\n @@endurance += d(6)\n @@strength += d(6)\n @@agility += d(6)\n @@accuracy += d(6)\n @@willpower += d(6)\n @@intelligence += d(6)\n @@perception += d(6)\n @@appearance += d(6)\n puts \"JACKPOT -- +d6 to EACH Attribute!\"\n end\n\n end",
"def test_check_coins_true\r\n assert_equal 1, @g.check_coins('1')\r\n end",
"def search_health_pack\n health_pack= rand(1..6)\n if health_pack == 1\n puts \"Tu n'as rien trouvé... \"\n elsif health_pack >= 2 && health_pack <=5\n puts \"Bravo, tu as trouvé un pack de +50 points de vie !\"\n health_pack = 50\n if @life_points < 100 #je met une conditon pour pas dépasser 100 point de vie\n @life_points = @life_points + health_pack\n if @life_points > 100\n @life_points = 100\n end\n end\n puts \"Votre Santé en est rendu à #{@life_points} point de vie\"\n else health_pack == 6\n puts \"Waow, tu as trouvé un pack de +80 points de vie !\"\n health_pack = 80\n if @life_points < 100\n @life_points = @life_points + health_pack\n if @life_points > 100\n @life_points = 100\n end\n end\n puts \"Votre Santé en est rendu à #{@life_points} point de vie\"\n end\n end",
"def counting_recommendation\n count = @shoe.count\n if count <= 1\n @cold\n elsif count <= 10\n @warm\n else\n @hot\n end\n end",
"def test_empty_word_score_zero\n scrabble = Scrabble.new(\"\")\n expected_score = scrabble.score()\n assert_equal expected_score,0\n end",
"def test_judgement\n add_test_judgement\n assert(@gold_standard.contains_judgement? :document => \"doc1\", :query => \"query1\")\n end",
"def search_health_pack\n \t\t\trand(1..6)\n \t\t\tresult = rand(1..6)\n \t\t\tif result == 1\n \t\t\t \tputs \"Tu n'as rien trouvé... \"\n\n\t \t\telsif result.between?(2,5)\n\t \t\t\tunless @life_points < 100\n\t \t\t\t\t@life_points = @life_points+50 \n\t \t\t\t\tputs \"Bravo, tu as trouvé un pack de +50 points de vie !\"\n\t \t\t\telse \n\t \t\t\t\tputs \"Désolé tu as déjà plein de vies\"\n\t \t\t\tend\n\t \t\telse \n\t \t\t\tunless @life_points < 100\n\t\t \t\t\t@life_points = @life_points+80\n\t\t\t \t\tputs \"Waow, tu as trouvé un pack de +80 points de vie !\"\n\t\t\t \telse \n\t \t\t\t\tputs \"Désolé tu as déjà pleins de vies\"\n\t\t \t\tend\n\t \t\tend\n\t \tend",
"def search_health_pack\n dice = rand(1..6)\n if dice == 1\n puts \"Tu n'as rien trouvé... \"\n elsif dice > 1 && dice < 6 \n @life_points += 50 \n puts \"Bravo, tu as trouvé un pack de +50 points de vie !\" \n if @life_points > 100\n @life_points = 100\n end\n elsif dice == 6 \n @life_points += 80\n puts \"Waow, tu as trouvé un pack de +80 points de vie !\"\n if @life_points > 100\n @life_points = 100\n end\n end\n end",
"def test_check_plural_total\n ruby_rush=RubyRush.new(1, 2, 3)\n ruby_rush.real_rb=0\n ruby_rush.fake_rb=1\n assert_equal \"rubies,ruby\", ruby_rush.check_plural_total\n ruby_rush.total_real_sp='ruby'\n ruby_rush.total_fake_sp='ruby'\n ruby_rush.real_rb=1\n ruby_rush.fake_rb=0\n assert_equal \"ruby,rubies\", ruby_rush.check_plural_total\n ruby_rush.total_real_sp='ruby'\n ruby_rush.total_fake_sp='ruby'\n ruby_rush.real_rb=2\n ruby_rush.fake_rb=2\n assert_equal \"rubies,rubies\", ruby_rush.check_plural_total\n ruby_rush.real_sp='ruby'\n ruby_rush.fake_sp='ruby'\n end",
"def mood\n self.happiness > self.nausea ? \"happy\" : \"sad\"\n end",
"def mood\n if !nausea || !happiness\n return \"\"\n elsif nausea >= happiness\n return \"sad\"\n elsif happiness > nausea\n return \"happy\"\n end\n end",
"def points\n raise \"Not an IOI style task.\" unless task.scoring == \"ioi\"\n total = body.count.to_f\n raise \"Task has no tests.\" unless total > 0\n\n passed = body.count { |test| test[:status] == \"Correct\" }\n ((passed / total) * 100).round\n end",
"def mood\n if self.happiness < self.nausea\n \"sad\"\n else\n \"happy\"\n end\n end",
"def fow_bonus(unit)\n return 0\n end",
"def test_prints_SB_if_div_by_5_and_7\n # sf = SuperFizz.new\n #35\n assert_equal 'SuperBuzz', SuperFizz.machine(35)[0]\n end",
"def test_is_steam_when_above_100\n state = water_description(120)\n assert_equal(\"steam\", state)\n end",
"def test_pros_sim\r\n sim = GoldRushSim.new(1, 1)\r\n fakePros = Minitest::Mock.new(\"fake prospector\")\r\n def fakePros.location; 'Sutter Creek'; end\r\n \tdef fakePros.mine_iteration(param); 1; end\r\n \tdef fakePros.mine_last_two(param); 1; end\r\n \tdef fakePros.convert_resources(); 1; end\r\n \tdef fakePros.days; 1; end\r\n \tdef fakePros.gold; 1; end\r\n \tdef fakePros.silver; 1; end\r\n \tdef fakePros.end_messages(a, b, c, d, e); nil; end\r\n assert_equal true, sim.pros_sim(fakePros, 0)\r\n end"
] | [
"0.7173911",
"0.685631",
"0.67086405",
"0.6661949",
"0.66006815",
"0.63181806",
"0.6314163",
"0.62224674",
"0.6221259",
"0.6200686",
"0.61864275",
"0.613763",
"0.6074936",
"0.6011024",
"0.598571",
"0.59780777",
"0.5968635",
"0.58969223",
"0.5896835",
"0.58573604",
"0.5835133",
"0.5826769",
"0.58171374",
"0.57991683",
"0.5768205",
"0.57654226",
"0.5749538",
"0.5731384",
"0.5728801",
"0.5723446",
"0.571314",
"0.5712051",
"0.57104933",
"0.570956",
"0.57094646",
"0.570879",
"0.5708663",
"0.56740975",
"0.5673455",
"0.5660256",
"0.56601113",
"0.56549597",
"0.5654755",
"0.56474644",
"0.56462604",
"0.56382143",
"0.5634505",
"0.5619048",
"0.56125534",
"0.56117624",
"0.56102866",
"0.5608103",
"0.5592702",
"0.55909246",
"0.5575451",
"0.5571901",
"0.5564363",
"0.5562021",
"0.5552688",
"0.5552624",
"0.5546821",
"0.5544489",
"0.55423087",
"0.5541341",
"0.5537114",
"0.55358",
"0.55186194",
"0.5517452",
"0.5516956",
"0.55152345",
"0.55129343",
"0.5509691",
"0.55061424",
"0.5505115",
"0.5490718",
"0.54798985",
"0.5468739",
"0.5436614",
"0.5427633",
"0.5427633",
"0.54244834",
"0.5422914",
"0.542102",
"0.5415726",
"0.5415223",
"0.54129404",
"0.54093176",
"0.540707",
"0.540342",
"0.54008085",
"0.5398011",
"0.5396074",
"0.5395314",
"0.5393256",
"0.53880966",
"0.53864557",
"0.5385752",
"0.5382804",
"0.5381476",
"0.5380799"
] | 0.6403735 | 5 |
This test when found 1 rubies | def test_mood2
assert_equal @p.mood?([1, 0]), 'sad.'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_rubies_found_positive\n prospector = Rubyist.new(1)\n prospector.rubies_found(2, 2)\n assert prospector.real_ruby_count == 2 && prospector.fake_ruby_count == 2\n end",
"def test_fake_rubies_found\n\t\ttest_main = Main.new(3, 4, 6)\n\t\ttest_graph = Graph.new(10)\n\t\ttest_main.fake_rubies_found(7)\n\t\ttest_main.fake_rubies_found(7)\n\t\tassert test_main.num_fake_rubies, 14\n\tend",
"def test_rubies_found_negative\n prospector = Rubyist.new(1)\n prospector.rubies_found(-2, -2)\n assert prospector.real_ruby_count.zero? && prospector.fake_ruby_count.zero?\n end",
"def test_real_rubies_found\n\t\ttest_main = Main.new(3, 4, 6)\n\t\ttest_graph = Graph.new(10)\n\t\ttest_main.real_rubies_found(7)\n\t\ttest_main.real_rubies_found(7)\n\t\tassert test_main.num_real_rubies, 14\n\tend",
"def test_find_rubies_nonzero\r\n\t\tassert_includes [email protected]_rubies, @t.find_rubies\r\n\tend",
"def test_find_rubies_zero\r\n\t\tassert_equal 0, @t2.find_rubies\r\n\tend",
"def find_rubies\r\n # Add 1 to max_rubies to make maximum inclusive\r\n @random.rand(@max_rubies + 1)\r\n end",
"def test_find_fake_rubies_zero\r\n\t\tassert_equal 0, @t2.find_fake_rubies\r\n\tend",
"def test_display_two\r\n assert_output(\"After 2 days, Rubyist #2 found:\\n\\t2 rubies.\\n\\t2 fake rubies.\\n\") { @g.display_rubies(2, 2, 2, 2) }\r\n end",
"def test_display_one\r\n assert_output(\"After 2 days, Rubyist #1 found:\\n\\t1 ruby.\\n\\t1 fake ruby.\\n\") { @g.display_rubies(1, 1, 1, 2) }\r\n end",
"def test_found_no_rubies\n\t\tp = Print.new\n\t\tassert_output(\"\\tFound no rubies or fake rubies in Town.\\n\") {p.print_day([0,0],'Town')}\n\tend",
"def test_find_fake_rubies_nonzero\r\n\t\tassert_includes [email protected]_fake_rubies, @t.find_fake_rubies\r\n\tend",
"def find_fake_rubies\r\n # Add 1 to max_fake_rubies to make maximum inclusive\r\n @random.rand(@max_fake_rubies + 1)\r\n end",
"def test_two_rubies_test\r\n rubyArr = [2,2]\r\n seed = 10\r\n r = Random.new(seed)\r\n numReturn = mine(rubyArr, r)\r\n if numReturn == 0 || numReturn == 1 || numReturn == 2\r\n assert true\r\n end\r\n end",
"def sample_rubies\n @sample_rubies ||= sample_mri_rubies + %w[ jruby-9.3 ]\n end",
"def test_add_to_rubies\n pros = Prospector.new(0,0,0)\n pros.add_to_rubies([1,1])\n assert pros.real == 1 && pros.fake == 1\n end",
"def test_three_rubies_test\r\n rubyArr = [3,3]\r\n seed = 10\r\n r = Random.new(seed)\r\n numReturn = mine(rubyArr, r)\r\n if numReturn == 0 || numReturn == 1 || numReturn == 2 || numReturn == 3\r\n assert true\r\n end\r\n end",
"def results\n if @rubies_found > 1 && @fake_rubies_found > 1\n puts \"\\tFound #{@rubies_found} rubies and #{@fake_rubies_found} fake rubies in #{@current_city}\"\n elsif @rubies_found == 1 && @fake_rubies_found == 1\n puts \"\\tFound #{@rubies_found} ruby and #{@fake_rubies_found} fake ruby in #{@current_city}\"\n elsif @rubies_found > 1 && @fake_rubies_found == 1\n puts \"\\tFound #{@rubies_found} rubies and #{@fake_rubies_found} fake ruby in #{@current_city}\"\n elsif @rubies_found == 1 && @fake_rubies_found > 1\n puts \"\\tFound #{@rubies_found} ruby and #{@fake_rubies_found} fake rubies in #{@current_city}\"\n elsif @rubies_found > 1 && @fake_rubies_found.zero?\n puts \"\\tFound #{@rubies_found} rubies in #{@current_city}\"\n elsif @rubies_found == 1 && @fake_rubies_found.zero?\n puts \"\\tFound #{@rubies_found} ruby in #{@current_city}\"\n elsif @rubies_found.zero? && @fake_rubies_found > 1\n puts \"\\tFound #{@fake_rubies_found} fake rubies in #{@current_city}\"\n elsif @rubies_found.zero? && @fake_rubies_found == 1\n puts \"\\tFound #{@fake_rubies_found} fake ruby in #{@current_city}\"\n elsif @rubies_found.zero? && @fake_rubies_found.zero?\n puts \"\\tFound no rubies or fake rubies in #{@current_city}\"\n end\n end",
"def test_ruby_count_zeros\n pros = Prospector.new(0,0,0)\n assert pros.ruby_count.eql? \"After 0 days, Rubyist #0 found:\\n\\t0 rubies.\\n\\t0 fake rubies.\\n\"\n end",
"def print_rubies_found(rubies_found, fake_rubies_found, town)\n raise 'Ruby and/or Fake Ruby counts can not be < 0!' if rubies_found < 0 || fake_rubies_found < 0\n\n name = town.name\n if rubies_found.zero? && fake_rubies_found.zero?\n puts \"\\tFound no rubies or fake rubies in #{name}.\"\n elsif rubies_found == 1 && fake_rubies_found.zero?\n puts \"\\tFound 1 ruby in #{name}.\"\n elsif rubies_found.zero? && fake_rubies_found == 1\n puts \"\\tFound 1 fake ruby in #{name}.\"\n elsif rubies_found == 1 && fake_rubies_found == 1\n puts \"\\tFound 1 ruby and 1 fake ruby in #{name}.\"\n elsif rubies_found > 1 && fake_rubies_found.zero?\n puts \"\\tFound #{rubies_found} rubies in #{name}.\"\n elsif rubies_found.zero? && fake_rubies_found > 1\n puts \"\\tFound #{fake_rubies_found} fake rubies in #{name}.\"\n else\n puts \"\\tFound #{rubies_found} rubies and\n #{fake_rubies_found} fake rubies in #{name}.\"\n end\n end",
"def sample_mri_rubies\n @sample_mri_rubies ||= %w[ ruby-3.2 ruby-2.7 ]\n end",
"def test_no_increase\n\t\tm = Miner.new(1)\n\t\tfr = m.fake_rubies\n\t\tr = m.rubies\n\t\tm.increase_rubies(0,0)\n\t\tassert_equal(fr,m.fake_rubies)\n\t\tassert_equal(r,m.rubies)\n\tend",
"def test_bad_rubinius_deps\n check_deps_fail BadRubiniusBall unless `/usr/bin/which rbx`.chomp.empty?\n end",
"def test_json_max_rubies\n load_location_setup\n assert_equal 5, @json_location.max_rubies\n end",
"def supported_rubies\n @supported_rubies ||= supported_mri_rubies + jrubies\n end",
"def rubies\n @parent.list_strings\n end",
"def test_different_increase\n\t\tm = Miner.new(1)\n\t\tfr = m.fake_rubies\n\t\tr = m.rubies\n\t\tm.increase_rubies(1,2)\n\t\tassert_equal(fr+2,m.fake_rubies)\n\t\tassert_equal(r+1,m.rubies)\n\tend",
"def create_rubies\n @rubies = [[1, 1], [2, 2], [1, 1], [0, 3], [3, 0], [2, 2], [2, 2]]\n end",
"def recent_rubies\n @recent_rubies ||= %w[ ruby-3.2 ruby-3.1 jruby-9.3 ]\n end",
"def test_new_location_rubies\n assert_equal 5, @loc1.max_rubies\n end",
"def test_display_negative_rubyist\r\n assert_raises('rubyist_num must be greater than 0!\\n') { @g.display_rubies(1, 1, 0, 2) }\r\n end",
"def test_display_one_day\r\n assert_output(\"After 1 day, Rubyist #1 found:\\n\\t1 ruby.\\n\\t1 fake ruby.\\n\") { @g.display_rubies(1, 1, 1, 1) }\r\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_random_rubies\n loc1 = Location.new(\"location 1\", 10, 1000)\n res = loc1.random_rubies\n assert res >= 0 && res <= 10\n end",
"def test_random_rubies_zero\n loc1 = Location.new(\"location 1\", 0, 100)\n assert_equal 0, loc1.random_rubies\n end",
"def test_display_negative_iterations\r\n assert_raises('rubyist_num must be greater than 0!\\n') { @g.display_rubies(1, 1, 1, 0) }\r\n end",
"def jrubies\n @jrubies ||= %w[ jruby-9.3 jruby-9.2 ]\n end",
"def test_json_max_fake_rubies\n load_location_setup\n assert_equal 10, @json_location.max_fake_rubies\n end",
"def test_ruby_string_big\n pros = Prospector.new(0,0,0)\n assert pros.ruby_string(2).eql? '2 rubies'\n end",
"def testNominalWithSeveralRN\n setupTest do |iTasksFileName, iTicketsFileName|\n $Context[:OS_ExecAnswers] = [\n # svn co => success\n [ 0, '' ],\n # deliver => success, generating files\n [ 0, '', @@Generator_SingleDummyGemWithSeveralRN ]\n ]\n executeProcess(\n [\n '--user', 'ReleaseUser',\n '--branch', 'BranchName',\n '--comment', 'ReleaseComment',\n '--version', '0.0.1.20100317',\n '--tasksfile', iTasksFileName,\n '--ticketsfile', iTicketsFileName,\n '--svnco', 'MySVNRep',\n '--deliver', 'deliver %{DeliverablesDir}'\n ]\n ) do |iError, iSlaveActions|\n checkCallsMatch(\n [\n [ 'query', 'svn co MySVNRep' ],\n [ 'query', /^deliver .*$/ ]\n ],\n $Variables[:OS_Exec]\n )\n assert_equal( @@CommonSlaveActions.merge(\n {\n Tools::FilesManager => {\n Actions::File_Upload => [\n [ WEACE::Master::TransferFile.new(\"#{$Variables[:DeliverableDir]}/Releases/All/Gem/DummyGem.gem\"), 'All', 'Gem', 'BranchName', '0.0.1.20100317', 'ReleaseUser', 'ReleaseComment' ]\n ],\n Actions::File_UploadReleaseNote => [\n [ WEACE::Master::TransferFile.new(\"#{$Variables[:DeliverableDir]}/ReleaseNotes/DummyGemReleaseNote.html\"), 'html', 'BranchName', '0.0.1.20100317', 'ReleaseUser', 'ReleaseComment' ],\n [ WEACE::Master::TransferFile.new(\"#{$Variables[:DeliverableDir]}/ReleaseNotes/DummyGemReleaseNote.txt\"), 'txt', 'BranchName', '0.0.1.20100317', 'ReleaseUser', 'ReleaseComment' ]\n ]\n }\n } ),\n iSlaveActions\n )\n end\n end\n end",
"def older_rubies\n @older_rubies ||= %w[ ruby-3.0 ruby-2.7 ruby-2.6 ruby-2.5 ]\n end",
"def custom_runner?\n Gem::Version.new(MiniTest::Unit::VERSION) >= Gem::Version.new('2.1.0')\n end",
"def init_rubies\n @table = [\n [1, 1], # Enumerable Canyon ==> 0\n [1, 1], # Monkey Patch City ==> 1\n [2, 2], # Duck Type Beach ==> 2\n [3, 0], # Matzburg ==> 3\n [0, 3], # Nil Town ==> 4\n [2, 2], # Hash Crossing ==> 5\n [2, 2] # Dynamic Palisades ==> 6\n ]\n end",
"def test_random_fake_rubies_zero\n loc1 = Location.new(\"location 1\", 100, 0)\n assert_equal 0, loc1.random_fake_rubies\n end",
"def plural_rub(rubies)\r\n ret = if rubies == 1\r\n 'ruby'\r\n elsif rubies < 0 # No logical reason for negative rubies\r\n nil\r\n else\r\n 'rubies'\r\n end\r\n ret\r\n rescue ArgumentError\r\n 'Non-integer argument given'\r\n end",
"def test_new_location_fake_rubies\n assert_equal 10, @loc1.max_fake_rubies\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 ruby_format_print(rubies)\n real_ruby_noun = (rubies[0] > 1 ? 'rubies' : 'ruby')\n fake_ruby_noun = (rubies[1] > 1 ? 'fake rubies' : 'fake ruby')\n pri = ''\n if rubies[0] > 0 && rubies[1] > 0\n pri += \"\\tFound #{rubies[0]} #{real_ruby_noun} and #{rubies[1]} #{fake_ruby_noun} in #{@current_location.name}.\\n\"\n elsif rubies[1].zero?\n pri += \"\\tFound #{rubies[0]} #{real_ruby_noun} in #{@current_location.name}.\\n\"\n else\n pri += \"\\tFound #{rubies[1]} #{fake_ruby_noun} in #{@current_location.name}.\\n\"\n end\n puts pri\n pri\n end",
"def test_select\n\n @dashboard.register { catchall }\n\n @dashboard.launch(Ruote.define do\n concurrence { alpha; bravo; charly }\n end)\n\n while @dashboard.storage_participant.size < 3; end\n\n assert_equal(\n 1,\n @dashboard.storage_participant.select { |wi|\n wi.participant_name == 'bravo'\n }.size)\n end",
"def test_checklist_for_site\n login\n expect = Name.joins(:observations).with_rank(\"Species\").distinct\n\n get(:show)\n assert_match(/Checklist for #{:app_title.l}/, css_select(\"title\").text,\n \"Wrong page\")\n\n prove_checklist_content(expect)\n end",
"def test\n # grab the version of the cookbook in the local metadata\n result = system \"knife cookbook test -o #{File.join(Config.settings['jenkins']['workspace_dir'], 'cookbooks')} #{@cookbook} > /dev/null 2>&1\"\n\n puts 'Running knife cookbook test:'\n puts result ? 'PASS: Knife cookbook test was successful'.indent : 'FAIL: Knife cookbook test was NOT successful'.indent.to_red\n result\n end",
"def testCommandLineVersion\n executeSlave( [ '--version' ] )\n end",
"def test_random_fake_rubies\n loc1 = Location.new(\"location 1\", 1000, 10)\n res = loc1.random_fake_rubies\n assert res >= 0 && res <= 10\n end",
"def test_prospect_search_no_rubies\n \tlocation_stub = Minitest::Mock.new('Mock Location')\n \tpro = Prospector.new(1)\n \tdef location_stub.loc\n \"Laboon Lake\"\n end\n def location_stub.max_rubies\n 0\n end\n def location_stub.max_fake_rubies\n 1\n end\n def location_stub.neighbor_list\n [\"Sean's Bowser Castle\", \"Kitty's Cozy Condo\"]\n end\n pro.change_curr_location(location_stub)\n pro.prospect_search(1)\n assert pro.total_rubies == 0\n end",
"def test_results_negative\r\n assert_raises('Cannot have a negative number of rubies found!') { @g.results(-1) }\r\n end",
"def testBasicBinaryWithRubyInTerminal\n execTest('Applications/Basic', [ '-r' ], 'ReleaseInfo_ExeTerm.rb', :ExpectCalls => [\n [ 'system',\n {\n :Dir => /^.*$/,\n :Cmd => /^exerb\\.bat --version$/\n },\n { :Execute => $RBPTest_ExternalTools ? true : Proc.new { true } }\n ],\n [ 'system',\n {\n :Dir => /^.*\\/Releases\\/#{RUBY_PLATFORM}\\/UnnamedVersion\\/IncludeRuby\\/\\d\\d\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d\\/Release\\/Launch\\/windows\\/bin$/,\n :Cmd => /^allinoneruby\\.bat ruby-#{RUBY_VERSION}\\.exe$/\n },\n { :Execute => $RBPTest_ExternalTools ? true : Proc.new { true } }\n ],\n [ 'system',\n {\n :Dir => /^.*\\/Releases\\/#{RUBY_PLATFORM}\\/UnnamedVersion\\/IncludeRuby\\/\\d\\d\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d\\/Release$/,\n :Cmd => /^exerb\\.bat -o ExeName.exe .*\\/EXE_windows_Gen\\.rb$/\n },\n { :Execute => $RBPTest_ExternalTools ? true : Proc.new { true } }\n ],\n [ 'system',\n {\n :Dir => /^.*$/,\n :Cmd => /^.*\\/edicon\\.exe .*\\/Releases\\/#{RUBY_PLATFORM}\\/UnnamedVersion\\/IncludeRuby\\/\\d\\d\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d\\/Release\\/ExeName.exe .*\\/Icon\\.ico$/\n },\n { :Execute => $RBPTest_ExternalTools ? true : Proc.new {\n FileUtils::touch \"#{Dir.glob(\"Releases/#{RUBY_PLATFORM}/*/*/*\")[0]}/Release/ExeName.exe\"\n true\n } }\n ]\n ]) do |iReleaseDir, iReleaseInfo|\n checkReleaseInfo(iReleaseDir, iReleaseInfo)\n checkReleaseNotes(iReleaseDir, iReleaseInfo)\n lExeFileName = \"#{iReleaseDir}/Release/ExeName.exe\"\n assert(File.exists?(lExeFileName))\n # Unless the Executable file can contain other rb files (please Crate come faster !), files are still present.\n assert(File.exists?(\"#{iReleaseDir}/Release/Main.rb\"))\n if $RBPTest_ExternalTools\n # Test it in Ruby's environment\n assert_equal(\"#{getRubySignature}\nRuby found in environment. Using it directly.\n> ruby -w \\\"#{iReleaseDir}/Release/Main.rb\\\" \\nHello World\\n\", runExe(lExeFileName))\n # TODO: Test it without Ruby's environment\n end\n end\n end",
"def hunt_rubies\n i = 0\n while i < @num_turns\n @rubies_found = 0\n @fake_rubies_found = 0\n\n # Search the current city for any rubies.\n search_city\n # Once you don't find any rubies, display your results.\n results\n # Verify that you didn't find any rubies this time.\n check_next_city\n\n # Head to the next city.\n if @next_city\n @next_city = false\n # Decide where you want to go\n travel\n puts \"Heading from #{@prev_city} to #{@current_city}\"\n i += 1\n end\n end\n end",
"def testNominalWithRN\n setupTest do |iTasksFileName, iTicketsFileName|\n $Context[:OS_ExecAnswers] = [\n # svn co => success\n [ 0, '' ],\n # deliver => success, generating files\n [ 0, '', @@Generator_SingleDummyGemWithRN ]\n ]\n executeProcess(\n [\n '--user', 'ReleaseUser',\n '--branch', 'BranchName',\n '--comment', 'ReleaseComment',\n '--version', '0.0.1.20100317',\n '--tasksfile', iTasksFileName,\n '--ticketsfile', iTicketsFileName,\n '--svnco', 'MySVNRep',\n '--deliver', 'deliver %{DeliverablesDir}'\n ]\n ) do |iError, iSlaveActions|\n checkCallsMatch(\n [\n [ 'query', 'svn co MySVNRep' ],\n [ 'query', /^deliver .*$/ ]\n ],\n $Variables[:OS_Exec]\n )\n assert_equal( @@CommonSlaveActions.merge(\n {\n Tools::FilesManager => {\n Actions::File_Upload => [\n [ WEACE::Master::TransferFile.new(\"#{$Variables[:DeliverableDir]}/Releases/All/Gem/DummyGem.gem\"), 'All', 'Gem', 'BranchName', '0.0.1.20100317', 'ReleaseUser', 'ReleaseComment' ]\n ],\n Actions::File_UploadReleaseNote => [\n [ WEACE::Master::TransferFile.new(\"#{$Variables[:DeliverableDir]}/ReleaseNotes/DummyGemReleaseNote.html\"), 'html', 'BranchName', '0.0.1.20100317', 'ReleaseUser', 'ReleaseComment' ]\n ]\n }\n } ),\n iSlaveActions\n )\n end\n end\n end",
"def test_Browser_001_is_browser_installed()\n\n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_Browser_001_is_browser_installed\")\n puts2(\"#######################\")\n\n puts2(\"\\n\\nTest - is_chrome64_installed?()\")\n puts2(\"is_chrome64_installed? = \" + is_chrome64_installed?().to_s)\n\n puts2(\"\\n\\nTest - is_firefox64_installed?()\")\n puts2(\"is_firefox64_installed? = \" + is_firefox64_installed?().to_s)\n\n end",
"def chef_installed?\n cmd_if %{rvm use #{ruby} >/dev/null && gem list --no-versions | grep -q \"^chef$\" >/dev/null}, true\nend",
"def test_display_invalid_fake\r\n assert_raises('total_fake rubies must be an integer!') { @g.display_rubies(1, 'a', 1, 2) }\r\n end",
"def search_for_rubies(loc)\n curr_city = loc.to_i\n loop do\n @total_days += 1\n real_ruby = 0\n fake_ruby = 0\n real_ruby = @rng.rand(@table[curr_city][0]) if @table[curr_city][0] > 0\n fake_ruby = @rng.rand(@table[curr_city][1]) if @table[curr_city][1] > 0\n puts \" Found #{real_ruby} real ruby and #{fake_ruby} fake ruby in #{@map[curr_city][0]}\" if real_ruby == 1 && fake_ruby == 1\n puts \" Found #{real_ruby} real rubies and #{fake_ruby} fake ruby in #{@map[curr_city][0]}\" if real_ruby > 1 && fake_ruby == 1\n puts \" Found #{real_ruby} real ruby and #{fake_ruby} fake rubies in #{@map[curr_city][0]}\" if real_ruby == 1 && fake_ruby > 1\n puts \" Found #{real_ruby} real rubies and #{fake_ruby} fake rubies in #{@map[curr_city][0]}\" if real_ruby > 1 && fake_ruby > 1\n puts \" Found #{real_ruby} real ruby in #{@map[curr_city][0]}\" if real_ruby == 1 && fake_ruby == 0\n puts \" Found #{real_ruby} real rubies in #{@map[curr_city][0]}\" if real_ruby > 1 && fake_ruby == 0\n puts \" Found #{fake_ruby} fake ruby in #{@map[curr_city][0]}\" if real_ruby == 0 && fake_ruby == 1\n puts \" Found #{fake_ruby} fake rubies in #{@map[curr_city][0]}\" if real_ruby == 0 && fake_ruby > 1\n @total_real_rubies += real_ruby\n @total_fake_rubies += fake_ruby\n puts \" Found no rubies or fake rubies in #{@map[curr_city][0]}\" if real_ruby == 0 && fake_ruby == 0\n break if real_ruby == 0 && fake_ruby == 0\n end\n end",
"def test_vers_class_run_variant\n assert_equal 0, run_with_args(%w(-v))\n assert_match(/Ruby BlackBag version #{Rbkb::VERSION}/, @stdout_io.string)\n end",
"def test_ut_da10b_t1_16\n p \"Test 16\"\n pu =Pu.new( :name => \"SamplePU3\" )\n # gets a list of pjs belong to selected pu\n pjs = pu.get_pjs_belong_to_pu\n assert_equal [], pjs\n end",
"def testSlaveProductWithoutAsArg\n executeInstall(['--install', 'SlaveProduct', '--product', 'DummyProduct', '--as'],\n :Repository => 'Dummy/SlaveClientInstalled',\n :AddRegressionSlaveAdapters => true,\n :Error => OptionParser::MissingArgument\n ) do |iError|\n assert_equal(nil, $Variables[:ComponentInstall])\n end\n end",
"def verify_im_installed?(installed_directory)\n step \"Verify IBM Installation Manager is installed into directory: #{installed_directory}\"\n step 'Verify 1/3: IBM Installation Manager Launcher'\n fail_test \"Launcher has not been found in: #{installed_directory}/eclipse\" if agent.file_exist?(\"#{installed_directory}/eclipse/launcher\") == false\n\n step 'Verify 2/3: IBM Installation Manager License File'\n fail_test \"License file has not been found in: #{installed_directory}/license\" if agent.file_exist?(\"#{installed_directory}/license/es/license.txt\") == false\n\n step 'Verify 3/3: IBM Installation Manager Version'\n fail_test \"Version has not been found in: #{installed_directory}/properties/version\" if agent.file_exist?(\"#{installed_directory}/properties/version/IBM_Installation_Manager.*\") == false\nend",
"def test_show_rush_result\n assert_output(\"After 2 days, Rubyist 1 found:\n 10 rubies.\n 10 fake rubies.\nGoing home victorious!\\n\"){ @p.show_rush_result(2, 1, [10, 10]) }\n end",
"def test_results_invalid\r\n assert_raises('rubies_found must be an integer!') { @g.results('a') }\r\n end",
"def testSlaveProductWithoutAs\n executeInstall(['--install', 'SlaveProduct', '--product', 'DummyProduct'],\n :Repository => 'Dummy/SlaveClientInstalled',\n :AddRegressionSlaveAdapters => true,\n :Error => WEACEInstall::CommandLineError\n ) do |iError|\n assert_equal(nil, $Variables[:ComponentInstall])\n end\n end",
"def testSlaveProductWithoutProductArg\n executeInstall(['--install', 'SlaveProduct', '--as', 'RegProduct', '--product'],\n :Repository => 'Dummy/SlaveClientInstalled',\n :AddRegressionSlaveAdapters => true,\n :Error => OptionParser::MissingArgument\n ) do |iError|\n assert_equal(nil, $Variables[:ComponentInstall])\n end\n end",
"def pods_test\n pod 'Quick'\n pod 'Nimble'\nend",
"def test_harness_dependencies(*)\n return unless platform[/n(5|6)k/]\n skip_if_nv_overlay_rejected(agent)\n\n # Vxlan has a hard requirement to disable feature fabricpath on n5/6k\n cmd = 'no feature-set fabricpath'\n command_config(agent, cmd, cmd)\nend",
"def prospect(town, prng)\n raise 'Valid Pseudo-Random Number Generator must be passed in!' unless prng.is_a?(Random)\n\n # Existence of at least 1 of either type is implicit\n rubies_possible = town.rubies # Will throw NoMethodError if not Town\n fake_rubies_possible = town.fake_rubies\n\n # Mine for rubies\n rubies_found = prng.rand(rubies_possible + 1)\n fake_rubies_found = prng.rand(fake_rubies_possible + 1)\n\n # Return found rubies in an array\n rubies = Array[rubies_found, fake_rubies_found]\n rubies\n end",
"def testBasicBinaryInTerminal\n execTest('Applications/Basic', [], 'ReleaseInfo_ExeTerm.rb', :ExpectCalls => [\n [ 'system',\n {\n :Dir => /^.*$/,\n :Cmd => /^exerb\\.bat --version$/\n },\n { :Execute => $RBPTest_ExternalTools ? true : Proc.new { true } }\n ],\n [ 'system',\n {\n :Dir => /^.*\\/Releases\\/#{RUBY_PLATFORM}\\/UnnamedVersion\\/Normal\\/\\d\\d\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d\\/Release$/,\n :Cmd => /^exerb\\.bat -o ExeName.exe .*\\/EXE_windows_Gen\\.rb$/\n },\n { :Execute => $RBPTest_ExternalTools ? true : Proc.new { true } }\n ],\n [ 'system',\n {\n :Dir => /^.*$/,\n :Cmd => /^.*\\/edicon\\.exe .*\\/Releases\\/#{RUBY_PLATFORM}\\/UnnamedVersion\\/Normal\\/\\d\\d\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d\\/Release\\/ExeName.exe .*\\/Icon\\.ico$/\n },\n { :Execute => $RBPTest_ExternalTools ? true : Proc.new {\n FileUtils::touch \"#{Dir.glob(\"Releases/#{RUBY_PLATFORM}/*/*/*\")[0]}/Release/ExeName.exe\"\n true\n } }\n ]\n ]) do |iReleaseDir, iReleaseInfo|\n checkReleaseInfo(iReleaseDir, iReleaseInfo)\n checkReleaseNotes(iReleaseDir, iReleaseInfo)\n lExeFileName = \"#{iReleaseDir}/Release/ExeName.exe\"\n assert(File.exists?(lExeFileName))\n # Unless the Executable file can contain other rb files (please Crate come faster !), files are still present.\n assert(File.exists?(\"#{iReleaseDir}/Release/Main.rb\"))\n if $RBPTest_ExternalTools\n # Test it in Ruby's environment\n assert_equal(\"#{getRubySignature}\nRuby found in environment. Using it directly.\n> ruby -w \\\"#{iReleaseDir}/Release/Main.rb\\\" \\nHello World\\n\", runExe(lExeFileName))\n # TODO: Test it without Ruby's environment\n end\n end\n end",
"def choose_club\n require \"tty-prompt\"\n prompt = TTY::Prompt.new\n\n puts \"\\n \\n\"\n\n prompt.select(\"For which club?\", filter: true) do |menu|\n all_clubs.each do |club|\n menu.choice club.name\n end\n end\nend",
"def testSlaveProductWithoutProduct\n executeInstall(['--install', 'SlaveProduct', '--as', 'RegProduct'],\n :Repository => 'Dummy/SlaveClientInstalled',\n :AddRegressionSlaveAdapters => true,\n :Error => WEACEInstall::CommandLineError\n ) do |iError|\n assert_equal(nil, $Variables[:ComponentInstall])\n end\n end",
"def testRun2ActionsSameToolDifferentProducts\n executeSlave(\n [\n '--user', 'DummyUser',\n '--tool', 'DummyTool4',\n '--action', 'DummyAction4'\n ],\n :AddRegressionActions => true,\n :Repository => 'Dummy/AllDummyActionsAvailable'\n ) do |iError|\n assert_equal('DummyUser', $Variables[:DummyAction4_User])\n assert_equal(true, $Variables[:DummyAction4_DummyProduct])\n assert_equal(true, $Variables[:DummyAction4_DummyProduct2])\n end\n end",
"def test_bad_rubinius_deps\n check_deps_fail \"notapackage\" => :rbx if which('rbx')\n end",
"def test_bad_rubinius_deps\n check_deps_fail \"notapackage\" => :rbx if which('rbx')\n end",
"def test_checklist_for_species_list\n login\n list = species_lists(:one_genus_three_species_list)\n expect = Name.joins(observations: :species_list_observations).\n where({ species_list_observations: { species_list_id: list.id } }).\n with_rank(\"Species\").distinct\n\n get(:show, params: { species_list_id: list.id })\n assert_match(/Checklist for #{list.title}/, css_select(\"title\").text,\n \"Wrong page\")\n\n prove_checklist_content(expect)\n end",
"def testNominal\n executeProcess(\n [\n '--masterticket', '123',\n '--slaveticket', '456'\n ]\n ) do |iError, iSlaveActions|\n assert_equal(\n {\n Tools::TicketTracker => {\n Actions::Ticket_RejectDuplicate => [\n [ '123', '456' ]\n ]\n }\n },\n iSlaveActions\n )\n end\n end",
"def testNominalWithSeveralPlatforms\n setupTest do |iTasksFileName, iTicketsFileName|\n $Context[:OS_ExecAnswers] = [\n # svn co => success\n [ 0, '' ],\n # deliver => success, generating files\n [ 0, '', @@Generator_DummyGemAndWindows ]\n ]\n executeProcess(\n [\n '--user', 'ReleaseUser',\n '--branch', 'BranchName',\n '--comment', 'ReleaseComment',\n '--version', '0.0.1.20100317',\n '--tasksfile', iTasksFileName,\n '--ticketsfile', iTicketsFileName,\n '--svnco', 'MySVNRep',\n '--deliver', 'deliver %{DeliverablesDir}'\n ]\n ) do |iError, iSlaveActions|\n checkCallsMatch(\n [\n [ 'query', 'svn co MySVNRep' ],\n [ 'query', /^deliver .*$/ ]\n ],\n $Variables[:OS_Exec]\n )\n assert_equal( @@CommonSlaveActions.merge(\n {\n Tools::FilesManager => {\n Actions::File_Upload => [\n [ WEACE::Master::TransferFile.new(\"#{$Variables[:DeliverableDir]}/Releases/All/Gem/DummyGem.gem\"), 'All', 'Gem', 'BranchName', '0.0.1.20100317', 'ReleaseUser', 'ReleaseComment' ],\n [ WEACE::Master::TransferFile.new(\"#{$Variables[:DeliverableDir]}/Releases/Windows/Inst/Install.exe\"), 'Windows', 'Inst', 'BranchName', '0.0.1.20100317', 'ReleaseUser', 'ReleaseComment' ]\n ]\n }\n } ),\n iSlaveActions\n )\n end\n end\n end",
"def test_one_ruby_test\r\n rubyArr = [1,1]\r\n seed = 10\r\n r = Random.new(seed)\r\n numReturn = mine(rubyArr, r)\r\n if numReturn == 0 || numReturn == 1\r\n assert true\r\n end\r\n end",
"def testNominalWithSeveralTypes\n setupTest do |iTasksFileName, iTicketsFileName|\n $Context[:OS_ExecAnswers] = [\n # svn co => success\n [ 0, '' ],\n # deliver => success, generating files\n [ 0, '', @@Generator_DummyGemAndOther ]\n ]\n executeProcess(\n [\n '--user', 'ReleaseUser',\n '--branch', 'BranchName',\n '--comment', 'ReleaseComment',\n '--version', '0.0.1.20100317',\n '--tasksfile', iTasksFileName,\n '--ticketsfile', iTicketsFileName,\n '--svnco', 'MySVNRep',\n '--deliver', 'deliver %{DeliverablesDir}'\n ]\n ) do |iError, iSlaveActions|\n checkCallsMatch(\n [\n [ 'query', 'svn co MySVNRep' ],\n [ 'query', /^deliver .*$/ ]\n ],\n $Variables[:OS_Exec]\n )\n assert_equal( @@CommonSlaveActions.merge(\n {\n Tools::FilesManager => {\n Actions::File_Upload => [\n [ WEACE::Master::TransferFile.new(\"#{$Variables[:DeliverableDir]}/Releases/All/Gem/DummyGem.gem\"), 'All', 'Gem', 'BranchName', '0.0.1.20100317', 'ReleaseUser', 'ReleaseComment' ],\n [ WEACE::Master::TransferFile.new(\"#{$Variables[:DeliverableDir]}/Releases/All/Other/DummyOtherFile\"), 'All', 'Other', 'BranchName', '0.0.1.20100317', 'ReleaseUser', 'ReleaseComment' ]\n ]\n }\n } ),\n iSlaveActions\n )\n end\n end\n end",
"def test_recipe_within_recipe\n @fdb = setup\n idk = Recipe.new(\"Double PB&J\", [@fdb.get_recipe(\"PB&J Sandwich\"), @fdb.get_recipe(\"PB&J Sandwich\")])\n \n bool = @fdb.add_recipe(\"Double PB&J\", [\"PB&J Sandwich\", \"PB&J Sandwich\"])\n assert(bool == true, \"whoops fuck you\")\n end",
"def rspec?; ::ENV['TEST_RUNNER'].present?; end",
"def test_products()\n assert_equal(1, @manufacturer1.products.length())\n end",
"def testMissingSlave\n executeProcess(\n [\n '--masterticket', '123'\n ],\n :Error => WEACE::MissingVariableError\n )\n end",
"def test_truth\n april = riders(:rider_1)\n assert_equal \"April Jones\", april.name\n trigger = horses(:horse_1)\n assert_equal \"Trigger\", trigger.name\n event2 = events(:event_2)\n assert_equal \"5 Horse Scramble\", event2.name\n \n end",
"def testMissingMaster\n executeProcess(\n [\n '--slaveticket', '456'\n ],\n :Error => WEACE::MissingVariableError\n )\n end",
"def index\n @rubies = Ruby.all\n end",
"def judge\n puts \"Unleashing storms of judgement...\"\n cuke_dir = Pathname.new(Settings[:test_dir]).parent\n Dir.chdir(cuke_dir.to_s)\n tests_passed = system 'bundle exec cucumber'\n if tests_passed.nil? or not tests_passed\n puts \"Error running tests...\"\n exit 1\n else\n puts \"All tests passed! Clouds clearing...\"\n end\nend",
"def rvm_installed?\n cmd_test %{-s \"/usr/local/lib/rvm\"}\nend",
"def test_print_items_classes_when_driver_starts_at_cathedral\r\n\t\tmock_argv = [16526]\r\n\t\tARGV.replace(mock_argv)\r\n\t\trequire_relative 'city_sim_9006'\r\n\t\tprng = Random.new((ARGV[0]))\r\n\t\toakland = City::new\r\n\t\tgame = CitySim::new\r\n\t\tall_drivers = [d1 = Driver.new(1)]\r\n\t\tnum_starting_locs = oakland.all_locations.length\r\n\t\tnum_options = 2\r\n\t\tall_items = stfu do game.run_sim(all_drivers, oakland, prng, num_starting_locs, num_options) end\r\n\t\tassert_equal all_items[0].num_classes, 2\r\n\tend",
"def test_display_invalid_ruby\r\n assert_raises('rubyist_num must be an integer!') { @g.display_rubies(1, 1, 'a', 2) }\r\n end",
"def test_version_from_fixtures\n protocol_version=protocol_versions(:my_first_protocol_v1)\n assert_equal 1,protocol_version.version\n assert_equal users(:owner_of_my_first_protocol),protocol_version.contributor\n assert_equal content_blobs(:content_blob_with_little_file),protocol_version.content_blob\n\n protocol=protocols(:my_first_protocol)\n assert_equal protocol.id,protocol_version.protocol_id\n\n assert_equal 1,protocol.version\n assert_equal protocol.title,protocol.versions.first.title\n\n end",
"def test_display_invalid_real\r\n assert_raises('total_rubies must be an integer!') { @g.display_rubies('a', 1, 1, 2) }\r\n end",
"def testBasicBinaryWithRubyInTerminal\n execTest('Applications/Basic', [ '-r' ], 'ReleaseInfo_ExeTerm.rb', :ExpectCalls => [\n [ 'system',\n {\n :Dir => /^.*\\/Releases\\/#{RUBY_PLATFORM}\\/UnnamedVersion\\/IncludeRuby\\/\\d\\d\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d\\/Release\\/Launch\\/linux\\/bin$/,\n :Cmd => /^allinoneruby ruby\\-#{RUBY_VERSION}\\.bin$/\n },\n { :Execute => $RBPTest_ExternalTools ? true : Proc.new { true } }\n ]\n ]) do |iReleaseDir, iReleaseInfo|\n checkReleaseInfo(iReleaseDir, iReleaseInfo)\n checkReleaseNotes(iReleaseDir, iReleaseInfo)\n lExeFileName = \"#{iReleaseDir}/Release/ExeName\"\n assert(File.exists?(lExeFileName))\n # Unless the Executable file can contain other rb files (please Crate come faster !), files are still present.\n assert(File.exists?(\"#{iReleaseDir}/Release/Main.rb\"))\n # Test it in Ruby's environment\n assert_equal(\"Ruby found on current platform. Use it directly.\nHello World\\n\", runExe(lExeFileName))\n # TODO: Test it without Ruby's environment\n end\n end",
"def test_display_negative_real\r\n assert_raises(\"total_rubies must be a number greater than or equal to 0.\\n\") { @g.display_rubies(-1, 1, 1, 2) }\r\n end",
"def supported_mri_rubies\n @supported_mri_rubies ||= %w[\n ruby-3.2 ruby-3.1 ruby-3.0\n ruby-2.7 ruby-2.6 ruby-2.5\n ]\n end",
"def test_fake_string_big\n pros = Prospector.new(0,0,0)\n assert pros.fake_string(2).eql? '2 fake rubies'\n end"
] | [
"0.68268263",
"0.6563489",
"0.64960057",
"0.63847125",
"0.63142204",
"0.63050383",
"0.6188883",
"0.6137769",
"0.60396993",
"0.60160804",
"0.59812915",
"0.5976445",
"0.5967973",
"0.59442544",
"0.59298074",
"0.58944863",
"0.5887532",
"0.57994473",
"0.5781634",
"0.5744973",
"0.5735654",
"0.5633937",
"0.5569944",
"0.54845065",
"0.54623574",
"0.5434184",
"0.5406201",
"0.5401793",
"0.53743875",
"0.53720146",
"0.53272104",
"0.5323512",
"0.53156567",
"0.5311005",
"0.53003824",
"0.527569",
"0.52602446",
"0.5191704",
"0.51330906",
"0.51328695",
"0.51254725",
"0.51180935",
"0.5117261",
"0.51084864",
"0.5093304",
"0.5081178",
"0.5077362",
"0.5072256",
"0.5070846",
"0.5068763",
"0.5030223",
"0.50206095",
"0.5011735",
"0.49970073",
"0.49849948",
"0.49797985",
"0.4968835",
"0.4945538",
"0.49438152",
"0.4941316",
"0.49301454",
"0.49215746",
"0.49068463",
"0.4904868",
"0.48977605",
"0.48880896",
"0.48844278",
"0.48724905",
"0.48703364",
"0.4868351",
"0.4857048",
"0.48501754",
"0.4836641",
"0.48319784",
"0.48287565",
"0.48277408",
"0.4820331",
"0.48197037",
"0.48197037",
"0.48186457",
"0.48159686",
"0.481376",
"0.48110217",
"0.48079726",
"0.48059353",
"0.48041284",
"0.47946337",
"0.47902024",
"0.47826263",
"0.47797295",
"0.4778826",
"0.47746453",
"0.47700256",
"0.47666016",
"0.47614858",
"0.47599158",
"0.47566265",
"0.47470576",
"0.47423115",
"0.4736676",
"0.47353753"
] | 0.0 | -1 |
This test when found 5 rubies | def test_mood3
assert_equal @p.mood?([5, 0]), 'sad.'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_rubies_found_positive\n prospector = Rubyist.new(1)\n prospector.rubies_found(2, 2)\n assert prospector.real_ruby_count == 2 && prospector.fake_ruby_count == 2\n end",
"def sample_rubies\n @sample_rubies ||= sample_mri_rubies + %w[ jruby-9.3 ]\n end",
"def sample_mri_rubies\n @sample_mri_rubies ||= %w[ ruby-3.2 ruby-2.7 ]\n end",
"def supported_rubies\n @supported_rubies ||= supported_mri_rubies + jrubies\n end",
"def test_fake_rubies_found\n\t\ttest_main = Main.new(3, 4, 6)\n\t\ttest_graph = Graph.new(10)\n\t\ttest_main.fake_rubies_found(7)\n\t\ttest_main.fake_rubies_found(7)\n\t\tassert test_main.num_fake_rubies, 14\n\tend",
"def older_rubies\n @older_rubies ||= %w[ ruby-3.0 ruby-2.7 ruby-2.6 ruby-2.5 ]\n end",
"def test_rubies_found_negative\n prospector = Rubyist.new(1)\n prospector.rubies_found(-2, -2)\n assert prospector.real_ruby_count.zero? && prospector.fake_ruby_count.zero?\n end",
"def test_harness_dependencies(*)\n return unless platform[/n(5|6)k/]\n skip_if_nv_overlay_rejected(agent)\n\n # Vxlan has a hard requirement to disable feature fabricpath on n5/6k\n cmd = 'no feature-set fabricpath'\n command_config(agent, cmd, cmd)\nend",
"def test_three_rubies_test\r\n rubyArr = [3,3]\r\n seed = 10\r\n r = Random.new(seed)\r\n numReturn = mine(rubyArr, r)\r\n if numReturn == 0 || numReturn == 1 || numReturn == 2 || numReturn == 3\r\n assert true\r\n end\r\n end",
"def test_bad_rubinius_deps\n check_deps_fail BadRubiniusBall unless `/usr/bin/which rbx`.chomp.empty?\n end",
"def recent_rubies\n @recent_rubies ||= %w[ ruby-3.2 ruby-3.1 jruby-9.3 ]\n end",
"def find_rubies\r\n # Add 1 to max_rubies to make maximum inclusive\r\n @random.rand(@max_rubies + 1)\r\n end",
"def test_real_rubies_found\n\t\ttest_main = Main.new(3, 4, 6)\n\t\ttest_graph = Graph.new(10)\n\t\ttest_main.real_rubies_found(7)\n\t\ttest_main.real_rubies_found(7)\n\t\tassert test_main.num_real_rubies, 14\n\tend",
"def test_json_max_rubies\n load_location_setup\n assert_equal 5, @json_location.max_rubies\n end",
"def find_fake_rubies\r\n # Add 1 to max_fake_rubies to make maximum inclusive\r\n @random.rand(@max_fake_rubies + 1)\r\n end",
"def supported_mri_rubies\n @supported_mri_rubies ||= %w[\n ruby-3.2 ruby-3.1 ruby-3.0\n ruby-2.7 ruby-2.6 ruby-2.5\n ]\n end",
"def test_two_rubies_test\r\n rubyArr = [2,2]\r\n seed = 10\r\n r = Random.new(seed)\r\n numReturn = mine(rubyArr, r)\r\n if numReturn == 0 || numReturn == 1 || numReturn == 2\r\n assert true\r\n end\r\n end",
"def test_ruby_string_big\n pros = Prospector.new(0,0,0)\n assert pros.ruby_string(2).eql? '2 rubies'\n end",
"def test_find_rubies_nonzero\r\n\t\tassert_includes [email protected]_rubies, @t.find_rubies\r\n\tend",
"def jrubies\n @jrubies ||= %w[ jruby-9.3 jruby-9.2 ]\n end",
"def test_display_two\r\n assert_output(\"After 2 days, Rubyist #2 found:\\n\\t2 rubies.\\n\\t2 fake rubies.\\n\") { @g.display_rubies(2, 2, 2, 2) }\r\n end",
"def test_add_to_rubies\n pros = Prospector.new(0,0,0)\n pros.add_to_rubies([1,1])\n assert pros.real == 1 && pros.fake == 1\n end",
"def test_find_fake_rubies_nonzero\r\n\t\tassert_includes [email protected]_fake_rubies, @t.find_fake_rubies\r\n\tend",
"def test_new_location_rubies\n assert_equal 5, @loc1.max_rubies\n end",
"def testCommandLineVersion\n executeSlave( [ '--version' ] )\n end",
"def test_ruby_count_zeros\n pros = Prospector.new(0,0,0)\n assert pros.ruby_count.eql? \"After 0 days, Rubyist #0 found:\\n\\t0 rubies.\\n\\t0 fake rubies.\\n\"\n end",
"def rhel5x?\n major_version = node['platform_version'].split('.').first.to_i\n platform_family?('rhel') && major_version < 6\n end",
"def rhel5x?\n major_version = node['platform_version'].split('.').first.to_i\n platform_family?('rhel') && major_version < 6\n end",
"def test_find_rubies_zero\r\n\t\tassert_equal 0, @t2.find_rubies\r\n\tend",
"def test_find_fake_rubies_zero\r\n\t\tassert_equal 0, @t2.find_fake_rubies\r\n\tend",
"def test_display_one\r\n assert_output(\"After 2 days, Rubyist #1 found:\\n\\t1 ruby.\\n\\t1 fake ruby.\\n\") { @g.display_rubies(1, 1, 1, 2) }\r\n end",
"def test_json_max_fake_rubies\n load_location_setup\n assert_equal 10, @json_location.max_fake_rubies\n end",
"def testNominalWithSeveralRN\n setupTest do |iTasksFileName, iTicketsFileName|\n $Context[:OS_ExecAnswers] = [\n # svn co => success\n [ 0, '' ],\n # deliver => success, generating files\n [ 0, '', @@Generator_SingleDummyGemWithSeveralRN ]\n ]\n executeProcess(\n [\n '--user', 'ReleaseUser',\n '--branch', 'BranchName',\n '--comment', 'ReleaseComment',\n '--version', '0.0.1.20100317',\n '--tasksfile', iTasksFileName,\n '--ticketsfile', iTicketsFileName,\n '--svnco', 'MySVNRep',\n '--deliver', 'deliver %{DeliverablesDir}'\n ]\n ) do |iError, iSlaveActions|\n checkCallsMatch(\n [\n [ 'query', 'svn co MySVNRep' ],\n [ 'query', /^deliver .*$/ ]\n ],\n $Variables[:OS_Exec]\n )\n assert_equal( @@CommonSlaveActions.merge(\n {\n Tools::FilesManager => {\n Actions::File_Upload => [\n [ WEACE::Master::TransferFile.new(\"#{$Variables[:DeliverableDir]}/Releases/All/Gem/DummyGem.gem\"), 'All', 'Gem', 'BranchName', '0.0.1.20100317', 'ReleaseUser', 'ReleaseComment' ]\n ],\n Actions::File_UploadReleaseNote => [\n [ WEACE::Master::TransferFile.new(\"#{$Variables[:DeliverableDir]}/ReleaseNotes/DummyGemReleaseNote.html\"), 'html', 'BranchName', '0.0.1.20100317', 'ReleaseUser', 'ReleaseComment' ],\n [ WEACE::Master::TransferFile.new(\"#{$Variables[:DeliverableDir]}/ReleaseNotes/DummyGemReleaseNote.txt\"), 'txt', 'BranchName', '0.0.1.20100317', 'ReleaseUser', 'ReleaseComment' ]\n ]\n }\n } ),\n iSlaveActions\n )\n end\n end\n end",
"def test_vers_class_run_variant\n assert_equal 0, run_with_args(%w(-v))\n assert_match(/Ruby BlackBag version #{Rbkb::VERSION}/, @stdout_io.string)\n end",
"def test_platforms\n {\n 'suse' => %w( 12.2 )\n }.each do |platform, versions|\n versions.each do |version|\n yield(platform, version)\n end\n end\nend",
"def custom_runner?\n Gem::Version.new(MiniTest::Unit::VERSION) >= Gem::Version.new('2.1.0')\n end",
"def test_version\n assert_match(/^Ocra \\d+(\\.\\d)+$/, `ruby #{ocra} --version`)\n end",
"def testNominalWithSeveralPlatforms\n setupTest do |iTasksFileName, iTicketsFileName|\n $Context[:OS_ExecAnswers] = [\n # svn co => success\n [ 0, '' ],\n # deliver => success, generating files\n [ 0, '', @@Generator_DummyGemAndWindows ]\n ]\n executeProcess(\n [\n '--user', 'ReleaseUser',\n '--branch', 'BranchName',\n '--comment', 'ReleaseComment',\n '--version', '0.0.1.20100317',\n '--tasksfile', iTasksFileName,\n '--ticketsfile', iTicketsFileName,\n '--svnco', 'MySVNRep',\n '--deliver', 'deliver %{DeliverablesDir}'\n ]\n ) do |iError, iSlaveActions|\n checkCallsMatch(\n [\n [ 'query', 'svn co MySVNRep' ],\n [ 'query', /^deliver .*$/ ]\n ],\n $Variables[:OS_Exec]\n )\n assert_equal( @@CommonSlaveActions.merge(\n {\n Tools::FilesManager => {\n Actions::File_Upload => [\n [ WEACE::Master::TransferFile.new(\"#{$Variables[:DeliverableDir]}/Releases/All/Gem/DummyGem.gem\"), 'All', 'Gem', 'BranchName', '0.0.1.20100317', 'ReleaseUser', 'ReleaseComment' ],\n [ WEACE::Master::TransferFile.new(\"#{$Variables[:DeliverableDir]}/Releases/Windows/Inst/Install.exe\"), 'Windows', 'Inst', 'BranchName', '0.0.1.20100317', 'ReleaseUser', 'ReleaseComment' ]\n ]\n }\n } ),\n iSlaveActions\n )\n end\n end\n end",
"def test_random_rubies\n loc1 = Location.new(\"location 1\", 10, 1000)\n res = loc1.random_rubies\n assert res >= 0 && res <= 10\n end",
"def test_Browser_001_is_browser_installed()\n\n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_Browser_001_is_browser_installed\")\n puts2(\"#######################\")\n\n puts2(\"\\n\\nTest - is_chrome64_installed?()\")\n puts2(\"is_chrome64_installed? = \" + is_chrome64_installed?().to_s)\n\n puts2(\"\\n\\nTest - is_firefox64_installed?()\")\n puts2(\"is_firefox64_installed? = \" + is_firefox64_installed?().to_s)\n\n end",
"def detect_cpu_cores_nix\n # On Unix platforms trying to use etc module to determine accessible\n # number of cores\n require 'etc'\n Etc.nprocessors\n end",
"def test_found_no_rubies\n\t\tp = Print.new\n\t\tassert_output(\"\\tFound no rubies or fake rubies in Town.\\n\") {p.print_day([0,0],'Town')}\n\tend",
"def test_version\n assert Snarl.version >= '1.1'\n end",
"def test_platform_uses_unknown_if_uname_fails\n NewRelic::Helper.stubs('run_command').with('uname -s').raises(NewRelic::CommandRunFailedError)\n NewRelic::Agent::Samplers::MemorySampler.stub_const(:RUBY_PLATFORM, 'java') do\n platform = NewRelic::Agent::Samplers::MemorySampler.platform\n\n assert_equal 'unknown', platform\n end\n end",
"def platform(name)\n case ENV['PLATFORM']\n when 'windows_10_edge'\n {selenium_version: '3.141.59',\n platform_name: 'Windows 10',\n browser_name: 'edge',\n browser_version: '18.17763'}.merge(sauce_w3c(name))\n when 'windows_8_ie'\n # Note: w3c is not working for Windows 8 & IE 11\n {platform: 'Windows 8.1',\n browser_name: 'ie',\n selenium_version: '3.141.59',\n version: '11.0'}.merge(sauce_oss(name))\n when 'mac_sierra_chrome'\n # This is for running with w3c which is not yet the default\n # {platform_name: 'macOS 10.12',\n # browser_name: 'chrome',\n # \"goog:chromeOptions\": {w3c: true},\n # browser_version: '65.0'}.merge(sauce_w3c name)\n {selenium_version: '3.141.59',\n platform: 'macOS 10.12',\n browser_name: 'chrome',\n version: '65.0'}.merge(sauce_oss(name))\n when 'mac_mojave_safari'\n {platform_name: 'macOS 10.14',\n browser_name: 'safari',\n browser_version: '12.0'}.merge(sauce_w3c(name))\n when 'windows_7_ff'\n {platform_name: 'Windows 7',\n browser_name: 'firefox',\n browser_version: '60.0'}.merge(sauce_w3c(name))\n else\n # Always specify a default\n {selenium_version: '3.141.59',\n platform: 'macOS 10.12',\n browser_name: 'chrome',\n version: '65.0'}.merge(sauce_oss(name))\n end\n end",
"def testBasicBinaryWithRubyInTerminal\n execTest('Applications/Basic', [ '-r' ], 'ReleaseInfo_ExeTerm.rb', :ExpectCalls => [\n [ 'system',\n {\n :Dir => /^.*$/,\n :Cmd => /^exerb\\.bat --version$/\n },\n { :Execute => $RBPTest_ExternalTools ? true : Proc.new { true } }\n ],\n [ 'system',\n {\n :Dir => /^.*\\/Releases\\/#{RUBY_PLATFORM}\\/UnnamedVersion\\/IncludeRuby\\/\\d\\d\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d\\/Release\\/Launch\\/windows\\/bin$/,\n :Cmd => /^allinoneruby\\.bat ruby-#{RUBY_VERSION}\\.exe$/\n },\n { :Execute => $RBPTest_ExternalTools ? true : Proc.new { true } }\n ],\n [ 'system',\n {\n :Dir => /^.*\\/Releases\\/#{RUBY_PLATFORM}\\/UnnamedVersion\\/IncludeRuby\\/\\d\\d\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d\\/Release$/,\n :Cmd => /^exerb\\.bat -o ExeName.exe .*\\/EXE_windows_Gen\\.rb$/\n },\n { :Execute => $RBPTest_ExternalTools ? true : Proc.new { true } }\n ],\n [ 'system',\n {\n :Dir => /^.*$/,\n :Cmd => /^.*\\/edicon\\.exe .*\\/Releases\\/#{RUBY_PLATFORM}\\/UnnamedVersion\\/IncludeRuby\\/\\d\\d\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d\\/Release\\/ExeName.exe .*\\/Icon\\.ico$/\n },\n { :Execute => $RBPTest_ExternalTools ? true : Proc.new {\n FileUtils::touch \"#{Dir.glob(\"Releases/#{RUBY_PLATFORM}/*/*/*\")[0]}/Release/ExeName.exe\"\n true\n } }\n ]\n ]) do |iReleaseDir, iReleaseInfo|\n checkReleaseInfo(iReleaseDir, iReleaseInfo)\n checkReleaseNotes(iReleaseDir, iReleaseInfo)\n lExeFileName = \"#{iReleaseDir}/Release/ExeName.exe\"\n assert(File.exists?(lExeFileName))\n # Unless the Executable file can contain other rb files (please Crate come faster !), files are still present.\n assert(File.exists?(\"#{iReleaseDir}/Release/Main.rb\"))\n if $RBPTest_ExternalTools\n # Test it in Ruby's environment\n assert_equal(\"#{getRubySignature}\nRuby found in environment. Using it directly.\n> ruby -w \\\"#{iReleaseDir}/Release/Main.rb\\\" \\nHello World\\n\", runExe(lExeFileName))\n # TODO: Test it without Ruby's environment\n end\n end\n end",
"def test_fake_string_big\n pros = Prospector.new(0,0,0)\n assert pros.fake_string(2).eql? '2 fake rubies'\n end",
"def test_bad_rubinius_deps\n check_deps_fail \"notapackage\" => :rbx if which('rbx')\n end",
"def test_bad_rubinius_deps\n check_deps_fail \"notapackage\" => :rbx if which('rbx')\n end",
"def test_new_location_fake_rubies\n assert_equal 10, @loc1.max_fake_rubies\n end",
"def test_Enviroment_002_isPlatform\r\n\r\n puts2(\"\")\r\n puts2(\"#######################\")\r\n puts2(\"Testcase: test_Enviroment_002_isPlatform\")\r\n puts2(\"#######################\")\r\n\r\n puts2(\"Running Ruby for Windows: \" + is_win?.to_s)\r\n puts2(\"Running Ruby for Windows 32-bit: \" + is_win32?.to_s)\r\n puts2(\"Running Ruby for Windows 64 bit: \" + is_win64?.to_s)\r\n puts2(\"Running Ruby for Linux: \" + is_linux?.to_s)\r\n puts2(\"Running Ruby for OS/X: \" + is_osx?.to_s)\r\n puts2(\"Running on JRuby: \" + is_java?.to_s)\r\n\r\n end",
"def testNominalWithRN\n setupTest do |iTasksFileName, iTicketsFileName|\n $Context[:OS_ExecAnswers] = [\n # svn co => success\n [ 0, '' ],\n # deliver => success, generating files\n [ 0, '', @@Generator_SingleDummyGemWithRN ]\n ]\n executeProcess(\n [\n '--user', 'ReleaseUser',\n '--branch', 'BranchName',\n '--comment', 'ReleaseComment',\n '--version', '0.0.1.20100317',\n '--tasksfile', iTasksFileName,\n '--ticketsfile', iTicketsFileName,\n '--svnco', 'MySVNRep',\n '--deliver', 'deliver %{DeliverablesDir}'\n ]\n ) do |iError, iSlaveActions|\n checkCallsMatch(\n [\n [ 'query', 'svn co MySVNRep' ],\n [ 'query', /^deliver .*$/ ]\n ],\n $Variables[:OS_Exec]\n )\n assert_equal( @@CommonSlaveActions.merge(\n {\n Tools::FilesManager => {\n Actions::File_Upload => [\n [ WEACE::Master::TransferFile.new(\"#{$Variables[:DeliverableDir]}/Releases/All/Gem/DummyGem.gem\"), 'All', 'Gem', 'BranchName', '0.0.1.20100317', 'ReleaseUser', 'ReleaseComment' ]\n ],\n Actions::File_UploadReleaseNote => [\n [ WEACE::Master::TransferFile.new(\"#{$Variables[:DeliverableDir]}/ReleaseNotes/DummyGemReleaseNote.html\"), 'html', 'BranchName', '0.0.1.20100317', 'ReleaseUser', 'ReleaseComment' ]\n ]\n }\n } ),\n iSlaveActions\n )\n end\n end\n end",
"def test_platform_uses_uname_for_jruby\n stubbed = 'MCP'\n NewRelic::Helper.stubs('run_command').with('uname -s').returns(stubbed)\n NewRelic::Agent::Samplers::MemorySampler.stub_const(:RUBY_PLATFORM, 'java') do\n platform = NewRelic::Agent::Samplers::MemorySampler.platform\n\n assert_equal platform, stubbed.downcase\n end\n end",
"def testCommandLineVersionShort\n executeSlave( [ '-v' ] )\n end",
"def test_hardware_cpu_type\n assert [:intel, :ppc].include?(Hardware.cpu_type)\n end",
"def test_random_fake_rubies\n loc1 = Location.new(\"location 1\", 1000, 10)\n res = loc1.random_fake_rubies\n assert res >= 0 && res <= 10\n end",
"def test_different_increase\n\t\tm = Miner.new(1)\n\t\tfr = m.fake_rubies\n\t\tr = m.rubies\n\t\tm.increase_rubies(1,2)\n\t\tassert_equal(fr+2,m.fake_rubies)\n\t\tassert_equal(r+1,m.rubies)\n\tend",
"def test_versions\n tidy = TidyExe.new\n assert_not_nil(tidy.version, 'version returned nil.')\n assert_not_nil(tidy.version_major, 'version_major returned nil.')\n assert_not_nil(tidy.version_minor, 'version_minor returned nil.')\n assert_not_nil(tidy.version_patch, 'version_patch returned nil.')\n assert_not_nil(tidy.version_plain, 'version_plain returned nil.')\n end",
"def test_current_browsers_detected\n for browser in CURRENT_BROWSERS\n @request.user_agent = browser\n assert ! @page.legacy_browser?\n end\n end",
"def distro_ruby_versions\n case distribution_class\n when :ubuntu\n if is_distribution?(\"<= artful\")\n [\"2.3\"]\n elsif is_distribution?(\"<= eoan\")\n [\"2.5\"]\n elsif is_distribution?(\"<= impish\")\n [\"2.7\"]\n elsif is_distribution?(\"<= kinetic\")\n [\"3.0\"]\n else\n [\"3.1\"]\n end\n when :debian\n if is_distribution?(\"<= jessie\")\n [\"2.1\"]\n elsif is_distribution?(\"<= stretch\")\n [\"2.3\"]\n elsif is_distribution?(\"<= buster\")\n [\"2.5\"]\n elsif is_distribution?(\"<= bullseye\")\n [\"2.7\"]\n else\n [\"3.1\"]\n end\n else\n raise \"Unknown distribution class\"\n end\nend",
"def test_that_it_has_a_version_number\n refute_nil ::Malody::VERSION\n end",
"def testBasicBinaryInTerminal\n execTest('Applications/Basic', [], 'ReleaseInfo_ExeTerm.rb', :ExpectCalls => [\n [ 'system',\n {\n :Dir => /^.*$/,\n :Cmd => /^exerb\\.bat --version$/\n },\n { :Execute => $RBPTest_ExternalTools ? true : Proc.new { true } }\n ],\n [ 'system',\n {\n :Dir => /^.*\\/Releases\\/#{RUBY_PLATFORM}\\/UnnamedVersion\\/Normal\\/\\d\\d\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d\\/Release$/,\n :Cmd => /^exerb\\.bat -o ExeName.exe .*\\/EXE_windows_Gen\\.rb$/\n },\n { :Execute => $RBPTest_ExternalTools ? true : Proc.new { true } }\n ],\n [ 'system',\n {\n :Dir => /^.*$/,\n :Cmd => /^.*\\/edicon\\.exe .*\\/Releases\\/#{RUBY_PLATFORM}\\/UnnamedVersion\\/Normal\\/\\d\\d\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d\\/Release\\/ExeName.exe .*\\/Icon\\.ico$/\n },\n { :Execute => $RBPTest_ExternalTools ? true : Proc.new {\n FileUtils::touch \"#{Dir.glob(\"Releases/#{RUBY_PLATFORM}/*/*/*\")[0]}/Release/ExeName.exe\"\n true\n } }\n ]\n ]) do |iReleaseDir, iReleaseInfo|\n checkReleaseInfo(iReleaseDir, iReleaseInfo)\n checkReleaseNotes(iReleaseDir, iReleaseInfo)\n lExeFileName = \"#{iReleaseDir}/Release/ExeName.exe\"\n assert(File.exists?(lExeFileName))\n # Unless the Executable file can contain other rb files (please Crate come faster !), files are still present.\n assert(File.exists?(\"#{iReleaseDir}/Release/Main.rb\"))\n if $RBPTest_ExternalTools\n # Test it in Ruby's environment\n assert_equal(\"#{getRubySignature}\nRuby found in environment. Using it directly.\n> ruby -w \\\"#{iReleaseDir}/Release/Main.rb\\\" \\nHello World\\n\", runExe(lExeFileName))\n # TODO: Test it without Ruby's environment\n end\n end\n end",
"def test_rubygems_to_standard_inequality_comparison\n assert_operator(::Versionomy.parse('1.2.3', :rubygems), :<, ::Versionomy.parse('1.2.4'))\n assert_operator(::Versionomy.parse('1.2.b.3', :rubygems), :>, ::Versionomy.parse('1.2b2'))\n assert_operator(::Versionomy.parse('1.2', :rubygems), :>, ::Versionomy.parse('1.2b1'))\n end",
"def target_ruby_version\n @target ||= begin\n target = config['AllCops'] && config['AllCops']['TargetRubyVersion']\n\n if !target || !RuboCop::Config::KNOWN_RUBIES.include?(target)\n fail ValidationError, \"Unknown Ruby version #{target.inspect} found \" \\\n 'in `TargetRubyVersion` parameter (in ' \\\n \"#{loaded_path}).\\nKnown versions: \" \\\n \"#{RuboCop::Config::KNOWN_RUBIES.join(', ')}\"\n end\n\n target\n end\n end",
"def testBasicBinaryWithRubyInTerminal\n execTest('Applications/Basic', [ '-r' ], 'ReleaseInfo_ExeTerm.rb', :ExpectCalls => [\n [ 'system',\n {\n :Dir => /^.*\\/Releases\\/#{RUBY_PLATFORM}\\/UnnamedVersion\\/IncludeRuby\\/\\d\\d\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d\\/Release\\/Launch\\/linux\\/bin$/,\n :Cmd => /^allinoneruby ruby\\-#{RUBY_VERSION}\\.bin$/\n },\n { :Execute => $RBPTest_ExternalTools ? true : Proc.new { true } }\n ]\n ]) do |iReleaseDir, iReleaseInfo|\n checkReleaseInfo(iReleaseDir, iReleaseInfo)\n checkReleaseNotes(iReleaseDir, iReleaseInfo)\n lExeFileName = \"#{iReleaseDir}/Release/ExeName\"\n assert(File.exists?(lExeFileName))\n # Unless the Executable file can contain other rb files (please Crate come faster !), files are still present.\n assert(File.exists?(\"#{iReleaseDir}/Release/Main.rb\"))\n # Test it in Ruby's environment\n assert_equal(\"Ruby found on current platform. Use it directly.\nHello World\\n\", runExe(lExeFileName))\n # TODO: Test it without Ruby's environment\n end\n end",
"def rackspace_cloudbackup_test_platforms\n return {\n ubuntu: %w(12.04),\n debian: %w(7.2), # Requires Fauxhai chicanery as https://github.com/customink/fauxhai/pull/60\n # hasn't made its way to RubyGems yet.\n centos: %w(6.4 6.5)\n }\nend",
"def test_display_one_day\r\n assert_output(\"After 1 day, Rubyist #1 found:\\n\\t1 ruby.\\n\\t1 fake ruby.\\n\") { @g.display_rubies(1, 1, 1, 1) }\r\n end",
"def test_standard_to_rubygems_inequality_comparison\n assert_operator(::Versionomy.parse('1.2.4'), :>, ::Versionomy.parse('1.2.3', :rubygems))\n assert_operator(::Versionomy.parse('1.2b2'), :<, ::Versionomy.parse('1.2.beta.3', :rubygems))\n assert_operator(::Versionomy.parse('1.2b2'), :<, ::Versionomy.parse('1.2', :rubygems))\n end",
"def test_location_max_ruby\n assert_equal @l1.max_ruby, [10, 10] # pass\n end",
"def test_no_increase\n\t\tm = Miner.new(1)\n\t\tfr = m.fake_rubies\n\t\tr = m.rubies\n\t\tm.increase_rubies(0,0)\n\t\tassert_equal(fr,m.fake_rubies)\n\t\tassert_equal(r,m.rubies)\n\tend",
"def test_framework?\n NewRelic::Agent.config[:framework] == :test\n end",
"def test_display_negative_rubyist\r\n assert_raises('rubyist_num must be greater than 0!\\n') { @g.display_rubies(1, 1, 0, 2) }\r\n end",
"def testBasicBinary\n execTest('Applications/Basic', [], 'ReleaseInfo_Exe.rb', :ExpectCalls => [\n [ 'system',\n {\n :Dir => /^.*$/,\n :Cmd => /^exerb\\.bat --version$/\n },\n { :Execute => $RBPTest_ExternalTools ? true : Proc.new { true } }\n ],\n [ 'system',\n {\n :Dir => /^.*\\/Releases\\/#{RUBY_PLATFORM}\\/UnnamedVersion\\/Normal\\/\\d\\d\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d\\/Release$/,\n :Cmd => /^exerb\\.bat -o ExeName.exe .*\\/EXE_windows_Gen\\.rb$/\n },\n { :Execute => $RBPTest_ExternalTools ? true : Proc.new { true } }\n ],\n [ 'system',\n {\n :Dir => /^.*$/,\n :Cmd => /^.*\\/edicon\\.exe .*\\/Releases\\/#{RUBY_PLATFORM}\\/UnnamedVersion\\/Normal\\/\\d\\d\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d\\/Release\\/ExeName.exe .*\\/Icon\\.ico$/\n },\n { :Execute => $RBPTest_ExternalTools ? true : Proc.new {\n FileUtils::touch \"#{Dir.glob(\"Releases/#{RUBY_PLATFORM}/*/*/*\")[0]}/Release/ExeName.exe\"\n true\n } }\n ]\n ]) do |iReleaseDir, iReleaseInfo|\n checkReleaseInfo(iReleaseDir, iReleaseInfo)\n checkReleaseNotes(iReleaseDir, iReleaseInfo)\n lExeFileName = \"#{iReleaseDir}/Release/ExeName.exe\"\n assert(File.exists?(lExeFileName))\n # Unless the Executable file can contain other rb files (please Crate come faster !), files are still present.\n assert(File.exists?(\"#{iReleaseDir}/Release/Main.rb\"))\n if $RBPTest_ExternalTools\n # Test it in Ruby's environment\n assert_equal(\"#{getRubySignature}\nRuby found in environment. Using it directly.\n> start rubyw -w \\\"#{iReleaseDir}/Release/Main.rb\\\" \\n\", runExe(lExeFileName))\n # TODO: Test it without Ruby's environment\n end\n end\n end",
"def testBasicBinaryWithRuby\n execTest('Applications/Basic', [ '-r' ], 'ReleaseInfo_Exe.rb', :ExpectCalls => [\n [ 'system',\n {\n :Dir => /^.*$/,\n :Cmd => /^exerb\\.bat --version$/\n },\n { :Execute => $RBPTest_ExternalTools ? true : Proc.new { true } }\n ],\n [ 'system',\n {\n :Dir => /^.*\\/Releases\\/#{RUBY_PLATFORM}\\/UnnamedVersion\\/IncludeRuby\\/\\d\\d\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d\\/Release\\/Launch\\/windows\\/bin$/,\n :Cmd => /^allinoneruby\\.bat --rubyw rubyw-#{RUBY_VERSION}\\.exe$/\n },\n { :Execute => $RBPTest_ExternalTools ? true : Proc.new { true } }\n ],\n [ 'system',\n {\n :Dir => /^.*\\/Releases\\/#{RUBY_PLATFORM}\\/UnnamedVersion\\/IncludeRuby\\/\\d\\d\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d\\/Release$/,\n :Cmd => /^exerb\\.bat -o ExeName.exe .*\\/EXE_windows_Gen\\.rb$/\n },\n { :Execute => $RBPTest_ExternalTools ? true : Proc.new { true } }\n ],\n [ 'system',\n {\n :Dir => /^.*$/,\n :Cmd => /^.*\\/edicon\\.exe .*\\/Releases\\/#{RUBY_PLATFORM}\\/UnnamedVersion\\/IncludeRuby\\/\\d\\d\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d\\/Release\\/ExeName.exe .*\\/Icon\\.ico$/\n },\n { :Execute => $RBPTest_ExternalTools ? true : Proc.new {\n FileUtils::touch \"#{Dir.glob(\"Releases/#{RUBY_PLATFORM}/*/*/*\")[0]}/Release/ExeName.exe\"\n true\n } }\n ]\n ]) do |iReleaseDir, iReleaseInfo|\n checkReleaseInfo(iReleaseDir, iReleaseInfo)\n checkReleaseNotes(iReleaseDir, iReleaseInfo)\n lExeFileName = \"#{iReleaseDir}/Release/ExeName.exe\"\n assert(File.exists?(lExeFileName))\n # Unless the Executable file can contain other rb files (please Crate come faster !), files are still present.\n assert(File.exists?(\"#{iReleaseDir}/Release/Main.rb\"))\n if $RBPTest_ExternalTools\n # Test it in Ruby's environment\n assert_equal(\"#{getRubySignature}\nRuby found in environment. Using it directly.\n> start rubyw -w \\\"#{iReleaseDir}/Release/Main.rb\\\" \\n\", runExe(lExeFileName))\n # TODO: Test it without Ruby's environment\n end\n end\n end",
"def test_platform_uses_ruby_platform\n stubbed = 'ENCOM OS-12'\n NewRelic::Agent::Samplers::MemorySampler.stub_const(:RUBY_PLATFORM, stubbed) do\n platform = NewRelic::Agent::Samplers::MemorySampler.platform\n\n assert_equal platform, stubbed.downcase\n end\n end",
"def is_yum_platform\n node[:platform_family] == \"rhel\"\nend",
"def test_provided_example\n assert_equal \"tknk\", @system.base.name\n end",
"def test_on_current_browsers\n for current_browser in CURRENT_BROWSERS\n @request.user_agent = current_browser\n get :index\n assert_response :success\n assert_select 'img[src*=painless_test.png]'\n end\n end",
"def ruby_version; '2.6.3' end",
"def test_framework_runtimes\n find_duplicates :frameworks\n end",
"def test_random_rubies_zero\n loc1 = Location.new(\"location 1\", 0, 100)\n assert_equal 0, loc1.random_rubies\n end",
"def testNominalWithSeveralTypes\n setupTest do |iTasksFileName, iTicketsFileName|\n $Context[:OS_ExecAnswers] = [\n # svn co => success\n [ 0, '' ],\n # deliver => success, generating files\n [ 0, '', @@Generator_DummyGemAndOther ]\n ]\n executeProcess(\n [\n '--user', 'ReleaseUser',\n '--branch', 'BranchName',\n '--comment', 'ReleaseComment',\n '--version', '0.0.1.20100317',\n '--tasksfile', iTasksFileName,\n '--ticketsfile', iTicketsFileName,\n '--svnco', 'MySVNRep',\n '--deliver', 'deliver %{DeliverablesDir}'\n ]\n ) do |iError, iSlaveActions|\n checkCallsMatch(\n [\n [ 'query', 'svn co MySVNRep' ],\n [ 'query', /^deliver .*$/ ]\n ],\n $Variables[:OS_Exec]\n )\n assert_equal( @@CommonSlaveActions.merge(\n {\n Tools::FilesManager => {\n Actions::File_Upload => [\n [ WEACE::Master::TransferFile.new(\"#{$Variables[:DeliverableDir]}/Releases/All/Gem/DummyGem.gem\"), 'All', 'Gem', 'BranchName', '0.0.1.20100317', 'ReleaseUser', 'ReleaseComment' ],\n [ WEACE::Master::TransferFile.new(\"#{$Variables[:DeliverableDir]}/Releases/All/Other/DummyOtherFile\"), 'All', 'Other', 'BranchName', '0.0.1.20100317', 'ReleaseUser', 'ReleaseComment' ]\n ]\n }\n } ),\n iSlaveActions\n )\n end\n end\n end",
"def required_ruby_version\n spec.required_ruby_version\n end",
"def test_vers_go_set_variant\n assert_equal 0, go_set_args(%w(-v))\n assert_match(/Ruby BlackBag version #{Rbkb::VERSION}/, @stdout_io.string)\n end",
"def only_test_os\n if ENV.key?('ONLY_OS')\n ENV['ONLY_OS'].split(',')\n end\nend",
"def fails_on_jruby\n before do\n unless SpecConfig.instance.mri?\n skip \"Fails on jruby\"\n end\n end\n end",
"def fails_on_jruby\n before do\n unless SpecConfig.instance.mri?\n skip \"Fails on jruby\"\n end\n end\n end",
"def create_rubies\n @rubies = [[1, 1], [2, 2], [1, 1], [0, 3], [3, 0], [2, 2], [2, 2]]\n end",
"def test_legacy_browser_detected\n for browser in LEGACY_BROWSERS\n @request.user_agent = browser\n assert @page.legacy_browser?\n end\n end",
"def print_rubies_found(rubies_found, fake_rubies_found, town)\n raise 'Ruby and/or Fake Ruby counts can not be < 0!' if rubies_found < 0 || fake_rubies_found < 0\n\n name = town.name\n if rubies_found.zero? && fake_rubies_found.zero?\n puts \"\\tFound no rubies or fake rubies in #{name}.\"\n elsif rubies_found == 1 && fake_rubies_found.zero?\n puts \"\\tFound 1 ruby in #{name}.\"\n elsif rubies_found.zero? && fake_rubies_found == 1\n puts \"\\tFound 1 fake ruby in #{name}.\"\n elsif rubies_found == 1 && fake_rubies_found == 1\n puts \"\\tFound 1 ruby and 1 fake ruby in #{name}.\"\n elsif rubies_found > 1 && fake_rubies_found.zero?\n puts \"\\tFound #{rubies_found} rubies in #{name}.\"\n elsif rubies_found.zero? && fake_rubies_found > 1\n puts \"\\tFound #{fake_rubies_found} fake rubies in #{name}.\"\n else\n puts \"\\tFound #{rubies_found} rubies and\n #{fake_rubies_found} fake rubies in #{name}.\"\n end\n end",
"def rhel6x?\n major_version = node['platform_version'].split('.').first.to_i\n platform_family?('rhel') && major_version >= 6 && major_version < 7\n end",
"def common_pods_for_test\n pod 'Quick', '2.1.0'\n pod 'Nimble', '8.0.1'\nend",
"def test_frameworks; end",
"def version_specified_gem?(node); end",
"def test_bad_jruby_deps\n check_deps_fail BadJRubyBall unless `/usr/bin/which jruby`.chomp.empty?\n end",
"def test_random_fake_rubies_zero\n loc1 = Location.new(\"location 1\", 100, 0)\n assert_equal 0, loc1.random_fake_rubies\n end",
"def pods_test\n pod 'Quick'\n pod 'Nimble'\nend",
"def restrictive_version_specified_gem?(node); end",
"def has_required_xcode_version?\n # TODO: bring in from build_runner\n rand(10) > 3 # 1 in 3 chance of failure\n end",
"def contents_detected?\n !is_openatrium? && installed_version.major < 7 if super\n end",
"def numvcpus\n begin\n os_cpu_cores\n rescue\n 4\n end\nend"
] | [
"0.65690386",
"0.64885926",
"0.64375806",
"0.62965983",
"0.6247658",
"0.6206247",
"0.6169475",
"0.61245495",
"0.60010076",
"0.5994164",
"0.5965378",
"0.5949765",
"0.59384394",
"0.592935",
"0.5929066",
"0.5915587",
"0.5893615",
"0.5855466",
"0.58351475",
"0.5807437",
"0.5726146",
"0.57195014",
"0.5683261",
"0.5663222",
"0.5650104",
"0.5639854",
"0.56121206",
"0.56121206",
"0.5596881",
"0.5593954",
"0.55920255",
"0.55730146",
"0.5526097",
"0.5512576",
"0.55107933",
"0.54528016",
"0.5422472",
"0.5415198",
"0.5406644",
"0.53925836",
"0.538419",
"0.53624815",
"0.53521395",
"0.53353614",
"0.53319436",
"0.5310404",
"0.5301296",
"0.52861995",
"0.52861995",
"0.5285661",
"0.52743566",
"0.5268487",
"0.52656996",
"0.5245904",
"0.52342546",
"0.5219188",
"0.52166927",
"0.5213811",
"0.5206244",
"0.5192664",
"0.51797634",
"0.51679164",
"0.51580614",
"0.5148129",
"0.5141971",
"0.5141676",
"0.51410764",
"0.51346827",
"0.5130595",
"0.5126449",
"0.51253104",
"0.51170766",
"0.5114945",
"0.51092345",
"0.5101645",
"0.5089606",
"0.5084441",
"0.50821936",
"0.50808847",
"0.5077877",
"0.5076716",
"0.5076367",
"0.5064037",
"0.5059133",
"0.5056512",
"0.50547403",
"0.50547403",
"0.50545144",
"0.50514185",
"0.50491273",
"0.5043434",
"0.5041358",
"0.5040617",
"0.50292456",
"0.50244325",
"0.50151676",
"0.5008124",
"0.5003502",
"0.4996288",
"0.49954212",
"0.49876636"
] | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.