repo
stringlengths
5
58
path
stringlengths
9
168
func_name
stringlengths
9
130
original_string
stringlengths
66
10.5k
language
stringclasses
1 value
code
stringlengths
66
10.5k
code_tokens
list
docstring
stringlengths
8
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
94
266
partition
stringclasses
1 value
Azure/azure-sdk-for-ruby
management/azure_mgmt_sql/lib/2017-10-01-preview/generated/azure_mgmt_sql/managed_instance_keys.rb
Azure::SQL::Mgmt::V2017_10_01_preview.ManagedInstanceKeys.begin_delete_with_http_info
def begin_delete_with_http_info(resource_group_name, managed_instance_name, key_name, custom_headers:nil) begin_delete_async(resource_group_name, managed_instance_name, key_name, custom_headers:custom_headers).value! end
ruby
def begin_delete_with_http_info(resource_group_name, managed_instance_name, key_name, custom_headers:nil) begin_delete_async(resource_group_name, managed_instance_name, key_name, custom_headers:custom_headers).value! end
[ "def", "begin_delete_with_http_info", "(", "resource_group_name", ",", "managed_instance_name", ",", "key_name", ",", "custom_headers", ":", "nil", ")", "begin_delete_async", "(", "resource_group_name", ",", "managed_instance_name", ",", "key_name", ",", "custom_headers", ":", "custom_headers", ")", ".", "value!", "end" ]
Deletes the managed instance key with the given name. @param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param managed_instance_name [String] The name of the managed instance. @param key_name [String] The name of the managed instance key to be deleted. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request. @return [MsRestAzure::AzureOperationResponse] HTTP response information.
[ "Deletes", "the", "managed", "instance", "key", "with", "the", "given", "name", "." ]
78eedacf8f8cbd65c2d8a2af421405eaa4373d8e
https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2017-10-01-preview/generated/azure_mgmt_sql/managed_instance_keys.rb#L493-L495
train
Azure/azure-sdk-for-ruby
management/azure_mgmt_monitor/lib/2018-06-01-preview/generated/azure_mgmt_monitor/guest_diagnostics_settings.rb
Azure::Monitor::Mgmt::V2018_06_01_preview.GuestDiagnosticsSettings.update_with_http_info
def update_with_http_info(resource_group_name, diagnostic_settings_name, parameters, custom_headers:nil) update_async(resource_group_name, diagnostic_settings_name, parameters, custom_headers:custom_headers).value! end
ruby
def update_with_http_info(resource_group_name, diagnostic_settings_name, parameters, custom_headers:nil) update_async(resource_group_name, diagnostic_settings_name, parameters, custom_headers:custom_headers).value! end
[ "def", "update_with_http_info", "(", "resource_group_name", ",", "diagnostic_settings_name", ",", "parameters", ",", "custom_headers", ":", "nil", ")", "update_async", "(", "resource_group_name", ",", "diagnostic_settings_name", ",", "parameters", ",", "custom_headers", ":", "custom_headers", ")", ".", "value!", "end" ]
Updates guest diagnostics settings. @param resource_group_name [String] The name of the resource group. @param diagnostic_settings_name [String] The name of the diagnostic setting. @param parameters [GuestDiagnosticSettingsPatchResource] The configuration to patch. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request. @return [MsRestAzure::AzureOperationResponse] HTTP response information.
[ "Updates", "guest", "diagnostics", "settings", "." ]
78eedacf8f8cbd65c2d8a2af421405eaa4373d8e
https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_monitor/lib/2018-06-01-preview/generated/azure_mgmt_monitor/guest_diagnostics_settings.rb#L261-L263
train
Azure/azure-sdk-for-ruby
management/azure_mgmt_monitor/lib/2018-06-01-preview/generated/azure_mgmt_monitor/guest_diagnostics_settings.rb
Azure::Monitor::Mgmt::V2018_06_01_preview.GuestDiagnosticsSettings.delete
def delete(resource_group_name, diagnostic_settings_name, custom_headers:nil) response = delete_async(resource_group_name, diagnostic_settings_name, custom_headers:custom_headers).value! nil end
ruby
def delete(resource_group_name, diagnostic_settings_name, custom_headers:nil) response = delete_async(resource_group_name, diagnostic_settings_name, custom_headers:custom_headers).value! nil end
[ "def", "delete", "(", "resource_group_name", ",", "diagnostic_settings_name", ",", "custom_headers", ":", "nil", ")", "response", "=", "delete_async", "(", "resource_group_name", ",", "diagnostic_settings_name", ",", "custom_headers", ":", "custom_headers", ")", ".", "value!", "nil", "end" ]
Delete guest diagnostics settings. @param resource_group_name [String] The name of the resource group. @param diagnostic_settings_name [String] The name of the diagnostic setting. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
[ "Delete", "guest", "diagnostics", "settings", "." ]
78eedacf8f8cbd65c2d8a2af421405eaa4373d8e
https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_monitor/lib/2018-06-01-preview/generated/azure_mgmt_monitor/guest_diagnostics_settings.rb#L357-L360
train
Azure/azure-sdk-for-ruby
runtime/ms_rest/lib/ms_rest/http_operation_error.rb
MsRest.HttpOperationError.to_json
def to_json(*a) res_dict = response ? { body: response.body, headers: response.headers, status: response.status } : nil {message: @msg, request: request, response: res_dict}.to_json(*a) end
ruby
def to_json(*a) res_dict = response ? { body: response.body, headers: response.headers, status: response.status } : nil {message: @msg, request: request, response: res_dict}.to_json(*a) end
[ "def", "to_json", "(", "*", "a", ")", "res_dict", "=", "response", "?", "{", "body", ":", "response", ".", "body", ",", "headers", ":", "response", ".", "headers", ",", "status", ":", "response", ".", "status", "}", ":", "nil", "{", "message", ":", "@msg", ",", "request", ":", "request", ",", "response", ":", "res_dict", "}", ".", "to_json", "(", "*", "a", ")", "end" ]
Creates and initialize new instance of the HttpOperationException class. @param [Hash] the HTTP request data (uri, body, headers). @param [Faraday::Response] the HTTP response object. @param [String] body the HTTP response body. @param [String] error message.
[ "Creates", "and", "initialize", "new", "instance", "of", "the", "HttpOperationException", "class", "." ]
78eedacf8f8cbd65c2d8a2af421405eaa4373d8e
https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/runtime/ms_rest/lib/ms_rest/http_operation_error.rb#L58-L61
train
Azure/azure-sdk-for-ruby
management/azure_mgmt_mixedreality/lib/2019-02-28-preview/generated/azure_mgmt_mixedreality/mixed_reality_client.rb
Azure::MixedReality::Mgmt::V2019_02_28_preview.MixedRealityClient.check_name_availability_local
def check_name_availability_local(location, check_name_availability, custom_headers:nil) response = check_name_availability_local_async(location, check_name_availability, custom_headers:custom_headers).value! response.body unless response.nil? end
ruby
def check_name_availability_local(location, check_name_availability, custom_headers:nil) response = check_name_availability_local_async(location, check_name_availability, custom_headers:custom_headers).value! response.body unless response.nil? end
[ "def", "check_name_availability_local", "(", "location", ",", "check_name_availability", ",", "custom_headers", ":", "nil", ")", "response", "=", "check_name_availability_local_async", "(", "location", ",", "check_name_availability", ",", "custom_headers", ":", "custom_headers", ")", ".", "value!", "response", ".", "body", "unless", "response", ".", "nil?", "end" ]
Check Name Availability for global uniqueness @param location [String] The location in which uniqueness will be verified. @param check_name_availability [CheckNameAvailabilityRequest] Check Name Availability Request. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request. @return [CheckNameAvailabilityResponse] operation results.
[ "Check", "Name", "Availability", "for", "global", "uniqueness" ]
78eedacf8f8cbd65c2d8a2af421405eaa4373d8e
https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_mixedreality/lib/2019-02-28-preview/generated/azure_mgmt_mixedreality/mixed_reality_client.rb#L135-L138
train
Azure/azure-sdk-for-ruby
management/azure_mgmt_sql/lib/2017-10-01-preview/generated/azure_mgmt_sql/recoverable_managed_databases.rb
Azure::SQL::Mgmt::V2017_10_01_preview.RecoverableManagedDatabases.get_with_http_info
def get_with_http_info(resource_group_name, managed_instance_name, recoverable_database_name, custom_headers:nil) get_async(resource_group_name, managed_instance_name, recoverable_database_name, custom_headers:custom_headers).value! end
ruby
def get_with_http_info(resource_group_name, managed_instance_name, recoverable_database_name, custom_headers:nil) get_async(resource_group_name, managed_instance_name, recoverable_database_name, custom_headers:custom_headers).value! end
[ "def", "get_with_http_info", "(", "resource_group_name", ",", "managed_instance_name", ",", "recoverable_database_name", ",", "custom_headers", ":", "nil", ")", "get_async", "(", "resource_group_name", ",", "managed_instance_name", ",", "recoverable_database_name", ",", "custom_headers", ":", "custom_headers", ")", ".", "value!", "end" ]
Gets a recoverable managed database. @param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param managed_instance_name [String] The name of the managed instance. @param recoverable_database_name [String] @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request. @return [MsRestAzure::AzureOperationResponse] HTTP response information.
[ "Gets", "a", "recoverable", "managed", "database", "." ]
78eedacf8f8cbd65c2d8a2af421405eaa4373d8e
https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2017-10-01-preview/generated/azure_mgmt_sql/recoverable_managed_databases.rb#L156-L158
train
Azure/azure-sdk-for-ruby
management/azure_mgmt_kusto/lib/2017-09-07-privatepreview/generated/azure_mgmt_kusto/clusters.rb
Azure::Kusto::Mgmt::V2018_09_07_privatepreview.Clusters.list_skus_by_resource
def list_skus_by_resource(resource_group_name, cluster_name, custom_headers:nil) response = list_skus_by_resource_async(resource_group_name, cluster_name, custom_headers:custom_headers).value! response.body unless response.nil? end
ruby
def list_skus_by_resource(resource_group_name, cluster_name, custom_headers:nil) response = list_skus_by_resource_async(resource_group_name, cluster_name, custom_headers:custom_headers).value! response.body unless response.nil? end
[ "def", "list_skus_by_resource", "(", "resource_group_name", ",", "cluster_name", ",", "custom_headers", ":", "nil", ")", "response", "=", "list_skus_by_resource_async", "(", "resource_group_name", ",", "cluster_name", ",", "custom_headers", ":", "custom_headers", ")", ".", "value!", "response", ".", "body", "unless", "response", ".", "nil?", "end" ]
Returns the SKUs available for the provided resource. @param resource_group_name [String] The name of the resource group containing the Kusto cluster. @param cluster_name [String] The name of the Kusto cluster. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request. @return [ListResourceSkusResult] operation results.
[ "Returns", "the", "SKUs", "available", "for", "the", "provided", "resource", "." ]
78eedacf8f8cbd65c2d8a2af421405eaa4373d8e
https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_kusto/lib/2017-09-07-privatepreview/generated/azure_mgmt_kusto/clusters.rb#L706-L709
train
Azure/azure-sdk-for-ruby
management/azure_mgmt_kusto/lib/2017-09-07-privatepreview/generated/azure_mgmt_kusto/clusters.rb
Azure::Kusto::Mgmt::V2018_09_07_privatepreview.Clusters.begin_create_or_update_with_http_info
def begin_create_or_update_with_http_info(resource_group_name, cluster_name, parameters, custom_headers:nil) begin_create_or_update_async(resource_group_name, cluster_name, parameters, custom_headers:custom_headers).value! end
ruby
def begin_create_or_update_with_http_info(resource_group_name, cluster_name, parameters, custom_headers:nil) begin_create_or_update_async(resource_group_name, cluster_name, parameters, custom_headers:custom_headers).value! end
[ "def", "begin_create_or_update_with_http_info", "(", "resource_group_name", ",", "cluster_name", ",", "parameters", ",", "custom_headers", ":", "nil", ")", "begin_create_or_update_async", "(", "resource_group_name", ",", "cluster_name", ",", "parameters", ",", "custom_headers", ":", "custom_headers", ")", ".", "value!", "end" ]
Create or update a Kusto cluster. @param resource_group_name [String] The name of the resource group containing the Kusto cluster. @param cluster_name [String] The name of the Kusto cluster. @param parameters [Cluster] The Kusto cluster parameters supplied to the CreateOrUpdate operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request. @return [MsRestAzure::AzureOperationResponse] HTTP response information.
[ "Create", "or", "update", "a", "Kusto", "cluster", "." ]
78eedacf8f8cbd65c2d8a2af421405eaa4373d8e
https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_kusto/lib/2017-09-07-privatepreview/generated/azure_mgmt_kusto/clusters.rb#L821-L823
train
Azure/azure-sdk-for-ruby
management/azure_mgmt_sql/lib/2015-05-01-preview/generated/azure_mgmt_sql/virtual_clusters.rb
Azure::SQL::Mgmt::V2015_05_01_preview.VirtualClusters.begin_update_with_http_info
def begin_update_with_http_info(resource_group_name, virtual_cluster_name, parameters, custom_headers:nil) begin_update_async(resource_group_name, virtual_cluster_name, parameters, custom_headers:custom_headers).value! end
ruby
def begin_update_with_http_info(resource_group_name, virtual_cluster_name, parameters, custom_headers:nil) begin_update_async(resource_group_name, virtual_cluster_name, parameters, custom_headers:custom_headers).value! end
[ "def", "begin_update_with_http_info", "(", "resource_group_name", ",", "virtual_cluster_name", ",", "parameters", ",", "custom_headers", ":", "nil", ")", "begin_update_async", "(", "resource_group_name", ",", "virtual_cluster_name", ",", "parameters", ",", "custom_headers", ":", "custom_headers", ")", ".", "value!", "end" ]
Updates a virtual cluster. @param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param virtual_cluster_name [String] The name of the virtual cluster. @param parameters [VirtualClusterUpdate] The requested managed instance resource state. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request. @return [MsRestAzure::AzureOperationResponse] HTTP response information.
[ "Updates", "a", "virtual", "cluster", "." ]
78eedacf8f8cbd65c2d8a2af421405eaa4373d8e
https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2015-05-01-preview/generated/azure_mgmt_sql/virtual_clusters.rb#L515-L517
train
Azure/azure-sdk-for-ruby
management/azure_mgmt_sql/lib/2017-03-01-preview/generated/azure_mgmt_sql/server_dns_aliases.rb
Azure::SQL::Mgmt::V2017_03_01_preview.ServerDnsAliases.get_with_http_info
def get_with_http_info(resource_group_name, server_name, dns_alias_name, custom_headers:nil) get_async(resource_group_name, server_name, dns_alias_name, custom_headers:custom_headers).value! end
ruby
def get_with_http_info(resource_group_name, server_name, dns_alias_name, custom_headers:nil) get_async(resource_group_name, server_name, dns_alias_name, custom_headers:custom_headers).value! end
[ "def", "get_with_http_info", "(", "resource_group_name", ",", "server_name", ",", "dns_alias_name", ",", "custom_headers", ":", "nil", ")", "get_async", "(", "resource_group_name", ",", "server_name", ",", "dns_alias_name", ",", "custom_headers", ":", "custom_headers", ")", ".", "value!", "end" ]
Gets a server DNS alias. @param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param server_name [String] The name of the server that the alias is pointing to. @param dns_alias_name [String] The name of the server DNS alias. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request. @return [MsRestAzure::AzureOperationResponse] HTTP response information.
[ "Gets", "a", "server", "DNS", "alias", "." ]
78eedacf8f8cbd65c2d8a2af421405eaa4373d8e
https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2017-03-01-preview/generated/azure_mgmt_sql/server_dns_aliases.rb#L60-L62
train
Azure/azure-sdk-for-ruby
management/azure_mgmt_sql/lib/2017-03-01-preview/generated/azure_mgmt_sql/server_dns_aliases.rb
Azure::SQL::Mgmt::V2017_03_01_preview.ServerDnsAliases.begin_create_or_update_with_http_info
def begin_create_or_update_with_http_info(resource_group_name, server_name, dns_alias_name, custom_headers:nil) begin_create_or_update_async(resource_group_name, server_name, dns_alias_name, custom_headers:custom_headers).value! end
ruby
def begin_create_or_update_with_http_info(resource_group_name, server_name, dns_alias_name, custom_headers:nil) begin_create_or_update_async(resource_group_name, server_name, dns_alias_name, custom_headers:custom_headers).value! end
[ "def", "begin_create_or_update_with_http_info", "(", "resource_group_name", ",", "server_name", ",", "dns_alias_name", ",", "custom_headers", ":", "nil", ")", "begin_create_or_update_async", "(", "resource_group_name", ",", "server_name", ",", "dns_alias_name", ",", "custom_headers", ":", "custom_headers", ")", ".", "value!", "end" ]
Creates a server dns alias. @param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param server_name [String] The name of the server that the alias is pointing to. @param dns_alias_name [String] The name of the server DNS alias. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request. @return [MsRestAzure::AzureOperationResponse] HTTP response information.
[ "Creates", "a", "server", "dns", "alias", "." ]
78eedacf8f8cbd65c2d8a2af421405eaa4373d8e
https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2017-03-01-preview/generated/azure_mgmt_sql/server_dns_aliases.rb#L410-L412
train
Azure/azure-sdk-for-ruby
management/azure_mgmt_sql/lib/2017-03-01-preview/generated/azure_mgmt_sql/server_dns_aliases.rb
Azure::SQL::Mgmt::V2017_03_01_preview.ServerDnsAliases.begin_delete_with_http_info
def begin_delete_with_http_info(resource_group_name, server_name, dns_alias_name, custom_headers:nil) begin_delete_async(resource_group_name, server_name, dns_alias_name, custom_headers:custom_headers).value! end
ruby
def begin_delete_with_http_info(resource_group_name, server_name, dns_alias_name, custom_headers:nil) begin_delete_async(resource_group_name, server_name, dns_alias_name, custom_headers:custom_headers).value! end
[ "def", "begin_delete_with_http_info", "(", "resource_group_name", ",", "server_name", ",", "dns_alias_name", ",", "custom_headers", ":", "nil", ")", "begin_delete_async", "(", "resource_group_name", ",", "server_name", ",", "dns_alias_name", ",", "custom_headers", ":", "custom_headers", ")", ".", "value!", "end" ]
Deletes the server DNS alias with the given name. @param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param server_name [String] The name of the server that the alias is pointing to. @param dns_alias_name [String] The name of the server DNS alias. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request. @return [MsRestAzure::AzureOperationResponse] HTTP response information.
[ "Deletes", "the", "server", "DNS", "alias", "with", "the", "given", "name", "." ]
78eedacf8f8cbd65c2d8a2af421405eaa4373d8e
https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2017-03-01-preview/generated/azure_mgmt_sql/server_dns_aliases.rb#L524-L526
train
Azure/azure-sdk-for-ruby
management/azure_mgmt_managed_applications/lib/2016-09-01-preview/generated/azure_mgmt_managed_applications/appliance_definitions.rb
Azure::ManagedApplications::Mgmt::V2016_09_01_preview.ApplianceDefinitions.get_by_id
def get_by_id(appliance_definition_id, custom_headers:nil) response = get_by_id_async(appliance_definition_id, custom_headers:custom_headers).value! response.body unless response.nil? end
ruby
def get_by_id(appliance_definition_id, custom_headers:nil) response = get_by_id_async(appliance_definition_id, custom_headers:custom_headers).value! response.body unless response.nil? end
[ "def", "get_by_id", "(", "appliance_definition_id", ",", "custom_headers", ":", "nil", ")", "response", "=", "get_by_id_async", "(", "appliance_definition_id", ",", "custom_headers", ":", "custom_headers", ")", ".", "value!", "response", ".", "body", "unless", "response", ".", "nil?", "end" ]
Gets the appliance definition. @param appliance_definition_id [String] The fully qualified ID of the appliance definition, including the appliance name and the appliance definition resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-name} @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request. @return [ApplianceDefinition] operation results.
[ "Gets", "the", "appliance", "definition", "." ]
78eedacf8f8cbd65c2d8a2af421405eaa4373d8e
https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_managed_applications/lib/2016-09-01-preview/generated/azure_mgmt_managed_applications/appliance_definitions.rb#L325-L328
train
Azure/azure-sdk-for-ruby
management/azure_mgmt_managed_applications/lib/2016-09-01-preview/generated/azure_mgmt_managed_applications/appliance_definitions.rb
Azure::ManagedApplications::Mgmt::V2016_09_01_preview.ApplianceDefinitions.begin_create_or_update_with_http_info
def begin_create_or_update_with_http_info(resource_group_name, appliance_definition_name, parameters, custom_headers:nil) begin_create_or_update_async(resource_group_name, appliance_definition_name, parameters, custom_headers:custom_headers).value! end
ruby
def begin_create_or_update_with_http_info(resource_group_name, appliance_definition_name, parameters, custom_headers:nil) begin_create_or_update_async(resource_group_name, appliance_definition_name, parameters, custom_headers:custom_headers).value! end
[ "def", "begin_create_or_update_with_http_info", "(", "resource_group_name", ",", "appliance_definition_name", ",", "parameters", ",", "custom_headers", ":", "nil", ")", "begin_create_or_update_async", "(", "resource_group_name", ",", "appliance_definition_name", ",", "parameters", ",", "custom_headers", ":", "custom_headers", ")", ".", "value!", "end" ]
Creates a new appliance definition. @param resource_group_name [String] The name of the resource group. The name is case insensitive. @param appliance_definition_name [String] The name of the appliance definition. @param parameters [ApplianceDefinition] Parameters supplied to the create or update an appliance definition. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request. @return [MsRestAzure::AzureOperationResponse] HTTP response information.
[ "Creates", "a", "new", "appliance", "definition", "." ]
78eedacf8f8cbd65c2d8a2af421405eaa4373d8e
https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_managed_applications/lib/2016-09-01-preview/generated/azure_mgmt_managed_applications/appliance_definitions.rb#L626-L628
train
Azure/azure-sdk-for-ruby
management/azure_mgmt_kusto/lib/2017-09-07-privatepreview/generated/azure_mgmt_kusto/event_hub_connections.rb
Azure::Kusto::Mgmt::V2018_09_07_privatepreview.EventHubConnections.get_with_http_info
def get_with_http_info(resource_group_name, cluster_name, database_name, event_hub_connection_name, custom_headers:nil) get_async(resource_group_name, cluster_name, database_name, event_hub_connection_name, custom_headers:custom_headers).value! end
ruby
def get_with_http_info(resource_group_name, cluster_name, database_name, event_hub_connection_name, custom_headers:nil) get_async(resource_group_name, cluster_name, database_name, event_hub_connection_name, custom_headers:custom_headers).value! end
[ "def", "get_with_http_info", "(", "resource_group_name", ",", "cluster_name", ",", "database_name", ",", "event_hub_connection_name", ",", "custom_headers", ":", "nil", ")", "get_async", "(", "resource_group_name", ",", "cluster_name", ",", "database_name", ",", "event_hub_connection_name", ",", "custom_headers", ":", "custom_headers", ")", ".", "value!", "end" ]
Returns an Event Hub connection. @param resource_group_name [String] The name of the resource group containing the Kusto cluster. @param cluster_name [String] The name of the Kusto cluster. @param database_name [String] The name of the database in the Kusto cluster. @param event_hub_connection_name [String] The name of the event hub connection. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request. @return [MsRestAzure::AzureOperationResponse] HTTP response information.
[ "Returns", "an", "Event", "Hub", "connection", "." ]
78eedacf8f8cbd65c2d8a2af421405eaa4373d8e
https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_kusto/lib/2017-09-07-privatepreview/generated/azure_mgmt_kusto/event_hub_connections.rb#L271-L273
train
Azure/azure-sdk-for-ruby
management/azure_mgmt_kusto/lib/2017-09-07-privatepreview/generated/azure_mgmt_kusto/event_hub_connections.rb
Azure::Kusto::Mgmt::V2018_09_07_privatepreview.EventHubConnections.begin_delete_with_http_info
def begin_delete_with_http_info(resource_group_name, cluster_name, database_name, event_hub_connection_name, custom_headers:nil) begin_delete_async(resource_group_name, cluster_name, database_name, event_hub_connection_name, custom_headers:custom_headers).value! end
ruby
def begin_delete_with_http_info(resource_group_name, cluster_name, database_name, event_hub_connection_name, custom_headers:nil) begin_delete_async(resource_group_name, cluster_name, database_name, event_hub_connection_name, custom_headers:custom_headers).value! end
[ "def", "begin_delete_with_http_info", "(", "resource_group_name", ",", "cluster_name", ",", "database_name", ",", "event_hub_connection_name", ",", "custom_headers", ":", "nil", ")", "begin_delete_async", "(", "resource_group_name", ",", "cluster_name", ",", "database_name", ",", "event_hub_connection_name", ",", "custom_headers", ":", "custom_headers", ")", ".", "value!", "end" ]
Deletes the Event Hub connection with the given name. @param resource_group_name [String] The name of the resource group containing the Kusto cluster. @param cluster_name [String] The name of the Kusto cluster. @param database_name [String] The name of the database in the Kusto cluster. @param event_hub_connection_name [String] The name of the event hub connection. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request. @return [MsRestAzure::AzureOperationResponse] HTTP response information.
[ "Deletes", "the", "Event", "Hub", "connection", "with", "the", "given", "name", "." ]
78eedacf8f8cbd65c2d8a2af421405eaa4373d8e
https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_kusto/lib/2017-09-07-privatepreview/generated/azure_mgmt_kusto/event_hub_connections.rb#L790-L792
train
Azure/azure-sdk-for-ruby
management/azure_mgmt_service_fabric/lib/2016-09-01/generated/azure_mgmt_service_fabric/cluster_versions.rb
Azure::ServiceFabric::Mgmt::V2016_09_01.ClusterVersions.get_with_http_info
def get_with_http_info(location, environment, cluster_version, custom_headers:nil) get_async(location, environment, cluster_version, custom_headers:custom_headers).value! end
ruby
def get_with_http_info(location, environment, cluster_version, custom_headers:nil) get_async(location, environment, cluster_version, custom_headers:custom_headers).value! end
[ "def", "get_with_http_info", "(", "location", ",", "environment", ",", "cluster_version", ",", "custom_headers", ":", "nil", ")", "get_async", "(", "location", ",", "environment", ",", "cluster_version", ",", "custom_headers", ":", "custom_headers", ")", ".", "value!", "end" ]
Get cluster code versions by environment and version @param location [String] The location for the cluster code versions, this is different from cluster location @param environment [Enum] Cluster operating system, the default means all. Possible values include: 'Windows', 'Linux' @param cluster_version [String] The cluster code version @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request. @return [MsRestAzure::AzureOperationResponse] HTTP response information.
[ "Get", "cluster", "code", "versions", "by", "environment", "and", "version" ]
78eedacf8f8cbd65c2d8a2af421405eaa4373d8e
https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_service_fabric/lib/2016-09-01/generated/azure_mgmt_service_fabric/cluster_versions.rb#L244-L246
train
Azure/azure-sdk-for-ruby
management/azure_mgmt_api_management/lib/2018-01-01/generated/azure_mgmt_api_management/api_policy.rb
Azure::ApiManagement::Mgmt::V2018_01_01.ApiPolicy.list_by_api
def list_by_api(resource_group_name, service_name, api_id, custom_headers:nil) response = list_by_api_async(resource_group_name, service_name, api_id, custom_headers:custom_headers).value! response.body unless response.nil? end
ruby
def list_by_api(resource_group_name, service_name, api_id, custom_headers:nil) response = list_by_api_async(resource_group_name, service_name, api_id, custom_headers:custom_headers).value! response.body unless response.nil? end
[ "def", "list_by_api", "(", "resource_group_name", ",", "service_name", ",", "api_id", ",", "custom_headers", ":", "nil", ")", "response", "=", "list_by_api_async", "(", "resource_group_name", ",", "service_name", ",", "api_id", ",", "custom_headers", ":", "custom_headers", ")", ".", "value!", "response", ".", "body", "unless", "response", ".", "nil?", "end" ]
Get the policy configuration at the API level. @param resource_group_name [String] The name of the resource group. @param service_name [String] The name of the API Management service. @param api_id [String] API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request. @return [PolicyCollection] operation results.
[ "Get", "the", "policy", "configuration", "at", "the", "API", "level", "." ]
78eedacf8f8cbd65c2d8a2af421405eaa4373d8e
https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_api_management/lib/2018-01-01/generated/azure_mgmt_api_management/api_policy.rb#L37-L40
train
Azure/azure-sdk-for-ruby
management/azure_mgmt_recovery_services/lib/2016-06-01/generated/azure_mgmt_recovery_services/usages.rb
Azure::RecoveryServices::Mgmt::V2016_06_01.Usages.list_by_vaults
def list_by_vaults(resource_group_name, vault_name, custom_headers:nil) response = list_by_vaults_async(resource_group_name, vault_name, custom_headers:custom_headers).value! response.body unless response.nil? end
ruby
def list_by_vaults(resource_group_name, vault_name, custom_headers:nil) response = list_by_vaults_async(resource_group_name, vault_name, custom_headers:custom_headers).value! response.body unless response.nil? end
[ "def", "list_by_vaults", "(", "resource_group_name", ",", "vault_name", ",", "custom_headers", ":", "nil", ")", "response", "=", "list_by_vaults_async", "(", "resource_group_name", ",", "vault_name", ",", "custom_headers", ":", "custom_headers", ")", ".", "value!", "response", ".", "body", "unless", "response", ".", "nil?", "end" ]
Fetches the usages of the vault. @param resource_group_name [String] The name of the resource group where the recovery services vault is present. @param vault_name [String] The name of the recovery services vault. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request. @return [VaultUsageList] operation results.
[ "Fetches", "the", "usages", "of", "the", "vault", "." ]
78eedacf8f8cbd65c2d8a2af421405eaa4373d8e
https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_recovery_services/lib/2016-06-01/generated/azure_mgmt_recovery_services/usages.rb#L35-L38
train
Azure/azure-sdk-for-ruby
management/azure_mgmt_policy_insights/lib/2018-04-04/generated/azure_mgmt_policy_insights/policy_events.rb
Azure::PolicyInsights::Mgmt::V2018_04_04.PolicyEvents.list_query_results_for_policy_set_definition_with_http_info
def list_query_results_for_policy_set_definition_with_http_info(subscription_id, policy_set_definition_name, query_options:nil, custom_headers:nil) list_query_results_for_policy_set_definition_async(subscription_id, policy_set_definition_name, query_options:query_options, custom_headers:custom_headers).value! end
ruby
def list_query_results_for_policy_set_definition_with_http_info(subscription_id, policy_set_definition_name, query_options:nil, custom_headers:nil) list_query_results_for_policy_set_definition_async(subscription_id, policy_set_definition_name, query_options:query_options, custom_headers:custom_headers).value! end
[ "def", "list_query_results_for_policy_set_definition_with_http_info", "(", "subscription_id", ",", "policy_set_definition_name", ",", "query_options", ":", "nil", ",", "custom_headers", ":", "nil", ")", "list_query_results_for_policy_set_definition_async", "(", "subscription_id", ",", "policy_set_definition_name", ",", "query_options", ":", "query_options", ",", "custom_headers", ":", "custom_headers", ")", ".", "value!", "end" ]
Queries policy events for the subscription level policy set definition. @param subscription_id [String] Microsoft Azure subscription ID. @param policy_set_definition_name [String] Policy set definition name. @param query_options [QueryOptions] Additional parameters for the operation @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request. @return [MsRestAzure::AzureOperationResponse] HTTP response information.
[ "Queries", "policy", "events", "for", "the", "subscription", "level", "policy", "set", "definition", "." ]
78eedacf8f8cbd65c2d8a2af421405eaa4373d8e
https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_policy_insights/lib/2018-04-04/generated/azure_mgmt_policy_insights/policy_events.rb#L533-L535
train
Azure/azure-sdk-for-ruby
management/azure_mgmt_policy_insights/lib/2018-04-04/generated/azure_mgmt_policy_insights/policy_events.rb
Azure::PolicyInsights::Mgmt::V2018_04_04.PolicyEvents.list_query_results_for_policy_definition_with_http_info
def list_query_results_for_policy_definition_with_http_info(subscription_id, policy_definition_name, query_options:nil, custom_headers:nil) list_query_results_for_policy_definition_async(subscription_id, policy_definition_name, query_options:query_options, custom_headers:custom_headers).value! end
ruby
def list_query_results_for_policy_definition_with_http_info(subscription_id, policy_definition_name, query_options:nil, custom_headers:nil) list_query_results_for_policy_definition_async(subscription_id, policy_definition_name, query_options:query_options, custom_headers:custom_headers).value! end
[ "def", "list_query_results_for_policy_definition_with_http_info", "(", "subscription_id", ",", "policy_definition_name", ",", "query_options", ":", "nil", ",", "custom_headers", ":", "nil", ")", "list_query_results_for_policy_definition_async", "(", "subscription_id", ",", "policy_definition_name", ",", "query_options", ":", "query_options", ",", "custom_headers", ":", "custom_headers", ")", ".", "value!", "end" ]
Queries policy events for the subscription level policy definition. @param subscription_id [String] Microsoft Azure subscription ID. @param policy_definition_name [String] Policy definition name. @param query_options [QueryOptions] Additional parameters for the operation @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request. @return [MsRestAzure::AzureOperationResponse] HTTP response information.
[ "Queries", "policy", "events", "for", "the", "subscription", "level", "policy", "definition", "." ]
78eedacf8f8cbd65c2d8a2af421405eaa4373d8e
https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_policy_insights/lib/2018-04-04/generated/azure_mgmt_policy_insights/policy_events.rb#L657-L659
train
Azure/azure-sdk-for-ruby
management/azure_mgmt_service_bus/lib/2015-08-01/generated/azure_mgmt_service_bus/topics.rb
Azure::ServiceBus::Mgmt::V2015_08_01.Topics.delete_with_http_info
def delete_with_http_info(resource_group_name, namespace_name, topic_name, custom_headers:nil) delete_async(resource_group_name, namespace_name, topic_name, custom_headers:custom_headers).value! end
ruby
def delete_with_http_info(resource_group_name, namespace_name, topic_name, custom_headers:nil) delete_async(resource_group_name, namespace_name, topic_name, custom_headers:custom_headers).value! end
[ "def", "delete_with_http_info", "(", "resource_group_name", ",", "namespace_name", ",", "topic_name", ",", "custom_headers", ":", "nil", ")", "delete_async", "(", "resource_group_name", ",", "namespace_name", ",", "topic_name", ",", "custom_headers", ":", "custom_headers", ")", ".", "value!", "end" ]
Deletes a topic from the specified namespace and resource group. @param resource_group_name [String] Name of the Resource group within the Azure subscription. @param namespace_name [String] The namespace name @param topic_name [String] The topic name. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request. @return [MsRestAzure::AzureOperationResponse] HTTP response information.
[ "Deletes", "a", "topic", "from", "the", "specified", "namespace", "and", "resource", "group", "." ]
78eedacf8f8cbd65c2d8a2af421405eaa4373d8e
https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_service_bus/lib/2015-08-01/generated/azure_mgmt_service_bus/topics.rb#L270-L272
train
Azure/azure-sdk-for-ruby
management/azure_mgmt_service_bus/lib/2015-08-01/generated/azure_mgmt_service_bus/topics.rb
Azure::ServiceBus::Mgmt::V2015_08_01.Topics.list_authorization_rules_with_http_info
def list_authorization_rules_with_http_info(resource_group_name, namespace_name, topic_name, custom_headers:nil) list_authorization_rules_async(resource_group_name, namespace_name, topic_name, custom_headers:custom_headers).value! end
ruby
def list_authorization_rules_with_http_info(resource_group_name, namespace_name, topic_name, custom_headers:nil) list_authorization_rules_async(resource_group_name, namespace_name, topic_name, custom_headers:custom_headers).value! end
[ "def", "list_authorization_rules_with_http_info", "(", "resource_group_name", ",", "namespace_name", ",", "topic_name", ",", "custom_headers", ":", "nil", ")", "list_authorization_rules_async", "(", "resource_group_name", ",", "namespace_name", ",", "topic_name", ",", "custom_headers", ":", "custom_headers", ")", ".", "value!", "end" ]
Gets authorization rules for a topic. @param resource_group_name [String] Name of the Resource group within the Azure subscription. @param namespace_name [String] The namespace name @param topic_name [String] The topic name. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request. @return [MsRestAzure::AzureOperationResponse] HTTP response information.
[ "Gets", "authorization", "rules", "for", "a", "topic", "." ]
78eedacf8f8cbd65c2d8a2af421405eaa4373d8e
https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_service_bus/lib/2015-08-01/generated/azure_mgmt_service_bus/topics.rb#L470-L472
train
Azure/azure-sdk-for-ruby
management/azure_mgmt_service_bus/lib/2015-08-01/generated/azure_mgmt_service_bus/topics.rb
Azure::ServiceBus::Mgmt::V2015_08_01.Topics.post_authorization_rule_with_http_info
def post_authorization_rule_with_http_info(resource_group_name, namespace_name, topic_name, authorization_rule_name, custom_headers:nil) post_authorization_rule_async(resource_group_name, namespace_name, topic_name, authorization_rule_name, custom_headers:custom_headers).value! end
ruby
def post_authorization_rule_with_http_info(resource_group_name, namespace_name, topic_name, authorization_rule_name, custom_headers:nil) post_authorization_rule_async(resource_group_name, namespace_name, topic_name, authorization_rule_name, custom_headers:custom_headers).value! end
[ "def", "post_authorization_rule_with_http_info", "(", "resource_group_name", ",", "namespace_name", ",", "topic_name", ",", "authorization_rule_name", ",", "custom_headers", ":", "nil", ")", "post_authorization_rule_async", "(", "resource_group_name", ",", "namespace_name", ",", "topic_name", ",", "authorization_rule_name", ",", "custom_headers", ":", "custom_headers", ")", ".", "value!", "end" ]
Returns the specified authorization rule. @param resource_group_name [String] Name of the Resource group within the Azure subscription. @param namespace_name [String] The namespace name @param topic_name [String] The topic name. @param authorization_rule_name [String] The authorization rule name. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request. @return [MsRestAzure::AzureOperationResponse] HTTP response information.
[ "Returns", "the", "specified", "authorization", "rule", "." ]
78eedacf8f8cbd65c2d8a2af421405eaa4373d8e
https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_service_bus/lib/2015-08-01/generated/azure_mgmt_service_bus/topics.rb#L702-L704
train
Azure/azure-sdk-for-ruby
data/azure_service_fabric/lib/6.4.0.36/generated/azure_service_fabric/mesh_network.rb
Azure::ServiceFabric::V6_4_0_36.MeshNetwork.create_or_update
def create_or_update(network_resource_name, network_resource_description, custom_headers:nil) response = create_or_update_async(network_resource_name, network_resource_description, custom_headers:custom_headers).value! response.body unless response.nil? end
ruby
def create_or_update(network_resource_name, network_resource_description, custom_headers:nil) response = create_or_update_async(network_resource_name, network_resource_description, custom_headers:custom_headers).value! response.body unless response.nil? end
[ "def", "create_or_update", "(", "network_resource_name", ",", "network_resource_description", ",", "custom_headers", ":", "nil", ")", "response", "=", "create_or_update_async", "(", "network_resource_name", ",", "network_resource_description", ",", "custom_headers", ":", "custom_headers", ")", ".", "value!", "response", ".", "body", "unless", "response", ".", "nil?", "end" ]
Creates or updates a Network resource. Creates a Network resource with the specified name, description and properties. If Network resource with the same name exists, then it is updated with the specified description and properties. Network resource provides connectivity between application services. @param network_resource_name [String] The identity of the network. @param network_resource_description [NetworkResourceDescription] Description for creating a Network resource. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request. @return [NetworkResourceDescription] operation results.
[ "Creates", "or", "updates", "a", "Network", "resource", "." ]
78eedacf8f8cbd65c2d8a2af421405eaa4373d8e
https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_service_fabric/lib/6.4.0.36/generated/azure_service_fabric/mesh_network.rb#L41-L44
train
Azure/azure-sdk-for-ruby
data/azure_graph_rbac/lib/1.6/generated/azure_graph_rbac/applications.rb
Azure::GraphRbac::V1_6.Applications.patch
def patch(application_object_id, parameters, custom_headers:nil) response = patch_async(application_object_id, parameters, custom_headers:custom_headers).value! nil end
ruby
def patch(application_object_id, parameters, custom_headers:nil) response = patch_async(application_object_id, parameters, custom_headers:custom_headers).value! nil end
[ "def", "patch", "(", "application_object_id", ",", "parameters", ",", "custom_headers", ":", "nil", ")", "response", "=", "patch_async", "(", "application_object_id", ",", "parameters", ",", "custom_headers", ":", "custom_headers", ")", ".", "value!", "nil", "end" ]
Update an existing application. @param application_object_id [String] Application object ID. @param parameters [ApplicationUpdateParameters] Parameters to update an existing application. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
[ "Update", "an", "existing", "application", "." ]
78eedacf8f8cbd65c2d8a2af421405eaa4373d8e
https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_graph_rbac/lib/1.6/generated/azure_graph_rbac/applications.rb#L384-L387
train
Azure/azure-sdk-for-ruby
data/azure_graph_rbac/lib/1.6/generated/azure_graph_rbac/applications.rb
Azure::GraphRbac::V1_6.Applications.list_owners
def list_owners(application_object_id, custom_headers:nil) response = list_owners_async(application_object_id, custom_headers:custom_headers).value! response.body unless response.nil? end
ruby
def list_owners(application_object_id, custom_headers:nil) response = list_owners_async(application_object_id, custom_headers:custom_headers).value! response.body unless response.nil? end
[ "def", "list_owners", "(", "application_object_id", ",", "custom_headers", ":", "nil", ")", "response", "=", "list_owners_async", "(", "application_object_id", ",", "custom_headers", ":", "custom_headers", ")", ".", "value!", "response", ".", "body", "unless", "response", ".", "nil?", "end" ]
Directory objects that are owners of the application. The owners are a set of non-admin users who are allowed to modify this object. @param application_object_id [String] The object ID of the application for which to get owners. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request. @return [DirectoryObjectListResult] operation results.
[ "Directory", "objects", "that", "are", "owners", "of", "the", "application", "." ]
78eedacf8f8cbd65c2d8a2af421405eaa4373d8e
https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_graph_rbac/lib/1.6/generated/azure_graph_rbac/applications.rb#L478-L481
train
Azure/azure-sdk-for-ruby
data/azure_graph_rbac/lib/1.6/generated/azure_graph_rbac/applications.rb
Azure::GraphRbac::V1_6.Applications.list_key_credentials
def list_key_credentials(application_object_id, custom_headers:nil) response = list_key_credentials_async(application_object_id, custom_headers:custom_headers).value! response.body unless response.nil? end
ruby
def list_key_credentials(application_object_id, custom_headers:nil) response = list_key_credentials_async(application_object_id, custom_headers:custom_headers).value! response.body unless response.nil? end
[ "def", "list_key_credentials", "(", "application_object_id", ",", "custom_headers", ":", "nil", ")", "response", "=", "list_key_credentials_async", "(", "application_object_id", ",", "custom_headers", ":", "custom_headers", ")", ".", "value!", "response", ".", "body", "unless", "response", ".", "nil?", "end" ]
Get the keyCredentials associated with an application. @param application_object_id [String] Application object ID. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request. @return [KeyCredentialListResult] operation results.
[ "Get", "the", "keyCredentials", "associated", "with", "an", "application", "." ]
78eedacf8f8cbd65c2d8a2af421405eaa4373d8e
https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_graph_rbac/lib/1.6/generated/azure_graph_rbac/applications.rb#L671-L674
train
Azure/azure-sdk-for-ruby
data/azure_graph_rbac/lib/1.6/generated/azure_graph_rbac/applications.rb
Azure::GraphRbac::V1_6.Applications.update_key_credentials
def update_key_credentials(application_object_id, parameters, custom_headers:nil) response = update_key_credentials_async(application_object_id, parameters, custom_headers:custom_headers).value! nil end
ruby
def update_key_credentials(application_object_id, parameters, custom_headers:nil) response = update_key_credentials_async(application_object_id, parameters, custom_headers:custom_headers).value! nil end
[ "def", "update_key_credentials", "(", "application_object_id", ",", "parameters", ",", "custom_headers", ":", "nil", ")", "response", "=", "update_key_credentials_async", "(", "application_object_id", ",", "parameters", ",", "custom_headers", ":", "custom_headers", ")", ".", "value!", "nil", "end" ]
Update the keyCredentials associated with an application. @param application_object_id [String] Application object ID. @param parameters [KeyCredentialsUpdateParameters] Parameters to update the keyCredentials of an existing application. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
[ "Update", "the", "keyCredentials", "associated", "with", "an", "application", "." ]
78eedacf8f8cbd65c2d8a2af421405eaa4373d8e
https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_graph_rbac/lib/1.6/generated/azure_graph_rbac/applications.rb#L760-L763
train
Azure/azure-sdk-for-ruby
data/azure_graph_rbac/lib/1.6/generated/azure_graph_rbac/applications.rb
Azure::GraphRbac::V1_6.Applications.list_password_credentials
def list_password_credentials(application_object_id, custom_headers:nil) response = list_password_credentials_async(application_object_id, custom_headers:custom_headers).value! response.body unless response.nil? end
ruby
def list_password_credentials(application_object_id, custom_headers:nil) response = list_password_credentials_async(application_object_id, custom_headers:custom_headers).value! response.body unless response.nil? end
[ "def", "list_password_credentials", "(", "application_object_id", ",", "custom_headers", ":", "nil", ")", "response", "=", "list_password_credentials_async", "(", "application_object_id", ",", "custom_headers", ":", "custom_headers", ")", ".", "value!", "response", ".", "body", "unless", "response", ".", "nil?", "end" ]
Get the passwordCredentials associated with an application. @param application_object_id [String] Application object ID. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request. @return [PasswordCredentialListResult] operation results.
[ "Get", "the", "passwordCredentials", "associated", "with", "an", "application", "." ]
78eedacf8f8cbd65c2d8a2af421405eaa4373d8e
https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_graph_rbac/lib/1.6/generated/azure_graph_rbac/applications.rb#L850-L853
train
Azure/azure-sdk-for-ruby
data/azure_graph_rbac/lib/1.6/generated/azure_graph_rbac/applications.rb
Azure::GraphRbac::V1_6.Applications.update_password_credentials
def update_password_credentials(application_object_id, parameters, custom_headers:nil) response = update_password_credentials_async(application_object_id, parameters, custom_headers:custom_headers).value! nil end
ruby
def update_password_credentials(application_object_id, parameters, custom_headers:nil) response = update_password_credentials_async(application_object_id, parameters, custom_headers:custom_headers).value! nil end
[ "def", "update_password_credentials", "(", "application_object_id", ",", "parameters", ",", "custom_headers", ":", "nil", ")", "response", "=", "update_password_credentials_async", "(", "application_object_id", ",", "parameters", ",", "custom_headers", ":", "custom_headers", ")", ".", "value!", "nil", "end" ]
Update passwordCredentials associated with an application. @param application_object_id [String] Application object ID. @param parameters [PasswordCredentialsUpdateParameters] Parameters to update passwordCredentials of an existing application. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
[ "Update", "passwordCredentials", "associated", "with", "an", "application", "." ]
78eedacf8f8cbd65c2d8a2af421405eaa4373d8e
https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_graph_rbac/lib/1.6/generated/azure_graph_rbac/applications.rb#L939-L942
train
Azure/azure-sdk-for-ruby
management/azure_mgmt_authorization/lib/2018-07-01-preview/generated/azure_mgmt_authorization/deny_assignments.rb
Azure::Authorization::Mgmt::V2018_07_01_preview.DenyAssignments.get_by_id
def get_by_id(deny_assignment_id, custom_headers:nil) response = get_by_id_async(deny_assignment_id, custom_headers:custom_headers).value! response.body unless response.nil? end
ruby
def get_by_id(deny_assignment_id, custom_headers:nil) response = get_by_id_async(deny_assignment_id, custom_headers:custom_headers).value! response.body unless response.nil? end
[ "def", "get_by_id", "(", "deny_assignment_id", ",", "custom_headers", ":", "nil", ")", "response", "=", "get_by_id_async", "(", "deny_assignment_id", ",", "custom_headers", ":", "custom_headers", ")", ".", "value!", "response", ".", "body", "unless", "response", ".", "nil?", "end" ]
Gets a deny assignment by ID. @param deny_assignment_id [String] The fully qualified deny assignment ID. For example, use the format, /subscriptions/{guid}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} for subscription level deny assignments, or /providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} for tenant level deny assignments. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request. @return [DenyAssignment] operation results.
[ "Gets", "a", "deny", "assignment", "by", "ID", "." ]
78eedacf8f8cbd65c2d8a2af421405eaa4373d8e
https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_authorization/lib/2018-07-01-preview/generated/azure_mgmt_authorization/deny_assignments.rb#L525-L528
train
Azure/azure-sdk-for-ruby
management/azure_mgmt_iot_central/lib/2018-09-01/generated/azure_mgmt_iot_central/apps.rb
Azure::IotCentral::Mgmt::V2018_09_01.Apps.check_subdomain_availability
def check_subdomain_availability(operation_inputs, custom_headers:nil) response = check_subdomain_availability_async(operation_inputs, custom_headers:custom_headers).value! response.body unless response.nil? end
ruby
def check_subdomain_availability(operation_inputs, custom_headers:nil) response = check_subdomain_availability_async(operation_inputs, custom_headers:custom_headers).value! response.body unless response.nil? end
[ "def", "check_subdomain_availability", "(", "operation_inputs", ",", "custom_headers", ":", "nil", ")", "response", "=", "check_subdomain_availability_async", "(", "operation_inputs", ",", "custom_headers", ":", "custom_headers", ")", ".", "value!", "response", ".", "body", "unless", "response", ".", "nil?", "end" ]
Check if an IoT Central application subdomain is available. @param operation_inputs [OperationInputs] Set the name parameter in the OperationInputs structure to the subdomain of the IoT Central application to check. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request. @return [AppAvailabilityInfo] operation results.
[ "Check", "if", "an", "IoT", "Central", "application", "subdomain", "is", "available", "." ]
78eedacf8f8cbd65c2d8a2af421405eaa4373d8e
https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_iot_central/lib/2018-09-01/generated/azure_mgmt_iot_central/apps.rb#L552-L555
train
Azure/azure-sdk-for-ruby
management/azure_mgmt_api_management/lib/2018-01-01/generated/azure_mgmt_api_management/notification_recipient_email.rb
Azure::ApiManagement::Mgmt::V2018_01_01.NotificationRecipientEmail.check_entity_exists_with_http_info
def check_entity_exists_with_http_info(resource_group_name, service_name, notification_name, email, custom_headers:nil) check_entity_exists_async(resource_group_name, service_name, notification_name, email, custom_headers:custom_headers).value! end
ruby
def check_entity_exists_with_http_info(resource_group_name, service_name, notification_name, email, custom_headers:nil) check_entity_exists_async(resource_group_name, service_name, notification_name, email, custom_headers:custom_headers).value! end
[ "def", "check_entity_exists_with_http_info", "(", "resource_group_name", ",", "service_name", ",", "notification_name", ",", "email", ",", "custom_headers", ":", "nil", ")", "check_entity_exists_async", "(", "resource_group_name", ",", "service_name", ",", "notification_name", ",", "email", ",", "custom_headers", ":", "custom_headers", ")", ".", "value!", "end" ]
Determine if Notification Recipient Email subscribed to the notification. @param resource_group_name [String] The name of the resource group. @param service_name [String] The name of the API Management service. @param notification_name [NotificationName] Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' @param email [String] Email identifier. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request. @return [MsRestAzure::AzureOperationResponse] HTTP response information.
[ "Determine", "if", "Notification", "Recipient", "Email", "subscribed", "to", "the", "notification", "." ]
78eedacf8f8cbd65c2d8a2af421405eaa4373d8e
https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_api_management/lib/2018-01-01/generated/azure_mgmt_api_management/notification_recipient_email.rb#L175-L177
train
Azure/azure-sdk-for-ruby
management/azure_mgmt_api_management/lib/2018-01-01/generated/azure_mgmt_api_management/notification_recipient_email.rb
Azure::ApiManagement::Mgmt::V2018_01_01.NotificationRecipientEmail.create_or_update_with_http_info
def create_or_update_with_http_info(resource_group_name, service_name, notification_name, email, custom_headers:nil) create_or_update_async(resource_group_name, service_name, notification_name, email, custom_headers:custom_headers).value! end
ruby
def create_or_update_with_http_info(resource_group_name, service_name, notification_name, email, custom_headers:nil) create_or_update_async(resource_group_name, service_name, notification_name, email, custom_headers:custom_headers).value! end
[ "def", "create_or_update_with_http_info", "(", "resource_group_name", ",", "service_name", ",", "notification_name", ",", "email", ",", "custom_headers", ":", "nil", ")", "create_or_update_async", "(", "resource_group_name", ",", "service_name", ",", "notification_name", ",", "email", ",", "custom_headers", ":", "custom_headers", ")", ".", "value!", "end" ]
Adds the Email address to the list of Recipients for the Notification. @param resource_group_name [String] The name of the resource group. @param service_name [String] The name of the API Management service. @param notification_name [NotificationName] Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' @param email [String] Email identifier. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request. @return [MsRestAzure::AzureOperationResponse] HTTP response information.
[ "Adds", "the", "Email", "address", "to", "the", "list", "of", "Recipients", "for", "the", "Notification", "." ]
78eedacf8f8cbd65c2d8a2af421405eaa4373d8e
https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_api_management/lib/2018-01-01/generated/azure_mgmt_api_management/notification_recipient_email.rb#L281-L283
train
Azure/azure-sdk-for-ruby
management/azure_mgmt_api_management/lib/2018-01-01/generated/azure_mgmt_api_management/notification_recipient_email.rb
Azure::ApiManagement::Mgmt::V2018_01_01.NotificationRecipientEmail.delete_with_http_info
def delete_with_http_info(resource_group_name, service_name, notification_name, email, custom_headers:nil) delete_async(resource_group_name, service_name, notification_name, email, custom_headers:custom_headers).value! end
ruby
def delete_with_http_info(resource_group_name, service_name, notification_name, email, custom_headers:nil) delete_async(resource_group_name, service_name, notification_name, email, custom_headers:custom_headers).value! end
[ "def", "delete_with_http_info", "(", "resource_group_name", ",", "service_name", ",", "notification_name", ",", "email", ",", "custom_headers", ":", "nil", ")", "delete_async", "(", "resource_group_name", ",", "service_name", ",", "notification_name", ",", "email", ",", "custom_headers", ":", "custom_headers", ")", ".", "value!", "end" ]
Removes the email from the list of Notification. @param resource_group_name [String] The name of the resource group. @param service_name [String] The name of the API Management service. @param notification_name [NotificationName] Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' @param email [String] Email identifier. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request. @return [MsRestAzure::AzureOperationResponse] HTTP response information.
[ "Removes", "the", "email", "from", "the", "list", "of", "Notification", "." ]
78eedacf8f8cbd65c2d8a2af421405eaa4373d8e
https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_api_management/lib/2018-01-01/generated/azure_mgmt_api_management/notification_recipient_email.rb#L405-L407
train
Azure/azure-sdk-for-ruby
management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/network_interfaces.rb
Azure::Network::Mgmt::V2018_07_01.NetworkInterfaces.begin_update_tags_with_http_info
def begin_update_tags_with_http_info(resource_group_name, network_interface_name, parameters, custom_headers:nil) begin_update_tags_async(resource_group_name, network_interface_name, parameters, custom_headers:custom_headers).value! end
ruby
def begin_update_tags_with_http_info(resource_group_name, network_interface_name, parameters, custom_headers:nil) begin_update_tags_async(resource_group_name, network_interface_name, parameters, custom_headers:custom_headers).value! end
[ "def", "begin_update_tags_with_http_info", "(", "resource_group_name", ",", "network_interface_name", ",", "parameters", ",", "custom_headers", ":", "nil", ")", "begin_update_tags_async", "(", "resource_group_name", ",", "network_interface_name", ",", "parameters", ",", "custom_headers", ":", "custom_headers", ")", ".", "value!", "end" ]
Updates a network interface tags. @param resource_group_name [String] The name of the resource group. @param network_interface_name [String] The name of the network interface. @param parameters [TagsObject] Parameters supplied to update network interface tags. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request. @return [MsRestAzure::AzureOperationResponse] HTTP response information.
[ "Updates", "a", "network", "interface", "tags", "." ]
78eedacf8f8cbd65c2d8a2af421405eaa4373d8e
https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/network_interfaces.rb#L731-L733
train
Azure/azure-sdk-for-ruby
management/azure_mgmt_resources/lib/2016-02-01/generated/azure_mgmt_resources/providers.rb
Azure::Resources::Mgmt::V2016_02_01.Providers.unregister
def unregister(resource_provider_namespace, custom_headers:nil) response = unregister_async(resource_provider_namespace, custom_headers:custom_headers).value! response.body unless response.nil? end
ruby
def unregister(resource_provider_namespace, custom_headers:nil) response = unregister_async(resource_provider_namespace, custom_headers:custom_headers).value! response.body unless response.nil? end
[ "def", "unregister", "(", "resource_provider_namespace", ",", "custom_headers", ":", "nil", ")", "response", "=", "unregister_async", "(", "resource_provider_namespace", ",", "custom_headers", ":", "custom_headers", ")", ".", "value!", "response", ".", "body", "unless", "response", ".", "nil?", "end" ]
Unregisters provider from a subscription. @param resource_provider_namespace [String] Namespace of the resource provider. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request. @return [Provider] operation results.
[ "Unregisters", "provider", "from", "a", "subscription", "." ]
78eedacf8f8cbd65c2d8a2af421405eaa4373d8e
https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_resources/lib/2016-02-01/generated/azure_mgmt_resources/providers.rb#L34-L37
train
Azure/azure-sdk-for-ruby
management/azure_mgmt_resources/lib/2016-02-01/generated/azure_mgmt_resources/providers.rb
Azure::Resources::Mgmt::V2016_02_01.Providers.register
def register(resource_provider_namespace, custom_headers:nil) response = register_async(resource_provider_namespace, custom_headers:custom_headers).value! response.body unless response.nil? end
ruby
def register(resource_provider_namespace, custom_headers:nil) response = register_async(resource_provider_namespace, custom_headers:custom_headers).value! response.body unless response.nil? end
[ "def", "register", "(", "resource_provider_namespace", ",", "custom_headers", ":", "nil", ")", "response", "=", "register_async", "(", "resource_provider_namespace", ",", "custom_headers", ":", "custom_headers", ")", ".", "value!", "response", ".", "body", "unless", "response", ".", "nil?", "end" ]
Registers provider to be used with a subscription. @param resource_provider_namespace [String] Namespace of the resource provider. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request. @return [Provider] operation results.
[ "Registers", "provider", "to", "be", "used", "with", "a", "subscription", "." ]
78eedacf8f8cbd65c2d8a2af421405eaa4373d8e
https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_resources/lib/2016-02-01/generated/azure_mgmt_resources/providers.rb#L125-L128
train
Azure/azure-sdk-for-ruby
management/azure_mgmt_resources/lib/2016-02-01/generated/azure_mgmt_resources/providers.rb
Azure::Resources::Mgmt::V2016_02_01.Providers.get_with_http_info
def get_with_http_info(resource_provider_namespace, expand:nil, custom_headers:nil) get_async(resource_provider_namespace, expand:expand, custom_headers:custom_headers).value! end
ruby
def get_with_http_info(resource_provider_namespace, expand:nil, custom_headers:nil) get_async(resource_provider_namespace, expand:expand, custom_headers:custom_headers).value! end
[ "def", "get_with_http_info", "(", "resource_provider_namespace", ",", "expand", ":", "nil", ",", "custom_headers", ":", "nil", ")", "get_async", "(", "resource_provider_namespace", ",", "expand", ":", "expand", ",", "custom_headers", ":", "custom_headers", ")", ".", "value!", "end" ]
Gets a resource provider. @param resource_provider_namespace [String] Namespace of the resource provider. @param expand [String] The $expand query parameter. e.g. To include property aliases in response, use $expand=resourceTypes/aliases. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request. @return [MsRestAzure::AzureOperationResponse] HTTP response information.
[ "Gets", "a", "resource", "provider", "." ]
78eedacf8f8cbd65c2d8a2af421405eaa4373d8e
https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_resources/lib/2016-02-01/generated/azure_mgmt_resources/providers.rb#L331-L333
train
Azure/azure-sdk-for-ruby
management/azure_mgmt_logic/lib/2016-06-01/generated/azure_mgmt_logic/certificates.rb
Azure::Logic::Mgmt::V2016_06_01.Certificates.get_with_http_info
def get_with_http_info(resource_group_name, integration_account_name, certificate_name, custom_headers:nil) get_async(resource_group_name, integration_account_name, certificate_name, custom_headers:custom_headers).value! end
ruby
def get_with_http_info(resource_group_name, integration_account_name, certificate_name, custom_headers:nil) get_async(resource_group_name, integration_account_name, certificate_name, custom_headers:custom_headers).value! end
[ "def", "get_with_http_info", "(", "resource_group_name", ",", "integration_account_name", ",", "certificate_name", ",", "custom_headers", ":", "nil", ")", "get_async", "(", "resource_group_name", ",", "integration_account_name", ",", "certificate_name", ",", "custom_headers", ":", "custom_headers", ")", ".", "value!", "end" ]
Gets an integration account certificate. @param resource_group_name [String] The resource group name. @param integration_account_name [String] The integration account name. @param certificate_name [String] The integration account certificate name. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request. @return [MsRestAzure::AzureOperationResponse] HTTP response information.
[ "Gets", "an", "integration", "account", "certificate", "." ]
78eedacf8f8cbd65c2d8a2af421405eaa4373d8e
https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_logic/lib/2016-06-01/generated/azure_mgmt_logic/certificates.rb#L146-L148
train
Azure/azure-sdk-for-ruby
management/azure_mgmt_logic/lib/2016-06-01/generated/azure_mgmt_logic/certificates.rb
Azure::Logic::Mgmt::V2016_06_01.Certificates.delete_with_http_info
def delete_with_http_info(resource_group_name, integration_account_name, certificate_name, custom_headers:nil) delete_async(resource_group_name, integration_account_name, certificate_name, custom_headers:custom_headers).value! end
ruby
def delete_with_http_info(resource_group_name, integration_account_name, certificate_name, custom_headers:nil) delete_async(resource_group_name, integration_account_name, certificate_name, custom_headers:custom_headers).value! end
[ "def", "delete_with_http_info", "(", "resource_group_name", ",", "integration_account_name", ",", "certificate_name", ",", "custom_headers", ":", "nil", ")", "delete_async", "(", "resource_group_name", ",", "integration_account_name", ",", "certificate_name", ",", "custom_headers", ":", "custom_headers", ")", ".", "value!", "end" ]
Deletes an integration account certificate. @param resource_group_name [String] The resource group name. @param integration_account_name [String] The integration account name. @param certificate_name [String] The integration account certificate name. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request. @return [MsRestAzure::AzureOperationResponse] HTTP response information.
[ "Deletes", "an", "integration", "account", "certificate", "." ]
78eedacf8f8cbd65c2d8a2af421405eaa4373d8e
https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_logic/lib/2016-06-01/generated/azure_mgmt_logic/certificates.rb#L361-L363
train
Azure/azure-sdk-for-ruby
management/azure_mgmt_network/lib/2019-02-01/generated/azure_mgmt_network/load_balancer_outbound_rules.rb
Azure::Network::Mgmt::V2019_02_01.LoadBalancerOutboundRules.get_with_http_info
def get_with_http_info(resource_group_name, load_balancer_name, outbound_rule_name, custom_headers:nil) get_async(resource_group_name, load_balancer_name, outbound_rule_name, custom_headers:custom_headers).value! end
ruby
def get_with_http_info(resource_group_name, load_balancer_name, outbound_rule_name, custom_headers:nil) get_async(resource_group_name, load_balancer_name, outbound_rule_name, custom_headers:custom_headers).value! end
[ "def", "get_with_http_info", "(", "resource_group_name", ",", "load_balancer_name", ",", "outbound_rule_name", ",", "custom_headers", ":", "nil", ")", "get_async", "(", "resource_group_name", ",", "load_balancer_name", ",", "outbound_rule_name", ",", "custom_headers", ":", "custom_headers", ")", ".", "value!", "end" ]
Gets the specified load balancer outbound rule. @param resource_group_name [String] The name of the resource group. @param load_balancer_name [String] The name of the load balancer. @param outbound_rule_name [String] The name of the outbound rule. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request. @return [MsRestAzure::AzureOperationResponse] HTTP response information.
[ "Gets", "the", "specified", "load", "balancer", "outbound", "rule", "." ]
78eedacf8f8cbd65c2d8a2af421405eaa4373d8e
https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2019-02-01/generated/azure_mgmt_network/load_balancer_outbound_rules.rb#L143-L145
train
Azure/azure-sdk-for-ruby
management/azure_mgmt_policy/lib/2015-10-01-preview/generated/azure_mgmt_policy/policy_assignments.rb
Azure::Policy::Mgmt::V2015_10_01_preview.PolicyAssignments.create_with_http_info
def create_with_http_info(scope, policy_assignment_name, parameters, custom_headers:nil) create_async(scope, policy_assignment_name, parameters, custom_headers:custom_headers).value! end
ruby
def create_with_http_info(scope, policy_assignment_name, parameters, custom_headers:nil) create_async(scope, policy_assignment_name, parameters, custom_headers:custom_headers).value! end
[ "def", "create_with_http_info", "(", "scope", ",", "policy_assignment_name", ",", "parameters", ",", "custom_headers", ":", "nil", ")", "create_async", "(", "scope", ",", "policy_assignment_name", ",", "parameters", ",", "custom_headers", ":", "custom_headers", ")", ".", "value!", "end" ]
Creates a policy assignment. Policy assignments are inherited by child resources. For example, when you apply a policy to a resource group that policy is assigned to all resources in the group. @param scope [String] The scope of the policy assignment. @param policy_assignment_name [String] The name of the policy assignment. @param parameters [PolicyAssignment] Parameters for the policy assignment. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request. @return [MsRestAzure::AzureOperationResponse] HTTP response information.
[ "Creates", "a", "policy", "assignment", "." ]
78eedacf8f8cbd65c2d8a2af421405eaa4373d8e
https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_policy/lib/2015-10-01-preview/generated/azure_mgmt_policy/policy_assignments.rb#L155-L157
train
Azure/azure-sdk-for-ruby
management/azure_mgmt_policy/lib/2015-10-01-preview/generated/azure_mgmt_policy/policy_assignments.rb
Azure::Policy::Mgmt::V2015_10_01_preview.PolicyAssignments.delete_by_id
def delete_by_id(policy_assignment_id, custom_headers:nil) response = delete_by_id_async(policy_assignment_id, custom_headers:custom_headers).value! response.body unless response.nil? end
ruby
def delete_by_id(policy_assignment_id, custom_headers:nil) response = delete_by_id_async(policy_assignment_id, custom_headers:custom_headers).value! response.body unless response.nil? end
[ "def", "delete_by_id", "(", "policy_assignment_id", ",", "custom_headers", ":", "nil", ")", "response", "=", "delete_by_id_async", "(", "policy_assignment_id", ",", "custom_headers", ":", "custom_headers", ")", ".", "value!", "response", ".", "body", "unless", "response", ".", "nil?", "end" ]
Deletes a policy assignment by ID. When providing a scope for the assignment, use '/subscriptions/{subscription-id}/' for subscriptions, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for resource groups, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' for resources. @param policy_assignment_id [String] The ID of the policy assignment to delete. Use the format '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request. @return [PolicyAssignment] operation results.
[ "Deletes", "a", "policy", "assignment", "by", "ID", "." ]
78eedacf8f8cbd65c2d8a2af421405eaa4373d8e
https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_policy/lib/2015-10-01-preview/generated/azure_mgmt_policy/policy_assignments.rb#L653-L656
train
Azure/azure-sdk-for-ruby
management/azure_mgmt_policy/lib/2015-10-01-preview/generated/azure_mgmt_policy/policy_assignments.rb
Azure::Policy::Mgmt::V2015_10_01_preview.PolicyAssignments.get_by_id
def get_by_id(policy_assignment_id, custom_headers:nil) response = get_by_id_async(policy_assignment_id, custom_headers:custom_headers).value! response.body unless response.nil? end
ruby
def get_by_id(policy_assignment_id, custom_headers:nil) response = get_by_id_async(policy_assignment_id, custom_headers:custom_headers).value! response.body unless response.nil? end
[ "def", "get_by_id", "(", "policy_assignment_id", ",", "custom_headers", ":", "nil", ")", "response", "=", "get_by_id_async", "(", "policy_assignment_id", ",", "custom_headers", ":", "custom_headers", ")", ".", "value!", "response", ".", "body", "unless", "response", ".", "nil?", "end" ]
Gets a policy assignment by ID. When providing a scope for the assignment, use '/subscriptions/{subscription-id}/' for subscriptions, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for resource groups, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' for resources. @param policy_assignment_id [String] The ID of the policy assignment to get. Use the format '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request. @return [PolicyAssignment] operation results.
[ "Gets", "a", "policy", "assignment", "by", "ID", "." ]
78eedacf8f8cbd65c2d8a2af421405eaa4373d8e
https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_policy/lib/2015-10-01-preview/generated/azure_mgmt_policy/policy_assignments.rb#L898-L901
train
wvanbergen/request-log-analyzer
lib/request_log_analyzer/tracker/numeric_value.rb
RequestLogAnalyzer::Tracker.NumericValue.prepare
def prepare fail "No value field set up for numeric tracker #{inspect}" unless options[:value] fail "No categorizer set up for numeric tracker #{inspect}" unless options[:category] unless options[:multiple] @categorizer = create_lambda(options[:category]) @valueizer = create_lambda(options[:value]) end @number_of_buckets = options[:number_of_buckets] || 1000 @min_bucket_value = options[:min_bucket_value] ? options[:min_bucket_value].to_f : 0.000001 @max_bucket_value = options[:max_bucket_value] ? options[:max_bucket_value].to_f : 1_000_000_000 # precalculate the bucket size @bucket_size = (Math.log(@max_bucket_value) - Math.log(@min_bucket_value)) / @number_of_buckets.to_f @categories = {} end
ruby
def prepare fail "No value field set up for numeric tracker #{inspect}" unless options[:value] fail "No categorizer set up for numeric tracker #{inspect}" unless options[:category] unless options[:multiple] @categorizer = create_lambda(options[:category]) @valueizer = create_lambda(options[:value]) end @number_of_buckets = options[:number_of_buckets] || 1000 @min_bucket_value = options[:min_bucket_value] ? options[:min_bucket_value].to_f : 0.000001 @max_bucket_value = options[:max_bucket_value] ? options[:max_bucket_value].to_f : 1_000_000_000 # precalculate the bucket size @bucket_size = (Math.log(@max_bucket_value) - Math.log(@min_bucket_value)) / @number_of_buckets.to_f @categories = {} end
[ "def", "prepare", "fail", "\"No value field set up for numeric tracker #{inspect}\"", "unless", "options", "[", ":value", "]", "fail", "\"No categorizer set up for numeric tracker #{inspect}\"", "unless", "options", "[", ":category", "]", "unless", "options", "[", ":multiple", "]", "@categorizer", "=", "create_lambda", "(", "options", "[", ":category", "]", ")", "@valueizer", "=", "create_lambda", "(", "options", "[", ":value", "]", ")", "end", "@number_of_buckets", "=", "options", "[", ":number_of_buckets", "]", "||", "1000", "@min_bucket_value", "=", "options", "[", ":min_bucket_value", "]", "?", "options", "[", ":min_bucket_value", "]", ".", "to_f", ":", "0.000001", "@max_bucket_value", "=", "options", "[", ":max_bucket_value", "]", "?", "options", "[", ":max_bucket_value", "]", ".", "to_f", ":", "1_000_000_000", "@bucket_size", "=", "(", "Math", ".", "log", "(", "@max_bucket_value", ")", "-", "Math", ".", "log", "(", "@min_bucket_value", ")", ")", "/", "@number_of_buckets", ".", "to_f", "@categories", "=", "{", "}", "end" ]
Sets up the numeric value tracker. It will check whether the value and category options are set that are used to extract and categorize the values during parsing. Two lambda procedures are created for these tasks
[ "Sets", "up", "the", "numeric", "value", "tracker", ".", "It", "will", "check", "whether", "the", "value", "and", "category", "options", "are", "set", "that", "are", "used", "to", "extract", "and", "categorize", "the", "values", "during", "parsing", ".", "Two", "lambda", "procedures", "are", "created", "for", "these", "tasks" ]
b83865d440278583ac8e4901bb33878244fd7c75
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/tracker/numeric_value.rb#L8-L25
train
wvanbergen/request-log-analyzer
lib/request_log_analyzer/tracker/numeric_value.rb
RequestLogAnalyzer::Tracker.NumericValue.update
def update(request) if options[:multiple] found_categories = request.every(options[:category]) found_values = request.every(options[:value]) fail 'Capture mismatch for multiple values in a request' unless found_categories.length == found_values.length found_categories.each_with_index do |cat, index| update_statistics(cat, found_values[index]) if cat && found_values[index].is_a?(Numeric) end else category = @categorizer.call(request) value = @valueizer.call(request) update_statistics(category, value) if (value.is_a?(Numeric) || value.is_a?(Array)) && category end end
ruby
def update(request) if options[:multiple] found_categories = request.every(options[:category]) found_values = request.every(options[:value]) fail 'Capture mismatch for multiple values in a request' unless found_categories.length == found_values.length found_categories.each_with_index do |cat, index| update_statistics(cat, found_values[index]) if cat && found_values[index].is_a?(Numeric) end else category = @categorizer.call(request) value = @valueizer.call(request) update_statistics(category, value) if (value.is_a?(Numeric) || value.is_a?(Array)) && category end end
[ "def", "update", "(", "request", ")", "if", "options", "[", ":multiple", "]", "found_categories", "=", "request", ".", "every", "(", "options", "[", ":category", "]", ")", "found_values", "=", "request", ".", "every", "(", "options", "[", ":value", "]", ")", "fail", "'Capture mismatch for multiple values in a request'", "unless", "found_categories", ".", "length", "==", "found_values", ".", "length", "found_categories", ".", "each_with_index", "do", "|", "cat", ",", "index", "|", "update_statistics", "(", "cat", ",", "found_values", "[", "index", "]", ")", "if", "cat", "&&", "found_values", "[", "index", "]", ".", "is_a?", "(", "Numeric", ")", "end", "else", "category", "=", "@categorizer", ".", "call", "(", "request", ")", "value", "=", "@valueizer", ".", "call", "(", "request", ")", "update_statistics", "(", "category", ",", "value", ")", "if", "(", "value", ".", "is_a?", "(", "Numeric", ")", "||", "value", ".", "is_a?", "(", "Array", ")", ")", "&&", "category", "end", "end" ]
Get the value information from the request and store it in the respective categories. If a request can contain multiple usable values for this tracker, the :multiple option should be set to true. In this case, all the values and respective categories will be read from the request using the #every method from the fields given in the :value and :category option. If the request contains only one suitable value and the :multiple is not set, it will read the single value and category from the fields provided in the :value and :category option, or calculate it with any lambda procedure that is assigned to these options. The request will be passed to procedure as input for the calculation. @param [RequestLogAnalyzer::Request] request The request to get the information from.
[ "Get", "the", "value", "information", "from", "the", "request", "and", "store", "it", "in", "the", "respective", "categories", "." ]
b83865d440278583ac8e4901bb33878244fd7c75
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/tracker/numeric_value.rb#L40-L54
train
wvanbergen/request-log-analyzer
lib/request_log_analyzer/tracker/numeric_value.rb
RequestLogAnalyzer::Tracker.NumericValue.display_value
def display_value(value) return '- ' if value.nil? return '0 ' if value.zero? case [Math.log10(value.abs).floor, 0].max when 0...4 then '%d ' % value when 4...7 then '%dk' % (value / 1000) when 7...10 then '%dM' % (value / 1_000_000) when 10...13 then '%dG' % (value / 1_000_000_000) when 13...16 then '%dT' % (value / 1_000_000_000_000) else '%dP' % (value / 1_000_000_000_000_000) end end
ruby
def display_value(value) return '- ' if value.nil? return '0 ' if value.zero? case [Math.log10(value.abs).floor, 0].max when 0...4 then '%d ' % value when 4...7 then '%dk' % (value / 1000) when 7...10 then '%dM' % (value / 1_000_000) when 10...13 then '%dG' % (value / 1_000_000_000) when 13...16 then '%dT' % (value / 1_000_000_000_000) else '%dP' % (value / 1_000_000_000_000_000) end end
[ "def", "display_value", "(", "value", ")", "return", "'- '", "if", "value", ".", "nil?", "return", "'0 '", "if", "value", ".", "zero?", "case", "[", "Math", ".", "log10", "(", "value", ".", "abs", ")", ".", "floor", ",", "0", "]", ".", "max", "when", "0", "...", "4", "then", "'%d '", "%", "value", "when", "4", "...", "7", "then", "'%dk'", "%", "(", "value", "/", "1000", ")", "when", "7", "...", "10", "then", "'%dM'", "%", "(", "value", "/", "1_000_000", ")", "when", "10", "...", "13", "then", "'%dG'", "%", "(", "value", "/", "1_000_000_000", ")", "when", "13", "...", "16", "then", "'%dT'", "%", "(", "value", "/", "1_000_000_000_000", ")", "else", "'%dP'", "%", "(", "value", "/", "1_000_000_000_000_000", ")", "end", "end" ]
Display a value
[ "Display", "a", "value" ]
b83865d440278583ac8e4901bb33878244fd7c75
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/tracker/numeric_value.rb#L73-L85
train
wvanbergen/request-log-analyzer
lib/request_log_analyzer/tracker/numeric_value.rb
RequestLogAnalyzer::Tracker.NumericValue.title
def title @title ||= begin if options[:title] options[:title] else title_builder = '' title_builder << "#{options[:value]} " if options[:value].is_a?(Symbol) title_builder << (options[:category].is_a?(Symbol) ? "per #{options[:category]}" : 'per request') title_builder end end end
ruby
def title @title ||= begin if options[:title] options[:title] else title_builder = '' title_builder << "#{options[:value]} " if options[:value].is_a?(Symbol) title_builder << (options[:category].is_a?(Symbol) ? "per #{options[:category]}" : 'per request') title_builder end end end
[ "def", "title", "@title", "||=", "begin", "if", "options", "[", ":title", "]", "options", "[", ":title", "]", "else", "title_builder", "=", "''", "title_builder", "<<", "\"#{options[:value]} \"", "if", "options", "[", ":value", "]", ".", "is_a?", "(", "Symbol", ")", "title_builder", "<<", "(", "options", "[", ":category", "]", ".", "is_a?", "(", "Symbol", ")", "?", "\"per #{options[:category]}\"", ":", "'per request'", ")", "title_builder", "end", "end", "end" ]
Returns the title of this tracker for reports
[ "Returns", "the", "title", "of", "this", "tracker", "for", "reports" ]
b83865d440278583ac8e4901bb33878244fd7c75
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/tracker/numeric_value.rb#L104-L115
train
wvanbergen/request-log-analyzer
lib/request_log_analyzer/tracker/numeric_value.rb
RequestLogAnalyzer::Tracker.NumericValue.to_yaml_object
def to_yaml_object return nil if @categories.empty? @categories.each do |cat, info| info[:stddev] = stddev(cat) info[:median] = median(cat) if info[:buckets] info[:interval_95_percent] = percentile_interval(cat, 95) if info[:buckets] end @categories end
ruby
def to_yaml_object return nil if @categories.empty? @categories.each do |cat, info| info[:stddev] = stddev(cat) info[:median] = median(cat) if info[:buckets] info[:interval_95_percent] = percentile_interval(cat, 95) if info[:buckets] end @categories end
[ "def", "to_yaml_object", "return", "nil", "if", "@categories", ".", "empty?", "@categories", ".", "each", "do", "|", "cat", ",", "info", "|", "info", "[", ":stddev", "]", "=", "stddev", "(", "cat", ")", "info", "[", ":median", "]", "=", "median", "(", "cat", ")", "if", "info", "[", ":buckets", "]", "info", "[", ":interval_95_percent", "]", "=", "percentile_interval", "(", "cat", ",", "95", ")", "if", "info", "[", ":buckets", "]", "end", "@categories", "end" ]
Returns all the categories and the tracked duration as a hash than can be exported to YAML
[ "Returns", "all", "the", "categories", "and", "the", "tracked", "duration", "as", "a", "hash", "than", "can", "be", "exported", "to", "YAML" ]
b83865d440278583ac8e4901bb33878244fd7c75
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/tracker/numeric_value.rb#L118-L126
train
wvanbergen/request-log-analyzer
lib/request_log_analyzer/tracker/numeric_value.rb
RequestLogAnalyzer::Tracker.NumericValue.bucket_index
def bucket_index(value) return 0 if value < @min_bucket_value return @number_of_buckets - 1 if value >= @max_bucket_value ((Math.log(value) - Math.log(@min_bucket_value)) / @bucket_size).floor end
ruby
def bucket_index(value) return 0 if value < @min_bucket_value return @number_of_buckets - 1 if value >= @max_bucket_value ((Math.log(value) - Math.log(@min_bucket_value)) / @bucket_size).floor end
[ "def", "bucket_index", "(", "value", ")", "return", "0", "if", "value", "<", "@min_bucket_value", "return", "@number_of_buckets", "-", "1", "if", "value", ">=", "@max_bucket_value", "(", "(", "Math", ".", "log", "(", "value", ")", "-", "Math", ".", "log", "(", "@min_bucket_value", ")", ")", "/", "@bucket_size", ")", ".", "floor", "end" ]
Returns the bucket index for a value
[ "Returns", "the", "bucket", "index", "for", "a", "value" ]
b83865d440278583ac8e4901bb33878244fd7c75
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/tracker/numeric_value.rb#L129-L134
train
wvanbergen/request-log-analyzer
lib/request_log_analyzer/tracker/numeric_value.rb
RequestLogAnalyzer::Tracker.NumericValue.bucket_value
def bucket_value(index, type = nil) case type when :begin, :start, :lower, :lower_bound then bucket_lower_bound(index) when :end, :finish, :upper, :upper_bound then bucket_upper_bound(index) else bucket_average_value(index) end end
ruby
def bucket_value(index, type = nil) case type when :begin, :start, :lower, :lower_bound then bucket_lower_bound(index) when :end, :finish, :upper, :upper_bound then bucket_upper_bound(index) else bucket_average_value(index) end end
[ "def", "bucket_value", "(", "index", ",", "type", "=", "nil", ")", "case", "type", "when", ":begin", ",", ":start", ",", ":lower", ",", ":lower_bound", "then", "bucket_lower_bound", "(", "index", ")", "when", ":end", ",", ":finish", ",", ":upper", ",", ":upper_bound", "then", "bucket_upper_bound", "(", "index", ")", "else", "bucket_average_value", "(", "index", ")", "end", "end" ]
Returns a single value representing a bucket.
[ "Returns", "a", "single", "value", "representing", "a", "bucket", "." ]
b83865d440278583ac8e4901bb33878244fd7c75
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/tracker/numeric_value.rb#L152-L158
train
wvanbergen/request-log-analyzer
lib/request_log_analyzer/tracker/numeric_value.rb
RequestLogAnalyzer::Tracker.NumericValue.percentile_index
def percentile_index(category, x, inclusive = false) total_encountered = 0 @categories[category][:buckets].each_with_index do |count, index| total_encountered += count percentage = ((total_encountered.to_f / hits(category).to_f) * 100).floor return index if (inclusive && percentage >= x) || (!inclusive && percentage > x) end end
ruby
def percentile_index(category, x, inclusive = false) total_encountered = 0 @categories[category][:buckets].each_with_index do |count, index| total_encountered += count percentage = ((total_encountered.to_f / hits(category).to_f) * 100).floor return index if (inclusive && percentage >= x) || (!inclusive && percentage > x) end end
[ "def", "percentile_index", "(", "category", ",", "x", ",", "inclusive", "=", "false", ")", "total_encountered", "=", "0", "@categories", "[", "category", "]", "[", ":buckets", "]", ".", "each_with_index", "do", "|", "count", ",", "index", "|", "total_encountered", "+=", "count", "percentage", "=", "(", "(", "total_encountered", ".", "to_f", "/", "hits", "(", "category", ")", ".", "to_f", ")", "*", "100", ")", ".", "floor", "return", "index", "if", "(", "inclusive", "&&", "percentage", ">=", "x", ")", "||", "(", "!", "inclusive", "&&", "percentage", ">", "x", ")", "end", "end" ]
Returns the upper bound value that would include x% of the hits.
[ "Returns", "the", "upper", "bound", "value", "that", "would", "include", "x%", "of", "the", "hits", "." ]
b83865d440278583ac8e4901bb33878244fd7c75
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/tracker/numeric_value.rb#L171-L178
train
wvanbergen/request-log-analyzer
lib/request_log_analyzer/tracker/numeric_value.rb
RequestLogAnalyzer::Tracker.NumericValue.percentile_interval
def percentile_interval(category, x) case x when Range lower, upper = percentile_indices(category, x.begin, x.end) Range.new(bucket_lower_bound(lower), bucket_upper_bound(upper)) when Numeric percentile_interval(category, Range.new((100 - x) / 2, (100 - (100 - x) / 2))) else fail 'What does it mean?' end end
ruby
def percentile_interval(category, x) case x when Range lower, upper = percentile_indices(category, x.begin, x.end) Range.new(bucket_lower_bound(lower), bucket_upper_bound(upper)) when Numeric percentile_interval(category, Range.new((100 - x) / 2, (100 - (100 - x) / 2))) else fail 'What does it mean?' end end
[ "def", "percentile_interval", "(", "category", ",", "x", ")", "case", "x", "when", "Range", "lower", ",", "upper", "=", "percentile_indices", "(", "category", ",", "x", ".", "begin", ",", "x", ".", "end", ")", "Range", ".", "new", "(", "bucket_lower_bound", "(", "lower", ")", ",", "bucket_upper_bound", "(", "upper", ")", ")", "when", "Numeric", "percentile_interval", "(", "category", ",", "Range", ".", "new", "(", "(", "100", "-", "x", ")", "/", "2", ",", "(", "100", "-", "(", "100", "-", "x", ")", "/", "2", ")", ")", ")", "else", "fail", "'What does it mean?'", "end", "end" ]
Returns a percentile interval, i.e. the lower bound and the upper bound of the values that represent the x%-interval for the bucketized dataset. A 90% interval means that 5% of the values would have been lower than the lower bound and 5% would have been higher than the upper bound, leaving 90% of the values within the bounds. You can also provide a Range to specify the lower bound and upper bound percentages (e.g. 5..95).
[ "Returns", "a", "percentile", "interval", "i", ".", "e", ".", "the", "lower", "bound", "and", "the", "upper", "bound", "of", "the", "values", "that", "represent", "the", "x%", "-", "interval", "for", "the", "bucketized", "dataset", "." ]
b83865d440278583ac8e4901bb33878244fd7c75
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/tracker/numeric_value.rb#L209-L219
train
wvanbergen/request-log-analyzer
lib/request_log_analyzer/tracker/numeric_value.rb
RequestLogAnalyzer::Tracker.NumericValue.statistics_header
def statistics_header(options) [ { title: options[:title], width: :rest }, { title: 'Hits', align: :right, highlight: (options[:highlight] == :hits), min_width: 4 }, { title: 'Sum', align: :right, highlight: (options[:highlight] == :sum), min_width: 6 }, { title: 'Mean', align: :right, highlight: (options[:highlight] == :mean), min_width: 6 }, { title: 'StdDev', align: :right, highlight: (options[:highlight] == :stddev), min_width: 6 }, { title: 'Min', align: :right, highlight: (options[:highlight] == :min), min_width: 6 }, { title: 'Max', align: :right, highlight: (options[:highlight] == :max), min_width: 6 }, { title: '95 %tile', align: :right, highlight: (options[:highlight] == :percentile_interval), min_width: 11 } ] end
ruby
def statistics_header(options) [ { title: options[:title], width: :rest }, { title: 'Hits', align: :right, highlight: (options[:highlight] == :hits), min_width: 4 }, { title: 'Sum', align: :right, highlight: (options[:highlight] == :sum), min_width: 6 }, { title: 'Mean', align: :right, highlight: (options[:highlight] == :mean), min_width: 6 }, { title: 'StdDev', align: :right, highlight: (options[:highlight] == :stddev), min_width: 6 }, { title: 'Min', align: :right, highlight: (options[:highlight] == :min), min_width: 6 }, { title: 'Max', align: :right, highlight: (options[:highlight] == :max), min_width: 6 }, { title: '95 %tile', align: :right, highlight: (options[:highlight] == :percentile_interval), min_width: 11 } ] end
[ "def", "statistics_header", "(", "options", ")", "[", "{", "title", ":", "options", "[", ":title", "]", ",", "width", ":", ":rest", "}", ",", "{", "title", ":", "'Hits'", ",", "align", ":", ":right", ",", "highlight", ":", "(", "options", "[", ":highlight", "]", "==", ":hits", ")", ",", "min_width", ":", "4", "}", ",", "{", "title", ":", "'Sum'", ",", "align", ":", ":right", ",", "highlight", ":", "(", "options", "[", ":highlight", "]", "==", ":sum", ")", ",", "min_width", ":", "6", "}", ",", "{", "title", ":", "'Mean'", ",", "align", ":", ":right", ",", "highlight", ":", "(", "options", "[", ":highlight", "]", "==", ":mean", ")", ",", "min_width", ":", "6", "}", ",", "{", "title", ":", "'StdDev'", ",", "align", ":", ":right", ",", "highlight", ":", "(", "options", "[", ":highlight", "]", "==", ":stddev", ")", ",", "min_width", ":", "6", "}", ",", "{", "title", ":", "'Min'", ",", "align", ":", ":right", ",", "highlight", ":", "(", "options", "[", ":highlight", "]", "==", ":min", ")", ",", "min_width", ":", "6", "}", ",", "{", "title", ":", "'Max'", ",", "align", ":", ":right", ",", "highlight", ":", "(", "options", "[", ":highlight", "]", "==", ":max", ")", ",", "min_width", ":", "6", "}", ",", "{", "title", ":", "'95 %tile'", ",", "align", ":", ":right", ",", "highlight", ":", "(", "options", "[", ":highlight", "]", "==", ":percentile_interval", ")", ",", "min_width", ":", "11", "}", "]", "end" ]
Returns the column header for a statistics table to report on the statistics result
[ "Returns", "the", "column", "header", "for", "a", "statistics", "table", "to", "report", "on", "the", "statistics", "result" ]
b83865d440278583ac8e4901bb33878244fd7c75
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/tracker/numeric_value.rb#L311-L322
train
wvanbergen/request-log-analyzer
lib/request_log_analyzer/tracker/numeric_value.rb
RequestLogAnalyzer::Tracker.NumericValue.statistics_row
def statistics_row(cat) [cat, hits(cat), display_value(sum(cat)), display_value(mean(cat)), display_value(stddev(cat)), display_value(min(cat)), display_value(max(cat)), display_value(percentile_interval(cat, 95).begin) + '-' + display_value(percentile_interval(cat, 95).end)] end
ruby
def statistics_row(cat) [cat, hits(cat), display_value(sum(cat)), display_value(mean(cat)), display_value(stddev(cat)), display_value(min(cat)), display_value(max(cat)), display_value(percentile_interval(cat, 95).begin) + '-' + display_value(percentile_interval(cat, 95).end)] end
[ "def", "statistics_row", "(", "cat", ")", "[", "cat", ",", "hits", "(", "cat", ")", ",", "display_value", "(", "sum", "(", "cat", ")", ")", ",", "display_value", "(", "mean", "(", "cat", ")", ")", ",", "display_value", "(", "stddev", "(", "cat", ")", ")", ",", "display_value", "(", "min", "(", "cat", ")", ")", ",", "display_value", "(", "max", "(", "cat", ")", ")", ",", "display_value", "(", "percentile_interval", "(", "cat", ",", "95", ")", ".", "begin", ")", "+", "'-'", "+", "display_value", "(", "percentile_interval", "(", "cat", ",", "95", ")", ".", "end", ")", "]", "end" ]
Returns a row of statistics information for a report table, given a category
[ "Returns", "a", "row", "of", "statistics", "information", "for", "a", "report", "table", "given", "a", "category" ]
b83865d440278583ac8e4901bb33878244fd7c75
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/tracker/numeric_value.rb#L325-L329
train
wvanbergen/request-log-analyzer
lib/request_log_analyzer/source/log_parser.rb
RequestLogAnalyzer::Source.LogParser.decompress_file?
def decompress_file?(filename) nice_command = 'nice -n 5' return "#{nice_command} gunzip -c -d #{filename}" if filename.match(/\.tar.gz$/) || filename.match(/\.tgz$/) || filename.match(/\.gz$/) return "#{nice_command} bunzip2 -c -d #{filename}" if filename.match(/\.bz2$/) return "#{nice_command} unzip -p #{filename}" if filename.match(/\.zip$/) '' end
ruby
def decompress_file?(filename) nice_command = 'nice -n 5' return "#{nice_command} gunzip -c -d #{filename}" if filename.match(/\.tar.gz$/) || filename.match(/\.tgz$/) || filename.match(/\.gz$/) return "#{nice_command} bunzip2 -c -d #{filename}" if filename.match(/\.bz2$/) return "#{nice_command} unzip -p #{filename}" if filename.match(/\.zip$/) '' end
[ "def", "decompress_file?", "(", "filename", ")", "nice_command", "=", "'nice -n 5'", "return", "\"#{nice_command} gunzip -c -d #{filename}\"", "if", "filename", ".", "match", "(", "/", "\\.", "/", ")", "||", "filename", ".", "match", "(", "/", "\\.", "/", ")", "||", "filename", ".", "match", "(", "/", "\\.", "/", ")", "return", "\"#{nice_command} bunzip2 -c -d #{filename}\"", "if", "filename", ".", "match", "(", "/", "\\.", "/", ")", "return", "\"#{nice_command} unzip -p #{filename}\"", "if", "filename", ".", "match", "(", "/", "\\.", "/", ")", "''", "end" ]
Check if a file has a compressed extention in the filename. If recognized, return the command string used to decompress the file
[ "Check", "if", "a", "file", "has", "a", "compressed", "extention", "in", "the", "filename", ".", "If", "recognized", "return", "the", "command", "string", "used", "to", "decompress", "the", "file" ]
b83865d440278583ac8e4901bb33878244fd7c75
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/source/log_parser.rb#L97-L105
train
wvanbergen/request-log-analyzer
lib/request_log_analyzer/source/log_parser.rb
RequestLogAnalyzer::Source.LogParser.parse_file
def parse_file(file, options = {}, &block) if File.directory?(file) parse_files(Dir["#{ file }/*"], options, &block) return end @current_source = File.expand_path(file) @source_changes_handler.call(:started, @current_source) if @source_changes_handler if decompress_file?(file).empty? @progress_handler = @dormant_progress_handler @progress_handler.call(:started, file) if @progress_handler File.open(file, 'rb') { |f| parse_io(f, options, &block) } @progress_handler.call(:finished, file) if @progress_handler @progress_handler = nil @processed_files.push(@current_source.dup) else IO.popen(decompress_file?(file), 'rb') { |f| parse_io(f, options, &block) } end @source_changes_handler.call(:finished, @current_source) if @source_changes_handler @current_source = nil end
ruby
def parse_file(file, options = {}, &block) if File.directory?(file) parse_files(Dir["#{ file }/*"], options, &block) return end @current_source = File.expand_path(file) @source_changes_handler.call(:started, @current_source) if @source_changes_handler if decompress_file?(file).empty? @progress_handler = @dormant_progress_handler @progress_handler.call(:started, file) if @progress_handler File.open(file, 'rb') { |f| parse_io(f, options, &block) } @progress_handler.call(:finished, file) if @progress_handler @progress_handler = nil @processed_files.push(@current_source.dup) else IO.popen(decompress_file?(file), 'rb') { |f| parse_io(f, options, &block) } end @source_changes_handler.call(:finished, @current_source) if @source_changes_handler @current_source = nil end
[ "def", "parse_file", "(", "file", ",", "options", "=", "{", "}", ",", "&", "block", ")", "if", "File", ".", "directory?", "(", "file", ")", "parse_files", "(", "Dir", "[", "\"#{ file }/*\"", "]", ",", "options", ",", "&", "block", ")", "return", "end", "@current_source", "=", "File", ".", "expand_path", "(", "file", ")", "@source_changes_handler", ".", "call", "(", ":started", ",", "@current_source", ")", "if", "@source_changes_handler", "if", "decompress_file?", "(", "file", ")", ".", "empty?", "@progress_handler", "=", "@dormant_progress_handler", "@progress_handler", ".", "call", "(", ":started", ",", "file", ")", "if", "@progress_handler", "File", ".", "open", "(", "file", ",", "'rb'", ")", "{", "|", "f", "|", "parse_io", "(", "f", ",", "options", ",", "&", "block", ")", "}", "@progress_handler", ".", "call", "(", ":finished", ",", "file", ")", "if", "@progress_handler", "@progress_handler", "=", "nil", "@processed_files", ".", "push", "(", "@current_source", ".", "dup", ")", "else", "IO", ".", "popen", "(", "decompress_file?", "(", "file", ")", ",", "'rb'", ")", "{", "|", "f", "|", "parse_io", "(", "f", ",", "options", ",", "&", "block", ")", "}", "end", "@source_changes_handler", ".", "call", "(", ":finished", ",", "@current_source", ")", "if", "@source_changes_handler", "@current_source", "=", "nil", "end" ]
Parses a log file. Creates an IO stream for the provided file, and sends it to parse_io for further handling. This method supports progress updates that can be used to display a progressbar If the logfile is compressed, it is uncompressed to stdout and read. TODO: Check if IO.popen encounters problems with the given command line. TODO: Fix progress bar that is broken for IO.popen, as it returns a single string. <tt>file</tt>:: The file that should be parsed. <tt>options</tt>:: A Hash of options that will be pased to parse_io.
[ "Parses", "a", "log", "file", ".", "Creates", "an", "IO", "stream", "for", "the", "provided", "file", "and", "sends", "it", "to", "parse_io", "for", "further", "handling", ".", "This", "method", "supports", "progress", "updates", "that", "can", "be", "used", "to", "display", "a", "progressbar" ]
b83865d440278583ac8e4901bb33878244fd7c75
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/source/log_parser.rb#L116-L144
train
wvanbergen/request-log-analyzer
lib/request_log_analyzer/source/log_parser.rb
RequestLogAnalyzer::Source.LogParser.update_current_request
def update_current_request(request_data, &block) # :yields: request if alternative_header_line?(request_data) if @current_request @current_request << request_data else @current_request = @file_format.request(request_data) end elsif header_line?(request_data) if @current_request case options[:parse_strategy] when 'assume-correct' handle_request(@current_request, &block) @current_request = @file_format.request(request_data) when 'cautious' @skipped_lines += 1 warn(:unclosed_request, "Encountered header line (#{request_data[:line_definition].name.inspect}), but previous request was not closed!") @current_request = nil # remove all data that was parsed, skip next request as well. end elsif footer_line?(request_data) handle_request(@file_format.request(request_data), &block) else @current_request = @file_format.request(request_data) end else if @current_request @current_request << request_data if footer_line?(request_data) handle_request(@current_request, &block) # yield @current_request @current_request = nil end else @skipped_lines += 1 warn(:no_current_request, "Parseable line (#{request_data[:line_definition].name.inspect}) found outside of a request!") end end end
ruby
def update_current_request(request_data, &block) # :yields: request if alternative_header_line?(request_data) if @current_request @current_request << request_data else @current_request = @file_format.request(request_data) end elsif header_line?(request_data) if @current_request case options[:parse_strategy] when 'assume-correct' handle_request(@current_request, &block) @current_request = @file_format.request(request_data) when 'cautious' @skipped_lines += 1 warn(:unclosed_request, "Encountered header line (#{request_data[:line_definition].name.inspect}), but previous request was not closed!") @current_request = nil # remove all data that was parsed, skip next request as well. end elsif footer_line?(request_data) handle_request(@file_format.request(request_data), &block) else @current_request = @file_format.request(request_data) end else if @current_request @current_request << request_data if footer_line?(request_data) handle_request(@current_request, &block) # yield @current_request @current_request = nil end else @skipped_lines += 1 warn(:no_current_request, "Parseable line (#{request_data[:line_definition].name.inspect}) found outside of a request!") end end end
[ "def", "update_current_request", "(", "request_data", ",", "&", "block", ")", "if", "alternative_header_line?", "(", "request_data", ")", "if", "@current_request", "@current_request", "<<", "request_data", "else", "@current_request", "=", "@file_format", ".", "request", "(", "request_data", ")", "end", "elsif", "header_line?", "(", "request_data", ")", "if", "@current_request", "case", "options", "[", ":parse_strategy", "]", "when", "'assume-correct'", "handle_request", "(", "@current_request", ",", "&", "block", ")", "@current_request", "=", "@file_format", ".", "request", "(", "request_data", ")", "when", "'cautious'", "@skipped_lines", "+=", "1", "warn", "(", ":unclosed_request", ",", "\"Encountered header line (#{request_data[:line_definition].name.inspect}), but previous request was not closed!\"", ")", "@current_request", "=", "nil", "end", "elsif", "footer_line?", "(", "request_data", ")", "handle_request", "(", "@file_format", ".", "request", "(", "request_data", ")", ",", "&", "block", ")", "else", "@current_request", "=", "@file_format", ".", "request", "(", "request_data", ")", "end", "else", "if", "@current_request", "@current_request", "<<", "request_data", "if", "footer_line?", "(", "request_data", ")", "handle_request", "(", "@current_request", ",", "&", "block", ")", "@current_request", "=", "nil", "end", "else", "@skipped_lines", "+=", "1", "warn", "(", ":no_current_request", ",", "\"Parseable line (#{request_data[:line_definition].name.inspect}) found outside of a request!\"", ")", "end", "end", "end" ]
Combines the different lines of a request into a single Request object. It will start a new request when a header line is encountered en will emit the request when a footer line is encountered. Combining the lines is done using heuristics. Problems can occur in this process. The current parse strategy defines how these cases are handled. When using the 'assume-correct' parse strategy (default): - Every line that is parsed before a header line is ignored as it cannot be included in any request. It will emit a :no_current_request warning. - If a header line is found before the previous requests was closed, the previous request will be yielded and a new request will be started. When using the 'cautious' parse strategy: - Every line that is parsed before a header line is ignored as it cannot be included in any request. It will emit a :no_current_request warning. - A header line that is parsed before a request is closed by a footer line, is a sign of an unproperly ordered file. All data that is gathered for the request until then is discarded and the next request is ignored as well. An :unclosed_request warning is emitted. <tt>request_data</tt>:: A hash of data that was parsed from the last line.
[ "Combines", "the", "different", "lines", "of", "a", "request", "into", "a", "single", "Request", "object", ".", "It", "will", "start", "a", "new", "request", "when", "a", "header", "line", "is", "encountered", "en", "will", "emit", "the", "request", "when", "a", "footer", "line", "is", "encountered", "." ]
b83865d440278583ac8e4901bb33878244fd7c75
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/source/log_parser.rb#L285-L320
train
wvanbergen/request-log-analyzer
lib/request_log_analyzer/source/log_parser.rb
RequestLogAnalyzer::Source.LogParser.handle_request
def handle_request(request, &_block) # :yields: :request, request @parsed_requests += 1 request.validate accepted = block_given? ? yield(request) : true @skipped_requests += 1 unless accepted end
ruby
def handle_request(request, &_block) # :yields: :request, request @parsed_requests += 1 request.validate accepted = block_given? ? yield(request) : true @skipped_requests += 1 unless accepted end
[ "def", "handle_request", "(", "request", ",", "&", "_block", ")", "@parsed_requests", "+=", "1", "request", ".", "validate", "accepted", "=", "block_given?", "?", "yield", "(", "request", ")", ":", "true", "@skipped_requests", "+=", "1", "unless", "accepted", "end" ]
Handles the parsed request by sending it into the pipeline. - It will call RequestLogAnalyzer::Request#validate on the request instance - It will send the request into the pipeline, checking whether it was accepted by all the filters. - It will update the parsed_requests and skipped_requests variables accordingly <tt>request</tt>:: The parsed request instance (RequestLogAnalyzer::Request)
[ "Handles", "the", "parsed", "request", "by", "sending", "it", "into", "the", "pipeline", "." ]
b83865d440278583ac8e4901bb33878244fd7c75
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/source/log_parser.rb#L329-L334
train
wvanbergen/request-log-analyzer
lib/request_log_analyzer/file_format.rb
RequestLogAnalyzer::FileFormat.CommonRegularExpressions.hostname_or_ip_address
def hostname_or_ip_address(blank = false) regexp = Regexp.union(hostname, ip_address) add_blank_option(regexp, blank) end
ruby
def hostname_or_ip_address(blank = false) regexp = Regexp.union(hostname, ip_address) add_blank_option(regexp, blank) end
[ "def", "hostname_or_ip_address", "(", "blank", "=", "false", ")", "regexp", "=", "Regexp", ".", "union", "(", "hostname", ",", "ip_address", ")", "add_blank_option", "(", "regexp", ",", "blank", ")", "end" ]
Creates a regular expression to match a hostname or ip address
[ "Creates", "a", "regular", "expression", "to", "match", "a", "hostname", "or", "ip", "address" ]
b83865d440278583ac8e4901bb33878244fd7c75
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/file_format.rb#L134-L137
train
wvanbergen/request-log-analyzer
lib/request_log_analyzer/file_format.rb
RequestLogAnalyzer::FileFormat.CommonRegularExpressions.timestamp
def timestamp(format_string, blank = false) regexp = '' format_string.scan(/([^%]*)(?:%([A-Za-z%]))?/) do |literal, variable| regexp << Regexp.quote(literal) if variable if TIMESTAMP_PARTS.key?(variable) regexp << TIMESTAMP_PARTS[variable] else fail "Unknown variable: %#{variable}" end end end add_blank_option(Regexp.new(regexp), blank) end
ruby
def timestamp(format_string, blank = false) regexp = '' format_string.scan(/([^%]*)(?:%([A-Za-z%]))?/) do |literal, variable| regexp << Regexp.quote(literal) if variable if TIMESTAMP_PARTS.key?(variable) regexp << TIMESTAMP_PARTS[variable] else fail "Unknown variable: %#{variable}" end end end add_blank_option(Regexp.new(regexp), blank) end
[ "def", "timestamp", "(", "format_string", ",", "blank", "=", "false", ")", "regexp", "=", "''", "format_string", ".", "scan", "(", "/", "/", ")", "do", "|", "literal", ",", "variable", "|", "regexp", "<<", "Regexp", ".", "quote", "(", "literal", ")", "if", "variable", "if", "TIMESTAMP_PARTS", ".", "key?", "(", "variable", ")", "regexp", "<<", "TIMESTAMP_PARTS", "[", "variable", "]", "else", "fail", "\"Unknown variable: %#{variable}\"", "end", "end", "end", "add_blank_option", "(", "Regexp", ".", "new", "(", "regexp", ")", ",", "blank", ")", "end" ]
Create a regular expression for a timestamp, generated by a strftime call. Provide the format string to construct a matching regular expression. Set blank to true to allow and empty string, or set blank to a string to set a substitute for the nil value.
[ "Create", "a", "regular", "expression", "for", "a", "timestamp", "generated", "by", "a", "strftime", "call", ".", "Provide", "the", "format", "string", "to", "construct", "a", "matching", "regular", "expression", ".", "Set", "blank", "to", "true", "to", "allow", "and", "empty", "string", "or", "set", "blank", "to", "a", "string", "to", "set", "a", "substitute", "for", "the", "nil", "value", "." ]
b83865d440278583ac8e4901bb33878244fd7c75
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/file_format.rb#L143-L157
train
wvanbergen/request-log-analyzer
lib/request_log_analyzer/file_format.rb
RequestLogAnalyzer::FileFormat.CommonRegularExpressions.add_blank_option
def add_blank_option(regexp, blank) case blank when String then Regexp.union(regexp, Regexp.new(Regexp.quote(blank))) when true then Regexp.union(regexp, //) else regexp end end
ruby
def add_blank_option(regexp, blank) case blank when String then Regexp.union(regexp, Regexp.new(Regexp.quote(blank))) when true then Regexp.union(regexp, //) else regexp end end
[ "def", "add_blank_option", "(", "regexp", ",", "blank", ")", "case", "blank", "when", "String", "then", "Regexp", ".", "union", "(", "regexp", ",", "Regexp", ".", "new", "(", "Regexp", ".", "quote", "(", "blank", ")", ")", ")", "when", "true", "then", "Regexp", ".", "union", "(", "regexp", ",", "/", "/", ")", "else", "regexp", "end", "end" ]
Allow the field to be blank if this option is given. This can be true to allow an empty string or a string alternative for the nil value.
[ "Allow", "the", "field", "to", "be", "blank", "if", "this", "option", "is", "given", ".", "This", "can", "be", "true", "to", "allow", "an", "empty", "string", "or", "a", "string", "alternative", "for", "the", "nil", "value", "." ]
b83865d440278583ac8e4901bb33878244fd7c75
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/file_format.rb#L184-L190
train
wvanbergen/request-log-analyzer
lib/request_log_analyzer/file_format.rb
RequestLogAnalyzer::FileFormat.Base.valid_line_definitions?
def valid_line_definitions? line_definitions.any? { |(_, ld)| ld.header } && line_definitions.any? { |(_, ld)| ld.footer } end
ruby
def valid_line_definitions? line_definitions.any? { |(_, ld)| ld.header } && line_definitions.any? { |(_, ld)| ld.footer } end
[ "def", "valid_line_definitions?", "line_definitions", ".", "any?", "{", "|", "(", "_", ",", "ld", ")", "|", "ld", ".", "header", "}", "&&", "line_definitions", ".", "any?", "{", "|", "(", "_", ",", "ld", ")", "|", "ld", ".", "footer", "}", "end" ]
Checks whether the line definitions form a valid language. A file format should have at least a header and a footer line type
[ "Checks", "whether", "the", "line", "definitions", "form", "a", "valid", "language", ".", "A", "file", "format", "should", "have", "at", "least", "a", "header", "and", "a", "footer", "line", "type" ]
b83865d440278583ac8e4901bb33878244fd7c75
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/file_format.rb#L277-L279
train
wvanbergen/request-log-analyzer
lib/request_log_analyzer/file_format.rb
RequestLogAnalyzer::FileFormat.Base.parse_line
def parse_line(line, &warning_handler) line_definitions.each do |_lt, definition| match = definition.matches(line, &warning_handler) return match if match end nil end
ruby
def parse_line(line, &warning_handler) line_definitions.each do |_lt, definition| match = definition.matches(line, &warning_handler) return match if match end nil end
[ "def", "parse_line", "(", "line", ",", "&", "warning_handler", ")", "line_definitions", ".", "each", "do", "|", "_lt", ",", "definition", "|", "match", "=", "definition", ".", "matches", "(", "line", ",", "&", "warning_handler", ")", "return", "match", "if", "match", "end", "nil", "end" ]
Parses a line by trying to parse it using every line definition in this file format
[ "Parses", "a", "line", "by", "trying", "to", "parse", "it", "using", "every", "line", "definition", "in", "this", "file", "format" ]
b83865d440278583ac8e4901bb33878244fd7c75
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/file_format.rb#L297-L304
train
wvanbergen/request-log-analyzer
lib/request_log_analyzer/aggregator/summarizer.rb
RequestLogAnalyzer::Aggregator.Summarizer.to_yaml
def to_yaml require 'yaml' trackers_export = @trackers.reduce({}) do |export, tracker| export[tracker.title] = tracker.to_yaml_object; export end YAML.dump(trackers_export) end
ruby
def to_yaml require 'yaml' trackers_export = @trackers.reduce({}) do |export, tracker| export[tracker.title] = tracker.to_yaml_object; export end YAML.dump(trackers_export) end
[ "def", "to_yaml", "require", "'yaml'", "trackers_export", "=", "@trackers", ".", "reduce", "(", "{", "}", ")", "do", "|", "export", ",", "tracker", "|", "export", "[", "tracker", ".", "title", "]", "=", "tracker", ".", "to_yaml_object", ";", "export", "end", "YAML", ".", "dump", "(", "trackers_export", ")", "end" ]
Exports all the tracker results to YAML. It will call the to_yaml_object method for every tracker and combines these into a single YAML export.
[ "Exports", "all", "the", "tracker", "results", "to", "YAML", ".", "It", "will", "call", "the", "to_yaml_object", "method", "for", "every", "tracker", "and", "combines", "these", "into", "a", "single", "YAML", "export", "." ]
b83865d440278583ac8e4901bb33878244fd7c75
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/aggregator/summarizer.rb#L80-L86
train
wvanbergen/request-log-analyzer
lib/request_log_analyzer/tracker/frequency.rb
RequestLogAnalyzer::Tracker.Frequency.prepare
def prepare options[:category] = options[:value] if options[:value] && !options[:category] fail "No categorizer set up for category tracker #{inspect}" unless options[:category] @categorizer = create_lambda(options[:category]) unless options[:multiple] # Initialize the categories. Use the list of category names to @categories = {} options[:all_categories].each { |cat| @categories[cat] = 0 } if options[:all_categories].is_a?(Enumerable) end
ruby
def prepare options[:category] = options[:value] if options[:value] && !options[:category] fail "No categorizer set up for category tracker #{inspect}" unless options[:category] @categorizer = create_lambda(options[:category]) unless options[:multiple] # Initialize the categories. Use the list of category names to @categories = {} options[:all_categories].each { |cat| @categories[cat] = 0 } if options[:all_categories].is_a?(Enumerable) end
[ "def", "prepare", "options", "[", ":category", "]", "=", "options", "[", ":value", "]", "if", "options", "[", ":value", "]", "&&", "!", "options", "[", ":category", "]", "fail", "\"No categorizer set up for category tracker #{inspect}\"", "unless", "options", "[", ":category", "]", "@categorizer", "=", "create_lambda", "(", "options", "[", ":category", "]", ")", "unless", "options", "[", ":multiple", "]", "@categories", "=", "{", "}", "options", "[", ":all_categories", "]", ".", "each", "{", "|", "cat", "|", "@categories", "[", "cat", "]", "=", "0", "}", "if", "options", "[", ":all_categories", "]", ".", "is_a?", "(", "Enumerable", ")", "end" ]
Check if categories are set up
[ "Check", "if", "categories", "are", "set", "up" ]
b83865d440278583ac8e4901bb33878244fd7c75
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/tracker/frequency.rb#L26-L35
train
wvanbergen/request-log-analyzer
lib/request_log_analyzer/tracker.rb
RequestLogAnalyzer::Tracker.Base.setup_should_update_checks!
def setup_should_update_checks! @should_update_checks = [] @should_update_checks.push(lambda { |request| request.has_line_type?(options[:line_type]) }) if options[:line_type] @should_update_checks.push(options[:if]) if options[:if].respond_to?(:call) @should_update_checks.push(lambda { |request| request[options[:if]] }) if options[:if].is_a?(Symbol) @should_update_checks.push(lambda { |request| !options[:unless].call(request) }) if options[:unless].respond_to?(:call) @should_update_checks.push(lambda { |request| !request[options[:unless]] }) if options[:unless].is_a?(Symbol) end
ruby
def setup_should_update_checks! @should_update_checks = [] @should_update_checks.push(lambda { |request| request.has_line_type?(options[:line_type]) }) if options[:line_type] @should_update_checks.push(options[:if]) if options[:if].respond_to?(:call) @should_update_checks.push(lambda { |request| request[options[:if]] }) if options[:if].is_a?(Symbol) @should_update_checks.push(lambda { |request| !options[:unless].call(request) }) if options[:unless].respond_to?(:call) @should_update_checks.push(lambda { |request| !request[options[:unless]] }) if options[:unless].is_a?(Symbol) end
[ "def", "setup_should_update_checks!", "@should_update_checks", "=", "[", "]", "@should_update_checks", ".", "push", "(", "lambda", "{", "|", "request", "|", "request", ".", "has_line_type?", "(", "options", "[", ":line_type", "]", ")", "}", ")", "if", "options", "[", ":line_type", "]", "@should_update_checks", ".", "push", "(", "options", "[", ":if", "]", ")", "if", "options", "[", ":if", "]", ".", "respond_to?", "(", ":call", ")", "@should_update_checks", ".", "push", "(", "lambda", "{", "|", "request", "|", "request", "[", "options", "[", ":if", "]", "]", "}", ")", "if", "options", "[", ":if", "]", ".", "is_a?", "(", "Symbol", ")", "@should_update_checks", ".", "push", "(", "lambda", "{", "|", "request", "|", "!", "options", "[", ":unless", "]", ".", "call", "(", "request", ")", "}", ")", "if", "options", "[", ":unless", "]", ".", "respond_to?", "(", ":call", ")", "@should_update_checks", ".", "push", "(", "lambda", "{", "|", "request", "|", "!", "request", "[", "options", "[", ":unless", "]", "]", "}", ")", "if", "options", "[", ":unless", "]", ".", "is_a?", "(", "Symbol", ")", "end" ]
Initialize the class Note that the options are only applicable if should_update? is not overwritten by the inheriting class. === Options * <tt>:if</tt> Handle request if this proc is true for the handled request. * <tt>:unless</tt> Handle request if this proc is false for the handled request. * <tt>:line_type</tt> Line type this tracker will accept. Sets up the tracker's should_update? checks.
[ "Initialize", "the", "class", "Note", "that", "the", "options", "are", "only", "applicable", "if", "should_update?", "is", "not", "overwritten", "by", "the", "inheriting", "class", "." ]
b83865d440278583ac8e4901bb33878244fd7c75
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/tracker.rb#L28-L35
train
wvanbergen/request-log-analyzer
lib/request_log_analyzer/tracker.rb
RequestLogAnalyzer::Tracker.Base.create_lambda
def create_lambda(arg) case arg when Proc then arg when Symbol then lambda { |request| request[arg] } else fail "Canot create a lambda expression from this argument: #{arg.inspect}!" end end
ruby
def create_lambda(arg) case arg when Proc then arg when Symbol then lambda { |request| request[arg] } else fail "Canot create a lambda expression from this argument: #{arg.inspect}!" end end
[ "def", "create_lambda", "(", "arg", ")", "case", "arg", "when", "Proc", "then", "arg", "when", "Symbol", "then", "lambda", "{", "|", "request", "|", "request", "[", "arg", "]", "}", "else", "fail", "\"Canot create a lambda expression from this argument: #{arg.inspect}!\"", "end", "end" ]
Creates a lambda expression to return a static field from a request. If the argument already is a lambda exprssion, it will simply return the argument.
[ "Creates", "a", "lambda", "expression", "to", "return", "a", "static", "field", "from", "a", "request", ".", "If", "the", "argument", "already", "is", "a", "lambda", "exprssion", "it", "will", "simply", "return", "the", "argument", "." ]
b83865d440278583ac8e4901bb33878244fd7c75
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/tracker.rb#L39-L45
train
wvanbergen/request-log-analyzer
lib/request_log_analyzer/line_definition.rb
RequestLogAnalyzer.LineDefinition.match_for
def match_for(line, request, &warning_handler) if match_info = matches(line, &warning_handler) convert_captured_values(match_info[:captures], request) else false end end
ruby
def match_for(line, request, &warning_handler) if match_info = matches(line, &warning_handler) convert_captured_values(match_info[:captures], request) else false end end
[ "def", "match_for", "(", "line", ",", "request", ",", "&", "warning_handler", ")", "if", "match_info", "=", "matches", "(", "line", ",", "&", "warning_handler", ")", "convert_captured_values", "(", "match_info", "[", ":captures", "]", ",", "request", ")", "else", "false", "end", "end" ]
matches the line and converts the captured values using the request's convert_value function.
[ "matches", "the", "line", "and", "converts", "the", "captured", "values", "using", "the", "request", "s", "convert_value", "function", "." ]
b83865d440278583ac8e4901bb33878244fd7c75
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/line_definition.rb#L104-L110
train
wvanbergen/request-log-analyzer
lib/request_log_analyzer/request.rb
RequestLogAnalyzer.Request.add_parsed_line
def add_parsed_line(parsed_line) value_hash = parsed_line[:line_definition].convert_captured_values(parsed_line[:captures], self) value_hash[:line_type] = parsed_line[:line_definition].name value_hash[:lineno] = parsed_line[:lineno] value_hash[:source] = parsed_line[:source] value_hash[:compound] = parsed_line[:line_definition].compound add_line_hash(value_hash) end
ruby
def add_parsed_line(parsed_line) value_hash = parsed_line[:line_definition].convert_captured_values(parsed_line[:captures], self) value_hash[:line_type] = parsed_line[:line_definition].name value_hash[:lineno] = parsed_line[:lineno] value_hash[:source] = parsed_line[:source] value_hash[:compound] = parsed_line[:line_definition].compound add_line_hash(value_hash) end
[ "def", "add_parsed_line", "(", "parsed_line", ")", "value_hash", "=", "parsed_line", "[", ":line_definition", "]", ".", "convert_captured_values", "(", "parsed_line", "[", ":captures", "]", ",", "self", ")", "value_hash", "[", ":line_type", "]", "=", "parsed_line", "[", ":line_definition", "]", ".", "name", "value_hash", "[", ":lineno", "]", "=", "parsed_line", "[", ":lineno", "]", "value_hash", "[", ":source", "]", "=", "parsed_line", "[", ":source", "]", "value_hash", "[", ":compound", "]", "=", "parsed_line", "[", ":line_definition", "]", ".", "compound", "add_line_hash", "(", "value_hash", ")", "end" ]
Adds another line to the request when it is parsed in the LogParser. The line should be provided as a hash with the attributes line_definition, :captures, :lineno and :source set. This function is called from LogParser.
[ "Adds", "another", "line", "to", "the", "request", "when", "it", "is", "parsed", "in", "the", "LogParser", "." ]
b83865d440278583ac8e4901bb33878244fd7c75
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/request.rb#L133-L140
train
wvanbergen/request-log-analyzer
lib/request_log_analyzer/request.rb
RequestLogAnalyzer.Request.add_line_hash
def add_line_hash(value_hash) @lines << value_hash if value_hash[:compound] value_hash.each do |key, value| if value_hash[:compound].include?(key) @attributes[key] = [] if @attributes[key].nil? @attributes[key] = [@attributes[key]] unless @attributes[key].is_a?(Array) @attributes[key] << value else @attributes[key] = value unless key == :compound || @attributes[key] end end else @attributes = value_hash.merge(@attributes) end end
ruby
def add_line_hash(value_hash) @lines << value_hash if value_hash[:compound] value_hash.each do |key, value| if value_hash[:compound].include?(key) @attributes[key] = [] if @attributes[key].nil? @attributes[key] = [@attributes[key]] unless @attributes[key].is_a?(Array) @attributes[key] << value else @attributes[key] = value unless key == :compound || @attributes[key] end end else @attributes = value_hash.merge(@attributes) end end
[ "def", "add_line_hash", "(", "value_hash", ")", "@lines", "<<", "value_hash", "if", "value_hash", "[", ":compound", "]", "value_hash", ".", "each", "do", "|", "key", ",", "value", "|", "if", "value_hash", "[", ":compound", "]", ".", "include?", "(", "key", ")", "@attributes", "[", "key", "]", "=", "[", "]", "if", "@attributes", "[", "key", "]", ".", "nil?", "@attributes", "[", "key", "]", "=", "[", "@attributes", "[", "key", "]", "]", "unless", "@attributes", "[", "key", "]", ".", "is_a?", "(", "Array", ")", "@attributes", "[", "key", "]", "<<", "value", "else", "@attributes", "[", "key", "]", "=", "value", "unless", "key", "==", ":compound", "||", "@attributes", "[", "key", "]", "end", "end", "else", "@attributes", "=", "value_hash", ".", "merge", "(", "@attributes", ")", "end", "end" ]
Adds another line to the request using a plain hash. The line should be provides as a hash of the fields parsed from the line.
[ "Adds", "another", "line", "to", "the", "request", "using", "a", "plain", "hash", "." ]
b83865d440278583ac8e4901bb33878244fd7c75
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/request.rb#L145-L160
train
wvanbergen/request-log-analyzer
lib/request_log_analyzer/request.rb
RequestLogAnalyzer.Request.has_line_type?
def has_line_type?(line_type) return true if @lines.length == 1 && @lines[0][:line_type] == line_type.to_sym @lines.find { |l| l[:line_type] == line_type.to_sym } end
ruby
def has_line_type?(line_type) return true if @lines.length == 1 && @lines[0][:line_type] == line_type.to_sym @lines.find { |l| l[:line_type] == line_type.to_sym } end
[ "def", "has_line_type?", "(", "line_type", ")", "return", "true", "if", "@lines", ".", "length", "==", "1", "&&", "@lines", "[", "0", "]", "[", ":line_type", "]", "==", "line_type", ".", "to_sym", "@lines", ".", "find", "{", "|", "l", "|", "l", "[", ":line_type", "]", "==", "line_type", ".", "to_sym", "}", "end" ]
Checks whether the given line type was parsed from the log file for this request
[ "Checks", "whether", "the", "given", "line", "type", "was", "parsed", "from", "the", "log", "file", "for", "this", "request" ]
b83865d440278583ac8e4901bb33878244fd7c75
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/request.rb#L169-L172
train
wvanbergen/request-log-analyzer
lib/request_log_analyzer/request.rb
RequestLogAnalyzer.Request.every
def every(field) @lines.reduce([]) { |result, fields| result << fields[field] if fields.key?(field); result } end
ruby
def every(field) @lines.reduce([]) { |result, fields| result << fields[field] if fields.key?(field); result } end
[ "def", "every", "(", "field", ")", "@lines", ".", "reduce", "(", "[", "]", ")", "{", "|", "result", ",", "fields", "|", "result", "<<", "fields", "[", "field", "]", "if", "fields", ".", "key?", "(", "field", ")", ";", "result", "}", "end" ]
Returns an array of all the "field" values that were captured for this request
[ "Returns", "an", "array", "of", "all", "the", "field", "values", "that", "were", "captured", "for", "this", "request" ]
b83865d440278583ac8e4901bb33878244fd7c75
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/request.rb#L186-L188
train
wvanbergen/request-log-analyzer
lib/request_log_analyzer/request.rb
RequestLogAnalyzer.Request.completed?
def completed? header_found, footer_found = false, false @lines.each do |line| line_def = file_format.line_definitions[line[:line_type]] header_found = true if line_def.header footer_found = true if line_def.footer end header_found && footer_found end
ruby
def completed? header_found, footer_found = false, false @lines.each do |line| line_def = file_format.line_definitions[line[:line_type]] header_found = true if line_def.header footer_found = true if line_def.footer end header_found && footer_found end
[ "def", "completed?", "header_found", ",", "footer_found", "=", "false", ",", "false", "@lines", ".", "each", "do", "|", "line", "|", "line_def", "=", "file_format", ".", "line_definitions", "[", "line", "[", ":line_type", "]", "]", "header_found", "=", "true", "if", "line_def", ".", "header", "footer_found", "=", "true", "if", "line_def", ".", "footer", "end", "header_found", "&&", "footer_found", "end" ]
Checks whether this request is completed. A completed request contains both a parsed header line and a parsed footer line. Not that calling this function in single line mode will always return false.
[ "Checks", "whether", "this", "request", "is", "completed", ".", "A", "completed", "request", "contains", "both", "a", "parsed", "header", "line", "and", "a", "parsed", "footer", "line", ".", "Not", "that", "calling", "this", "function", "in", "single", "line", "mode", "will", "always", "return", "false", "." ]
b83865d440278583ac8e4901bb33878244fd7c75
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/request.rb#L199-L207
train
wvanbergen/request-log-analyzer
lib/request_log_analyzer/tracker/traffic.rb
RequestLogAnalyzer::Tracker.Traffic.prepare
def prepare options[:value] = options[:traffic] if options[:traffic] options[:total] = true super @number_of_buckets = options[:number_of_buckets] || 1000 @min_bucket_value = options[:min_bucket_value] ? options[:min_bucket_value].to_f : 1 @max_bucket_value = options[:max_bucket_value] ? options[:max_bucket_value].to_f : 1_000_000_000_000 # precalculate the bucket size @bucket_size = (Math.log(@max_bucket_value) - Math.log(@min_bucket_value)) / @number_of_buckets.to_f end
ruby
def prepare options[:value] = options[:traffic] if options[:traffic] options[:total] = true super @number_of_buckets = options[:number_of_buckets] || 1000 @min_bucket_value = options[:min_bucket_value] ? options[:min_bucket_value].to_f : 1 @max_bucket_value = options[:max_bucket_value] ? options[:max_bucket_value].to_f : 1_000_000_000_000 # precalculate the bucket size @bucket_size = (Math.log(@max_bucket_value) - Math.log(@min_bucket_value)) / @number_of_buckets.to_f end
[ "def", "prepare", "options", "[", ":value", "]", "=", "options", "[", ":traffic", "]", "if", "options", "[", ":traffic", "]", "options", "[", ":total", "]", "=", "true", "super", "@number_of_buckets", "=", "options", "[", ":number_of_buckets", "]", "||", "1000", "@min_bucket_value", "=", "options", "[", ":min_bucket_value", "]", "?", "options", "[", ":min_bucket_value", "]", ".", "to_f", ":", "1", "@max_bucket_value", "=", "options", "[", ":max_bucket_value", "]", "?", "options", "[", ":max_bucket_value", "]", ".", "to_f", ":", "1_000_000_000_000", "@bucket_size", "=", "(", "Math", ".", "log", "(", "@max_bucket_value", ")", "-", "Math", ".", "log", "(", "@min_bucket_value", ")", ")", "/", "@number_of_buckets", ".", "to_f", "end" ]
Check if duration and catagory option have been received,
[ "Check", "if", "duration", "and", "catagory", "option", "have", "been", "received" ]
b83865d440278583ac8e4901bb33878244fd7c75
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/tracker/traffic.rb#L13-L24
train
wvanbergen/request-log-analyzer
lib/request_log_analyzer/filter/field.rb
RequestLogAnalyzer::Filter.Field.filter
def filter(request) found_field = request.every(@field).any? { |value| @value === value.to_s } return nil if !found_field && @mode == :select return nil if found_field && @mode == :reject request end
ruby
def filter(request) found_field = request.every(@field).any? { |value| @value === value.to_s } return nil if !found_field && @mode == :select return nil if found_field && @mode == :reject request end
[ "def", "filter", "(", "request", ")", "found_field", "=", "request", ".", "every", "(", "@field", ")", ".", "any?", "{", "|", "value", "|", "@value", "===", "value", ".", "to_s", "}", "return", "nil", "if", "!", "found_field", "&&", "@mode", "==", ":select", "return", "nil", "if", "found_field", "&&", "@mode", "==", ":reject", "request", "end" ]
Keep request if @mode == :select and request has the field and value. Drop request if @mode == :reject and request has the field and value. Returns nil otherwise. <tt>request</tt> Request Object
[ "Keep", "request", "if" ]
b83865d440278583ac8e4901bb33878244fd7c75
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/filter/field.rb#L32-L37
train
wvanbergen/request-log-analyzer
lib/request_log_analyzer/output/html.rb
RequestLogAnalyzer::Output.HTML.header
def header @io.content_type = content_type if @io.respond_to?(:content_type) @io << '<html>' @io << tag(:head) do |headers| headers << tag(:title, 'Request-log-analyzer report') headers << tag(:style, ' body { font: normal 11px auto "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; color: #4f6b72; background: #E6EAE9; padding-left:20px; padding-top:20px; padding-bottom:20px; } a { color: #c75f3e; } .color_bar { border: 1px solid; height:10px; background: #CAE8EA; } .rla-report-table { width: 700px; padding: 0; margin: 0; padding-bottom:10px; } caption { padding: 0 0 5px 0; width: 700px; font: italic 11px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; text-align: right; } th { font: bold 11px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; color: #4f6b72; border-right: 1px solid #C1DAD7; border-bottom: 1px solid #C1DAD7; border-top: 1px solid #C1DAD7; letter-spacing: 2px; text-transform: uppercase; text-align: left; padding: 6px 6px 6px 12px; background: #CAE8EA url(images/bg_header.jpg) no-repeat; } td { font: bold 11px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; border-right: 1px solid #C1DAD7; border-bottom: 1px solid #C1DAD7; background: #fff; padding: 6px 6px 6px 12px; color: #4f6b72; } td.alt { background: #F5FAFA; color: #797268; } ', type: 'text/css') end @io << '<body>' @io << tag(:h1, 'Request-log-analyzer summary report') @io << tag(:p, "Version #{RequestLogAnalyzer::VERSION} - written by Willem van Bergen and Bart ten Brinke") end
ruby
def header @io.content_type = content_type if @io.respond_to?(:content_type) @io << '<html>' @io << tag(:head) do |headers| headers << tag(:title, 'Request-log-analyzer report') headers << tag(:style, ' body { font: normal 11px auto "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; color: #4f6b72; background: #E6EAE9; padding-left:20px; padding-top:20px; padding-bottom:20px; } a { color: #c75f3e; } .color_bar { border: 1px solid; height:10px; background: #CAE8EA; } .rla-report-table { width: 700px; padding: 0; margin: 0; padding-bottom:10px; } caption { padding: 0 0 5px 0; width: 700px; font: italic 11px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; text-align: right; } th { font: bold 11px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; color: #4f6b72; border-right: 1px solid #C1DAD7; border-bottom: 1px solid #C1DAD7; border-top: 1px solid #C1DAD7; letter-spacing: 2px; text-transform: uppercase; text-align: left; padding: 6px 6px 6px 12px; background: #CAE8EA url(images/bg_header.jpg) no-repeat; } td { font: bold 11px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; border-right: 1px solid #C1DAD7; border-bottom: 1px solid #C1DAD7; background: #fff; padding: 6px 6px 6px 12px; color: #4f6b72; } td.alt { background: #F5FAFA; color: #797268; } ', type: 'text/css') end @io << '<body>' @io << tag(:h1, 'Request-log-analyzer summary report') @io << tag(:p, "Version #{RequestLogAnalyzer::VERSION} - written by Willem van Bergen and Bart ten Brinke") end
[ "def", "header", "@io", ".", "content_type", "=", "content_type", "if", "@io", ".", "respond_to?", "(", ":content_type", ")", "@io", "<<", "'<html>'", "@io", "<<", "tag", "(", ":head", ")", "do", "|", "headers", "|", "headers", "<<", "tag", "(", ":title", ",", "'Request-log-analyzer report'", ")", "headers", "<<", "tag", "(", ":style", ",", "' body { \tfont: normal 11px auto \"Trebuchet MS\", Verdana, Arial, Helvetica, sans-serif; \tcolor: #4f6b72; \tbackground: #E6EAE9; \tpadding-left:20px; \tpadding-top:20px; \tpadding-bottom:20px; } a { \tcolor: #c75f3e; } .color_bar { border: 1px solid; height:10px; \tbackground: #CAE8EA; } .rla-report-table { \twidth: 700px; \tpadding: 0; \tmargin: 0; \tpadding-bottom:10px; } caption { \tpadding: 0 0 5px 0; \twidth: 700px; \tfont: italic 11px \"Trebuchet MS\", Verdana, Arial, Helvetica, sans-serif; \ttext-align: right; } th { \tfont: bold 11px \"Trebuchet MS\", Verdana, Arial, Helvetica, sans-serif; \tcolor: #4f6b72; \tborder-right: 1px solid #C1DAD7; \tborder-bottom: 1px solid #C1DAD7; \tborder-top: 1px solid #C1DAD7; \tletter-spacing: 2px; \ttext-transform: uppercase; \ttext-align: left; \tpadding: 6px 6px 6px 12px; \tbackground: #CAE8EA url(images/bg_header.jpg) no-repeat; } td { \tfont: bold 11px \"Trebuchet MS\", Verdana, Arial, Helvetica, sans-serif; \tborder-right: 1px solid #C1DAD7; \tborder-bottom: 1px solid #C1DAD7; \tbackground: #fff; \tpadding: 6px 6px 6px 12px; \tcolor: #4f6b72; } td.alt { \tbackground: #F5FAFA; \tcolor: #797268; } '", ",", "type", ":", "'text/css'", ")", "end", "@io", "<<", "'<body>'", "@io", "<<", "tag", "(", ":h1", ",", "'Request-log-analyzer summary report'", ")", "@io", "<<", "tag", "(", ":p", ",", "\"Version #{RequestLogAnalyzer::VERSION} - written by Willem van Bergen and Bart ten Brinke\"", ")", "end" ]
Genrate HTML header and associated stylesheet
[ "Genrate", "HTML", "header", "and", "associated", "stylesheet" ]
b83865d440278583ac8e4901bb33878244fd7c75
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/output/html.rb#L76-L147
train
wvanbergen/request-log-analyzer
lib/request_log_analyzer/controller.rb
RequestLogAnalyzer.Controller.handle_source_change
def handle_source_change(change, filename) @aggregators.each { |agg| agg.source_change(change, File.expand_path(filename, Dir.pwd)) } end
ruby
def handle_source_change(change, filename) @aggregators.each { |agg| agg.source_change(change, File.expand_path(filename, Dir.pwd)) } end
[ "def", "handle_source_change", "(", "change", ",", "filename", ")", "@aggregators", ".", "each", "{", "|", "agg", "|", "agg", ".", "source_change", "(", "change", ",", "File", ".", "expand_path", "(", "filename", ",", "Dir", ".", "pwd", ")", ")", "}", "end" ]
Source change handler
[ "Source", "change", "handler" ]
b83865d440278583ac8e4901bb33878244fd7c75
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/controller.rb#L282-L284
train
wvanbergen/request-log-analyzer
lib/request_log_analyzer/controller.rb
RequestLogAnalyzer.Controller.add_filter
def add_filter(filter, filter_options = {}) filter = RequestLogAnalyzer::Filter.const_get(RequestLogAnalyzer.to_camelcase(filter)) if filter.is_a?(Symbol) @filters << filter.new(source.file_format, @options.merge(filter_options)) end
ruby
def add_filter(filter, filter_options = {}) filter = RequestLogAnalyzer::Filter.const_get(RequestLogAnalyzer.to_camelcase(filter)) if filter.is_a?(Symbol) @filters << filter.new(source.file_format, @options.merge(filter_options)) end
[ "def", "add_filter", "(", "filter", ",", "filter_options", "=", "{", "}", ")", "filter", "=", "RequestLogAnalyzer", "::", "Filter", ".", "const_get", "(", "RequestLogAnalyzer", ".", "to_camelcase", "(", "filter", ")", ")", "if", "filter", ".", "is_a?", "(", "Symbol", ")", "@filters", "<<", "filter", ".", "new", "(", "source", ".", "file_format", ",", "@options", ".", "merge", "(", "filter_options", ")", ")", "end" ]
Adds a request filter to the controller.
[ "Adds", "a", "request", "filter", "to", "the", "controller", "." ]
b83865d440278583ac8e4901bb33878244fd7c75
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/controller.rb#L296-L299
train
wvanbergen/request-log-analyzer
lib/request_log_analyzer/controller.rb
RequestLogAnalyzer.Controller.filter_request
def filter_request(request) @filters.each do |filter| request = filter.filter(request) return nil if request.nil? end request end
ruby
def filter_request(request) @filters.each do |filter| request = filter.filter(request) return nil if request.nil? end request end
[ "def", "filter_request", "(", "request", ")", "@filters", ".", "each", "do", "|", "filter", "|", "request", "=", "filter", ".", "filter", "(", "request", ")", "return", "nil", "if", "request", ".", "nil?", "end", "request", "end" ]
Push a request through the entire filterchain (@filters). <tt>request</tt> The request to filter. Returns the filtered request or nil.
[ "Push", "a", "request", "through", "the", "entire", "filterchain", "(" ]
b83865d440278583ac8e4901bb33878244fd7c75
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/controller.rb#L304-L310
train
wvanbergen/request-log-analyzer
lib/request_log_analyzer/controller.rb
RequestLogAnalyzer.Controller.aggregate_request
def aggregate_request(request) return false unless request @aggregators.each { |agg| agg.aggregate(request) } true end
ruby
def aggregate_request(request) return false unless request @aggregators.each { |agg| agg.aggregate(request) } true end
[ "def", "aggregate_request", "(", "request", ")", "return", "false", "unless", "request", "@aggregators", ".", "each", "{", "|", "agg", "|", "agg", ".", "aggregate", "(", "request", ")", "}", "true", "end" ]
Push a request to all the aggregators (@aggregators). <tt>request</tt> The request to push to the aggregators.
[ "Push", "a", "request", "to", "all", "the", "aggregators", "(" ]
b83865d440278583ac8e4901bb33878244fd7c75
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/controller.rb#L314-L318
train
wvanbergen/request-log-analyzer
lib/request_log_analyzer/controller.rb
RequestLogAnalyzer.Controller.run!
def run! # @aggregators.each{|agg| p agg} @aggregators.each { |agg| agg.prepare } install_signal_handlers @source.each_request do |request| break if @interrupted aggregate_request(filter_request(request)) end @aggregators.each { |agg| agg.finalize } @output.header @aggregators.each { |agg| agg.report(@output) } @output.footer @source.finalize if @output.io.is_a?(File) unless @options[:silent] puts puts 'Report written to: ' + File.expand_path(@output.io.path) puts 'Need an expert to analyze your application?' puts 'Mail to [email protected] or visit us at http://railsdoctors.com' puts 'Thanks for using request-log-analyzer!' end @output.io.close elsif @output.io.is_a?(RequestLogAnalyzer::Mailer) @output.io.mail end end
ruby
def run! # @aggregators.each{|agg| p agg} @aggregators.each { |agg| agg.prepare } install_signal_handlers @source.each_request do |request| break if @interrupted aggregate_request(filter_request(request)) end @aggregators.each { |agg| agg.finalize } @output.header @aggregators.each { |agg| agg.report(@output) } @output.footer @source.finalize if @output.io.is_a?(File) unless @options[:silent] puts puts 'Report written to: ' + File.expand_path(@output.io.path) puts 'Need an expert to analyze your application?' puts 'Mail to [email protected] or visit us at http://railsdoctors.com' puts 'Thanks for using request-log-analyzer!' end @output.io.close elsif @output.io.is_a?(RequestLogAnalyzer::Mailer) @output.io.mail end end
[ "def", "run!", "@aggregators", ".", "each", "{", "|", "agg", "|", "agg", ".", "prepare", "}", "install_signal_handlers", "@source", ".", "each_request", "do", "|", "request", "|", "break", "if", "@interrupted", "aggregate_request", "(", "filter_request", "(", "request", ")", ")", "end", "@aggregators", ".", "each", "{", "|", "agg", "|", "agg", ".", "finalize", "}", "@output", ".", "header", "@aggregators", ".", "each", "{", "|", "agg", "|", "agg", ".", "report", "(", "@output", ")", "}", "@output", ".", "footer", "@source", ".", "finalize", "if", "@output", ".", "io", ".", "is_a?", "(", "File", ")", "unless", "@options", "[", ":silent", "]", "puts", "puts", "'Report written to: '", "+", "File", ".", "expand_path", "(", "@output", ".", "io", ".", "path", ")", "puts", "'Need an expert to analyze your application?'", "puts", "'Mail to [email protected] or visit us at http://railsdoctors.com'", "puts", "'Thanks for using request-log-analyzer!'", "end", "@output", ".", "io", ".", "close", "elsif", "@output", ".", "io", ".", "is_a?", "(", "RequestLogAnalyzer", "::", "Mailer", ")", "@output", ".", "io", ".", "mail", "end", "end" ]
Runs RequestLogAnalyzer 1. Call prepare on every aggregator 2. Generate requests from source object 3. Filter out unwanted requests 4. Call aggregate for remaning requests on every aggregator 4. Call finalize on every aggregator 5. Call report on every aggregator 6. Finalize Source
[ "Runs", "RequestLogAnalyzer", "1", ".", "Call", "prepare", "on", "every", "aggregator", "2", ".", "Generate", "requests", "from", "source", "object", "3", ".", "Filter", "out", "unwanted", "requests", "4", ".", "Call", "aggregate", "for", "remaning", "requests", "on", "every", "aggregator", "4", ".", "Call", "finalize", "on", "every", "aggregator", "5", ".", "Call", "report", "on", "every", "aggregator", "6", ".", "Finalize", "Source" ]
b83865d440278583ac8e4901bb33878244fd7c75
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/controller.rb#L328-L359
train
wvanbergen/request-log-analyzer
lib/request_log_analyzer/tracker/duration.rb
RequestLogAnalyzer::Tracker.Duration.display_value
def display_value(time) case time when nil then '-' when 0...1 then '%0ims' % (time * 1000) when 1...60 then '%0.02fs' % time when 60...3600 then '%dm%02ds' % [time / 60, (time % 60).round] else '%dh%02dm%02ds' % [time / 3600, (time % 3600) / 60, (time % 60).round] end end
ruby
def display_value(time) case time when nil then '-' when 0...1 then '%0ims' % (time * 1000) when 1...60 then '%0.02fs' % time when 60...3600 then '%dm%02ds' % [time / 60, (time % 60).round] else '%dh%02dm%02ds' % [time / 3600, (time % 3600) / 60, (time % 60).round] end end
[ "def", "display_value", "(", "time", ")", "case", "time", "when", "nil", "then", "'-'", "when", "0", "...", "1", "then", "'%0ims'", "%", "(", "time", "*", "1000", ")", "when", "1", "...", "60", "then", "'%0.02fs'", "%", "time", "when", "60", "...", "3600", "then", "'%dm%02ds'", "%", "[", "time", "/", "60", ",", "(", "time", "%", "60", ")", ".", "round", "]", "else", "'%dh%02dm%02ds'", "%", "[", "time", "/", "3600", ",", "(", "time", "%", "3600", ")", "/", "60", ",", "(", "time", "%", "60", ")", ".", "round", "]", "end", "end" ]
Display a duration
[ "Display", "a", "duration" ]
b83865d440278583ac8e4901bb33878244fd7c75
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/tracker/duration.rb#L36-L44
train
wvanbergen/request-log-analyzer
lib/request_log_analyzer/aggregator/database_inserter.rb
RequestLogAnalyzer::Aggregator.DatabaseInserter.prepare
def prepare require 'request_log_analyzer/database' @sources = {} @database = RequestLogAnalyzer::Database.new(options[:database]) @database.file_format = source.file_format database.drop_database_schema! if options[:reset_database] database.create_database_schema! end
ruby
def prepare require 'request_log_analyzer/database' @sources = {} @database = RequestLogAnalyzer::Database.new(options[:database]) @database.file_format = source.file_format database.drop_database_schema! if options[:reset_database] database.create_database_schema! end
[ "def", "prepare", "require", "'request_log_analyzer/database'", "@sources", "=", "{", "}", "@database", "=", "RequestLogAnalyzer", "::", "Database", ".", "new", "(", "options", "[", ":database", "]", ")", "@database", ".", "file_format", "=", "source", ".", "file_format", "database", ".", "drop_database_schema!", "if", "options", "[", ":reset_database", "]", "database", ".", "create_database_schema!", "end" ]
Establishes a connection to the database and creates the necessary database schema for the current file format
[ "Establishes", "a", "connection", "to", "the", "database", "and", "creates", "the", "necessary", "database", "schema", "for", "the", "current", "file", "format" ]
b83865d440278583ac8e4901bb33878244fd7c75
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/aggregator/database_inserter.rb#L18-L27
train
wvanbergen/request-log-analyzer
lib/request_log_analyzer/aggregator/database_inserter.rb
RequestLogAnalyzer::Aggregator.DatabaseInserter.aggregate
def aggregate(request) @request_object = RequestLogAnalyzer::Database::Request.new(first_lineno: request.first_lineno, last_lineno: request.last_lineno) request.lines.each do |line| class_columns = database.get_class(line[:line_type]).column_names.reject { |column| %w(id source_id request_id).include?(column) } attributes = Hash[*line.select { |(key, _)| class_columns.include?(key.to_s) }.flatten] # Fix encoding patch for 1.9.2 attributes.each do |k, v| attributes[k] = v.force_encoding('UTF-8') if v.is_a?(String) end @request_object.send("#{line[:line_type]}_lines").build(attributes) end @request_object.save! rescue SQLite3::SQLException => e raise Interrupt, e.message end
ruby
def aggregate(request) @request_object = RequestLogAnalyzer::Database::Request.new(first_lineno: request.first_lineno, last_lineno: request.last_lineno) request.lines.each do |line| class_columns = database.get_class(line[:line_type]).column_names.reject { |column| %w(id source_id request_id).include?(column) } attributes = Hash[*line.select { |(key, _)| class_columns.include?(key.to_s) }.flatten] # Fix encoding patch for 1.9.2 attributes.each do |k, v| attributes[k] = v.force_encoding('UTF-8') if v.is_a?(String) end @request_object.send("#{line[:line_type]}_lines").build(attributes) end @request_object.save! rescue SQLite3::SQLException => e raise Interrupt, e.message end
[ "def", "aggregate", "(", "request", ")", "@request_object", "=", "RequestLogAnalyzer", "::", "Database", "::", "Request", ".", "new", "(", "first_lineno", ":", "request", ".", "first_lineno", ",", "last_lineno", ":", "request", ".", "last_lineno", ")", "request", ".", "lines", ".", "each", "do", "|", "line", "|", "class_columns", "=", "database", ".", "get_class", "(", "line", "[", ":line_type", "]", ")", ".", "column_names", ".", "reject", "{", "|", "column", "|", "%w(", "id", "source_id", "request_id", ")", ".", "include?", "(", "column", ")", "}", "attributes", "=", "Hash", "[", "*", "line", ".", "select", "{", "|", "(", "key", ",", "_", ")", "|", "class_columns", ".", "include?", "(", "key", ".", "to_s", ")", "}", ".", "flatten", "]", "attributes", ".", "each", "do", "|", "k", ",", "v", "|", "attributes", "[", "k", "]", "=", "v", ".", "force_encoding", "(", "'UTF-8'", ")", "if", "v", ".", "is_a?", "(", "String", ")", "end", "@request_object", ".", "send", "(", "\"#{line[:line_type]}_lines\"", ")", ".", "build", "(", "attributes", ")", "end", "@request_object", ".", "save!", "rescue", "SQLite3", "::", "SQLException", "=>", "e", "raise", "Interrupt", ",", "e", ".", "message", "end" ]
Aggregates a request into the database This will create a record in the requests table and create a record for every line that has been parsed, in which the captured values will be stored.
[ "Aggregates", "a", "request", "into", "the", "database", "This", "will", "create", "a", "record", "in", "the", "requests", "table", "and", "create", "a", "record", "for", "every", "line", "that", "has", "been", "parsed", "in", "which", "the", "captured", "values", "will", "be", "stored", "." ]
b83865d440278583ac8e4901bb33878244fd7c75
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/aggregator/database_inserter.rb#L32-L48
train
wvanbergen/request-log-analyzer
lib/request_log_analyzer/aggregator/database_inserter.rb
RequestLogAnalyzer::Aggregator.DatabaseInserter.warning
def warning(type, message, lineno) RequestLogAnalyzer::Database::Warning.create!(warning_type: type.to_s, message: message, lineno: lineno) end
ruby
def warning(type, message, lineno) RequestLogAnalyzer::Database::Warning.create!(warning_type: type.to_s, message: message, lineno: lineno) end
[ "def", "warning", "(", "type", ",", "message", ",", "lineno", ")", "RequestLogAnalyzer", "::", "Database", "::", "Warning", ".", "create!", "(", "warning_type", ":", "type", ".", "to_s", ",", "message", ":", "message", ",", "lineno", ":", "lineno", ")", "end" ]
Records w warining in the warnings table.
[ "Records", "w", "warining", "in", "the", "warnings", "table", "." ]
b83865d440278583ac8e4901bb33878244fd7c75
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/aggregator/database_inserter.rb#L58-L60
train
wvanbergen/request-log-analyzer
lib/request_log_analyzer/aggregator/database_inserter.rb
RequestLogAnalyzer::Aggregator.DatabaseInserter.source_change
def source_change(change, filename) if File.exist?(filename) case change when :started @sources[filename] = RequestLogAnalyzer::Database::Source.create!(filename: filename) when :finished @sources[filename].update_attributes!(filesize: File.size(filename), mtime: File.mtime(filename)) end end end
ruby
def source_change(change, filename) if File.exist?(filename) case change when :started @sources[filename] = RequestLogAnalyzer::Database::Source.create!(filename: filename) when :finished @sources[filename].update_attributes!(filesize: File.size(filename), mtime: File.mtime(filename)) end end end
[ "def", "source_change", "(", "change", ",", "filename", ")", "if", "File", ".", "exist?", "(", "filename", ")", "case", "change", "when", ":started", "@sources", "[", "filename", "]", "=", "RequestLogAnalyzer", "::", "Database", "::", "Source", ".", "create!", "(", "filename", ":", "filename", ")", "when", ":finished", "@sources", "[", "filename", "]", ".", "update_attributes!", "(", "filesize", ":", "File", ".", "size", "(", "filename", ")", ",", "mtime", ":", "File", ".", "mtime", "(", "filename", ")", ")", "end", "end", "end" ]
Records source changes in the sources table
[ "Records", "source", "changes", "in", "the", "sources", "table" ]
b83865d440278583ac8e4901bb33878244fd7c75
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/aggregator/database_inserter.rb#L63-L72
train
wvanbergen/request-log-analyzer
lib/request_log_analyzer/aggregator/database_inserter.rb
RequestLogAnalyzer::Aggregator.DatabaseInserter.report
def report(output) output.title('Request database created') output << "A database file has been created with all parsed request information.\n" output << "#{@request_count} requests have been added to the database.\n" output << "\n" output << "To open a Ruby console to inspect the database, run the following command.\n" output << output.colorize(" $ request-log-analyzer console -d #{options[:database]}\n", :bold) output << "\n" end
ruby
def report(output) output.title('Request database created') output << "A database file has been created with all parsed request information.\n" output << "#{@request_count} requests have been added to the database.\n" output << "\n" output << "To open a Ruby console to inspect the database, run the following command.\n" output << output.colorize(" $ request-log-analyzer console -d #{options[:database]}\n", :bold) output << "\n" end
[ "def", "report", "(", "output", ")", "output", ".", "title", "(", "'Request database created'", ")", "output", "<<", "\"A database file has been created with all parsed request information.\\n\"", "output", "<<", "\"#{@request_count} requests have been added to the database.\\n\"", "output", "<<", "\"\\n\"", "output", "<<", "\"To open a Ruby console to inspect the database, run the following command.\\n\"", "output", "<<", "output", ".", "colorize", "(", "\" $ request-log-analyzer console -d #{options[:database]}\\n\"", ",", ":bold", ")", "output", "<<", "\"\\n\"", "end" ]
Prints a short report of what has been inserted into the database
[ "Prints", "a", "short", "report", "of", "what", "has", "been", "inserted", "into", "the", "database" ]
b83865d440278583ac8e4901bb33878244fd7c75
https://github.com/wvanbergen/request-log-analyzer/blob/b83865d440278583ac8e4901bb33878244fd7c75/lib/request_log_analyzer/aggregator/database_inserter.rb#L75-L84
train
activescaffold/active_scaffold
lib/active_scaffold/data_structures/set.rb
ActiveScaffold::DataStructures.Set.add
def add(*args) args.flatten! # allow [] as a param args.each do |arg| arg = arg.to_sym if arg.is_a? String @set << arg unless @set.include? arg # avoid duplicates end end
ruby
def add(*args) args.flatten! # allow [] as a param args.each do |arg| arg = arg.to_sym if arg.is_a? String @set << arg unless @set.include? arg # avoid duplicates end end
[ "def", "add", "(", "*", "args", ")", "args", ".", "flatten!", "args", ".", "each", "do", "|", "arg", "|", "arg", "=", "arg", ".", "to_sym", "if", "arg", ".", "is_a?", "String", "@set", "<<", "arg", "unless", "@set", ".", "include?", "arg", "end", "end" ]
the way to add items to the set.
[ "the", "way", "to", "add", "items", "to", "the", "set", "." ]
1954f85b5395d09de09fa86f3ea70c29bbee2612
https://github.com/activescaffold/active_scaffold/blob/1954f85b5395d09de09fa86f3ea70c29bbee2612/lib/active_scaffold/data_structures/set.rb#L20-L26
train
activescaffold/active_scaffold
lib/active_scaffold/data_structures/set.rb
ActiveScaffold::DataStructures.Set.exclude
def exclude(*args) args.flatten! # allow [] as a param args.collect!(&:to_sym) # symbolize the args # check respond_to? :to_sym, ActionColumns doesn't respond to to_sym @set.reject! { |c| c.respond_to?(:to_sym) && args.include?(c.to_sym) } # reject all items specified end
ruby
def exclude(*args) args.flatten! # allow [] as a param args.collect!(&:to_sym) # symbolize the args # check respond_to? :to_sym, ActionColumns doesn't respond to to_sym @set.reject! { |c| c.respond_to?(:to_sym) && args.include?(c.to_sym) } # reject all items specified end
[ "def", "exclude", "(", "*", "args", ")", "args", ".", "flatten!", "args", ".", "collect!", "(", "&", ":to_sym", ")", "@set", ".", "reject!", "{", "|", "c", "|", "c", ".", "respond_to?", "(", ":to_sym", ")", "&&", "args", ".", "include?", "(", "c", ".", "to_sym", ")", "}", "end" ]
the way to remove items from the set.
[ "the", "way", "to", "remove", "items", "from", "the", "set", "." ]
1954f85b5395d09de09fa86f3ea70c29bbee2612
https://github.com/activescaffold/active_scaffold/blob/1954f85b5395d09de09fa86f3ea70c29bbee2612/lib/active_scaffold/data_structures/set.rb#L30-L35
train
activescaffold/active_scaffold
lib/active_scaffold/attribute_params.rb
ActiveScaffold.AttributeParams.attributes_hash_is_empty?
def attributes_hash_is_empty?(hash, klass) hash.all? do |key, value| # convert any possible multi-parameter attributes like 'created_at(5i)' to simply 'created_at' column_name = key.to_s.split('(', 2)[0] # datetimes will always have a value. so we ignore them when checking whether the hash is empty. # this could be a bad idea. but the current situation (excess record entry) seems worse. next true if mulitpart_ignored?(key, klass) # defaults are pre-filled on the form. we can't use them to determine if the user intends a new row. # booleans always have value, so they are ignored if not changed from default next true if default_value?(column_name, klass, value) if params_hash? value attributes_hash_is_empty?(value, klass) elsif value.is_a?(Array) value.all?(&:blank?) else value.respond_to?(:empty?) ? value.empty? : false end end end
ruby
def attributes_hash_is_empty?(hash, klass) hash.all? do |key, value| # convert any possible multi-parameter attributes like 'created_at(5i)' to simply 'created_at' column_name = key.to_s.split('(', 2)[0] # datetimes will always have a value. so we ignore them when checking whether the hash is empty. # this could be a bad idea. but the current situation (excess record entry) seems worse. next true if mulitpart_ignored?(key, klass) # defaults are pre-filled on the form. we can't use them to determine if the user intends a new row. # booleans always have value, so they are ignored if not changed from default next true if default_value?(column_name, klass, value) if params_hash? value attributes_hash_is_empty?(value, klass) elsif value.is_a?(Array) value.all?(&:blank?) else value.respond_to?(:empty?) ? value.empty? : false end end end
[ "def", "attributes_hash_is_empty?", "(", "hash", ",", "klass", ")", "hash", ".", "all?", "do", "|", "key", ",", "value", "|", "column_name", "=", "key", ".", "to_s", ".", "split", "(", "'('", ",", "2", ")", "[", "0", "]", "next", "true", "if", "mulitpart_ignored?", "(", "key", ",", "klass", ")", "next", "true", "if", "default_value?", "(", "column_name", ",", "klass", ",", "value", ")", "if", "params_hash?", "value", "attributes_hash_is_empty?", "(", "value", ",", "klass", ")", "elsif", "value", ".", "is_a?", "(", "Array", ")", "value", ".", "all?", "(", "&", ":blank?", ")", "else", "value", ".", "respond_to?", "(", ":empty?", ")", "?", "value", ".", "empty?", ":", "false", "end", "end", "end" ]
Determines whether the given attributes hash is "empty". This isn't a literal emptiness - it's an attempt to discern whether the user intended it to be empty or not.
[ "Determines", "whether", "the", "given", "attributes", "hash", "is", "empty", ".", "This", "isn", "t", "a", "literal", "emptiness", "-", "it", "s", "an", "attempt", "to", "discern", "whether", "the", "user", "intended", "it", "to", "be", "empty", "or", "not", "." ]
1954f85b5395d09de09fa86f3ea70c29bbee2612
https://github.com/activescaffold/active_scaffold/blob/1954f85b5395d09de09fa86f3ea70c29bbee2612/lib/active_scaffold/attribute_params.rb#L294-L315
train
activescaffold/active_scaffold
lib/active_scaffold/actions/nested.rb
ActiveScaffold::Actions::Nested.ChildMethods.do_add_existing
def do_add_existing parent_record = nested_parent_record(:update) @record = active_scaffold_config.model.find(params[:associated_id]) if parent_record && @record parent_record.send(nested.association.name) << @record parent_record.save else false end end
ruby
def do_add_existing parent_record = nested_parent_record(:update) @record = active_scaffold_config.model.find(params[:associated_id]) if parent_record && @record parent_record.send(nested.association.name) << @record parent_record.save else false end end
[ "def", "do_add_existing", "parent_record", "=", "nested_parent_record", "(", ":update", ")", "@record", "=", "active_scaffold_config", ".", "model", ".", "find", "(", "params", "[", ":associated_id", "]", ")", "if", "parent_record", "&&", "@record", "parent_record", ".", "send", "(", "nested", ".", "association", ".", "name", ")", "<<", "@record", "parent_record", ".", "save", "else", "false", "end", "end" ]
The actual "add_existing" algorithm
[ "The", "actual", "add_existing", "algorithm" ]
1954f85b5395d09de09fa86f3ea70c29bbee2612
https://github.com/activescaffold/active_scaffold/blob/1954f85b5395d09de09fa86f3ea70c29bbee2612/lib/active_scaffold/actions/nested.rb#L238-L247
train
activescaffold/active_scaffold
lib/active_scaffold/extensions/action_view_rendering.rb
ActiveScaffold.RenderingHelper.render
def render(*args, &block) if args.first.is_a?(Hash) && args.first[:active_scaffold] render_embedded args.first elsif args.first == :super @_view_paths ||= lookup_context.view_paths.clone @_last_template ||= lookup_context.last_template parts = @virtual_path.split('/') template = parts.pop prefix = parts.join('/') options = args[1] || {} options[:locals] ||= {} if view_stack.last options[:locals] = view_stack.last[:locals].merge!(options[:locals]) if view_stack.last[:locals] options[:object] ||= view_stack.last[:object] if view_stack.last[:object] end options[:template] = template # if prefix is active_scaffold_overrides we must try to render with this prefix in following paths if prefix != 'active_scaffold_overrides' options[:prefixes] = lookup_context.prefixes.drop((lookup_context.prefixes.find_index(prefix) || -1) + 1) else options[:prefixes] = ['active_scaffold_overrides'] last_view_path = File.expand_path(File.dirname(File.dirname(lookup_context.last_template.inspect)), Rails.root) lookup_context.view_paths = view_paths.drop(view_paths.find_index { |path| path.to_s == last_view_path } + 1) end result = super options lookup_context.view_paths = @_view_paths if @_view_paths lookup_context.last_template = @_last_template if @_last_template result else @_view_paths ||= lookup_context.view_paths.clone last_template = lookup_context.last_template current_view = if args[0].is_a?(Hash) {:locals => args[0][:locals], :object => args[0][:object]} else # call is render 'partial', locals_hash {:locals => args[1]} end view_stack << current_view if current_view lookup_context.view_paths = @_view_paths # reset view_paths in case a view render :super, and then render :partial result = super view_stack.pop if current_view.present? lookup_context.last_template = last_template result end end
ruby
def render(*args, &block) if args.first.is_a?(Hash) && args.first[:active_scaffold] render_embedded args.first elsif args.first == :super @_view_paths ||= lookup_context.view_paths.clone @_last_template ||= lookup_context.last_template parts = @virtual_path.split('/') template = parts.pop prefix = parts.join('/') options = args[1] || {} options[:locals] ||= {} if view_stack.last options[:locals] = view_stack.last[:locals].merge!(options[:locals]) if view_stack.last[:locals] options[:object] ||= view_stack.last[:object] if view_stack.last[:object] end options[:template] = template # if prefix is active_scaffold_overrides we must try to render with this prefix in following paths if prefix != 'active_scaffold_overrides' options[:prefixes] = lookup_context.prefixes.drop((lookup_context.prefixes.find_index(prefix) || -1) + 1) else options[:prefixes] = ['active_scaffold_overrides'] last_view_path = File.expand_path(File.dirname(File.dirname(lookup_context.last_template.inspect)), Rails.root) lookup_context.view_paths = view_paths.drop(view_paths.find_index { |path| path.to_s == last_view_path } + 1) end result = super options lookup_context.view_paths = @_view_paths if @_view_paths lookup_context.last_template = @_last_template if @_last_template result else @_view_paths ||= lookup_context.view_paths.clone last_template = lookup_context.last_template current_view = if args[0].is_a?(Hash) {:locals => args[0][:locals], :object => args[0][:object]} else # call is render 'partial', locals_hash {:locals => args[1]} end view_stack << current_view if current_view lookup_context.view_paths = @_view_paths # reset view_paths in case a view render :super, and then render :partial result = super view_stack.pop if current_view.present? lookup_context.last_template = last_template result end end
[ "def", "render", "(", "*", "args", ",", "&", "block", ")", "if", "args", ".", "first", ".", "is_a?", "(", "Hash", ")", "&&", "args", ".", "first", "[", ":active_scaffold", "]", "render_embedded", "args", ".", "first", "elsif", "args", ".", "first", "==", ":super", "@_view_paths", "||=", "lookup_context", ".", "view_paths", ".", "clone", "@_last_template", "||=", "lookup_context", ".", "last_template", "parts", "=", "@virtual_path", ".", "split", "(", "'/'", ")", "template", "=", "parts", ".", "pop", "prefix", "=", "parts", ".", "join", "(", "'/'", ")", "options", "=", "args", "[", "1", "]", "||", "{", "}", "options", "[", ":locals", "]", "||=", "{", "}", "if", "view_stack", ".", "last", "options", "[", ":locals", "]", "=", "view_stack", ".", "last", "[", ":locals", "]", ".", "merge!", "(", "options", "[", ":locals", "]", ")", "if", "view_stack", ".", "last", "[", ":locals", "]", "options", "[", ":object", "]", "||=", "view_stack", ".", "last", "[", ":object", "]", "if", "view_stack", ".", "last", "[", ":object", "]", "end", "options", "[", ":template", "]", "=", "template", "if", "prefix", "!=", "'active_scaffold_overrides'", "options", "[", ":prefixes", "]", "=", "lookup_context", ".", "prefixes", ".", "drop", "(", "(", "lookup_context", ".", "prefixes", ".", "find_index", "(", "prefix", ")", "||", "-", "1", ")", "+", "1", ")", "else", "options", "[", ":prefixes", "]", "=", "[", "'active_scaffold_overrides'", "]", "last_view_path", "=", "File", ".", "expand_path", "(", "File", ".", "dirname", "(", "File", ".", "dirname", "(", "lookup_context", ".", "last_template", ".", "inspect", ")", ")", ",", "Rails", ".", "root", ")", "lookup_context", ".", "view_paths", "=", "view_paths", ".", "drop", "(", "view_paths", ".", "find_index", "{", "|", "path", "|", "path", ".", "to_s", "==", "last_view_path", "}", "+", "1", ")", "end", "result", "=", "super", "options", "lookup_context", ".", "view_paths", "=", "@_view_paths", "if", "@_view_paths", "lookup_context", ".", "last_template", "=", "@_last_template", "if", "@_last_template", "result", "else", "@_view_paths", "||=", "lookup_context", ".", "view_paths", ".", "clone", "last_template", "=", "lookup_context", ".", "last_template", "current_view", "=", "if", "args", "[", "0", "]", ".", "is_a?", "(", "Hash", ")", "{", ":locals", "=>", "args", "[", "0", "]", "[", ":locals", "]", ",", ":object", "=>", "args", "[", "0", "]", "[", ":object", "]", "}", "else", "{", ":locals", "=>", "args", "[", "1", "]", "}", "end", "view_stack", "<<", "current_view", "if", "current_view", "lookup_context", ".", "view_paths", "=", "@_view_paths", "result", "=", "super", "view_stack", ".", "pop", "if", "current_view", ".", "present?", "lookup_context", ".", "last_template", "=", "last_template", "result", "end", "end" ]
Adds two rendering options. ==render :super This syntax skips all template overrides and goes directly to the provided ActiveScaffold templates. Useful if you want to wrap an existing template. Just call super! ==render :active_scaffold => #{controller.to_s}, options = {}+ Lets you embed an ActiveScaffold by referencing the controller where it's configured. You may specify options[:constraints] for the embedded scaffold. These constraints have three effects: * the scaffold's only displays records matching the constraint * all new records created will be assigned the constrained values * constrained columns will be hidden (they're pretty boring at this point) You may also specify options[:conditions] for the embedded scaffold. These only do 1/3 of what constraints do (they only limit search results). Any format accepted by ActiveRecord::Base.find is valid. Defining options[:label] lets you completely customize the list title for the embedded scaffold. options[:xhr] force to load embedded scaffold with AJAX even when render_component gem is installed.
[ "Adds", "two", "rendering", "options", "." ]
1954f85b5395d09de09fa86f3ea70c29bbee2612
https://github.com/activescaffold/active_scaffold/blob/1954f85b5395d09de09fa86f3ea70c29bbee2612/lib/active_scaffold/extensions/action_view_rendering.rb#L38-L82
train
activescaffold/active_scaffold
lib/active_scaffold/data_structures/action_link.rb
ActiveScaffold::DataStructures.ActionLink.initialize_copy
def initialize_copy(action_link) self.parameters = parameters.clone if action_link.instance_variable_get(:@parameters) self.html_options = html_options.clone if action_link.instance_variable_get(:@html_options) end
ruby
def initialize_copy(action_link) self.parameters = parameters.clone if action_link.instance_variable_get(:@parameters) self.html_options = html_options.clone if action_link.instance_variable_get(:@html_options) end
[ "def", "initialize_copy", "(", "action_link", ")", "self", ".", "parameters", "=", "parameters", ".", "clone", "if", "action_link", ".", "instance_variable_get", "(", ":@parameters", ")", "self", ".", "html_options", "=", "html_options", ".", "clone", "if", "action_link", ".", "instance_variable_get", "(", ":@html_options", ")", "end" ]
provides a quick way to set any property of the object from a hash
[ "provides", "a", "quick", "way", "to", "set", "any", "property", "of", "the", "object", "from", "a", "hash" ]
1954f85b5395d09de09fa86f3ea70c29bbee2612
https://github.com/activescaffold/active_scaffold/blob/1954f85b5395d09de09fa86f3ea70c29bbee2612/lib/active_scaffold/data_structures/action_link.rb#L31-L34
train
activescaffold/active_scaffold
lib/active_scaffold/config/nested.rb
ActiveScaffold::Config.Nested.add_link
def add_link(attribute, options = {}) column = @core.columns[attribute.to_sym] raise ArgumentError, "unknown column #{attribute}" if column.nil? raise ArgumentError, "column #{attribute} is not an association" if column.association.nil? label = if column.association.polymorphic? column.label else column.association.klass.model_name.human(:count => column.association.singular? ? 1 : 2, :default => column.association.klass.name.pluralize) end options.reverse_merge! :security_method => :nested_authorized?, :label => label action_group = options.delete(:action_group) || self.action_group action_link = @core.link_for_association(column, options) @core.action_links.add_to_group(action_link, action_group) unless action_link.nil? action_link end
ruby
def add_link(attribute, options = {}) column = @core.columns[attribute.to_sym] raise ArgumentError, "unknown column #{attribute}" if column.nil? raise ArgumentError, "column #{attribute} is not an association" if column.association.nil? label = if column.association.polymorphic? column.label else column.association.klass.model_name.human(:count => column.association.singular? ? 1 : 2, :default => column.association.klass.name.pluralize) end options.reverse_merge! :security_method => :nested_authorized?, :label => label action_group = options.delete(:action_group) || self.action_group action_link = @core.link_for_association(column, options) @core.action_links.add_to_group(action_link, action_group) unless action_link.nil? action_link end
[ "def", "add_link", "(", "attribute", ",", "options", "=", "{", "}", ")", "column", "=", "@core", ".", "columns", "[", "attribute", ".", "to_sym", "]", "raise", "ArgumentError", ",", "\"unknown column #{attribute}\"", "if", "column", ".", "nil?", "raise", "ArgumentError", ",", "\"column #{attribute} is not an association\"", "if", "column", ".", "association", ".", "nil?", "label", "=", "if", "column", ".", "association", ".", "polymorphic?", "column", ".", "label", "else", "column", ".", "association", ".", "klass", ".", "model_name", ".", "human", "(", ":count", "=>", "column", ".", "association", ".", "singular?", "?", "1", ":", "2", ",", ":default", "=>", "column", ".", "association", ".", "klass", ".", "name", ".", "pluralize", ")", "end", "options", ".", "reverse_merge!", ":security_method", "=>", ":nested_authorized?", ",", ":label", "=>", "label", "action_group", "=", "options", ".", "delete", "(", ":action_group", ")", "||", "self", ".", "action_group", "action_link", "=", "@core", ".", "link_for_association", "(", "column", ",", "options", ")", "@core", ".", "action_links", ".", "add_to_group", "(", "action_link", ",", "action_group", ")", "unless", "action_link", ".", "nil?", "action_link", "end" ]
Add a nested ActionLink
[ "Add", "a", "nested", "ActionLink" ]
1954f85b5395d09de09fa86f3ea70c29bbee2612
https://github.com/activescaffold/active_scaffold/blob/1954f85b5395d09de09fa86f3ea70c29bbee2612/lib/active_scaffold/config/nested.rb#L26-L42
train
activescaffold/active_scaffold
lib/active_scaffold/actions/create.rb
ActiveScaffold::Actions.Create.do_create
def do_create(options = {}) attributes = options[:attributes] || params[:record] active_scaffold_config.model.transaction do @record = update_record_from_params(new_model, active_scaffold_config.create.columns, attributes) apply_constraints_to_record(@record, :allow_autosave => true) create_association_with_parent(@record) if nested? before_create_save(@record) # errors to @record can be added by update_record_from_params when association fails to set and ActiveRecord::RecordNotSaved is raised self.successful = [@record.keeping_errors { @record.valid? }, @record.associated_valid?].all? # this syntax avoids a short-circuit create_save(@record) unless options[:skip_save] end rescue ActiveRecord::ActiveRecordError => ex flash[:error] = ex.message self.successful = false @record ||= new_model # ensure @record exists or display form will fail end
ruby
def do_create(options = {}) attributes = options[:attributes] || params[:record] active_scaffold_config.model.transaction do @record = update_record_from_params(new_model, active_scaffold_config.create.columns, attributes) apply_constraints_to_record(@record, :allow_autosave => true) create_association_with_parent(@record) if nested? before_create_save(@record) # errors to @record can be added by update_record_from_params when association fails to set and ActiveRecord::RecordNotSaved is raised self.successful = [@record.keeping_errors { @record.valid? }, @record.associated_valid?].all? # this syntax avoids a short-circuit create_save(@record) unless options[:skip_save] end rescue ActiveRecord::ActiveRecordError => ex flash[:error] = ex.message self.successful = false @record ||= new_model # ensure @record exists or display form will fail end
[ "def", "do_create", "(", "options", "=", "{", "}", ")", "attributes", "=", "options", "[", ":attributes", "]", "||", "params", "[", ":record", "]", "active_scaffold_config", ".", "model", ".", "transaction", "do", "@record", "=", "update_record_from_params", "(", "new_model", ",", "active_scaffold_config", ".", "create", ".", "columns", ",", "attributes", ")", "apply_constraints_to_record", "(", "@record", ",", ":allow_autosave", "=>", "true", ")", "create_association_with_parent", "(", "@record", ")", "if", "nested?", "before_create_save", "(", "@record", ")", "self", ".", "successful", "=", "[", "@record", ".", "keeping_errors", "{", "@record", ".", "valid?", "}", ",", "@record", ".", "associated_valid?", "]", ".", "all?", "create_save", "(", "@record", ")", "unless", "options", "[", ":skip_save", "]", "end", "rescue", "ActiveRecord", "::", "ActiveRecordError", "=>", "ex", "flash", "[", ":error", "]", "=", "ex", ".", "message", "self", ".", "successful", "=", "false", "@record", "||=", "new_model", "end" ]
A somewhat complex method to actually create a new record. The complexity is from support for subforms and associated records. If you want to customize this behavior, consider using the +before_create_save+ and +after_create_save+ callbacks.
[ "A", "somewhat", "complex", "method", "to", "actually", "create", "a", "new", "record", ".", "The", "complexity", "is", "from", "support", "for", "subforms", "and", "associated", "records", ".", "If", "you", "want", "to", "customize", "this", "behavior", "consider", "using", "the", "+", "before_create_save", "+", "and", "+", "after_create_save", "+", "callbacks", "." ]
1954f85b5395d09de09fa86f3ea70c29bbee2612
https://github.com/activescaffold/active_scaffold/blob/1954f85b5395d09de09fa86f3ea70c29bbee2612/lib/active_scaffold/actions/create.rb#L93-L108
train
activescaffold/active_scaffold
lib/active_scaffold/config/core.rb
ActiveScaffold::Config.Core._configure_sti
def _configure_sti column = model.inheritance_column if sti_create_links columns[column].form_ui ||= :hidden else columns[column].form_ui ||= :select columns[column].options ||= {} columns[column].options[:options] = sti_children.collect do |model_name| [model_name.to_s.camelize.constantize.model_name.human, model_name.to_s.camelize] end end end
ruby
def _configure_sti column = model.inheritance_column if sti_create_links columns[column].form_ui ||= :hidden else columns[column].form_ui ||= :select columns[column].options ||= {} columns[column].options[:options] = sti_children.collect do |model_name| [model_name.to_s.camelize.constantize.model_name.human, model_name.to_s.camelize] end end end
[ "def", "_configure_sti", "column", "=", "model", ".", "inheritance_column", "if", "sti_create_links", "columns", "[", "column", "]", ".", "form_ui", "||=", ":hidden", "else", "columns", "[", "column", "]", ".", "form_ui", "||=", ":select", "columns", "[", "column", "]", ".", "options", "||=", "{", "}", "columns", "[", "column", "]", ".", "options", "[", ":options", "]", "=", "sti_children", ".", "collect", "do", "|", "model_name", "|", "[", "model_name", ".", "to_s", ".", "camelize", ".", "constantize", ".", "model_name", ".", "human", ",", "model_name", ".", "to_s", ".", "camelize", "]", "end", "end", "end" ]
To be called after your finished configuration
[ "To", "be", "called", "after", "your", "finished", "configuration" ]
1954f85b5395d09de09fa86f3ea70c29bbee2612
https://github.com/activescaffold/active_scaffold/blob/1954f85b5395d09de09fa86f3ea70c29bbee2612/lib/active_scaffold/config/core.rb#L208-L219
train
activescaffold/active_scaffold
lib/active_scaffold/data_structures/sorting.rb
ActiveScaffold::DataStructures.Sorting.add
def add(column_name, direction = nil) direction ||= 'ASC' direction = direction.to_s.upcase column = get_column(column_name) raise ArgumentError, "Could not find column #{column_name}" if column.nil? raise ArgumentError, 'Sorting direction unknown' unless %i[ASC DESC].include? direction.to_sym @clauses << [column, direction.untaint] if column.sortable? raise ArgumentError, "Can't mix :method- and :sql-based sorting" if mixed_sorting? end
ruby
def add(column_name, direction = nil) direction ||= 'ASC' direction = direction.to_s.upcase column = get_column(column_name) raise ArgumentError, "Could not find column #{column_name}" if column.nil? raise ArgumentError, 'Sorting direction unknown' unless %i[ASC DESC].include? direction.to_sym @clauses << [column, direction.untaint] if column.sortable? raise ArgumentError, "Can't mix :method- and :sql-based sorting" if mixed_sorting? end
[ "def", "add", "(", "column_name", ",", "direction", "=", "nil", ")", "direction", "||=", "'ASC'", "direction", "=", "direction", ".", "to_s", ".", "upcase", "column", "=", "get_column", "(", "column_name", ")", "raise", "ArgumentError", ",", "\"Could not find column #{column_name}\"", "if", "column", ".", "nil?", "raise", "ArgumentError", ",", "'Sorting direction unknown'", "unless", "%i[", "ASC", "DESC", "]", ".", "include?", "direction", ".", "to_sym", "@clauses", "<<", "[", "column", ",", "direction", ".", "untaint", "]", "if", "column", ".", "sortable?", "raise", "ArgumentError", ",", "\"Can't mix :method- and :sql-based sorting\"", "if", "mixed_sorting?", "end" ]
add a clause to the sorting, assuming the column is sortable
[ "add", "a", "clause", "to", "the", "sorting", "assuming", "the", "column", "is", "sortable" ]
1954f85b5395d09de09fa86f3ea70c29bbee2612
https://github.com/activescaffold/active_scaffold/blob/1954f85b5395d09de09fa86f3ea70c29bbee2612/lib/active_scaffold/data_structures/sorting.rb#L37-L45
train