query
stringlengths 7
9.55k
| document
stringlengths 10
363k
| metadata
dict | negatives
listlengths 0
101
| negative_scores
listlengths 0
101
| document_score
stringlengths 3
10
| document_rank
stringclasses 102
values |
|---|---|---|---|---|---|---|
Update properties of this object
|
def update!(**args)
@data_source_id = args[:data_source_id] if args.key?(:data_source_id)
@destination_dataset_id = args[:destination_dataset_id] if args.key?(:destination_dataset_id)
@email_preferences = args[:email_preferences] if args.key?(:email_preferences)
@end_time = args[:end_time] if args.key?(:end_time)
@error_status = args[:error_status] if args.key?(:error_status)
@name = args[:name] if args.key?(:name)
@notification_pubsub_topic = args[:notification_pubsub_topic] if args.key?(:notification_pubsub_topic)
@params = args[:params] if args.key?(:params)
@run_time = args[:run_time] if args.key?(:run_time)
@schedule = args[:schedule] if args.key?(:schedule)
@schedule_time = args[:schedule_time] if args.key?(:schedule_time)
@start_time = args[:start_time] if args.key?(:start_time)
@state = args[:state] if args.key?(:state)
@update_time = args[:update_time] if args.key?(:update_time)
@user_id = args[:user_id] if args.key?(:user_id)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end",
"def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"def refresh\n self.class.base_properties.each_with_index do |prop, prop_id|\n @properties[prop] = get_property(prop_id)\n end\n refresh_features\n refresh_status\n refresh_config\n self\n end",
"def update!(**args)\n @subobject_properties = args[:subobject_properties] if args.key?(:subobject_properties)\n end",
"def update!(**args)\n @subobject_properties = args[:subobject_properties] if args.key?(:subobject_properties)\n end",
"def update(attrs)\n super(attrs)\n end",
"def update(attrs)\n super(attrs)\n end",
"def update(attrs)\n super(attrs)\n end",
"def update(attrs)\n super(attrs)\n end",
"def update_properties!(branch_id=nil)\n properties = fetch_properties(false, branch_id)\n length = properties.length\n counter = 0\n properties.each do |property|\n counter += 1\n if Vebra.debugging?\n puts \"[Vebra]: #{counter}/#{length}: live updating property with Vebra ref: #{property.attributes[:vebra_ref]}\"\n end\n live_update!(property)\n Vebra.set_last_updated_at(Time.now) if counter == length\n end\n end",
"def update_self obj\n obj.each do |k,v|\n instance_variable_set(\"@#{k}\", v) if v\n end\n end",
"def update_attributes(properties_hash)\n self.class.get_class_properties.each do |property|\n key = property[:name].to_sym\n if properties_hash.has_key? key\n self.setValue(properties_hash[key], forKey:key)\n end\n end\n end",
"def update\n # TODO: implement update\n end",
"def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n @states = args[:states] if args.key?(:states)\n end",
"def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @object = args[:object] if args.key?(:object)\n end",
"def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @object = args[:object] if args.key?(:object)\n end",
"def update!(**args)\n @property = args[:property] if args.key?(:property)\n @total_value_count = args[:total_value_count] if args.key?(:total_value_count)\n @value = args[:value] if args.key?(:value)\n @value_status = args[:value_status] if args.key?(:value_status)\n end",
"def update\n \n end",
"def refresh\n set_attributes\n end",
"def update(attrs)\n @attrs.update(attrs)\n self\n end",
"def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n @source = args[:source] if args.key?(:source)\n end",
"def update_resource object, attributes\n object.update attributes\n end",
"def update(attrs)\n @attrs ||= {}\n @attrs.update(attrs)\n self\n end",
"def update\n \n end",
"def update!(**args)\n @property = args[:property] if args.key?(:property)\n @schema = args[:schema] if args.key?(:schema)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n @options = args[:options] if args.key?(:options)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n @options = args[:options] if args.key?(:options)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end",
"def update(attributes = {})\n super(attributes)\n retrieve!\n self\n end",
"def _update!\n self.class.properties.each do |property, predicate|\n if dirty?(property)\n self.class.repository_or_fail.delete([subject, predicate[:predicate], nil])\n if self.class.is_list?(property)\n repo = RDF::Repository.new\n attribute_get(property).each do |value|\n repo << RDF::Statement.new(subject, predicate[:predicate], self.class.build_rdf_value(value, self.class.properties[property][:type]))\n end\n self.class.repository_or_fail.insert(*repo)\n else\n self.class.repository_or_fail.insert(RDF::Statement.new(subject, predicate[:predicate], self.class.build_rdf_value(attribute_get(property), self.class.properties[property][:type])))\n end\n end\n @dirty[property] = nil\n @attributes[:original][property] = attribute_get(property)\n end\n self.class.repository_or_fail.insert(RDF::Statement.new(@subject, RDF.type, type)) unless type.nil?\n end",
"def update\n @objects.map(&:update);\n end",
"def update\n raise NotImplementedError\n end",
"def update\n raise NotImplementedError\n end",
"def live_update!(property)\n property_class = Vebra.models[:property][:class].to_s.camelize.constantize\n\n # ensure we have the full property attributes\n property.get_property if !property.attributes[:status] && property.attributes[:action] != 'deleted'\n\n # find & update or build a new property\n property_model = property_class.find_or_initialize_by_vebra_ref(property.attributes[:vebra_ref])\n\n # make sure property object is not empty\n return false if !property.attributes || !property.attributes[:property_type]\n\n # if the property has been deleted, mark it appropriately and move on\n if property.attributes[:action] == 'deleted'\n return property_model.destroy\n end\n\n # extract accessible attributes for the property\n property_accessibles = property_class.accessible_attributes.map(&:to_sym)\n property_attributes = property.attributes.inject({}) do |result, (key, value)|\n result[key] = value if property_accessibles.include?(key)\n result\n end\n\n # update the property model's attributes\n property_model.no_callbacks = true if property_model.respond_to?(:no_callbacks)\n property_model.update_attributes(property_attributes)\n\n # find & update or build a new address\n if Vebra.models[:address]\n address_class = Vebra.models[:address][:class].to_s.camelize.constantize\n address_model = property_model.send(Vebra.models[:property][:address_method])\n address_model = property_model.send(\"build_#{Vebra.models[:property][:address_method]}\") unless address_model\n\n # extract accessible attributes for the address\n address_accessibles = address_class.accessible_attributes.map(&:to_sym)\n address_attributes = property.attributes[:address].inject({}) do |result, (key, value)|\n result[key] = value if address_accessibles.include?(key)\n result\n end\n\n # update the address model's attributes\n address_model.update_attributes(address_attributes)\n end\n\n # find & update or build new rooms\n if Vebra.models[:room]\n room_class = Vebra.models[:room][:class].to_s.camelize.constantize\n\n # accessible attributes for the rooms\n room_accessibles = room_class.accessible_attributes.map(&:to_sym)\n\n # delete any rooms which are no longer present\n property_rooms = property.attributes[:rooms] || []\n property_model_rooms = property_model.send(Vebra.models[:property][:rooms_method])\n refs_to_delete = property_model_rooms.map(&:vebra_ref) - property_rooms.map { |r| r[:vebra_ref] }\n property_model_rooms.each do |room|\n room.destroy if refs_to_delete.include?(room.vebra_ref)\n end\n\n # find & update or build new rooms\n property_rooms.each do |room|\n room_model = room_class.find_by_property_id_and_vebra_ref(property_model.id, room[:vebra_ref])\n room_model = property_model_rooms.build unless room_model\n\n # extract accessible attributes for the room\n room_attributes = room.inject({}) do |result, (key, value)|\n result[key] = value if room_accessibles.include?(key)\n result\n end\n\n # update the room model's attributes\n room_model.update_attributes(room_attributes)\n end\n end\n\n # find & update or build new file attachments\n if Vebra.models[:file]\n file_class = Vebra.models[:file][:class].to_s.camelize.constantize\n\n # accessible attributes for the files\n file_accessibles = file_class.accessible_attributes.map(&:to_sym)\n\n # first normalize the collection (currently nested collections)\n property_files = property.attributes[:files].inject([]) do |result, (kind, collection)|\n collection.each do |file|\n file[:type] = kind.to_s.singularize.camelize if file_accessibles.include?(:type)\n file[\"remote_#{Vebra.models[:file][:attachment_method]}_url\".to_sym] = file.delete(:url)\n # if file[:type] is set, it means the attachment file class can be subclassed. In this\n # case we need to ensure that the subclass exists. If not, we ignore this file\n begin\n file[:type].constantize if file_accessibles.include?(:type)\n result << file\n rescue NameError => e\n # ignore - this means the subclass does not exist\n puts \"[Vebra]: #{e.message}\" if Vebra.debugging?\n end\n end\n\n result\n end\n\n # delete any files which are no longer present\n property_model_files = property_model.send(Vebra.models[:property][:files_method])\n refs_to_delete = property_model_files.map(&:vebra_ref) - property_files.map { |f| f[:vebra_ref] }\n property_model_files.each do |file|\n file.destroy if refs_to_delete.include?(file.vebra_ref)\n end\n\n # find & update or build new files\n property_files.each do |file|\n begin\n file_model = property_model_files.find_by_vebra_ref(file[:vebra_ref])\n file_model = property_model_files.build unless file_model\n\n # extract accessible attributes for the file\n file_attributes = file.inject({}) do |result, (key, value)|\n result[key] = value if file_accessibles.include?(key)\n result\n end\n\n # update the room model's attributes\n file_model.update_attributes(file_attributes)\n rescue CarrierWave::ProcessingError, OpenURI::HTTPError => e\n # just ignore the file\n puts \"[Vebra]: #{e.message}\" if Vebra.debugging?\n end\n end\n end\n\n property_model.no_callbacks = false if property_model.respond_to?(:no_callbacks)\n property_model.save\n return property_model\n end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n @property_value = args[:property_value] if args.key?(:property_value)\n end",
"def update\n end",
"def update!(**args)\n @mid = args[:mid] if args.key?(:mid)\n @property_value = args[:property_value] if args.key?(:property_value)\n end",
"def modified_properties=(value)\n @modified_properties = value\n end",
"def apply_properties!(properties)\n # Non-commutitivity etc. eventually.\n end",
"def set_properties(hash)\n hash.each do |key, value|\n add_or_remove_ostruct_member(key, value)\n end\n rest_reset_properties\n end",
"def update\n\t\t\n\t\tend",
"def set_props(props)\n @props.merge!(props)\n end",
"def update() end",
"def update!(**args)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end",
"def assign_properties\n self.properties ||= {}\n listing_properties.each do |prop|\n self.properties[prop.key] ||= prop.value\n end\n end",
"def change_properties(new_current_floor, new_next_floor, new_movement)\n @current_floor = new_current_floor\n @next_floor = new_next_floor\n @movement = new_movement\n end",
"def update!(**args)\n @property_value = args[:property_value] if args.key?(:property_value)\n end",
"def update!(**args)\n @property_name = args[:property_name] if args.key?(:property_name)\n end",
"def update!(**args)\n @property_name = args[:property_name] if args.key?(:property_name)\n end",
"def update(attributes)\n (@attributes ||= {}).merge! attributes\n\n (self.class.attr_initializables & attributes.keys).each do |name|\n instance_variable_set :\"@#{name}\", attributes[name]\n end\n\n self\n end",
"def update_attributes(attrs)\n super({})\n end",
"def update\n @dirty = true\n end",
"def update\n\n # Run through the mixin updates\n colourable_update\n movable_update\n\n end",
"def set(props)\n props.each do |prop, val|\n self.send(:\"#{ prop }=\", val)\n end\n end",
"def update\n super\n end",
"def update!(**args)\n @property_id = args[:property_id] if args.key?(:property_id)\n @value_status = args[:value_status] if args.key?(:value_status)\n end",
"def update!(**args)\n @object_size_bytes = args[:object_size_bytes] if args.key?(:object_size_bytes)\n @object_version = args[:object_version] if args.key?(:object_version)\n end",
"def movable_update\n\n # Work through the different aspects we update\n movable_location_update\n movable_size_update\n movable_angle_update\n\n end",
"def update(attrs)\n attrs.each_pair do |key, value|\n send(\"#{key}=\", value) if respond_to?(\"#{key}=\")\n # attributes[key] = value <- lets make use of virtual attributes too\n end\n end",
"def update(context={})\n self.pre_cast_attributes\n m2o = @relations.reject{|k, v| !self.class.many2one_relations.has_key?(k)}\n vals = @attributes.reject {|key, value| key == 'id'}.merge(m2o.merge(m2o){|k, v| v.is_a?(Array) ? v[0] : v})\n self.class.rpc_execute('write', self.id, vals, context)\n reload_from_record!(self.class.find(self.id, :context => context))\n end",
"def properties=(value)\n @properties = value\n end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update ; end",
"def update!(**args)\n @freshness_duration = args[:freshness_duration] if args.key?(:freshness_duration)\n @freshness_property = args[:freshness_property] if args.key?(:freshness_property)\n end",
"def update!(**args)\n @freshness_duration = args[:freshness_duration] if args.key?(:freshness_duration)\n @freshness_property = args[:freshness_property] if args.key?(:freshness_property)\n end",
"def method_missing(method, *args)\n super if @updated\n set_up_properties_from(@client.get(@path))\n self.send method, *args\n end",
"def method_missing(method, *args)\n super if @updated\n set_up_properties_from(@client.get(@path))\n self.send method, *args\n end",
"def update_with(attributes)\n assign_attributes(attributes)\n end",
"def update\n # don't need to update; hash is shared\n end",
"def update(attributes)\n HashProxy.with(attributes) do |proxy|\n self.class.attribute_names.each do |name|\n send(\"#{name}=\", proxy[name]) if proxy.key?(name)\n end\n end\n save\n end",
"def update!(**args)\n @object_id_prop = args[:object_id_prop] if args.key?(:object_id_prop)\n @relation = args[:relation] if args.key?(:relation)\n @subject_id = args[:subject_id] if args.key?(:subject_id)\n end",
"def update!(**args)\n @boolean_property_options = args[:boolean_property_options] if args.key?(:boolean_property_options)\n @date_property_options = args[:date_property_options] if args.key?(:date_property_options)\n @display_options = args[:display_options] if args.key?(:display_options)\n @double_property_options = args[:double_property_options] if args.key?(:double_property_options)\n @enum_property_options = args[:enum_property_options] if args.key?(:enum_property_options)\n @html_property_options = args[:html_property_options] if args.key?(:html_property_options)\n @integer_property_options = args[:integer_property_options] if args.key?(:integer_property_options)\n @is_facetable = args[:is_facetable] if args.key?(:is_facetable)\n @is_repeatable = args[:is_repeatable] if args.key?(:is_repeatable)\n @is_returnable = args[:is_returnable] if args.key?(:is_returnable)\n @is_sortable = args[:is_sortable] if args.key?(:is_sortable)\n @is_suggestable = args[:is_suggestable] if args.key?(:is_suggestable)\n @is_wildcard_searchable = args[:is_wildcard_searchable] if args.key?(:is_wildcard_searchable)\n @name = args[:name] if args.key?(:name)\n @object_property_options = args[:object_property_options] if args.key?(:object_property_options)\n @text_property_options = args[:text_property_options] if args.key?(:text_property_options)\n @timestamp_property_options = args[:timestamp_property_options] if args.key?(:timestamp_property_options)\n end",
"def update!(**args)\n @boolean_property_options = args[:boolean_property_options] if args.key?(:boolean_property_options)\n @date_property_options = args[:date_property_options] if args.key?(:date_property_options)\n @display_options = args[:display_options] if args.key?(:display_options)\n @double_property_options = args[:double_property_options] if args.key?(:double_property_options)\n @enum_property_options = args[:enum_property_options] if args.key?(:enum_property_options)\n @html_property_options = args[:html_property_options] if args.key?(:html_property_options)\n @integer_property_options = args[:integer_property_options] if args.key?(:integer_property_options)\n @is_facetable = args[:is_facetable] if args.key?(:is_facetable)\n @is_repeatable = args[:is_repeatable] if args.key?(:is_repeatable)\n @is_returnable = args[:is_returnable] if args.key?(:is_returnable)\n @is_sortable = args[:is_sortable] if args.key?(:is_sortable)\n @is_suggestable = args[:is_suggestable] if args.key?(:is_suggestable)\n @is_wildcard_searchable = args[:is_wildcard_searchable] if args.key?(:is_wildcard_searchable)\n @name = args[:name] if args.key?(:name)\n @object_property_options = args[:object_property_options] if args.key?(:object_property_options)\n @text_property_options = args[:text_property_options] if args.key?(:text_property_options)\n @timestamp_property_options = args[:timestamp_property_options] if args.key?(:timestamp_property_options)\n end",
"def update\n raise NotImplementedError\n end",
"def update_attributes attributes\n @attributes.merge! attributes\n end",
"def update!(**args)\n @async_options = args[:async_options] if args.key?(:async_options)\n @input_mappings = args[:input_mappings] if args.key?(:input_mappings)\n @name_property = args[:name_property] if args.key?(:name_property)\n @validation_options = args[:validation_options] if args.key?(:validation_options)\n end",
"def update\r\n end",
"def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @type = args[:type] if args.key?(:type)\n end",
"def update\n raise NotImplemented\n end",
"def update_obj\n mean, sd = rating.to_glicko_rating\n @obj.rating = mean\n @obj.rating_deviation = sd\n @obj.volatility = volatility\n end",
"def update_values\n end",
"def update_values\n end",
"def update\n raise NotImplementedError\n end",
"def update!(**args)\n @answers_header_signals = args[:answers_header_signals] if args.key?(:answers_header_signals)\n @property_value = args[:property_value] if args.key?(:property_value)\n @response_meaning_application = args[:response_meaning_application] if args.key?(:response_meaning_application)\n end",
"def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @method_prop = args[:method_prop] if args.key?(:method_prop)\n @name = args[:name] if args.key?(:name)\n @state = args[:state] if args.key?(:state)\n end",
"def update attributes, collection #:nodoc:\n 0\n end",
"def update_property_groups(roll)\n @property_groups.each { |_, v| v.update_rent(roll) }\n end",
"def update_info(update_attr_hash)\n update_attr_hash.each do |k,v| \n\t\t\tself.send(\"#{k}=\",v)\n\t\tend\n end",
"def update!(**args)\n @source_property = args[:source_property] if args.key?(:source_property)\n end",
"def update_properties(path, properties)\n prop_patch = PropPatch.new(properties)\n emit('propPatch', [path, prop_patch])\n prop_patch.commit\n\n prop_patch.result\n end",
"def update\n set_deltatime\n set_last_update_at\n end"
] |
[
"0.70124525",
"0.69187176",
"0.69187176",
"0.69187176",
"0.69187176",
"0.69187176",
"0.6738901",
"0.67084897",
"0.67084897",
"0.66983044",
"0.66983044",
"0.66983044",
"0.66983044",
"0.66188794",
"0.6571416",
"0.6538292",
"0.65194744",
"0.63953435",
"0.63903284",
"0.63903284",
"0.63344294",
"0.63216114",
"0.6284898",
"0.6271445",
"0.62648237",
"0.624251",
"0.6218843",
"0.6217826",
"0.6211294",
"0.6204883",
"0.6204883",
"0.6203174",
"0.6203085",
"0.6202945",
"0.61754346",
"0.61754346",
"0.6159627",
"0.61573356",
"0.6146927",
"0.61265624",
"0.61233723",
"0.61213213",
"0.6110708",
"0.61082405",
"0.610203",
"0.6087213",
"0.60851586",
"0.606328",
"0.60598475",
"0.6056013",
"0.605159",
"0.605159",
"0.60428274",
"0.6032607",
"0.6025175",
"0.6016861",
"0.59932756",
"0.5991629",
"0.5977848",
"0.59746736",
"0.5967899",
"0.59640163",
"0.5963087",
"0.59628224",
"0.59534305",
"0.59534305",
"0.59534305",
"0.59534305",
"0.59534305",
"0.59534305",
"0.59534305",
"0.59534305",
"0.59529036",
"0.594494",
"0.594494",
"0.59420687",
"0.59420687",
"0.59377116",
"0.5927631",
"0.5926637",
"0.592564",
"0.59237856",
"0.59237856",
"0.5923722",
"0.59169865",
"0.591586",
"0.58917314",
"0.58872443",
"0.58862734",
"0.58807427",
"0.5880232",
"0.5880232",
"0.5877138",
"0.5860484",
"0.5846987",
"0.58439326",
"0.58367634",
"0.58300084",
"0.5829718",
"0.58233184",
"0.5822193"
] |
0.0
|
-1
|
Update properties of this object
|
def update!(**args)
@email = args[:email] if args.key?(:email)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end",
"def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"def refresh\n self.class.base_properties.each_with_index do |prop, prop_id|\n @properties[prop] = get_property(prop_id)\n end\n refresh_features\n refresh_status\n refresh_config\n self\n end",
"def update!(**args)\n @subobject_properties = args[:subobject_properties] if args.key?(:subobject_properties)\n end",
"def update!(**args)\n @subobject_properties = args[:subobject_properties] if args.key?(:subobject_properties)\n end",
"def update(attrs)\n super(attrs)\n end",
"def update(attrs)\n super(attrs)\n end",
"def update(attrs)\n super(attrs)\n end",
"def update(attrs)\n super(attrs)\n end",
"def update_properties!(branch_id=nil)\n properties = fetch_properties(false, branch_id)\n length = properties.length\n counter = 0\n properties.each do |property|\n counter += 1\n if Vebra.debugging?\n puts \"[Vebra]: #{counter}/#{length}: live updating property with Vebra ref: #{property.attributes[:vebra_ref]}\"\n end\n live_update!(property)\n Vebra.set_last_updated_at(Time.now) if counter == length\n end\n end",
"def update_self obj\n obj.each do |k,v|\n instance_variable_set(\"@#{k}\", v) if v\n end\n end",
"def update_attributes(properties_hash)\n self.class.get_class_properties.each do |property|\n key = property[:name].to_sym\n if properties_hash.has_key? key\n self.setValue(properties_hash[key], forKey:key)\n end\n end\n end",
"def update\n # TODO: implement update\n end",
"def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n @states = args[:states] if args.key?(:states)\n end",
"def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @object = args[:object] if args.key?(:object)\n end",
"def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @object = args[:object] if args.key?(:object)\n end",
"def update!(**args)\n @property = args[:property] if args.key?(:property)\n @total_value_count = args[:total_value_count] if args.key?(:total_value_count)\n @value = args[:value] if args.key?(:value)\n @value_status = args[:value_status] if args.key?(:value_status)\n end",
"def update\n \n end",
"def refresh\n set_attributes\n end",
"def update(attrs)\n @attrs.update(attrs)\n self\n end",
"def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n @source = args[:source] if args.key?(:source)\n end",
"def update_resource object, attributes\n object.update attributes\n end",
"def update(attrs)\n @attrs ||= {}\n @attrs.update(attrs)\n self\n end",
"def update\n \n end",
"def update!(**args)\n @property = args[:property] if args.key?(:property)\n @schema = args[:schema] if args.key?(:schema)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n @options = args[:options] if args.key?(:options)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n @options = args[:options] if args.key?(:options)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end",
"def _update!\n self.class.properties.each do |property, predicate|\n if dirty?(property)\n self.class.repository_or_fail.delete([subject, predicate[:predicate], nil])\n if self.class.is_list?(property)\n repo = RDF::Repository.new\n attribute_get(property).each do |value|\n repo << RDF::Statement.new(subject, predicate[:predicate], self.class.build_rdf_value(value, self.class.properties[property][:type]))\n end\n self.class.repository_or_fail.insert(*repo)\n else\n self.class.repository_or_fail.insert(RDF::Statement.new(subject, predicate[:predicate], self.class.build_rdf_value(attribute_get(property), self.class.properties[property][:type])))\n end\n end\n @dirty[property] = nil\n @attributes[:original][property] = attribute_get(property)\n end\n self.class.repository_or_fail.insert(RDF::Statement.new(@subject, RDF.type, type)) unless type.nil?\n end",
"def update(attributes = {})\n super(attributes)\n retrieve!\n self\n end",
"def update\n @objects.map(&:update);\n end",
"def update\n raise NotImplementedError\n end",
"def update\n raise NotImplementedError\n end",
"def live_update!(property)\n property_class = Vebra.models[:property][:class].to_s.camelize.constantize\n\n # ensure we have the full property attributes\n property.get_property if !property.attributes[:status] && property.attributes[:action] != 'deleted'\n\n # find & update or build a new property\n property_model = property_class.find_or_initialize_by_vebra_ref(property.attributes[:vebra_ref])\n\n # make sure property object is not empty\n return false if !property.attributes || !property.attributes[:property_type]\n\n # if the property has been deleted, mark it appropriately and move on\n if property.attributes[:action] == 'deleted'\n return property_model.destroy\n end\n\n # extract accessible attributes for the property\n property_accessibles = property_class.accessible_attributes.map(&:to_sym)\n property_attributes = property.attributes.inject({}) do |result, (key, value)|\n result[key] = value if property_accessibles.include?(key)\n result\n end\n\n # update the property model's attributes\n property_model.no_callbacks = true if property_model.respond_to?(:no_callbacks)\n property_model.update_attributes(property_attributes)\n\n # find & update or build a new address\n if Vebra.models[:address]\n address_class = Vebra.models[:address][:class].to_s.camelize.constantize\n address_model = property_model.send(Vebra.models[:property][:address_method])\n address_model = property_model.send(\"build_#{Vebra.models[:property][:address_method]}\") unless address_model\n\n # extract accessible attributes for the address\n address_accessibles = address_class.accessible_attributes.map(&:to_sym)\n address_attributes = property.attributes[:address].inject({}) do |result, (key, value)|\n result[key] = value if address_accessibles.include?(key)\n result\n end\n\n # update the address model's attributes\n address_model.update_attributes(address_attributes)\n end\n\n # find & update or build new rooms\n if Vebra.models[:room]\n room_class = Vebra.models[:room][:class].to_s.camelize.constantize\n\n # accessible attributes for the rooms\n room_accessibles = room_class.accessible_attributes.map(&:to_sym)\n\n # delete any rooms which are no longer present\n property_rooms = property.attributes[:rooms] || []\n property_model_rooms = property_model.send(Vebra.models[:property][:rooms_method])\n refs_to_delete = property_model_rooms.map(&:vebra_ref) - property_rooms.map { |r| r[:vebra_ref] }\n property_model_rooms.each do |room|\n room.destroy if refs_to_delete.include?(room.vebra_ref)\n end\n\n # find & update or build new rooms\n property_rooms.each do |room|\n room_model = room_class.find_by_property_id_and_vebra_ref(property_model.id, room[:vebra_ref])\n room_model = property_model_rooms.build unless room_model\n\n # extract accessible attributes for the room\n room_attributes = room.inject({}) do |result, (key, value)|\n result[key] = value if room_accessibles.include?(key)\n result\n end\n\n # update the room model's attributes\n room_model.update_attributes(room_attributes)\n end\n end\n\n # find & update or build new file attachments\n if Vebra.models[:file]\n file_class = Vebra.models[:file][:class].to_s.camelize.constantize\n\n # accessible attributes for the files\n file_accessibles = file_class.accessible_attributes.map(&:to_sym)\n\n # first normalize the collection (currently nested collections)\n property_files = property.attributes[:files].inject([]) do |result, (kind, collection)|\n collection.each do |file|\n file[:type] = kind.to_s.singularize.camelize if file_accessibles.include?(:type)\n file[\"remote_#{Vebra.models[:file][:attachment_method]}_url\".to_sym] = file.delete(:url)\n # if file[:type] is set, it means the attachment file class can be subclassed. In this\n # case we need to ensure that the subclass exists. If not, we ignore this file\n begin\n file[:type].constantize if file_accessibles.include?(:type)\n result << file\n rescue NameError => e\n # ignore - this means the subclass does not exist\n puts \"[Vebra]: #{e.message}\" if Vebra.debugging?\n end\n end\n\n result\n end\n\n # delete any files which are no longer present\n property_model_files = property_model.send(Vebra.models[:property][:files_method])\n refs_to_delete = property_model_files.map(&:vebra_ref) - property_files.map { |f| f[:vebra_ref] }\n property_model_files.each do |file|\n file.destroy if refs_to_delete.include?(file.vebra_ref)\n end\n\n # find & update or build new files\n property_files.each do |file|\n begin\n file_model = property_model_files.find_by_vebra_ref(file[:vebra_ref])\n file_model = property_model_files.build unless file_model\n\n # extract accessible attributes for the file\n file_attributes = file.inject({}) do |result, (key, value)|\n result[key] = value if file_accessibles.include?(key)\n result\n end\n\n # update the room model's attributes\n file_model.update_attributes(file_attributes)\n rescue CarrierWave::ProcessingError, OpenURI::HTTPError => e\n # just ignore the file\n puts \"[Vebra]: #{e.message}\" if Vebra.debugging?\n end\n end\n end\n\n property_model.no_callbacks = false if property_model.respond_to?(:no_callbacks)\n property_model.save\n return property_model\n end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n @property_value = args[:property_value] if args.key?(:property_value)\n end",
"def update\n end",
"def update!(**args)\n @mid = args[:mid] if args.key?(:mid)\n @property_value = args[:property_value] if args.key?(:property_value)\n end",
"def modified_properties=(value)\n @modified_properties = value\n end",
"def apply_properties!(properties)\n # Non-commutitivity etc. eventually.\n end",
"def set_properties(hash)\n hash.each do |key, value|\n add_or_remove_ostruct_member(key, value)\n end\n rest_reset_properties\n end",
"def update\n\t\t\n\t\tend",
"def set_props(props)\n @props.merge!(props)\n end",
"def update() end",
"def update!(**args)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end",
"def assign_properties\n self.properties ||= {}\n listing_properties.each do |prop|\n self.properties[prop.key] ||= prop.value\n end\n end",
"def change_properties(new_current_floor, new_next_floor, new_movement)\n @current_floor = new_current_floor\n @next_floor = new_next_floor\n @movement = new_movement\n end",
"def update!(**args)\n @property_value = args[:property_value] if args.key?(:property_value)\n end",
"def update!(**args)\n @property_name = args[:property_name] if args.key?(:property_name)\n end",
"def update!(**args)\n @property_name = args[:property_name] if args.key?(:property_name)\n end",
"def update(attributes)\n (@attributes ||= {}).merge! attributes\n\n (self.class.attr_initializables & attributes.keys).each do |name|\n instance_variable_set :\"@#{name}\", attributes[name]\n end\n\n self\n end",
"def update_attributes(attrs)\n super({})\n end",
"def update\n @dirty = true\n end",
"def update\n\n # Run through the mixin updates\n colourable_update\n movable_update\n\n end",
"def set(props)\n props.each do |prop, val|\n self.send(:\"#{ prop }=\", val)\n end\n end",
"def update\n super\n end",
"def update!(**args)\n @property_id = args[:property_id] if args.key?(:property_id)\n @value_status = args[:value_status] if args.key?(:value_status)\n end",
"def update!(**args)\n @object_size_bytes = args[:object_size_bytes] if args.key?(:object_size_bytes)\n @object_version = args[:object_version] if args.key?(:object_version)\n end",
"def movable_update\n\n # Work through the different aspects we update\n movable_location_update\n movable_size_update\n movable_angle_update\n\n end",
"def properties=(value)\n @properties = value\n end",
"def update(attrs)\n attrs.each_pair do |key, value|\n send(\"#{key}=\", value) if respond_to?(\"#{key}=\")\n # attributes[key] = value <- lets make use of virtual attributes too\n end\n end",
"def update(context={})\n self.pre_cast_attributes\n m2o = @relations.reject{|k, v| !self.class.many2one_relations.has_key?(k)}\n vals = @attributes.reject {|key, value| key == 'id'}.merge(m2o.merge(m2o){|k, v| v.is_a?(Array) ? v[0] : v})\n self.class.rpc_execute('write', self.id, vals, context)\n reload_from_record!(self.class.find(self.id, :context => context))\n end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update ; end",
"def update!(**args)\n @freshness_duration = args[:freshness_duration] if args.key?(:freshness_duration)\n @freshness_property = args[:freshness_property] if args.key?(:freshness_property)\n end",
"def update!(**args)\n @freshness_duration = args[:freshness_duration] if args.key?(:freshness_duration)\n @freshness_property = args[:freshness_property] if args.key?(:freshness_property)\n end",
"def method_missing(method, *args)\n super if @updated\n set_up_properties_from(@client.get(@path))\n self.send method, *args\n end",
"def method_missing(method, *args)\n super if @updated\n set_up_properties_from(@client.get(@path))\n self.send method, *args\n end",
"def update_with(attributes)\n assign_attributes(attributes)\n end",
"def update\n # don't need to update; hash is shared\n end",
"def update(attributes)\n HashProxy.with(attributes) do |proxy|\n self.class.attribute_names.each do |name|\n send(\"#{name}=\", proxy[name]) if proxy.key?(name)\n end\n end\n save\n end",
"def update!(**args)\n @object_id_prop = args[:object_id_prop] if args.key?(:object_id_prop)\n @relation = args[:relation] if args.key?(:relation)\n @subject_id = args[:subject_id] if args.key?(:subject_id)\n end",
"def update!(**args)\n @boolean_property_options = args[:boolean_property_options] if args.key?(:boolean_property_options)\n @date_property_options = args[:date_property_options] if args.key?(:date_property_options)\n @display_options = args[:display_options] if args.key?(:display_options)\n @double_property_options = args[:double_property_options] if args.key?(:double_property_options)\n @enum_property_options = args[:enum_property_options] if args.key?(:enum_property_options)\n @html_property_options = args[:html_property_options] if args.key?(:html_property_options)\n @integer_property_options = args[:integer_property_options] if args.key?(:integer_property_options)\n @is_facetable = args[:is_facetable] if args.key?(:is_facetable)\n @is_repeatable = args[:is_repeatable] if args.key?(:is_repeatable)\n @is_returnable = args[:is_returnable] if args.key?(:is_returnable)\n @is_sortable = args[:is_sortable] if args.key?(:is_sortable)\n @is_suggestable = args[:is_suggestable] if args.key?(:is_suggestable)\n @is_wildcard_searchable = args[:is_wildcard_searchable] if args.key?(:is_wildcard_searchable)\n @name = args[:name] if args.key?(:name)\n @object_property_options = args[:object_property_options] if args.key?(:object_property_options)\n @text_property_options = args[:text_property_options] if args.key?(:text_property_options)\n @timestamp_property_options = args[:timestamp_property_options] if args.key?(:timestamp_property_options)\n end",
"def update!(**args)\n @boolean_property_options = args[:boolean_property_options] if args.key?(:boolean_property_options)\n @date_property_options = args[:date_property_options] if args.key?(:date_property_options)\n @display_options = args[:display_options] if args.key?(:display_options)\n @double_property_options = args[:double_property_options] if args.key?(:double_property_options)\n @enum_property_options = args[:enum_property_options] if args.key?(:enum_property_options)\n @html_property_options = args[:html_property_options] if args.key?(:html_property_options)\n @integer_property_options = args[:integer_property_options] if args.key?(:integer_property_options)\n @is_facetable = args[:is_facetable] if args.key?(:is_facetable)\n @is_repeatable = args[:is_repeatable] if args.key?(:is_repeatable)\n @is_returnable = args[:is_returnable] if args.key?(:is_returnable)\n @is_sortable = args[:is_sortable] if args.key?(:is_sortable)\n @is_suggestable = args[:is_suggestable] if args.key?(:is_suggestable)\n @is_wildcard_searchable = args[:is_wildcard_searchable] if args.key?(:is_wildcard_searchable)\n @name = args[:name] if args.key?(:name)\n @object_property_options = args[:object_property_options] if args.key?(:object_property_options)\n @text_property_options = args[:text_property_options] if args.key?(:text_property_options)\n @timestamp_property_options = args[:timestamp_property_options] if args.key?(:timestamp_property_options)\n end",
"def update\n raise NotImplementedError\n end",
"def update_attributes attributes\n @attributes.merge! attributes\n end",
"def update!(**args)\n @async_options = args[:async_options] if args.key?(:async_options)\n @input_mappings = args[:input_mappings] if args.key?(:input_mappings)\n @name_property = args[:name_property] if args.key?(:name_property)\n @validation_options = args[:validation_options] if args.key?(:validation_options)\n end",
"def update\r\n end",
"def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @type = args[:type] if args.key?(:type)\n end",
"def update\n raise NotImplemented\n end",
"def update_obj\n mean, sd = rating.to_glicko_rating\n @obj.rating = mean\n @obj.rating_deviation = sd\n @obj.volatility = volatility\n end",
"def update_values\n end",
"def update_values\n end",
"def update\n raise NotImplementedError\n end",
"def update!(**args)\n @answers_header_signals = args[:answers_header_signals] if args.key?(:answers_header_signals)\n @property_value = args[:property_value] if args.key?(:property_value)\n @response_meaning_application = args[:response_meaning_application] if args.key?(:response_meaning_application)\n end",
"def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @method_prop = args[:method_prop] if args.key?(:method_prop)\n @name = args[:name] if args.key?(:name)\n @state = args[:state] if args.key?(:state)\n end",
"def update attributes, collection #:nodoc:\n 0\n end",
"def update_property_groups(roll)\n @property_groups.each { |_, v| v.update_rent(roll) }\n end",
"def update!(**args)\n @source_property = args[:source_property] if args.key?(:source_property)\n end",
"def update_info(update_attr_hash)\n update_attr_hash.each do |k,v| \n\t\t\tself.send(\"#{k}=\",v)\n\t\tend\n end",
"def update_properties(path, properties)\n prop_patch = PropPatch.new(properties)\n emit('propPatch', [path, prop_patch])\n prop_patch.commit\n\n prop_patch.result\n end",
"def update\n set_deltatime\n set_last_update_at\n end"
] |
[
"0.7012263",
"0.69181895",
"0.69181895",
"0.69181895",
"0.69181895",
"0.69181895",
"0.67403597",
"0.6709326",
"0.6709326",
"0.6696149",
"0.6696149",
"0.6696149",
"0.6696149",
"0.6618882",
"0.6571848",
"0.65386343",
"0.65178275",
"0.6394807",
"0.6389745",
"0.6389745",
"0.63328",
"0.6319025",
"0.6283673",
"0.6269463",
"0.62639254",
"0.62410724",
"0.62170374",
"0.62152076",
"0.6210263",
"0.6204041",
"0.6204041",
"0.62021106",
"0.62017816",
"0.62017",
"0.61730784",
"0.61730784",
"0.6159277",
"0.6156169",
"0.61445665",
"0.6125433",
"0.61241156",
"0.6121413",
"0.6110477",
"0.6105694",
"0.61016303",
"0.60845226",
"0.6084427",
"0.6065455",
"0.6059506",
"0.6054869",
"0.6051708",
"0.6051708",
"0.60413384",
"0.6030853",
"0.6022535",
"0.6015561",
"0.59932375",
"0.59898263",
"0.5976479",
"0.5973787",
"0.59678394",
"0.5963291",
"0.5962048",
"0.5961157",
"0.5950731",
"0.5950731",
"0.5950731",
"0.5950731",
"0.5950731",
"0.5950731",
"0.5950731",
"0.5950731",
"0.59500545",
"0.59443134",
"0.59443134",
"0.59424853",
"0.59424853",
"0.593523",
"0.5926413",
"0.5924831",
"0.592427",
"0.59233046",
"0.59233046",
"0.5921224",
"0.59144294",
"0.59142506",
"0.58887535",
"0.58854496",
"0.5883008",
"0.58792305",
"0.5876954",
"0.5876954",
"0.58744955",
"0.5857968",
"0.5845542",
"0.5841629",
"0.58363605",
"0.5829255",
"0.582919",
"0.5822138",
"0.58208305"
] |
0.0
|
-1
|
+false+ is blank: false.blank? => true
|
def blank?
true
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def blank?\n false\n end",
"def blank?\n false\n end",
"def blank?\n false\n end",
"def blank?\n false\n end",
"def blank?\n false\n end",
"def blank?\n false\n end",
"def blank?\n true\n end",
"def blank?\n true\n end",
"def blank?\n empty?\n end",
"def blank?\n to_s.blank?\n end",
"def blank?\n self.nil? || self.empty?\n end",
"def blank?\n BLANK_RE === self\n end",
"def blank?\n empty?\n end",
"def blank?\n value.blank?\n end",
"def blank?(value)\n value.nil? == false && value.empty? == false\n end",
"def blank?\r\n empty? || BLANK_STRING_REGEXP.match(self)\r\n end",
"def blank?\n respond_to?(:empty?) ? !!empty? : !self\n end",
"def blank?\r\n nil? || (respond_to?(:empty?) && empty?)\r\n end",
"def blank?\n self.strip.length === 0\n end",
"def _blank?(value)\n value.nil? || value == ''\n end",
"def blank?\n respond_to?(:empty?) ? empty? : !self\n end",
"def blank?\n length == 0\n end",
"def blank?\n nil? || (respond_to?(:empty?) && empty?)\n end",
"def blank?\n nil? || (respond_to?(:empty?) && empty?)\n end",
"def blank?\n nil? || (respond_to?(:empty?) && empty?)\n end",
"def blank?\n @value == nil\n end",
"def blank?\n self !~ /[^[:space:]]/\n end",
"def blank?(object)\n object.to_s.sub(/\\s+/, '') == ''\n end",
"def blank?\n self.strip.empty?\n end",
"def blank?(value)\n value.nil? || value.to_s.empty?\n end",
"def blank?(val)\n val.respond_to?(:empty?) ? val.empty? : !val\n end",
"def blank?\n attributes.values.all?(&:blank?)\n end",
"def blank?\n attributes.values.all?(&:blank?)\n end",
"def blank?\n attributes.values.all?(&:blank?)\n end",
"def blank?\n attributes.values.all?(&:blank?)\n end",
"def skip_blanks?() @skip_blanks end",
"def blank?\n attributes.values.all?(&:blank?)\n end",
"def blank?\n self.strip.size == 0\n end",
"def blank?\n strip.empty?\n end",
"def blank?(a)\n return true unless a\n BLANK_STRING_RE === a\n end",
"def blank?\n self.value.blank? || self.deleted?\n end",
"def blank?( string )\n string.respond_to?(:empty?) ? !!string.empty? : !string\n end",
"def blank?\n strip.size == 0\n end",
"def present?\n not blank?\n end",
"def blank?\n # The regexp that matches blank strings is expensive. For the case of empty\n # strings we can speed up this method (~3.5x) with an empty? call. The\n # penalty for the rest of strings is marginal.\n empty? || BLANK_RE.match?(self)\n end",
"def blank?(value)\n return value.blank? if value.respond_to?(:blank?)\n\n value.respond_to?(:empty?) ? !!value.empty? : !value\n end",
"def blank?\n # The regexp that matches blank strings is expensive. For the case of empty\n # strings we can speed up this method (~3.5x) with an empty? call. The\n # penalty for the rest of strings is marginal.\n empty? || BLANK_RE === self\n end",
"def blank?(str)\n str.nil? || str.to_s.strip == ''\nend",
"def blank?(value)\n value.nil? || BLANK_REGEX === value\n end",
"def truthy?\n if respond_to? :blank?\n not blank?\n else\n not nil?\n end\n end",
"def truthy?\n if respond_to? :blank?\n not blank?\n else\n not nil?\n end\n end",
"def blank_criteria?\n false\n end",
"def blank_criteria?\n false\n end",
"def empty?\n name.blank?\n end",
"def is_blank? item\n\titem.nil? || item.gsub(/\\s+/, \"\").empty?\nend",
"def blank?( object )\n return object.nil? || object.empty?\n end",
"def blank?\n @values.blank?\n end",
"def blank?(obj)\n obj.respond_to?(:empty?) ? obj.empty? : !obj\n end",
"def blank?\n return true if @target.nil?\n @target.respond_to?(:empty?) ? @target.empty? : !@target\n end",
"def blank?\n self.solution_type.blank? ? true : false\n end",
"def empty?(input)\n input == \"\" ? true : false\n end",
"def blank?\n if title.present? and title != Survey::DEFAULT_TITLE\n return false\n end\n\n [:description, :instructions].each do |attr|\n return false if self.send(attr).present?\n end\n\n questions.each do |question|\n return false unless question.blank?\n end\n\n true\n end",
"def blank?\n words.empty?\n end",
"def blank?\n @address_line1.blank? && @town.blank? && @postcode.blank?\n end",
"def blank?(str)\n str.nil? or (str.is_a? String and str.strip.empty?)\n end",
"def blank?\n [:city, :zip, :address_1, :address_2].all? do |attr|\n self.send(attr).blank?\n end\n end",
"def empty? t\n !t ? true : clean(t).gsub(' ','') == ''\nend",
"def blank?\n !!processed_content.match(/\\A(^\\s+$)*\\z/)\n end",
"def blank?\n if content.respond_to?(:empty?)\n content.empty?\n else\n content.nil?\n end\n end",
"def is_blank?(var)\n var.nil? or (var.is_a?(String) and var.strip.empty?)\n end",
"def empty?\n city.blank? && user.blank? && name.blank? && from_date.blank? && to_date.blank?\n end",
"def blank?(param)\n param.nil? || param.empty?\n end",
"def blank?\n buffer.last == \"\\n\"\n end",
"def blank_object?(obj)\n return obj.blank? if obj.respond_to?(:blank?)\n case obj\n when NilClass, FalseClass\n true\n when Numeric, TrueClass\n false\n when String\n obj.strip.empty?\n else\n obj.respond_to?(:empty?) ? obj.empty? : false\n end\n end",
"def empty?\n false\n end",
"def is_blank_space?\n get_type == :empty\n end",
"def strip_empty?\n @strip_empty\n end",
"def empty_nil_blank?(str, raize=false)\n result = (str !~ /[^[:space:]]/ || str.nil? || str.empty?)\n raise ShellTastic::CommandException.new(\"Command is emtpy or nil\") if result and raize\n result\n end",
"def empty?\n to_s.empty?\n end",
"def value_empty?\n if value === nil or value === \"\"\n return true\n end\n return false\n end",
"def is_empty?\n end",
"def is_blank?(o)\n if o.is_a?(RubyMotionQuery::RMQ)\n RubyMotionQuery::RMQ.is_blank?(o.to_a)\n else\n o.respond_to?(:empty?) ? o.empty? : !o\n end\n end",
"def empty?\n !value\n end",
"def nothing?\n\t\tjoin('').strip.empty?\n\tend",
"def empty?() end",
"def empty?() end",
"def empty?() end",
"def anything_blank?\n max_payment.blank? || min_payment.blank? || deposit.blank? || term.blank?\n end",
"def present?\n !blank?\n end",
"def present?\n !blank?\n end",
"def present?\n !blank?\n end",
"def present?\n !blank?\n end",
"def present?\n !blank?\n end",
"def empty?\n false\n end",
"def empty?\n false\n end",
"def blank?(only_visible_tags = T.unsafe(nil)); end",
"def empty?\n false\n end",
"def empty?()\n fields.empty?\n end"
] |
[
"0.87850034",
"0.87850034",
"0.8702937",
"0.8667318",
"0.8667318",
"0.8667318",
"0.8644546",
"0.8567929",
"0.8177368",
"0.80763835",
"0.8075611",
"0.8069542",
"0.8059156",
"0.80185467",
"0.80126923",
"0.7978013",
"0.79225576",
"0.7908251",
"0.78779536",
"0.7876693",
"0.78765225",
"0.78498954",
"0.7846082",
"0.7846082",
"0.78457516",
"0.78387153",
"0.7802834",
"0.7786984",
"0.771247",
"0.77059466",
"0.77033573",
"0.7697872",
"0.7697872",
"0.7697872",
"0.7697872",
"0.7667542",
"0.7654922",
"0.76153725",
"0.75869495",
"0.75724757",
"0.7513396",
"0.7436942",
"0.7412954",
"0.73897564",
"0.7387771",
"0.73662555",
"0.7362899",
"0.7356748",
"0.72764695",
"0.7265861",
"0.7265861",
"0.72369105",
"0.72369105",
"0.7234767",
"0.7230429",
"0.72221756",
"0.7215353",
"0.71858907",
"0.71264076",
"0.7124728",
"0.70887876",
"0.7067675",
"0.7065228",
"0.70300645",
"0.700216",
"0.69923496",
"0.696149",
"0.6960875",
"0.69340026",
"0.68832594",
"0.6868628",
"0.6855781",
"0.68236834",
"0.6820441",
"0.6791471",
"0.6762933",
"0.6752261",
"0.67272234",
"0.6724167",
"0.6721242",
"0.67164475",
"0.67023677",
"0.6692137",
"0.6690305",
"0.66861916",
"0.66861916",
"0.66861916",
"0.668196",
"0.6669056",
"0.6669056",
"0.6669056",
"0.6669056",
"0.6669056",
"0.6667104",
"0.6667104",
"0.66638935",
"0.6638472",
"0.66274554"
] |
0.8558307
|
9
|
Verify initiates an OTB (Open To Buy) request
|
def build_verify_request(credit_card, options)
timestamp = new_timestamp
xml = Builder::XmlMarkup.new indent: 2
xml.tag! 'request', 'timestamp' => timestamp, 'type' => 'otb' do
add_merchant_details(xml, options)
xml.tag! 'orderid', sanitize_order_id(options[:order_id])
add_card(xml, credit_card)
add_comments(xml, options)
add_signed_digest(xml, timestamp, @options[:login], sanitize_order_id(options[:order_id]), credit_card.number)
end
xml.target!
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def test_purchase_and_void_for_check\n assert purchase = @gateway.purchase(1000, @check, @options)\n assert_success purchase\n assert_approved purchase\n \n assert void = @gateway.void(purchase.authorization, @options)\n assert_success void\n assert_approved void\n end",
"def test_purchase_and_credit_for_check\n assert purchase = @gateway.purchase(1000, @check, @options)\n assert_success purchase\n assert_approved purchase\n \n assert void = @gateway.credit(1000, purchase.authorization, @options)\n assert_success void\n assert_approved void\n end",
"def attemp_buying\n\n end",
"def test_verify\n # Start out unavailabl\n assert_raise(Puppet::Network::InvalidClientRequest) do\n @obj.verify(@request)\n end\n class << @obj\n def available?(req)\n true\n end\n end\n assert_raise(Puppet::Network::InvalidClientRequest) do\n @obj.verify(@request)\n end\n class << @obj\n def authorized?(req)\n true\n end\n end\n assert_nothing_raised do\n @obj.verify(@request)\n end\n end",
"def billing\n user_agent = request.env['HTTP_USER_AGENT']\n #parameter = Parameter.first\n transaction_id = DateTime.now.to_i\n\n request = Typhoeus::Request.new(\"http://37.0.73.3:3778\", followlocation: true, params: {transaction_id: transaction_id, msisdn: @account.msisdn, price: \"50\"})\n\n#=begin\n request.on_complete do |response|\n if response.success?\n result = response.body\n elsif response.timed_out?\n result = Error.timeout(@screen_id)\n elsif response.code == 0\n result = Error.no_http_response(@screen_id)\n else\n result = Error.non_successful_http_response(@screen_id)\n end\n end\n\n request.run\n#=end\n return ((result.strip rescue nil) == \"1\" ? true : false)\n end",
"def test_transaction_opened\n response = @gateway.setup_purchase(400, @options)\n\n # now try to authorize the payment, issuer simulator keeps the payment open\n response = @gateway.capture(response.transaction['transactionID'])\n\n assert_failure response\n assert_equal 'Open', response.transaction['status'], 'Transaction should remain open'\n end",
"def verify\n create_order\n start_challenge\n wait_verify_status\n check_verify_status\n rescue Acme::Client::Error => e\n retry_on_verify_error(e)\n end",
"def test_check_purchase_and_credit_not_settled\n assert purchase = @gateway.purchase(@amount, @check, @options)\n assert_success purchase\n assert_equal 'Approved', purchase.message\n assert credit = @gateway.credit(@amount, purchase.authorization, @check, @options)\n assert_failure credit\n assert_equal 'CREDIT CANNOT BE COMPLETED ON A UNSETTLED TRANSACTION', credit.message\n end",
"def test_acknowledgement\n Net::HTTP.any_instance.expects(:request).returns(stub(:body => invoice_data.to_json))\n assert @go_coin.acknowledge\n end",
"def test_acknowledgement\n assert @cybersource_secure_acceptance.acknowledge\n end",
"def test_checkin\n req = c.checkin(\"abc123\", 123, &blk)\n\n assert_sent(req.tag, :verb => V::CHECKIN, :path => \"abc123\", :cas => 123)\n assert_recv(reply(req.tag, :cas => 123))\n end",
"def test_purchase_and_credit_for_check_with_differing_amounts\n assert purchase = @gateway.purchase(10000, @check, @options)\n assert_success purchase\n assert_approved purchase\n \n assert void = @gateway.credit(500, purchase.authorization, @options)\n assert_success void\n assert_not_equal 'Approved', void.message\n end",
"def test_issue_and_purchase\n invoice = 47\n assert response = @gateway.issue(300, @blank_test3_track2, @options.merge(:invoice => invoice, :order_id => invoice))\n assert_success response\n \n invoice = 48\n assert purchase = @gateway.purchase(700, @blank_test3_track2, @options.merge(:invoice => invoice, :order_id => invoice))\n assert_success purchase\n end",
"def test_successful_purchase_without_address_check2\n @solo.number = '633499110000000003'\n\n response = @gateway.purchase(@amount, @solo, @params)\n assert_success response\n assert response.test?\n end",
"def test_19_createofflinedonations_verifythermometer()\n\t\t\n\t\tputs \"---------------------- START OF SCENARIO 19 ----------------------\"\n\t\tcreateOfflineDonation($offline_donorname, $offline_donoremail, $offline_donoramount)\n\t\tlogout()\n\t\tputs \"---------------------- END OF SCENARIO 19 ----------------------\"\n\t\n\tend",
"def test_valid\n assoc = Association.new('handle', 'secret', Time.now, 10000, 'HMAC-SHA1')\n\n assert_log_matches() {\n assert_equal(call_negotiate([assoc]), assoc)\n }\n end",
"def trade action\n bid_ask=action==:buy ? :ask : :bid\n\n\tp = @price[:bid] if @price && @price[:bid] && bid_ask==:bid#memoize\n\tp = @price[:ask] if @price && @price[:ask] && bid_ask==:ask#memoize\n\tp = price(action) unless p\n bid_ask=action==:buy ? \"B\":\"S\" #reverse because its BTCUSD pair\n\tvolume = @options[:volume]\n\n params = {'username' => ENV['ROCK_USERNAME'],\n\t 'password' => ENV['ROCK_PASSWORD'],\n\t 'api_key' => ENV['ROCK_KEY'],\n\t 'fund_name'=> 'BTCUSD',\n\t\t 'order_type'=>bid_ask,\n\t\t 'amount' => volume,\n\t\t 'price' => p\n\t }\n\tresponse = RestClient.post(\"https://www.therocktrading.com/api/place_order\", params, {})\n r_json=JSON.parse(response)\n if !r_json[\"result\"][0].key?(\"order_id\")\n #order was not accepted by exchnage\n return false\n end\n\torder_id = r_json[\"result\"][0][\"order_id\"]\n retries = @options[:trade_retries]\n (1..retries).each do |attempt|\n if !open_orders.include?(order_id)\n return true\n end\n if attempt == retries\n cancel_order order_id\n logger.info \"failed to fill #{action} order at #{exchange}\"\n return false\n else\n logger.info \"Attempt #{attempt}/#{retries}: #{action} order #{order_id} still opening, waiting for close to\"\n sleep(1)\n end\n end\n return false\n\n\n end",
"def do \n validate\n ZipMoney.api.checkout(self.params)\n end",
"def test_successful_purchase_without_address_check2\n @solo.number = '633499110000000003'\n\n response = @gateway.purchase(@amount, @solo, @params)\n assert_success response\n end",
"def wait_until_open_confirmed; end",
"def settle\n \n\n if params[\"code\"]\n auth_code = params[\"code\"]\n end \n url = \"https://api.venmo.com/v1/oauth/access_token\"\n @response = HTTParty.post(url, :query => {:client_id => '1916', :client_secret => 'eGcyNHaysfbFGZ6xkMffUw3gGrKFzksG', :code => auth_code})\n user = @response[\"user\"]\n @access_token = @response[\"access_token\"]\n @refresh_token = @response[\"refresh_token\"]\n @email = params[:email]\n @amount = params[:amount]\n \n url = \"https://api.venmo.com/v1/payments\"\n @amount = HTTParty.post(url, :query => { \"access_token\" => @access_token, :email => @email, :amount => @amount, :note => 'PayUp'})\n redirect_to bets_path\n end",
"def test_successful_purchase_with_solo_card\n response = @gateway.purchase(@amount, @solo, @params)\n assert_success response\n end",
"def complete_buy_token\n status = \"\"\n reason = \"\"\n token = params[:email_token]\n if token\n buyRequests = BuyRequest.where(email_token: token).where(:status => [\"waiting-for-match\", \"completed\"])\n if buyRequests.length > 0\n buyRequests.update_all(status: \"completed\", updated_at: DateTime.now)\n status = \"ok\"\n else\n status = \"Bad request\"\n reason = \"Tampered token. We have alerted the authorities.\"\n response = { :status => status, :reason => reason}\n render json: response\n return\n end\n else\n status = \"Bad request\"\n reason = \"No authentication/token\"\n response = { :status => status, :reason => reason}\n render json: response\n return\n end\n # Old redirect version. We now give them an info page instead.\n #redirect_to \"/my-tix\"\n #return\n end",
"def test_should_checkout_with_unavailable_products\n # Add full quantity of an item to the cart.\n @product = items(:towel)\n xhr(:post, :add_to_cart_ajax, :id => @product.id, :quantity => @product.quantity)\n assert_response :success\n assert_equal 1, assigns(:order).items.length\n\n # Emulate another customer purchasing items before we checkout\n @product.update_attribute(:quantity, 1)\n\n get :checkout\n assert_response :success\n assert_template 'checkout'\n assert_equal \"Please enter your information to continue this purchase.\", assigns(:title)\n assert_not_nil assigns(:cc_processor)\n \n # Post to it an order.\n post :checkout,\n :order_account => {\n :cc_number => \"4007000000027\",\n :expiration_year => 4.years.from_now.year,\n :expiration_month => \"1\"\n },\n :shipping_address => {\n :city => \"\",\n :zip => \"\",\n :country_id => countries(:US).id,\n :first_name => \"\",\n :telephone => \"\",\n :last_name => \"\",\n :address => \"\",\n :state => \"\"\n },\n :billing_address => @scrooge_address.attributes,\n :order_user => {\n :email_address => \"uncle.scrooge@whoknowswhere.com\"\n }\n \n assert_redirected_to :action => :index\n assert flash[:notice].include?(\"have gone out of stock before you could purchase them\")\n end",
"def test_acknowledgement\n assert @dotpay.acknowledge\n end",
"def test_can_buy_org_item\n user = User.named(\"user\")\n org = Organization.named(\"org\")\n\n item = org.propose_item(\"Item\", 20, :fixed, nil, nil)\n item.activate\n\n assert(user.can_buy?(item))\n\n user.work_on_behalf_of(org)\n assert(!user.on_behalf_of.can_buy?(item))\n end",
"def checkout\n end",
"def check_if_approval_is_required\n !offer_request.blank?\n end",
"def test_successful_purchase_with_solo_card\n response = @gateway.purchase(@amount, @solo, @params)\n assert_success response\n assert response.test?\n end",
"def bought?\n # paym\n end",
"def test_mage_checkout\n #@custom_number_of_users.times do\n start_time = Time.now\n add_to_cart @helper.get_yaml_data\n get_a_shipping_quote\n @helper.proceed_to_checkout\n # assert_section 'checkout'\n finalize_checkout_as_guest\n final_time = Time.now - start_time\n puts \"It took #{final_time} seconds to complete the order\"\n #end\n end",
"def test_acknowledgement \n assert @rbk_money.acknowledge\n end",
"def test_authorization_and_void\n return if Base.mode == :test # only tests in production mode\n assert_equal Base.mode, :production\n assert authorization = @gateway.authorize(@amount, @credit_card, @options)\n assert_success authorization\n \n assert void = @gateway.void(authorization.authorization)\n assert_success void\n assert_match(/This transaction has been approved/, void.message)\n end",
"def test_checkout_token \n token = OnepageAuthToken.create_token(Customer.find(1), 3, :controller => 'cart', :action => 'checkout')\n get :add_set, :id => 1, :token => token\n assert_redirected_to :controller => :cart, :action => 'checkout', :token => token\n assert_equal(2, Customer.find(1).orders.size)\n post :checkout, :credit_card => { :number => '4111111111111111', :month => 12, :year => 2020 },\n :terms_and_conditions => true, :token => token\n assert_redirected_to :controller => :cart, :action => 'order_success'\n orders = Customer.find(1).orders\n assert_equal(3, orders.size)\n assert_equal(2, orders.first.line_items.size)\n assert_equal(5, orders.first.line_items.first.product.id)\n assert_equal(4, orders.first.line_items.last.product.id)\n assert_equal(\"Credit Card (Visa) XXXX-XXXX-XXXX-1111\", orders.first.payments.last.payment_method)\n assert_equal(BigDecimal('23.98'), orders.first.payments.last.amount)\n end",
"def checkout\n\tend",
"def test_should_finish_order_with_authorize\n # Execute an earlier test as this one deppends on it.\n test_should_set_shipping_method_without_confirmation\n \n order = Order.find(session[:order_id])\n\n # Now we say that we will use authorize. Mock the method.\n assert Preference.save_settings({ \"cc_processor\" => \"Authorize.net\" })\n Order.any_instance.expects(:run_transaction_authorize).once.returns(true)\n \n # Save initial quantity\n oli = assigns(:order).order_line_items.first\n initial_quantity = oli.item.quantity\n\n # Post to the finish order action.\n post :finish_order\n assert_response :success\n assert_select \"p\", :text => /Card processed successfully/\n \n # Ensure items still in order\n assert !order.empty?, \"Order items were emptied when they shouldn't be.\"\n \n # Ensure customer has been logged in, so they may download their files\n assert_not_nil session[:customer], \"Customer was not logged in after successful purchase.\"\n end",
"def verify()\n if has_order_items?\n order_template = order_object\n order_template = yield order_object if block_given?\n @virtual_server.softlayer_client[:Product_Order].verifyOrder(order_template)\n end\n end",
"def helper_univ_gc_checkout(options)\n\n options.allowed_and_required([:gc_code, \n :product_id,\n :apply_credit,\n :apply_month_credit,\n :pre_checkout_credit,\n :pre_checkout_months, \n :post_checkout_credit,\n :post_checkout_months, \n :product_ids_in_lis,\n :payment_type,\n :payment_total,\n :payment_as_new_revenue])\n get :index\n session[:customer_id] = 1\n get_customer_cart.empty!\n\n session[:timestamp] = Time.now.to_i\n \n # setup GC\n assert_equal(0.00, Customer.find(1).credit.to_f)\n assert_equal(0, Customer.find(1).credit_months)\n\n post :claim_code, :code => options[:gc_code]\n assert_redirected_to :controller => :cart, :action => 'checkout'\n\n assert_equal(options[:pre_checkout_credit], Customer.find(1).credit.to_f)\n assert_equal(options[:pre_checkout_months], Customer.find(1).credit_months)\n\n # put item in cart\n post :add, :id => options[:product_id]\n assert_redirected_to :controller => :cart, :action => ''\n\n # do checkout\n num_orders =Customer.find(1).orders.size\n post( :checkout, \n :credit_card => { :number => '4111111111111111', :month => 12, :year => 2020 },\n :terms_and_conditions => true, \n :apply_credit => options[:apply_credit],\n :apply_month_credit => options[:apply_month_credit])\n assert_redirected_to :controller => :cart, :action => 'order_success'\n\n valid_orders = Customer.find(1).orders\n# valid_orders = Customer.find(1).orders.select { |o| o.line_items.size > 0 }\n new_order = valid_orders.max_by(&:order_id)\n\n assert_equal(num_orders + 1, Customer.find(1).orders.select { |o| o.line_items.size > 0 }.size) # 1 more order\n\n\n assert_equal(options[:product_ids_in_lis].size, new_order.line_items.size)\n assert_equal(options[:product_ids_in_lis].to_set, new_order.line_items.map{|li| li.product.id}.to_set)\n\n \n assert_equal(options[:payment_type], new_order.payments.last.payment_method)\n assert_equal(options[:payment_total].to_d, new_order.payments.last.amount)\n\n assert_equal(options[:payment_as_new_revenue].to_d, new_order.payments.last.amount_as_new_revenue)\n\n assert_equal(options[:post_checkout_credit].to_f, Customer.find(1).credit)\n assert_equal(options[:post_checkout_months], Customer.find(1).credit_months)\n\n end",
"def test_valid_transaction\n\t\tassert_nothing_raised() {\n\t\t\t@transaction = @order.get_auth_transaction\n\t\t\tassert_equal @transaction.test_transaction, true\n\t\t\t@transaction.submit\n\t\t}\n\tend",
"def complete_buy\n status = \"\"\n netid = \"\"\n buy_request_id = \"\"\n reason = \"\"\n \n # Checks if user is logged in\n if user_is_logged_in?\n netid = session[:cas_user]\n buy_request_id = params[:buy_request_id]\n # Checks if there was a buy_request_id\n if buy_request_id\n buyRequests = BuyRequest.where(netid: netid).where(id: buy_request_id).where(:status => [\"waiting-for-match\"])\n # Checks if the buy request is valid\n if buyRequests.length > 0\n buyRequests.update_all(status: \"completed\", updated_at: DateTime.now)\n status = \"ok\"\n else\n status = \"Bad request\"\n reason = \"No buy requests found\"\n end\n else\n status = \"Bad request\"\n reason = \"Missing buy_request_id\"\n end\n else\n status = \"Bad request.\"\n reason = \"Not logged in.\"\n end\n \n # Return response in JSON\n response = { :status => status, :netid => netid, :buy_request_id => buy_request_id, :reason => reason}\n render json: response\n return\n end",
"def verified_request?; end",
"def verify!\n raise \"Payment details not active anymore\" if active == false\n end",
"def test_confirm_email\n # Step 1\n turtle_response = @user.register\n assert_response(turtle_response, :success)\n assert(@user.id)\n\n # Step 2\n get '/confirm_email/em_token_123456', {}\n assert_response(@response, 404)\n\n # Step 3\n assign_http(Config[\"panda\"][\"host\"])\n\n params = { 'email' => @user.email }\n\n get '/usr', params\n assert_response(@response, :success)\n assert(@parsed_response.first['email_token'], @parsed_response)\n\n email_token = @parsed_response.first['email_token']\n\n # Step 4\n assign_http(Config[\"turtle\"][\"host\"])\n\n get \"/confirm_email/#{email_token}\", {}\n assert_response(@response, :success)\n\n # Step 5\n assign_http(Config[\"panda\"][\"host\"])\n\n params = { 'email' => @user.email }\n\n get '/usr', params\n assert_response(@response, :success)\n assert_equal(true, @parsed_response.first['verified'], @parsed_response)\n end",
"def create_checkout(redirect_uri)\n # calculate app_fee as 10% of produce price\n app_fee = self.ticket_price * 0.1\n\n params = {\n :account_id => self.wepay_account_id,\n :short_description => \"Ticket for #{self.event_name}\",\n :type => :GOODS,\n :amount => self.ticket_price,\n :app_fee => app_fee,\n :fee_payer => :payee,\n :mode => :iframe,\n :redirect_uri => redirect_uri\n }\n response = WEPAY.call('/checkout/create', self.wepay_access_token, params)\n\n if !response\n raise \"Error - no response from WePay\"\n elsif response['error']\n raise \"Error - \" + response[\"error_description\"]\n end\n\n return response\n self.attendee_list += [params[\"nameOnCard\"]]\nend",
"def confirm_request action, appointment_id, timestamp\n local_request = RicartAgrawalaRequest.new(@calendar_network.local_node, \n\t\t\t\t\t action, appointment_id, \n\t\t\t\t\t timestamp)\n puts \"Request \" + local_request.to_s + \" is confirmed by a remote node\"\n @calendar_network.ricart_agrawala.requests_confirmation_count[local_request] += 1\n true\n end",
"def test_send_invoice_flow_with_click_go_there_now_link\n api_token, current_url, token_url = initiate_send_invoice('signup', nil)\n session_successfully_create_user(api_token, current_url) do |user|\n user.edit_user_gateways!\n html = Hpricot(user.response.body)\n assert_not_nil html.at('#beanstream-go-there-now-link')\n assert '/beanstream_help.html', html.at('#beanstream-go-there-now-link')['href'] \n end\n end",
"def test_success\n assert_equal('kaboodle', make_request.handle)\n end",
"def checkout_needed?\n\t\ttrue\n\tend",
"def test_checkout_cobranded \n get :index\n session[:customer_id] = 1\n get_customer_cart.empty!\n\n session[:timestamp] = Time.now.to_i\n @request.env['HTTP_HOST'] = 'woodturningonline.smartflix.com'\n post :add_set, :id => 1\n assert_redirected_to :controller => :cart, :action => ''\n assert_equal(2, Customer.find(1).orders.size)\n post :checkout, :credit_card => { :number => '4111111111111111', :month => 12, :year => 2020 }, :terms_and_conditions => true\n assert_redirected_to :controller => :cart, :action => 'order_success'\n orders = Customer.find(1).orders\n assert_equal(3, orders.size)\n assert_equal(2, orders.first.line_items.size)\n assert_equal(5, orders.first.line_items.first.product.id)\n assert_equal(4, orders.first.line_items.last.product.id)\n assert_equal(\"Credit Card (Visa) XXXX-XXXX-XXXX-1111\", orders.first.payments.last.payment_method)\n assert_equal(BigDecimal('23.98'), orders.first.payments.last.amount)\n assert_equal('woodturningonline.smartflix.com', orders.first.server_name)\n end",
"def test_submit_rent\n quote_details = SAMPLE_QUOTE_DETAILS.deep_dup\n quote_details['fixed_price_services_requested']['price'] = 1200\n params_hash = {\n udprn: '123456',\n services_required: SAMPLE_SERVICES_REQUIRED,\n payment_terms: SAMPLE_PAYMENT_TERMS,\n quote_details: quote_details.to_json\n }\n first_params_hash = params_hash.deep_dup\n first_params_hash[:quote_details] = SAMPLE_QUOTE_DETAILS.to_json\n post :new_quote_for_property, first_params_hash\n post :new, params_hash\n assert_response 200\n\n quote = Agents::Branches::AssignedAgents::Quote.last\n ### Now lets submit the quote\n post :submit, { udprn: '123456', quote_id: quote.id }\n response = Oj.load(@response.body)\n assert_response 200\n assert_equal response['message'], 'The quote is accepted'\n end",
"def test_initialize\n request = OIDC::Request.new(@params)\n assert_equal @params[:response_type], request.response_type\n assert_equal @params[:client_id], request.client_id\n assert_equal @params[:redirect_uri], request.redirect_uri\n assert_equal @params[:scope], request.scope\n assert_equal @params[:state], request.state\n assert_equal @params[:nonce], request.nonce\n end",
"def setup_preapproval\n api.execute :Preapproval, preapproval_payment_options\nend",
"def test_send_invoice_flow_with_valid_auth_and_no_sps\n # make request without a start_status, should default to send_invoice\n api_token, current_url, token_url = initiate_send_invoice(nil, :authorized)\n extended_session do |user|\n user.get current_url\n user.redirect_to_new_delivery!\n reset_deliveries\n user.send_invoice!(true)\n assert_last_delivery_had_no_errors\n user.received_complete!(token_url)\n assert_equal [users(:basic_user).email], user.last_email.reply_to\n assert_match(/To view this invoice/, user.email_text.body)\n end\n end",
"def test_ut_t5_sef_con_019\n assert ContextNotifier.send_email_waiting_but_no_analyzing\n # manually test by checking the mail.\n end",
"def test_successful_purchase_with_emv_credit_card_in_uk\n assert response = @gateway.purchase(@amount, @emv_credit_cards[:uk], @options)\n assert_success response\n assert_equal 'charge', response.params['object']\n assert response.params['paid']\n assert_match CHARGE_ID_REGEX, response.authorization\n end",
"def test_credit_card_purchase_and_void_amount_not_specified\n assert purchase = @gateway.purchase(@amount, @credit_card, @options)\n assert_success purchase\n assert_equal 'Approved', purchase.message\n assert void = @gateway.void(nil, purchase.authorization, @credit_card, @options)\n assert_failure void\n assert_equal 'TRANSACTION AMOUNT IS REQUIRED', void.message\n end",
"def test_abortif_opok_abort\n clipp(\n modules: %w{ testops abort },\n default_site_config: <<-EOS\n Rule x @true \"\" id:1 phase:REQUEST_HEADER \"abortIf:opok:Operator returned IB_OK.\"\n EOS\n ) do\n transaction do |t|\n t.request(raw: \"GET / HTTP/1.1\\n\")\n end\n end\n\n assert_no_clean_exit\n end",
"def ouroboros_accept\n MorLog.my_debug('Ouroboros payment : accept', 1)\n @payment = Payment.find(:first, :conditions => \"id = #{params[:order_id].to_i}\")\n if @payment\n @user = @payment.user\n MorLog.my_debug(\"Ouroboros payment : user - #{@user.id}\", 1)\n @enabled = Confline.get_value(\"Ouroboros_Enabled\", @user.owner_id).to_i\n if @enabled.to_i == 1\n if @payment.pending_reason.to_s == 'Unnotified payment'\n key = Confline.get_value(\"Ouroboros_Secret_key\", @user.owner_id)\n @hash = Ouroboros::Hash.reply_hash(params, key)\n if @hash == params[:signature]\n if params[:amount].to_d == @payment.amount.to_d*100\n @currency = Confline.get_value('Ouroboros_Default_Currency', @user.owner_id)\n rate = count_exchange_rate(session[:default_currency], @payment.currency)\n @user.balance += @payment.gross.to_d / rate\n @user.save\n @payment.completed = 1\n @payment.transaction_id = params[:tid]\n @payment.shipped_at = Time.now\n @payment.payer_email = @user.email\n @payment.payment_hash = params[:signature]\n @payment.pending_reason = ''\n @payment.save\n MorLog.my_debug(\"Ouroboros payment : payment - #{@payment.id}\", 1) if @payment\n MorLog.my_debug(\"Ouroboros payment : amount - #{@payment.gross.to_d / rate}\", 1)\n @error = 0\n else\n @error = 5\n MorLog.my_debug('Ouroboros payment : Amount missmach')\n MorLog.my_debug(' SYSTEM :' + @payment.amount.to_s)\n MorLog.my_debug(' Ouroboros :' + (params[:amount].to_d/100).to_s)\n end\n else\n @error = 4\n MorLog.my_debug('Ouroboros payment : Hash missmach')\n MorLog.my_debug(' SYSTEM :' + @hash)\n MorLog.my_debug(' Ouroboros :' + params[:signature])\n end\n else\n @error = 3\n MorLog.my_debug('Ouroboros payment : Unnotified payment.')\n MorLog.my_debug(' SYSTEM : ' + @payment.pending_reason.to_s)\n MorLog.my_debug(' Ouroboros : Notified payment')\n end\n else\n @error = 2\n MorLog.my_debug('Ouroboros payment : Ouroboros disabled')\n MorLog.my_debug(' SYSTEM : '+ @enabled.to_s)\n end\n else\n @error = 1\n MorLog.my_debug('Ouroboros payment : Payment was not found')\n end\n end",
"def test_bp_cancel_entitlement_eot\n bp = create_entitlement_base(@account.account_id, 'Sports', 'MONTHLY', 'DEFAULT', @user, @options)\n check_entitlement(bp, 'Sports', 'BASE', 'MONTHLY', 'DEFAULT', DEFAULT_KB_INIT_DATE, nil)\n\n # Move clock after the trial to have a CTD\n kb_clock_add_days(31, nil, @options)\n\n # Cancel BP in trial with no arguments\n requested_date = nil\n entitlement_policy = 'END_OF_TERM'\n billing_policy = nil\n use_requested_date_for_billing = nil\n\n bp.cancel(@user, nil, nil, requested_date, entitlement_policy, billing_policy, use_requested_date_for_billing, @options)\n\n canceled_bp = get_subscription(bp.subscription_id, @options)\n check_subscription(canceled_bp, 'Sports', 'BASE', 'MONTHLY', 'DEFAULT', DEFAULT_KB_INIT_DATE, '2013-09-30', DEFAULT_KB_INIT_DATE, '2013-09-30')\n end",
"def test_charge_cust_cust_has_cash\n @venue.charge_for_stuff(@charges,@venue,@gina)\n assert_equal(290,@gina.wallet)\n end",
"def validate_order() \n\tputs \"Validating order\" \n\tdata = create_order()\n\tresponse = request_post(\"/api/order/validate\", data)\n\tputs response.body\nend",
"def test_abortif_opok_noabort\n clipp(\n modules: %w{ testops abort },\n default_site_config: <<-EOS\n InitVar someText \"This is a string, not an integer.\"\n Rule someText @gt 0 id:1 phase:REQUEST_HEADER \"abortIf:opok:Operator returned IB_OK.\"\n EOS\n ) do\n transaction do |t|\n t.request(raw: \"GET / HTTP/1.1\\n\\n\")\n end\n end\n\n assert_clean_exit\n end",
"def express_checkout_complete \n paypal_token = params[:token] \n @prize = Prize.find_by_paypal_token(paypal_token, :conditions => [\"paypal_state = 'purchase_setup'\"]) \n @details = gateway.details_for(paypal_token) \n \n if !@details.success?\n #paypal has reported error back to our system\n paypal_error(@details) \n else \n \n #might want to add to debug\n logger.info \"Customer name: #{@details.params['name']}\" \n logger.info \"Customer e-mail: #{@details.params['payer']}\" \n \n @response = gateway.purchase( \n amount_in_cents(@prize.paypal_prizecost), \n :token => @details.params['token'], \n :payer_id => @details.params['payer_id'] \n )\n \n if !@response.success? \n paypal_error(@response) \n else \n @prize.update_attributes(\n :paypal_state => 'closed',\n :paypal_amount => @response.params['gross_amount'] \n ) \n \n #send to prize confirmation page \n end #!@response.success? \n end #!@details.success?\nend",
"def confirmation\n key = request.headers[\"Authorization\"]\n format_token(key)\n\n @pet = Pet.find_by(api_key: key)\n @request = Request.find_by(pet_id: @pet.id)\n\n if params[\"request\"] == \"success\"\n @request.update(body: nil, schedule: nil)\n\n add_feeding(@pet)\n\n update_current_supply(@pet)\n end\n\n render :nothing => true\n end",
"def verify\n head :ok\n end",
"def can_request_purchase?\n true # TODO: Should this be !virginia_borrower? ?\n end",
"def test_purchase_and_non_referenced_credit\n assert credit = @gateway.credit(100, @credit_card, @options)\n assert_success credit\n end",
"def test!\n @connection = Connection.new 14000\n @bitcoin = BlockrIo.new true\n end",
"def test_reference_purchase\n assert response = @gateway.purchase(10000, @credit_card, @options)\n assert_approved response\n assert_success response\n assert response.test?\n assert_not_nil pn_ref = response.authorization\n \n # now another purchase, by reference\n assert response = @gateway.purchase(10000, pn_ref)\n assert_approved response\n assert_success response\n assert response.test?\n end",
"def test_submit\n quote_details = SAMPLE_QUOTE_DETAILS.deep_dup\n quote_details['fixed_price_services_requested']['price'] = 1200\n params_hash = {\n udprn: SAMPLE_UDPRN,\n services_required: SAMPLE_SERVICES_REQUIRED,\n payment_terms: SAMPLE_PAYMENT_TERMS,\n quote_details: quote_details.to_json\n }\n first_params_hash = params_hash.deep_dup\n first_params_hash[:quote_details] = SAMPLE_QUOTE_DETAILS.to_json\n post :new_quote_for_property, first_params_hash\n post :new, params_hash\n assert_response 200\n\n quote = Agents::Branches::AssignedAgents::Quote.last\n ### Now lets submit the quote\n post :submit, { udprn: SAMPLE_UDPRN, quote_id: quote.id }\n response = Oj.load(@response.body)\n assert_response 200\n assert_equal response['message'], 'The quote is accepted'\n end",
"def test_buy_drink\n @Tom.buy_drink(\"bub\")\n assert_equal(135, @Tom.wallet)\n end",
"def assert_requests!\n super\n expect(action_request.uri.to_s).to eq(current_config[:voice_request_url])\n end",
"def test_test_place_order_with_minimum_criteria()\r\n # Parameters for the API call\r\n body = CreateOrderRequestModel.from_hash(JSON.parse(\r\n '{\"accountIdentifier\":\"sdkautotest5\",\"amount\":1.00,\"customerIdentifier\":\"sdk'\\\r\n 'autotest4\",\"sendEmail\":false,\"utid\":\"U561593\"}'\r\n ))\r\n\r\n # Perform the API call through the SDK function\r\n result = self.class.controller.create_order(body)\r\n\r\n # Test response code\r\n assert_equal(@response_catcher.response.status_code, 201)\r\n\r\n # Test whether the captured response is as we expected\r\n assert_not_nil(result)\r\n expected_body = JSON.parse(\r\n '{\"referenceOrderID\":\"RA180426-1401-64\",\"customerIdentifier\":\"sdkautotest4\",'\\\r\n '\"accountIdentifier\":\"sdkautotest5\",\"accountNumber\":\"A32386768\",\"amountCharg'\\\r\n 'ed\":{\"value\":1,\"currencyCode\":\"USD\",\"total\":1},\"marginShare\":{\"value\":0,\"cu'\\\r\n 'rrencyCode\":\"USD\"},\"denomination\":{\"value\":1,\"currencyCode\":\"USD\"},\"utid\":\"'\\\r\n 'U561593\",\"rewardName\":\"Reward Link\",\"sender\":{\"firstName\":\"\",\"lastName\":\"\",'\\\r\n '\"email\":\"\"},\"recipient\":{\"email\":\"\",\"firstName\":\"\",\"lastName\":\"\"},\"sendEmai'\\\r\n 'l\":false,\"status\":\"COMPLETE\",\"createdAt\":\"2018-04-26T20:08:59.624Z\",\"reward'\\\r\n '\":{\"credentials\":{\"Redemption URL\":\"https://sandbox.rewardlink.io/r/1/ed0Ht'\\\r\n 'zSblNV6oFddNnnlf68eXzGQoREvcxwxu_Vi5Wk\"},\"credentialList\":[{\"label\":\"Redemp'\\\r\n 'tion URL\",\"value\":\"https://sandbox.rewardlink.io/r/1/ed0HtzSblNV6oFddNnnlf6'\\\r\n '8eXzGQoREvcxwxu_Vi5Wk\",\"type\":\"url\"}],\"redemptionInstructions\":\"<p>• C'\\\r\n 'lick on the redemption link above to activate your Reward Link.<br />\\\\r\\\\n'\\\r\n '• Next, you will be able to spend your balance on retail gift cards.</'\\\r\n 'p>\\\\r\\\\n\\\\r\\\\n<p>If you don't want to spend your entire Reward Link val'\\\r\n 'ue right away, save the email or URL and return via the redemption link - y'\\\r\n 'our value will be waiting to be spent. This allows you to store the balance'\\\r\n ' to redeem at another time.</p>\\\\r\\\\n\"}}'\r\n )\r\n received_body = JSON.parse(@response_catcher.response.raw_body)\r\n assert(TestHelper.match_body(expected_body, received_body))\r\n end",
"def valid_oxum?\n bag_info[\"Payload-Oxum\"] == payload_oxum\n end",
"def confirm\n if @account.offload_billing?\n @current_subscription = @account.stripe_subscription.current_subscription\n end\n\n case @service\n when 'vps', 'vps_with_os'\n plan = params[:plan]\n plan_struct = VirtualMachine.plans['vps'][plan]\n\n @billing_amount = plan_struct['mrc']\n @code = 'VPS'\n @code_obj = ServiceCode.find_by(name: @code)\n\n @service_title = if @service == 'vps_with_os'\n VirtualMachine.os_display_name_from_code($CLOUD_OS, params[:os]) + ' VPS'\n else\n 'Generic VM'\n end\n\n @billing_amount_pro_rated = pro_rated_total(@billing_amount)\n\n @stripe_price_id = @account.offload_billing? ? $STRIPE_PRODUCTS['vps'][plan] : \"\"\n\n @pending_service = @account.services.create(\n pending: true,\n service_code: @code_obj,\n title: @service_title,\n billing_interval: 1,\n billing_amount: @billing_amount,\n stripe_price_id: @stripe_price_id\n )\n\n unless @account.offload_billing?\n @pending_invoice = @account.create_pro_rated_invoice!(\n @code, @service_title, @billing_amount_pro_rated, pending: true\n )\n end\n when 'metal'\n raise\n when 'thunder'\n raise\n when 'bgp'\n @billing_amount = 10.00\n @code = 'BANDWIDTH'\n @code_obj = ServiceCode.find_by(name: @code)\n @service_title = \"BGP Session (ASN #{params[:asn]})\"\n @billing_amount_pro_rated = pro_rated_total(@billing_amount)\n\n @stripe_price_id = @account.offload_billing? ? $STRIPE_PRODUCTS['bgp'] : \"\"\n\n @pending_service = @account.services.create(\n pending: true,\n service_code: @code_obj,\n title: @service_title,\n billing_interval: 1,\n billing_amount: @billing_amount,\n stripe_price_id: @stripe_price_id,\n description: \"Pending provisioning by ARP Networks staff.\\n\\nWe thank you for your patience!\"\n )\n\n unless @account.offload_billing?\n @pending_invoice = @account.create_pro_rated_invoice!(\n @code, @service_title, @billing_amount_pro_rated, pending: true\n )\n end\n when 'backup'\n raise\n end\n\n @services = [@pending_service].compact\n @invoices = [@pending_invoice].compact\n\n @enable_pending_view = true\n\n session[:service_to_enable] = @service\n session[:pending_service_ids] = @services.map(&:id)\n session[:pending_invoice_ids] = @invoices.map(&:id)\n end",
"def test_bp_cancel_entitlement_eot_billing_eot_with_ctd\n bp = create_entitlement_base(@account.account_id, 'Sports', 'MONTHLY', 'DEFAULT', @user, @options)\n check_entitlement(bp, 'Sports', 'BASE', 'MONTHLY', 'DEFAULT', DEFAULT_KB_INIT_DATE, nil)\n\n # Move clock after trial\n kb_clock_add_days(31, nil, @options)\n\n bp2 = get_subscription(bp.subscription_id, @options)\n assert_equal('2013-09-30', bp2.charged_through_date)\n\n requested_date = '2013-08-05'\n entitlement_policy = 'END_OF_TERM'\n billing_policy = 'END_OF_TERM'\n use_requested_date_for_billing = nil\n\n bp.cancel(@user, nil, nil, requested_date, entitlement_policy, billing_policy, use_requested_date_for_billing, @options)\n\n canceled_bp = get_subscription(bp.subscription_id, @options)\n check_subscription(canceled_bp, 'Sports', 'BASE', 'MONTHLY', 'DEFAULT', DEFAULT_KB_INIT_DATE, '2013-09-30', DEFAULT_KB_INIT_DATE, '2013-09-30')\n end",
"def test_successful_purchase_with_emv_credit_card_in_us\n assert response = @gateway.purchase(@amount, @emv_credit_cards[:us], @options)\n assert_success response\n assert_equal 'charge', response.params['object']\n assert response.params['paid']\n assert_match CHARGE_ID_REGEX, response.authorization\n end",
"def confirm!\n no_stock_of = self.order_items.select(&:validate_stock_levels)\n unless no_stock_of.empty?\n raise Shoppe::Errors::InsufficientStockToFulfil, :order => self, :out_of_stock_items => no_stock_of\n end\n \n run_callbacks :confirmation do\n # If we have successfully charged the card (i.e. no exception) we can go ahead and mark this\n # order as 'received' which means it can be accepted by staff.\n self.status = 'received'\n self.received_at = Time.now\n self.save!\n\n self.order_items.each(&:confirm!)\n\n # Send an email to the customer\n deliver_received_order_email\n end\n \n # We're all good.\n true\n end",
"def verify()\n # TODO\n end",
"def test_gc_checkout \n get :index\n session[:customer_id] = 1\n get_customer_cart.empty!\n\n session[:timestamp] = Time.now.to_i\n post :add_set, :id => 1\n assert_redirected_to :controller => :cart, :action => ''\n assert_equal(BigDecimal('0.00'), Customer.find(1).credit)\n post :claim_code, :code => 'LE_GIFT'\n assert_redirected_to :controller => :cart, :action => 'checkout'\n assert_equal(BigDecimal('1.33'), Customer.find(1).credit)\n assert_equal(2, Customer.find(1).orders.size)\n post :checkout, :credit_card => { :number => '4111111111111111', :month => 12, :year => 2020 },\n :terms_and_conditions => true, :apply_credit => true\n assert_redirected_to :controller => :cart, :action => 'order_success'\n orders = Customer.find(1).orders\n assert_equal(3, orders.size)\n assert_equal(2, orders.first.line_items.size)\n assert_equal(5, orders.first.line_items.first.product.id)\n assert_equal(4, orders.first.line_items.last.product.id)\n assert_equal(\"Gift Certificate / Credit Card (Visa) XXXX-XXXX-XXXX-1111\", orders.first.payments.last.payment_method)\n assert_equal(BigDecimal('23.98'), orders.first.payments.last.amount)\n assert_equal(BigDecimal('22.65'), orders.first.payments.last.amount_as_new_revenue)\n end",
"def purchase\n # number of checks to see if coming out of context\n # no order_id\n unless params[:order_id]\n go_home()\n return\n end\n @order = Order.find_by_id(params[:order_id])\n # order doesn't exist\n unless @order\n go_home()\n return\n end\n # order is already authorized or paid\n if @order.state != Order::CREATED\n go_home()\n return\n end\n # order has zero quantity or zero amount\n if @order.quantity == 0 or @order.amount == 0\n go_home()\n return\n end\n # deal doesn't exist\n deal = @order.deal\n unless deal\n go_home()\n return\n end\n \n # check if deal has ended\n if deal.is_ended\n flash[:error] = \"This deal has ended. Checkout out some of our other deals!\"\n go_home()\n return\n end\n \n # check if deal hasn't started\n if !deal.is_started\n go_home()\n return\n end\n \n # check if order is timed out\n if @order.is_timed_out\n flash[:error] = \"Your order has timed out. Please restart your transaction.\"\n redirect_to :controller => self.controller_name, :action => 'order', :deal_id => @order.deal.id\n return\n end\n \n if params[:failure]\n flash.now[:error] = \"There was a problem approving your transaction. Please try again.\"\n end\n \n @sim_transaction = \n AuthorizeNet::SIM::Transaction.new(\n AUTHORIZE_NET_CONFIG['api_login_id'], \n AUTHORIZE_NET_CONFIG['api_transaction_key'], \n @order.amount.to_f,\n :transaction_type => AuthorizeNet::SIM::Transaction::Type::AUTHORIZE_ONLY,\n :relay_url => url_for(:controller => self.controller_name, :action => 'relay_response', :only_path => false))\n @timeout = OPTIONS[:order_timeout]\n @gateway_url = Rails.env.production? ? AuthorizeNet::SIM::Transaction::Gateway::LIVE : AuthorizeNet::SIM::Transaction::Gateway::TEST\n render \"payment/#{self.action_name}\"\n end",
"def test_acknowledgement\n valid = Netgiro.notification(http_raw_data, :credential2 => 'password')\n assert valid.acknowledge\n assert valid.success?\n assert valid.complete?\n \n invalid = Netgiro.notification(http_raw_data, :credential2 => 'bogus')\n assert !invalid.acknowledge\n assert !invalid.success?\n assert !invalid.complete?\n end",
"def confirm_order\n @check = Ticket.where(table: session[:table_id]).last\n if @check.nil?\n puts(\"ticket not created yet!\")\n return\n end\n @items = OrderItem.where(:ticket_id => @check.id)\n @check.update(:subtotal => 0)\n\t # Add item totals\n\t comp = 0\n @items.each do |orderItem|\n menu_item = Menuitem.find_by(id: orderItem.item)\n @check.update(:subtotal => (@check.subtotal + menu_item.price))\n\t\tunless orderItem.compitem.nil?\n\t\t\tcomp = comp + orderItem.compitem.amount\n\t\tend\n end\n\n\t \n\t # check reward points\n\t if current_guestaccount\n\t\t # check points\n\t\t if current_guestaccount.points > 4\n\t\t\t @check.update(:subtotal => (@check.subtotal - 10.00))\n\t\t\t @check.update(:points => true)\n\t\t end\n\t\t # check birthday\n\t\t if (current_guestaccount.birthday.month == Time.now.month &&\n\t\t\t current_guestaccount.birthday.day == Time.now.day)\n\t\t\t @check.update(:birthday => true)\n\t\t end\n\t end\n\t \n\t # check birthday discount\n\t if @check.birthday\n\t\t @check.update(:subtotal => (@check.subtotal - 10.00))\n\t end\n\t \n\t # check coupon\n\t if @check.coupon\n\t\t @check.update(:subtotal => (@check.subtotal - 10.00))\n\t end\n\n\t #adjust subtotal for comp\n\t @check.update(:subtotal => (@check.subtotal - comp))\n unless @check.compticket.nil? \n @check.update(:subtotal => (@check.subtotal - @check.compticket.amount))\n end\n\n\t # subtotal cannot be negative\n\t if @check.subtotal < 0\n\t\t @check.update(:subtotal => 0)\n\t end\n\n\t # calculate tax\n\t @check.update(:tax => (@check.subtotal * 0.0825))\n\t \n\t unless @check.gratuity.nil?\n\t\t @check.update(:total => (@check.subtotal + @check.tax + @check.gratuity))\n\t else\n\t @check.update(:total => (@check.subtotal + @check.tax))\n\t end\n end",
"def test_successful_amex_purchase\n response = stub_comms do\n @gateway.purchase(@amount, @amex_credit_card, @amex_options)\n end.check_request do |_endpoint, data, _headers|\n assert_match(/post_code=11560/, data)\n end.respond_with(successful_purchase_amex_response)\n\n assert_success response\n\n assert_equal 'test12345', response.authorization\n assert response.test?\n end",
"def receive_test\n setup_http\n\n http_get(\"#{BASE_URL}\")\n\n { ok: true, message: \"OAuth token is valid\" }\n rescue => ex\n { ok: false, message: ex.message }\n end",
"def verify\n end",
"def post_buy_token\n # Whitelist parameters for buying tokens\n purchase_params \n end",
"def test_merchant_reference_that_is_too_short\n @params[:order_id] = @params[:order_id].first(5)\n response = @gateway.purchase(@amount, @mastercard, @params)\n assert_success response\n assert response.test?\n end",
"def successful_purchase_response\n end",
"def test_credit_card_authorize_and_void\n assert auth = @gateway.authorize(@amount, @credit_card, @options)\n assert_success auth\n assert_equal 'Approved', auth.message\n assert void = @gateway.void(@amount, auth.authorization, @credit_card, @options)\n assert_success void\n assert_equal 'Approved', void.message\n end",
"def sell_confirmed\n end",
"def test_successful_purchase_without_account_set_up_and_repeat_payments\n response = @gateway.purchase(@amount, @mastercard, @params)\n assert_success response\n assert response.authorization.to_s.split(';')[2].blank?\n assert response.test? \n end",
"def authorize_net_valid(options)\n transaction = AuthorizeNet::AIM::Transaction.new($api_login, $api_key, :gateway => $gateway.to_s.to_sym,\n :encapsulation_character => \"|\",\n :allow_split => true)\n\n # Find a state\n if params[:state].blank?\n state = \"--\"\n else\n state = State.find_by_state(options[:state]).state_abbr\n end \n\n # Add address to request\n address = AuthorizeNet::Address.new(:first_name => options[:first_name],\n :last_name => options[:last_name],\n :street_address => options[:address],\n :city => options[:city],\n :state => state,\n :zip => options[:zip],\n :country => options[:country])\n transaction.set_address(address)\n\n # Convert a date expired\n expired_date = params[:expires_date_months].[](0..1).strip.concat(params[:expires_date_years].[](2..3))\n if expired_date.length == 3\n expired_date = \"0\".concat(expired_date)\n end\n\n # Add credit card to request\n credit_card = AuthorizeNet::CreditCard.new(options[:cc_number], expired_date, :card_code => options[:cvv])\n # Execute a request\n response = transaction.authorize(0.0, credit_card)\n\n # Get a result of request\n @authorize_transaction_id = response.transaction_id\n #@authorize_gateway = transaction.gateway\n @authorize_gateway = response.raw.body\n @authorize_code = response.authorization_code\n @response_code = response.response_code\n @response_reason_code = response.response_reason_code\n\n # Generate user message\n if @response_code.to_i == 1 && @response_reason_code.to_i == 1\n user_message = \"Billing information changed\"\n else\n user_message = get_user_message(@response_code, @response_reason_code)\n end\n\n unless response.success?\n # Card is invalid(authorize.net)\n flash[:error_card] = 'Can\\'t authorize credit card'\n\n # Block in session\n block_ip_in_session\n\n # Add transaction\n add_transaction(:i_account => @account.i_account, \n :type => \"payment_refund\",\n :transaction_id => @authorize_transaction_id,\n :gw_string => @authorize_gateway,\n :user_message => user_message,\n :ip => request.remote_ip.to_s,\n :authorization_code => @authorize_code)\n \n false\n else\n true\n end\n end",
"def buyer_confirmed\n end",
"def test_transaction(type)\n amount = case type\n when :success then 100\n when :cancelled then 200\n when :expired then 300\n when :open then 400\n when :failure then 500\n when :server_error then 700\n end\n\n response = @gateway.setup_purchase(amount, @valid_options)\n assert response.success?\n response\n end",
"def test_credit_card_authorize_and_capture_amount_low\n assert auth = @gateway.authorize(@amount, @credit_card, @options)\n assert_success auth\n assert_equal 'Approved', auth.message\n assert capture = @gateway.capture(@amount-100, auth.authorization, @credit_card, @options)\n assert_success capture\n assert_equal 'Approved', capture.message\n end",
"def test_send_invoice_flow_with_edit_gateways_change_payment_credentials\n api_token, current_url, token_url = initiate_send_invoice('signup', nil, :invoice => { :currency => 'USD' })\n session_successfully_create_user(api_token, current_url) do |user|\n user.edit_user_gateways!\n api_token.reload\n add_beanstream_gateway_to_user(api_token.user)\n user.sign_up_for_sage_vcheck!(api_token)\n user.send_invoice_with_payment!(true, true, \"brand_new_user@billingboss.com\")\n assert api_token.invoice.selected_payment_types.any?\n assert_last_delivery_had_no_errors \n end\n end",
"def test_api_request\r\n t = AuthorInfo.make_request(\"James_Joyce\")\r\n assert_equal(true, t.length > 0)\r\n end",
"def token_supply\n\n @response = CompanyApi::Request::Economy.new(\n CompanyApi::Response::Formatter::Economy,\n request.cookies,\n {\"User-Agent\" => http_user_agent}\n ).fetch_supply_details\n\n # Check if error present or not?\n unless @response.success?\n render_error_response(@response)\n return\n end\n\n @presenter_obj = ::WebPresenter::Economy::TokenSupply.new(@response, params)\n unless @presenter_obj.client_token.step_three_done?\n redirect_to :planner, status: GlobalConstant::ErrorCode.temporary_redirect\n return\n end\n\n end",
"def test_seed_refund_iia\n data = {}\n data[:name] = 'Agostino Giordano'\n data[:external_key] = 'agostinogiordano8'\n data[:email] = 'agostinogiordano8@kb.com'\n data[:currency] = 'EUR'\n data[:time_zone] = 'Europe/Rome'\n data[:address1] = '3 Viale Abruzzi'\n data[:address2] = nil\n data[:postal_code] = '20010'\n data[:company] = nil\n data[:city] = 'Milan'\n data[:state] = 'Lombardy'\n data[:country] = 'Italy'\n data[:locale] = 'it_IT'\n\n @agostinogiordano = create_account_with_data(@user, data, @options)\n add_payment_method(@agostinogiordano.account_id, '__EXTERNAL_PAYMENT__', true, nil, @user, @options)\n\n # Generate first invoice for the annual plan\n base1 = create_entitlement_base(@agostinogiordano.account_id, 'reserved-metal', 'MONTHLY', 'DEFAULT', @user, @options)\n wait_for_expected_clause(1, @agostinogiordano, @options, &@proc_account_invoices_nb)\n\n # Second invoice\n kb_clock_add_days(31, nil, @options) # 2015-09-01\n wait_for_expected_clause(2, @agostinogiordano, @options, &@proc_account_invoices_nb)\n\n kb_clock_add_days(1, nil, @options) # 2015-09-02\n\n base1.cancel(@user, nil, nil, nil, 'IMMEDIATE', 'END_OF_TERM', nil, @options)\n\n payments = get_payments_for_account(@agostinogiordano.account_id, @options)\n\n invoice_payment = get_invoice_payment(payments[1].payment_id, @options)\n\n invoice = get_invoice_by_id(invoice_payment.target_invoice_id, @options)\n\n adjustments = []\n adjustments << { invoice_item_id: invoice.items[0].invoice_item_id,\n currency: 'EUR',\n amount: invoice.items[0].amount }\n\n refund(payments[1].payment_id, payments[1].purchased_amount, adjustments, @user, @options)\n end",
"def test_create_observation\n requires_login(:create_observation)\n assert_form_action(:action => 'create_observation', :approved_name => '')\n end"
] |
[
"0.6254768",
"0.6082567",
"0.6053607",
"0.60367775",
"0.59646964",
"0.5937461",
"0.59014326",
"0.5829643",
"0.58101565",
"0.5809986",
"0.578018",
"0.5762376",
"0.5718947",
"0.56751347",
"0.567493",
"0.567193",
"0.56247675",
"0.5607977",
"0.55994844",
"0.5577947",
"0.5568904",
"0.5566851",
"0.5562522",
"0.55563986",
"0.55502844",
"0.55489165",
"0.554784",
"0.5545488",
"0.552963",
"0.55140895",
"0.55115366",
"0.5504394",
"0.5501037",
"0.54861987",
"0.5484945",
"0.5471062",
"0.5454171",
"0.5441892",
"0.54409575",
"0.5437079",
"0.5436089",
"0.54326034",
"0.54312587",
"0.5423797",
"0.54221517",
"0.5399469",
"0.53803706",
"0.5378514",
"0.5377047",
"0.53613424",
"0.5358422",
"0.53521496",
"0.53507674",
"0.53498656",
"0.5337921",
"0.5330291",
"0.5326932",
"0.53266317",
"0.532159",
"0.5319974",
"0.531569",
"0.53131956",
"0.53112996",
"0.53110284",
"0.5310039",
"0.53076786",
"0.52994573",
"0.5297333",
"0.5295105",
"0.5289577",
"0.52859825",
"0.5283787",
"0.52771395",
"0.5275926",
"0.52745116",
"0.5256293",
"0.5238506",
"0.5237487",
"0.52330965",
"0.5232072",
"0.52288264",
"0.52287865",
"0.5228401",
"0.5223304",
"0.52171016",
"0.52167344",
"0.5213978",
"0.52133745",
"0.52119464",
"0.52102107",
"0.52069384",
"0.5204308",
"0.5201254",
"0.51982826",
"0.51950526",
"0.5193411",
"0.5187989",
"0.5186091",
"0.51860267",
"0.51784587",
"0.51734114"
] |
0.0
|
-1
|
Create a nested OpenStruct, such that all subhashes added to the table also become OpenStruct objects.
|
def nested(data=nil)
o = new
o.nested!(true)
o.update!(data) if data
o
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create_ostruct_from_hash(hash)\n ret = OpenStruct.new(hash)\n hash.each do |key, value|\n if value.is_a?(Hash)\n ret.send(\"#{key}=\", create_ostruct_from_hash(value))\n elsif value.is_a?(Array)\n ret.send(\"#{key}=\", create_ostruct_array(value))\n end\n end\n ret\nend",
"def store!(key, value)\n if @nested && Hash === value # value.respond_to?(:to_hash)\n value = OpenStruct2.new(value)\n end\n\n #new_ostruct_member(key) # this is here only for speed bump\n\n @table[key.to_sym] = value\n end",
"def nested_struct obj\n case obj\n when Hash\n obj.each_with_object(OpenStruct.new) do |(k,v), acc|\n acc[k]= case v\n when Hash then send(__method__,v)\n when Array then v.map(&method(__method__))\n else v\n end\n end.\n tap{|x| x.define_singleton_method(:keys){ obj.to_h.keys }}.\n tap{|x| x.define_singleton_method(:values){ AwsDevUtils::Utils.nested_struct obj.to_h.values }}\n when Array\n obj.map(&method(__method__))\n else\n obj\n end\n end",
"def hashes2ostruct(object)\n return case object\n when Hash\n object = object.clone\n object.each do |key, value|\n object[key] = hashes2ostruct(value)\n end\n OpenStruct.new(object)\n when Array\n object = object.clone\n object.map! { |i| hashes2ostruct(i) }\n else\n object\n end\n end",
"def hashes2ostruct(object)\n return case object\n when Hash\n object = object.clone\n object.each do |key, value|\n object[key] = hashes2ostruct(value)\n end\n OpenStruct.new(object)\n when Array\n object = object.clone\n object.map! { |i| hashes2ostruct(i) }\n else\n object\n end\n end",
"def hashes_to_ostruct object # {{{\n\n return case object\n when Hash\n object = object.clone\n object.each { |key, value| object[key] = hashes_to_ostruct(value) }\n OpenStruct.new( object )\n when Array\n object = object.clone\n object.map! { |i| hashes_to_ostruct(i) }\n else\n object\n end\n\n end",
"def build_struct_tree data\n data.to_hashugar\n end",
"def to_h\n NestedOstruct.parse(self)\n end",
"def _struct(obj)\n obj.class.new(*_renc(obj.to_h).values)\n end",
"def add_hash(obj, hash)\n return unless hash\n\n hash.each do |key, value|\n if value.class == Hash\n eval \"obj.#{key} = OpenStruct.new\"\n add_hash(eval(\"obj.#{key}\"), value)\n else\n eval \"obj.#{key.downcase} = value\"\n end\n end\n end",
"def create(structure_, data_={})\n Table.new(structure_, data_)\n end",
"def recursive_to_h(struct)\n if struct.is_a?(Array)\n return struct.map { |v| v.is_a?(OpenStruct) || v.is_a?(Array) || v.is_a?(Hash) ? recursive_to_h(v) : v }\n end\n\n hash = {}\n\n struct.each_pair do |k, v|\n recursive_val = v.is_a?(OpenStruct) || v.is_a?(Array) || v.is_a?(Hash)\n hash[k] = recursive_val ? recursive_to_h(v) : v\n end\n hash\n end",
"def initialize(hash=nil)\n @table = HashWithIndifferentAccess.new\n\n for k,v in hash\n @table[k] = v\n new_ostruct_member(k)\n end if hash\n end",
"def init_with(c)\n c.map.keys.each do|k|\n instance_variable_set(\"@#{k}\", c.map[k])\n end\n\n @table.keys.each do|k|\n new_ostruct_member(k)\n end\n end",
"def create_eos(o = OpenStruct.new) \n class << (o)\n include EOS\n alias_method :_hash, :deep_inspect\n end unless o.respond_to? :deep_inspect\n o\n end",
"def t2(*args)\n OpenStruct.new\n end",
"def to_doc(o = self)\n o = EOStruct::eos o\n h = o._hash.clone\n h.each { |k, v|\n if v.kind_of? OpenStruct\n h[k] = to_doc(v)\n end\n }\n h\n end",
"def from_nested_object(obj_, field_opts_=[], opts_={})\n ::NTable.from_nested_object(obj_, field_opts_, opts_)\n end",
"def hash2os(hash)\n hash.each_key do |key|\n hash[key] = hash2os(hash[key]) if hash[key].is_a?(Hash)\n chk_array(hash[key]) if hash[key].is_a?(Array)\n end\n hash = OpenStruct.new(hash)\n end",
"def build_struct(node)\n struct_values = node.find('struct/*[@resource-type=\"Primitive\"]').to_a.collect{|primitive_node|\n [ primitive_node['ident'].to_sym, \"Shapes::Builder::#{primitive_node['resource-type']}\".\n constantize.new(primitive_node).build_resource ]\n }\n Shapes::Struct.struct_class(struct_name, struct_values.map(&:first)).new(*struct_values.map(&:last))\n end",
"def _convert_ostruct(obj)\n return OpenStruct.new(Hash[obj.map { |k, v| [k, _convert_ostruct(v)] }]).freeze if obj.is_a?(Hash)\n return obj.map { |v| _convert_ostruct(v) }.freeze if obj.is_a?(Array)\n obj\n end",
"def struct(hash, arrays = false)\n keys = hash.keys.map(&:to_sym)\n values = hash.values_at(*keys)\n values.map! do |v|\n case v\n when Array then arrays ? v.map { |elem| struct(elem, arrays) } : v\n when Hash then struct(v, arrays)\n else v\n end\n end\n Struct.new(*keys).new(*values)\n end",
"def update(hash)\n @__table__ ||= {}\n if hash\n for k,v in hash\n @__table__[k.to_sym] = v\n new_ostruct_member(k)\n end\n end\n end",
"def to_nested_object(opts_={})\n if @structure.degenerate?\n @vals[@offset]\n else\n _to_nested_obj(0, ::Array.new(@structure.dim, 0), opts_)\n end\n end",
"def substruct(strbuf, name, len, klass, *extra_args)\n new=klass.new(strbuf, *extra_args)\n @fields << new\n @hash_references[name]=new\n meta_def name do new end\n # More informative than the NoMethodError they would normally get.\n meta_def (name.to_s + '=').to_sym do raise NoMethodError, \"Binstruct: Illegal call of '=' on a substruct.\" end\n end",
"def to_ostruct_exposing(*exposed_methods_and_initialize_hashes)\n exposed_attributes = exposed_methods_and_initialize_hashes.select do |arg|\n [ Symbol, String ].include?(arg.class)\n end\n\n initialize_hash = exposed_methods_and_initialize_hashes.select do |arg|\n arg.is_a?(Hash)\n end.inject({}, &:merge) # combine all hashes just in case\n \n for attr in exposed_attributes\n initialize_hash[attr] = send(attr)\n end\n \n OpenStruct.new(initialize_hash.symbolize_keys)\n end",
"def __class__\n OpenStruct2\n end",
"def create_ostruct_array(array)\n ret = []\n array.each do |value|\n if value.is_a?(Hash)\n ret << create_ostruct_from_hash(value)\n elsif value.is_a?(Array)\n ret << create_ostruct_array(value)\n else\n ret << value\n end\n end\n ret\nend",
"def create_struct( entry_hash )\n values = entry_hash.keys.sort_by{|entry|entry.to_s}.collect {|key| entry_hash[key]}\n result = Struct::Entry.new( *values )\n result\n end",
"def define_struct\n fields = (@entry_fields + [:raw_entry]).sort_by{|key|key.to_s}\n verbose = $VERBOSE\n $VERBOSE = nil\n Struct.new( \"Entry\", *fields )\n $VERBOSE = verbose\n end",
"def to_struct\n attributes = keys.sort\n members = attributes.map(&:to_sym)\n Struct.new(*members).new(*attributes.map do |key|\n attribute = fetch key\n (attribute.is_a? Hash) ? attribute.to_struct : attribute\n end) unless empty?\n end",
"def ostruct_to_hash(ostruct, hash = {})\n ostruct.each_pair do |k, v|\n hash[k] = v.is_a?(OpenStruct) ? ostruct_to_hash(v) : v\n end\n\n hash\n end",
"def hash_mapped_struct\n set_field_getter {|obj, name| obj[name.to_sym] }\n set_field_setter {|obj, name, value| obj[name.to_sym] = value }\n end",
"def struct_union_construct(base_type, member_list)\n con_hash = {'.type' => base_type['.type'].clone} # struct or union \n con_hash['.members'] = []\n\n member_list.each do |member|\n member_name = member[0] # identifier\n member_type = member[1] # chained hash\n\n con_hash['.members'].push([member_name, member_type])\n end\n\n return con_hash\nend",
"def struct_union_construct(base_type, member_list)\n con_hash = {'.type' => base_type['.type'].clone} # struct or union \n con_hash['.members'] = []\n\n member_list.each do |member|\n member_name = member[0] # identifier\n member_type = member[1] # chained hash\n\n con_hash['.members'].push([member_name, member_type])\n end\n\n return con_hash\nend",
"def reify(hash)\n type = index(hash, :type)\n content = klass(type).new(nil, @context, reify: true, def: index(hash, :def))\n DSLStructObject.new(type, content, reify: true, required: index(hash, :required))\n end",
"def fill_out\n @build = {}\n descend(@schema, [])\n @build\n end",
"def merge! other_hash\n @table.merge!(nested_class, (other_hash if other_hash.is_a? Hash) || other_hash.to_h)\n end",
"def structural_hash\n @structural_hash ||= pure_ruby_hash\n end",
"def assign_struct\n assignment = struct_record.shape_assignments.\n build(:shape => base.shape, :path => path) and\n assignment.save\n end",
"def obj_struct_build(options)\n if options.is_a? Array\n vals = group_by_class(options)\n vals.each { |k, v| set_attrs(k, v) }\n elsif options.is_a? Hash\n options.each { |k, v| set_attrs(k, v) } # multiple objects already built\n else\n klass = options.class.to_s.underscore\n set_attrs(klass, options)\n end\n end",
"def record_from_hash(data)\n attributes = data.delete('attributes')\n new_record = find_or_materialize(attributes[\"type\"]).new\n data.each do |name, value|\n field = new_record.description['fields'].find do |field|\n key_from_label(field[\"label\"]) == name || field[\"name\"] == name || field[\"relationshipName\"] == name\n end\n\n # Field not found\n if field == nil\n break\n end\n\n # If reference/lookup field data was fetched, recursively build the child record and apply\n if value.is_a?(Hash) and field['type'] == 'reference' and field[\"relationshipName\"]\n relation = record_from_hash( value )\n set_value( new_record, field[\"relationshipName\"], relation, 'reference' )\n\n # Apply the raw value for all other field types\n else\n set_value(new_record, field[\"name\"], value, field[\"type\"]) if field\n end\n end\n new_record\n end",
"def hash_to_obj hash\n OpenStruct.new(hash) rescue raise ConfigError, \"Can't convert setup to object\"\n end",
"def method_missing(mid, *args, **kwargs, &block)\n len = args.length\n\n res = if mid.to_s.end_with?('!')\n m = mid[0...-1].to_sym\n new_ostruct_member!(m)\n @table[m]\n elsif mid.to_s.end_with?('=')\n m = mid[0...-1].to_sym\n new_ostruct_member!(m)\n @table[m] = args.first\n elsif len.positive? || kwargs.any? || block\n new_ostruct_member!(mid)\n @table[mid] = nested_class.new(key: mid, **(args.first || {}), **kwargs)\n else\n @table[mid]\n end\n\n block&.call(res)\n\n res\n end",
"def initialize(opts={})\n\n # A Structure is really just a Blob with extra goop\n @value = Blob.new\n @value.parent = self\n\n # Most of the goop is for figuring out what fields to\n # add, with what arguments, given where we are in the\n # inheritance hierarchy.\n\n template = self.class.templates\n\n # If this is the first time we're seeing this definition,\n # we also need to convert field names into blob offsets.\n pop = false\n if not self.class.structure_field_names\n self.class.write_inheritable_hash :structure_field_names, {}\n pop = true\n end\n\n template.each do |t|\n # do some rewriting to support an old style of declaring\n # fields that we supported like 6 months ago.\n name = template_decoder_ring(t)\n\n # index the field name if this is the first time we've\n # ever instantiated this kind of structure, and the field\n # is valid\n self.class.structure_field_names[name] = @value.count if (name and pop)\n\n begin\n # create the structure field object, parent it\n klass, args = [t[0], t[1]]\n obj = klass.new(*args)\n obj.parent = @value\n\n template_entry_added_hook(obj) || @value << obj\n rescue\n pp t\n raise\n end\n end\n\n opts.each do |k, v|\n if self.class.structure_field_names.has_key? k\n raise \"attempting to assign field name as option; use with_{field_name} instead\"\n end\n end\n\n super(opts)\n\n final_initialization_hook\n end",
"def structure\n # create a hash and return it\n h = {\n name: @name,\n required: @required,\n expression: @expression,\n data_type: @data_type,\n field_type: @field_type\n }\n h[:properties] = @properties if @properties.keys.count > 0\n h\n end",
"def generate_employement_information_structs(status_array, name, pos, tenure, phone, ext, email, addr, city, state_array, postal, url)\n Struct.new(\"EmploymentInformation\", :status, :name, :position, :tenure,\n :work_phone, :work_phone_ext, :work_email, :work_address,\n :work_city, :work_state, :work_postal_code, :social_media_url)\n\n leadsArray = []\n\n for status in status_array\n for state in state_array\n leadsArray.push(Struct::EmploymentInformation.new(status, name, pos, tenure, phone, ext, email, addr, city, state, postal, url))\n end\n end\n\n return leadsArray\nend",
"def generate_document_structure; build_document_hash end",
"def generate_structure hash, parent\n\n if hash.is_a? Hash\n hash.each do |key, value|\n if key == :element\n if parent.class == @window.class\n parent.add(value)\n else\n parent.pack_start(value, true, true)\n end\n elsif key == :buttons\n @buttons.merge! create_buttons value, hash[:element]\n elsif value.is_a? Array\n value.each do |single_value|\n generate_structure single_value, hash[:element]\n end\n elsif value.is_a? Hash\n generate_structure value, hash[:element]\n end\n end\n end\n\n end",
"def build_nested(object)\n this = self\n\n nested_object = Configuration.new\n children.each { |child| child.build(nested_object) }\n object.instance_exec { define_singleton_method(this.name) { nested_object } }\n\n object\n end",
"def initialize(oid)\n @oid=oid\n @fields = Tree.new([])\n end",
"def format_structure\n # generate name/value pairs for structure metadata\n formatted_meta = []\n @structure.each do |k, v|\n formatted_meta << { name: k, value: v } unless %w(id user_defined_id analysis_id).include?(k)\n end\n new_struct = Hashie::Mash.new\n new_struct.metadata = formatted_meta\n\n # TODO: what if it's already in the structure hash?\n # add user_defined_id to structure\n new_struct.user_defined_id = @user_defined_id\n new_struct.analysis_id = @analysis_id\n\n data_hash = Hashie::Mash.new\n data_hash.structure = new_struct\n data_hash.measure_instances = @measure_instances ? @measure_instances : []\n\n # convert to json\n MultiJson.dump(data_hash)\n end",
"def write_struct\n @struct.connection.set(@struct.key, 'foo')\n end",
"def nested_hash obj\n if obj.kind_of? Array\n obj.map(&method(__method__))\n elsif obj.respond_to?(:to_h)\n obj.to_h.each_with_object({}) do |(k,v), acc|\n acc[k] = case v\n when Hash,OpenStruct then send(__method__,v)\n when Array then v.map(&method(__method__))\n else v\n end\n end\n else\n obj\n end\n end",
"def create_tree(node, elem, level, parent)\n node.level = level\n elemtype = check_type(elem[1])\n case elemtype\n when \"array\"\n node.kind = \"array\"\n node.arrsize = elem[1][\".array_size\"].to_i\n if elem[1].has_key?(\".subtype\") && elem[1][\".subtype\"].has_key?(\".members\")\n elem[1][\".subtype\"][\".members\"].each do |m|\n x = Tree.new(m[0], item_type(elem[1]), node)\n node.create_child(x)\n create_tree(x, m, level+1, node)\n end\n if elem[1][\".subtype\"].has_key?(\".type_or_id_name\")\n elem[1][\".subtype\"][\".type_or_id_name\"] =~ /\\((.+)\\): (\\w+)/\n node.s_u_name = $2.clone\n else\n node.s_u_name = \"__ANON__\"\n end\n node.basetype = node.data = elem[1][\".subtype\"][\".type\"].clone\n else\n subkind = check_type(elem[1][\".subtype\"])\n case subkind\n when \"enum\"\n node.basetype = \"enum\"\n node.data = {\".type\" => elem[1][\".subtype\"][\".type\"]}\n node.data[\".type_or_id_name\"] = elem[1][\".subtype\"][\".type_or_id_name\"]\n arr = []\n elem[1][\".subtype\"][\".values\"].each { |k,v| arr << [k,v] }\n node.data[\".values\"] = arr.clone\n node.data[\".values\"].sort! { |a,b| a[1] <=> b[1] }\n when \"numeric_ose\", \"boolean\"\n elem[1][\".subtype\"][\".type_or_id_name\"] =~ /\\((.+)\\): (\\w+)/\n node.basetype = $2.clone\n when \"native\", \"numeric_other\"\n node.basetype = \"OTHER\"\n node.data = {\".type\" => elem[1][\".subtype\"][\".type\"]}\n if elem[1][\".subtype\"].has_key?(\".signed\")\n node.data[\".signed\"] = elem[1][\".subtype\"][\".signed\"] \n end\n if elem[1][\".subtype\"].has_key?(\".type_or_id_name\")\n node.data[\".type_or_id_name\"] = elem[1][\".subtype\"][\".type_or_id_name\"]\n end\n end\n node.leaf = true\n end\n when \"struct\", \"union\"\n node.kind = elemtype\n if is_anon?(elem[1])\n node.s_u_name = \"__ANON__\"\n else\n node.s_u_name = item_name(elem[1])\n end\n elem[1][\".members\"].each do |m|\n x = Tree.new(m[0], item_type(elem[1]), node)\n node.create_child(x)\n create_tree(x, m, level+1, node)\n end\n when \"enum\"\n node.kind = \"enum\"\n node.basetype = \"enum\"\n node.s_u_name = item_name(elem[1])\n node.parent = parent\n node.leaf = true\n arr = []\n elem[1][\".values\"].each { |k,v| arr << [k,v] }\n node.data = arr.clone\n node.data.sort! { |a,b| a[1] <=> b[1] }\n when \"numeric_ose\"\n node.kind = \"numeric\"\n node.basetype = item_name(elem[1])\n node.parent = parent\n node.leaf = true\n when \"boolean\"\n node.kind = \"boolean\"\n node.basetype = item_name(elem[1])\n node.parent = parent\n node.leaf = true\n when \"native\", \"numeric_other\"\n node.kind = \"numeric\"\n node.basetype = \"OTHER\"\n node.data = {'.type' => elem[1][\".type\"]}\n node.data[\".signed\"] = elem[1][\".signed\"] if elem[1].has_key?(\".signed\")\n if elem[1].has_key?(\".type_or_id_name\")\n node.data[\".type_or_id_name\"] = elem[1][\".type_or_id_name\"]\n end\n node.parent = parent\n node.leaf = true\n else\n raise \"Node #{node.name} contains erroneous data\" \n end\n end",
"def build\n # Create the offsets, if they are not provided\n current_offset = 0\n fields.each do |field_def|\n field_def[2] ||= current_offset\n current_offset = field_def[2] + field_def[1].size\n end\n registry.do_create_compound(name, fields, size)\n end",
"def to_struct(name=nil)\n Struct.new(name, *data.keys).new *data.values\n end",
"def structs\n @__structs__ ||= Structs.new(registry, struct_namespace)\n end",
"def set_nested(hash, field_name, value)\n field_ref = Java::OrgLogstash::FieldReference.from(field_name)\n # create @metadata sub-hash if needed\n if field_ref.type == Java::OrgLogstash::FieldReference::META_CHILD\n nesting_hash = hash[\"@metadata\"]\n else\n nesting_hash = hash\n end\n\n field_ref.path.each do |token|\n nesting_hash[token] = {} unless nesting_hash.key?(token)\n nesting_hash = nesting_hash[token]\n end\n nesting_hash[field_ref.key] = value\n end",
"def structure_dump() end",
"def build(base=nil, &block)\n struct = base || SparkleStruct.new\n struct.instance_exec(&block)\n @_struct = struct\n end",
"def reset_properties(hash)\n @table.keys.each{|key| remove_ostruct_member(key)}\n hash.each{|key,value| new_ostruct_member(key,value)}\n rest_reset_properties\n end",
"def struct!(fields)\n flattened = flatten_struct!(fields).map do |field|\n type = field.first\n name = field.last\n \"#{type} #{name}\"\n end\n struct(flattened)\n end",
"def build_nested_object(prop, current_path)\n object_lines = []\n prop.properties.each do |nested_prop|\n next_path = \"#{current_path}/#{nested_prop.out_name}\"\n object_lines << lines([\"* `#{next_path}`\"].join(' '))\n\n object_lines << lines(wrap_field([\n ('Required.' if nested_prop.required),\n ('Output only.' if nested_prop.output),\n nested_prop.description\n ].compact.join(' '), 0), 1)\n\n if nested_prop.is_a? Api::Type::NestedObject\n object_lines.concat(build_nested_object(nested_prop, next_path))\n elsif nested_prop.is_a?(Api::Type::Array) &&\n nested_prop.item_type.is_a?(Api::Type::NestedObject)\n object_lines.concat(build_nested_object(nested_prop.item_type,\n \"#{next_path}[]\"))\n end\n end\n object_lines\n end",
"def init_simple_tree\n @root_org = Org.create(name: 'root')\n @lv1_child_org = Org.create(name: 'lv1')\n @lv1_child_org2 = Org.create(name: 'lv1-2')\n @lv2_child_org = Org.create(name: 'lv2')\n @lv2_child_org2 = Org.create(name: 'lv2-2')\n @lv2_child_org3 = Org.create(name: 'lv2-3')\n @lv2_child_org4 = Org.create(name: 'lv2-4')\n @lv3_child_org = Org.create(name: 'lv3')\n @lv3_child_org2 = Org.create(name: 'lv3-2')\n @lv4_child_org = Org.create(name: 'lv4')\n @lv4_child_org2 = Org.create(name: 'lv4-2')\n @lv5_child_org = Org.create(name: 'lv5')\n @lv5_child_org2 = Org.create(name: 'lv5-2')\n\n current_time = Time.now\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @root_org.id,\n distance: 0,\n start_time: 10.minutes.ago(current_time),\n end_time: 1000.years.from_now,\n scope_name: 'default'\n )\n\n # 10 minutes ago\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv2_child_org.id,\n distance: 1,\n start_time: 10.minutes.ago(current_time),\n end_time: current_time,\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv1_child_org.id,\n distance: 2,\n start_time: 10.minutes.ago(current_time),\n end_time: current_time,\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org.id,\n child_id: @lv1_child_org.id,\n distance: 1,\n start_time: 10.minutes.ago(current_time),\n end_time: current_time,\n scope_name: 'default'\n )\n\n # now\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv1_child_org.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv1_child_org2.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv2_child_org.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv2_child_org.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv2_child_org2.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv2_child_org2.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv2_child_org3.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org2.id,\n child_id: @lv2_child_org3.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv2_child_org4.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org2.id,\n child_id: @lv2_child_org4.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv3_child_org.id,\n distance: 3,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv3_child_org.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org.id,\n child_id: @lv3_child_org.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv4_child_org.id,\n distance: 4,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv4_child_org.id,\n distance: 3,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org.id,\n child_id: @lv4_child_org.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv3_child_org.id,\n child_id: @lv4_child_org.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv5_child_org.id,\n distance: 5,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv5_child_org.id,\n distance: 4,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org.id,\n child_id: @lv5_child_org.id,\n distance: 3,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv3_child_org.id,\n child_id: @lv5_child_org.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv4_child_org.id,\n child_id: @lv5_child_org.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv3_child_org2.id,\n distance: 3,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv3_child_org2.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org2.id,\n child_id: @lv3_child_org2.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv4_child_org2.id,\n distance: 4,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv4_child_org2.id,\n distance: 3,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org2.id,\n child_id: @lv4_child_org2.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv3_child_org2.id,\n child_id: @lv4_child_org2.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv5_child_org2.id,\n distance: 5,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv5_child_org2.id,\n distance: 4,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org2.id,\n child_id: @lv5_child_org2.id,\n distance: 3,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv3_child_org2.id,\n child_id: @lv5_child_org2.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv4_child_org2.id,\n child_id: @lv5_child_org2.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\nend",
"def initialize( tree )\n @tree = tree\n @result = OpenHash.new\n end",
"def table\n @table ||= __getobj__.each_with_object(Hash.new) do |document, table|\n table[document.key] = document\n end\n end",
"def data_struct # :yields: arguments\n ud_args = {}\n yield ud_args\n if data_struct_template.nil?\n OpenStruct.new(ud_args)\n else\n args_list = data_struct_template.members.map { |a| ud_args[a] }\n data_struct_template.new(*args_list)\n end\n end",
"def primitives\n return @primitives_structure if @primitives_structure\n @primitives_structure = {}\n cib_section_primitives.each do |primitive|\n primitive_structure = {}\n id = primitive.attributes['id']\n next unless id\n primitive_structure.store 'name', id\n primitive.attributes.each do |k, v|\n primitive_structure.store k.to_s, v\n end\n\n if primitive.parent.name and primitive.parent.attributes['id']\n parent_structure = {\n 'id' => primitive.parent.attributes['id'],\n 'type' => primitive.parent.name\n }\n primitive_structure.store 'name', parent_structure['id']\n primitive_structure.store 'parent', parent_structure\n end\n\n instance_attributes = primitive.elements['instance_attributes']\n if instance_attributes\n instance_attributes_structure = elements_to_hash instance_attributes, 'name', 'nvpair'\n primitive_structure.store 'instance_attributes', instance_attributes_structure\n end\n\n meta_attributes = primitive.elements['meta_attributes']\n if meta_attributes\n meta_attributes_structure = elements_to_hash meta_attributes, 'name', 'nvpair'\n primitive_structure.store 'meta_attributes', meta_attributes_structure\n end\n\n operations = primitive.elements['operations']\n if operations\n operations_structure = elements_to_hash operations, 'id', 'op'\n primitive_structure.store 'operations', operations_structure\n end\n\n @primitives_structure.store id, primitive_structure\n end\n @primitives_structure\n end",
"def initialize\n @left = @right = self\n @columns = {} # column_id object => Column\n @rows = {} # row_id object => Node\n end",
"def nested_builder(metadata, attributes, options)\n Builders::NestedAttributes::One.new(metadata, attributes, options)\n end",
"def create(data_={})\n Table.new(self, data_)\n end",
"def create(table, hash_of_attributes)\n @@pg_conn.exec(\"insert into #{tablename}#{table}(json) values ('#{JSON::dump(hash_of_attributes)}') \")\n end",
"def structure_records_from_flat_hash h\n rtn = {}\n rtn[:klass] = h.delete :klass\n rtn[:code] = h.delete :code\n rtn[:xlate] = h.extract! :name, :note, :desc\n rtn[:no_xlate] = h\n return rtn\n end",
"def attach_model\n model.each_member do |name, field|\n case field\n when OpenStructModel\n @members[name] ||= create_subfield(name)\n end\n end\n\n # Trigger updating the structure whenever the state model is\n # changed\n model.on_change(nil, false) do |name, value|\n if value.kind_of?(OpenStructModel)\n @members[name] ||= create_subfield(name)\n end\n end\n end",
"def use_openstruct(use_openstruct)\n @@use_openstruct = use_openstruct\n end",
"def ==(other)\n return false unless other.kind_of?(OpenStruct)\n @table == other.table\n end",
"def delta_structure\n DeltaStructure.new map, @new_creatures, @new_spawners, @new_quests, @knowledge_base, @new_pool, file_key, requests\n end",
"def nested_attributes_create(meta, attributes)\n reflection = meta[:reflection]\n obj = reflection.associated_class.new\n nested_attributes_set_attributes(meta, obj, attributes)\n delay_validate_associated_object(reflection, obj)\n if reflection.returns_array?\n send(reflection[:name]) << obj\n after_save_hook{send(reflection.add_method, obj)}\n else\n associations[reflection[:name]] = obj\n\n # Because we are modifying the associations cache manually before the\n # setter is called, we still want to run the setter code even though\n # the cached value will be the same as the given value.\n @set_associated_object_if_same = true\n\n # Don't need to validate the object twice if :validate association option is not false\n # and don't want to validate it at all if it is false.\n if reflection[:type] == :many_to_one \n before_save_hook{send(reflection.setter_method, obj.save(:validate=>false))}\n else\n after_save_hook{send(reflection.setter_method, obj)}\n end\n end\n add_reciprocal_object(reflection, obj)\n obj\n end",
"def deep_merge other_in, options_in = {}\n return self if other_in.nil? or other_in.blank?\n\n options = { mode: :append }.merge(options_in)\n\n other =\n if other_in.is_a?(OpenStruct)\n other_in.dup\n elsif other_in.is_a?(Hash)\n other_in.to_os\n else\n OpenStruct.new(nil => other_in)\n end\n\n self.reduce(other) do |res, key, value|\n res[key] =\n if res.table.keys.include?(key)\n case value\n when Hash, OpenStruct\n value.deep_merge(res[key], options)\n when Array\n value.concat([res[key]].compact.flatten(1))\n when NilClass\n res[key]\n else\n value_out =\n if options[:mode] == :append\n [res[key], value].compact.flatten(1)\n elsif options[:mode] == :prepend\n [value, res[key]].compact.flatten(1)\n else\n value\n end\n\n if value_out.is_a?(Array) && options[:dedup]\n value_out.uniq\n else\n value_out\n end\n end\n else\n value\n end\n\n res\n end\n end",
"def generate_toc_tree(toc, type, attr); end",
"def to_ostruct(response)\n OpenStruct.new(JSON.parse(response))\nend",
"def initialize(data=nil, &block)\n @table = ::Hash.new(&block)\n update!(data || {})\n end",
"def test_table_creation_from_ruby\n l = Lua::State.new\n\n l.eval( \"a = {}\")\n assert_instance_of Lua::Table, l.a\n\n s = \"return {1,2,3}\"\n assert_instance_of Lua::Table, l.eval(s)\n assert_equal 3, l.eval(s).__length\n assert_equal [1,2,3], l.eval(s).to_array\n \n b = l.new_table_at 'b'\n assert_instance_of Lua::Table, b\n assert_instance_of Lua::Table, l.b\n\n b = l.a.new_table_at 'b'\n assert_instance_of Lua::Table, b\n assert_instance_of Lua::Table, l.a.b\n \n l.c = []\n assert_instance_of Lua::Table, l.c\n assert_equal 0, l.c.__length\n \n l.d = {}\n assert_instance_of Lua::Table, l.d\n assert_equal 0, l.d.__length\n \n e = [1,2,3,4]\n l.e = e\n assert_equal 1, l.e[1]\n assert_equal 2, l.e[2]\n assert_equal 3, l.e[3]\n assert_equal 4, l.e[4]\n assert_equal e, l.e.to_array\n assert_instance_of Lua::Table, l.e\n \n f = { 1=>1, 2=>2, 'a'=>3, 'b'=>4 }\n l.f = f\n assert_equal 1, l.f[1]\n assert_equal 2, l.f[2]\n assert_equal 3, l.f['a']\n assert_equal 4, l.f['b']\n assert_equal 2, l.f.__length\n assert_instance_of Lua::Table, l.f\n \n assert_luastack_clean l\n end",
"def to_struct_class\n # flatten fields to handle the case where a helper has contributed a series of fields\n # in an array\n args = @fields.flatten\n # prepend the name if specified\n args = [ @name ] + args if @name\n \n # create an array.pack field specifier string from all the field specs\n field_spec_string = @field_specs.flatten.join(' ')\n \n # obtain the class for the arguments\n struct_class = self.class.create_struct_class(*args)\n \n # define metadata for this particular class\n struct_class.const_set(\"SIZE\", @size)\n struct_class.const_set(\"FIELD_SPEC_STRING\", field_spec_string)\n struct_class.const_set(\"LAMBDAS\", @lambdas)\n struct_class.const_set(\"PASCAL_STRINGS\", @pascal_strings)\n\n # create the struct class\n # mix in the record parse helpers\n struct_class.class_eval do\n include StructMixin\n end\n\n struct_class\n end",
"def new_ostruct_member(name)\n name = name.to_sym\n unless singleton_class.method_defined?(name)\n define_singleton_method(name) { @table[name] }\n define_singleton_method(\"#{name}=\") do |x|\n raise TypeError, \"can't modify frozen #{self.class}\", caller(10) if self.frozen?\n modifiable[name] = x\n end\n end\n name\n end",
"def add(object, parent=nil)\n iter = self.append parent\n case object\n when Hash\n update_iter_from_hash iter, object\n else\n update_iter_from_object iter, object\n end\n iter[ self.class.column_id[:object] ] = object\n iter\n end",
"def add_table(hash, options={})\n @main_doc.add_table(create_table_fragment(hash, options))\n end",
"def make_grove(structtag_table, typedef_table, signal_name_hash) \n signal_name_hash.each do |signal|\n structtag_table['table_data'].each do |struct|\n if signal[1][0] == struct[0] && struct[1].has_key?('.type') && \n struct[1].has_key?('.type_or_id_name')\n name = signal[0]\n root = Tree.new(name, item_type(struct[1]), nil)\n @@grove[name] = {\"signo\" => signal[1][1], \"tree\" => root}\n create_tree(root, struct, 0, root)\n end\n end\n typedef_table['table_data'].each do |elem|\n if signal[1][0] == elem[0] && elem[1].has_key?('.type') && elem[1]['.type'] =~ /struct/\n name = signal[0]\n root = Tree.new(name, item_type(elem[1]), nil)\n @@grove[name] = {\"signo\" => signal[1][1], \"tree\" => root}\n create_tree(root, elem, 0, root)\n end\n end\n end\n end",
"def new_ostruct_member(name)\n name = name.to_sym\n unless singleton_class.method_defined?(name)\n define_singleton_method(name) { @table[name] }\n define_singleton_method(\"#{name}=\") { |x| modifiable[name] = x }\n end\n name\n end",
"def ==(other)\n return false unless(other.kind_of?(OpenStruct))\n return @__table__ == other.table\n end",
"def init_object_from_row(row)\n if row\n data = Hash[columns.zip(row)]\n new(data)\n end\n end",
"def create_structure\n # Create variables table\n @db.execute(\"create table if not exists variables(key varchar(255) PRIMARY KEY, value TEXT);\");\n\n # Create quotes table\n @db.execute(\"create table if not exists quotes (id INTEGER PRIMARY KEY, quote TEXT);\")\n\n # Remember NSFW links\n @db.execute(\"create table if not exists nsfwlink_status (id INTEGER PRIMARY KEY, user VARCHAR(15), nsfw TINYINT DEFAULT 0);\")\n\n # Allow polls\n @poll_db.execute(\"create table if not exists polls (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user VARCHAR(30), question VARCHAR(255), date TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL)\")\n\n # Voting alternatives for polls\n @poll_db.execute(\"create table if not exists answers (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, poll_id INTEGER REFERENCES polls(id), number INTEGER, answer VARCHAR(255));\")\n\n # Votes for polls\n @poll_db.execute(\"create table if not exists votes (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, usermask VARCHAR(255), poll_id INTEGER REFERENCES polls(id), answer_id INTEGER REFERENCES answers(id));\")\n\n\n if @debug == true\n puts \"Should have created tables by now\"\n end\n end",
"def initialize(name, table_oid, table_attr_num, oid, type_length, mod, format)\n @name = name\n @type = Datatype::Base.class_for(oid, mod)\n @table_oid = table_oid\n @table_attr_num = table_attr_num\n @oid = oid\n @type_length = type_length\n @mod = mod\n @format = format\n end",
"def marshal_dump\n h = to_h.dup\n h.default = nil\n\n [nested_class, h]\n end",
"def rebuild_table\n @database.execute(\"SELECT ZICCLOUDSYNCINGOBJECT.ZMERGEABLEDATA1 \" +\n \"FROM ZICCLOUDSYNCINGOBJECT \" +\n \"WHERE ZICCLOUDSYNCINGOBJECT.ZIDENTIFIER=?\",\n @uuid) do |row|\n\n # Extract the blob\n gzipped_data = row[\"ZMERGEABLEDATA1\"]\n zlib_inflater = Zlib::Inflate.new(Zlib::MAX_WBITS + 16)\n gunzipped_data = zlib_inflater.inflate(gzipped_data)\n\n # Read the protobuff\n mergabledata_proto = MergableDataProto.decode(gunzipped_data)\n\n # Build list of key items\n @key_items = Array.new\n mergabledata_proto.mergable_data_object.mergeable_data_object_data.mergeable_data_object_key_item.each do |key_item|\n @key_items.push(key_item)\n end\n\n # Build list of type items\n @type_items = Array.new\n mergabledata_proto.mergable_data_object.mergeable_data_object_data.mergeable_data_object_type_item.each do |type_item|\n @type_items.push(type_item)\n end\n\n # Build list of uuid items\n @uuid_items = Array.new\n mergabledata_proto.mergable_data_object.mergeable_data_object_data.mergeable_data_object_uuid_item.each do |uuid_item|\n @uuid_items.push(uuid_item)\n end\n\n # Build Array of objects\n @table_objects = Array.new\n mergabledata_proto.mergable_data_object.mergeable_data_object_data.mergeable_data_object_entry.each do |mergeable_data_object_entry|\n @table_objects.push(mergeable_data_object_entry)\n\n # Best way I've found to set the table direction\n if mergeable_data_object_entry.custom_map\n if mergeable_data_object_entry.custom_map.map_entry.first.key == @key_items.index(\"crTableColumnDirection\") + 1 #Oddly seems to correspond to 'self'\n @table_direction = mergeable_data_object_entry.custom_map.map_entry.first.value.string_value\n end\n end\n end\n\n # Find the first ICTable, which shuld be the root, and execute\n mergabledata_proto.mergable_data_object.mergeable_data_object_data.mergeable_data_object_entry.each do |mergeable_data_object_entry|\n if mergeable_data_object_entry.custom_map and @type_items[mergeable_data_object_entry.custom_map.type] == \"com.apple.notes.ICTable\"\n parse_table(mergeable_data_object_entry)\n end\n end\n end\n end",
"def objects(with_table=false, &block)\n hashes(with_table) do |row|\n row = Row.convert(row, self.fetch_fields, with_table)\n (block) ? yield(row) : row\n end\n end",
"def make_table(table, *args, others)\n unless others.is_a? Hash\n args << others\n others = {}\n end\n table = table.to_s # probably already was\n table_sym = table.to_sym\n @fields[table_sym] = args + others.keys\n @xform[table_sym] = {:inspect => [], :yaml => []}\n xform, fields = @xform, @fields # because of change in 'self'\n @db.create_table table_sym do\n primary_key table+\"_id\"\n args.each do |field| \n if field.to_s =~ /_id$/\n Integer field \n else\n String field\n end\n end\n others.each_pair do |field, klass|\n case klass.to_s.to_sym\n when :Integer; Integer field\n when :String; String field\n when :Float; Float field\n when :DateTime; DateTime field\n when :Array, :Hash, :Symbol\n String field\n xform[table_sym][:inspect] << field\n when :Yaml\n String field\n xform[table_sym][:yaml] << field\n end\n end\n end\n # Now save metadata...\n args_hash = {}\n args.each {|arg| args_hash.update(arg => :String) }\n args_hash.update(others)\n args_hash.each_pair {|k, v| args_hash[k] = v.to_s.to_sym }\n @db[:metadata].insert(:table => table, :transform => xform[table_sym].to_yaml, \n :fields => fields[table_sym].to_yaml)\n end",
"def init_jaxb_json_hash(_o)\n @id = String.from_json(_o['id']) unless _o['id'].nil?\n if !_o['repositories'].nil?\n @repositories = Array.new\n _oa = _o['repositories']\n _oa.each { | _item | @repositories.push String.from_json(_item) }\n end\n @mergedIndexPath = String.from_json(_o['mergedIndexPath']) unless _o['mergedIndexPath'].nil?\n @mergedIndexTtl = Fixnum.from_json(_o['mergedIndexTtl']) unless _o['mergedIndexTtl'].nil?\n @cronExpression = String.from_json(_o['cronExpression']) unless _o['cronExpression'].nil?\n end",
"def to_eos(doc = self)\n raise EOException(\"doc must be a Hash or nested hashes.\") unless doc.kind_of? Hash\n o = create_eos\n doc.each { |k, v|\n o._hash[k.to_sym] = unless v.kind_of? Hash\n v\n else\n to_eos(v)\n end\n }\n o\n end"
] |
[
"0.66759557",
"0.6573493",
"0.6367067",
"0.6180123",
"0.6180123",
"0.60945314",
"0.6031478",
"0.5998468",
"0.58985204",
"0.5749736",
"0.57067525",
"0.5693243",
"0.5681242",
"0.5672903",
"0.5651274",
"0.56319577",
"0.55302566",
"0.55241627",
"0.55225444",
"0.54697",
"0.54378784",
"0.53852224",
"0.5376672",
"0.5367595",
"0.5366876",
"0.5356477",
"0.5355397",
"0.5338377",
"0.5300675",
"0.52928716",
"0.5256245",
"0.52400875",
"0.5217917",
"0.5215954",
"0.5215954",
"0.5208894",
"0.5152426",
"0.51398957",
"0.51196194",
"0.5091634",
"0.5085132",
"0.50399625",
"0.5037491",
"0.5033518",
"0.50312847",
"0.50183314",
"0.49929512",
"0.49809775",
"0.49793452",
"0.4939309",
"0.4900843",
"0.48962122",
"0.48716873",
"0.48636618",
"0.48331755",
"0.48218217",
"0.4821122",
"0.48161018",
"0.48141408",
"0.48092142",
"0.48080558",
"0.47900367",
"0.4788302",
"0.47808236",
"0.47625977",
"0.47562575",
"0.47440505",
"0.47291642",
"0.4721492",
"0.47164273",
"0.4708452",
"0.46952933",
"0.46825582",
"0.46712172",
"0.46687973",
"0.46667895",
"0.46646073",
"0.46580282",
"0.46524575",
"0.46509826",
"0.46468502",
"0.46464202",
"0.46430787",
"0.46395648",
"0.46344617",
"0.46309453",
"0.46308044",
"0.46207443",
"0.46168062",
"0.4610933",
"0.4602159",
"0.46001676",
"0.4599647",
"0.45902067",
"0.458721",
"0.45744893",
"0.45700735",
"0.45682275",
"0.45661026",
"0.4564187"
] |
0.5883278
|
9
|
Constructor that is both autovivified and nested.
|
def cascade(data=nil)
o = renew
o.nested!(true)
o.update!(data) if data
o
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize(first, parent = T.unsafe(nil)); end",
"def initialize(parent = T.unsafe(nil)); end",
"def initialize(first, second = T.unsafe(nil), parent = T.unsafe(nil)); end",
"def constructor; end",
"def initialize(obj); end",
"def initialize(constructor = {}, root = nil)\n @_delegate_hash = {}\n self.root = root || self \n constructor.each_with_object(self) do |(k,v),memo|\n memo[k] = v\n end\n self.default = OrderTreeNode.new(nil,self) if self.root\n _delegate_hash.default = self.default\n end",
"def initialize(attrs = {})\n if attrs.respond_to?(:with_indifferent_access)\n attrs = attrs.with_indifferent_access\n end\n @id = attrs.delete(:id)\n @_key = attrs.delete(:_key)\n @_value = attrs.delete(:_value)\n @_doc = attrs.delete(:_doc)\n @_meta = attrs.delete(:_meta)\n @_attributes = ::Hash.new do |h, k|\n default = self.class.attributes[k]\n h[k] = if default.respond_to?(:call)\n default.call\n else\n default\n end\n end\n update_attributes(@_doc || attrs)\n end",
"def initialize(id); end",
"def initialize(node, discount_repeated_attributes: T.unsafe(nil)); end",
"def initialize(path, relations = T.unsafe(nil)); end",
"def initialize(options = T.unsafe(nil), root = T.unsafe(nil), &block); end",
"def initialize(oid)\n @oid=oid\n @fields = Tree.new([])\n end",
"def initialize(specifications = T.unsafe(nil)); end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize\n\t\t\t@roots = {}\n\t\t\t@ordered = Array.new\n\t\tend",
"def initialize(parent); end",
"def initialize(opts = {}, &block)\n @parent = opts[:parent]\n @optional_attributes = []\n instance_eval(&block)\n end",
"def initialize(document, list = T.unsafe(nil)); end",
"def initialize(document, list = T.unsafe(nil)); end",
"def initialize(name, bindings, attributes, parent)\n\t\t\tself.cacheable = true unless @cacheable == false\n\t\t\tself.replaceable = false unless replaceable?\n\t\t\tself.fragment = false unless fragment?\n\t\t\t@creation_time = Time.now\n\t\t\t@parent = parent\n\t\t\t@session = parent ? parent.session : nil\n\n\t\t\tself.allow_docroot_caching = false if allow_docroot_caching?.nil?\n\n\t\t\t@subcomponents = {}\n\t\t\tsuper(name, bindings, attributes)\n\n\t\t\tawake()\n\t\tend",
"def initialize\n super()\n self.keys = List.new()\n self.values = List.new()\n end",
"def initialize (tree, parent = nil, id = \"\") # id - DEBUG\n @tree = tree\n @parent = parent\n @children = []\n @data = []\n @bounding_box = Rectangle.new(tree.dimension)\n @id = id # DEBUG\n end",
"def initialize() end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize(model = T.unsafe(nil)); end",
"def initialize(options = T.unsafe(nil)); end",
"def initialize(options = T.unsafe(nil)); end",
"def initialize(options = T.unsafe(nil)); end",
"def initialize(options = T.unsafe(nil)); end",
"def initialize(options = T.unsafe(nil)); end",
"def initialize(options = T.unsafe(nil)); end",
"def initialize(arry = [])\n @base = arry.collect{|el| el } # poor man's clone\n @tree_hash = run_layers\n end",
"def initialize(object)\n @price = Price.new\n @current_nesting_level = @price\n @object = object\n end",
"def initialize(x, *c)\t#No childs means empty array.\r\n\t\t@value = x\r\n\t\t@childs = c\r\n\tend",
"def initialize parent = nil\n self.parent = parent\n self.children_tree = {}\n end",
"def initialize(v, c=[])\n @value = v\n @children = c\n end",
"def initialize(params = {})\n params ||= {}\n params = params.try(:to_hash) || params if params.is_a?(self.class)\n self.dump(params)\n end",
"def initialize attr={}\n super\n self.attributes = attr\n end",
"def initialize tag_str, obj, namespace=nil\n Tag.clear_tag obj\n @vtag = tag_str.derive_tag\n obj.namespace = namespace\n @@classes_with_tags[[namespace, @vtag.revert_tag]] = obj # The specific class and the specific tag are the key to looking up the obj \n end",
"def initialize(*args)\n #This is a stub, used for indexing\n end",
"def initialize(*rest) end",
"def initialize()\n @childs = {}\n end",
"def initialize()\n @childs = {}\n end",
"def initialize(opts = {})\n @key = opts[:key]\n @operator = opts[:operator]\n @outer_op = opts[:outer_op] \n end",
"def initialize(v, c)\n @value = v\n @children = c\n end",
"def initialize\n super()\n @i_keys = List.new()\n @i_values = List.new()\n end",
"def initialize(id, key='')\n @_id = id\n @_key = key\n end",
"def initialize(tree = nil)\n # creates an undirected adjacency list graph\n @pathway = Bio::Pathway.new([], true)\n @root = nil\n @options = {}\n _init_cache\n self.concat(tree) if tree\n end",
"def initialize(hash=nil)\n @attributes = hash\n @attributes ||= {}\n end",
"def init_with(c)\n c.map.keys.each do|k|\n instance_variable_set(\"@#{k}\", c.map[k])\n end\n\n @table.keys.each do|k|\n new_ostruct_member(k)\n end\n end",
"def initialize()\n @root = Node.new(nil)\n end",
"def initialize\n @root = {}\n end",
"def initialize(k, v)\n\t\t\tsuper()\n\t\t\t@k = k\n\t\t\t@v = v\n\t\t\treturn\n\t\tend",
"def initialize\n\t\t\tsuper\n\t\t\t@rubier = Ruby2Ruby.new # used to convert hash AST representations to Hash object\n\t\t\t@relations = {}\n\t\t\t@polymorphics\n\t\t\t@as = {}\n\t\tend",
"def initialize(p, arg1 = 0, default = nil)\n super(p)\n if arg1.is_a?(::Array)\n arg1.each { |v| _check_assignment_value(v) }\n @data = arg1.dup\n elsif block_given?\n @data = ::Array.new(arg1) do\n _check_assignment_value(yield)\n end\n else\n @data = ::Array.new(arg1, _check_assignment_value(default))\n end\n\n # Ensure that the newly created object will be pushed into the database.\n @store.cache.cache_write(self)\n end",
"def construct\n end",
"def initialize(attrs={})\n self.update(attrs)\n @@identity_map[self.class] ||= {}\n @@identity_map[self.class][Marshal.dump(attrs)] = self\n end",
"def initialize(attrs = {})\n attrs.stringify_keys!\n @nodes = []\n super(attrs)\n end",
"def initialize(params={})\n name = init_collection_name params[:define_collection_name]\n @@_collection[self.class.name] ||= Schema.instance.get_collection(name)\n @id = params[:id] if params[:id]\n @__ref_value__ = '\"*\"'\n\n # @event_types = params[:event_types] ? params[:event_types] : []\n # @relation_kinds = params[:graphs] ? params[:graphs] : []\n\n @@_cache[self.class.name] ||= SimpleCacheRequest.new(ocollection)\n @@cache_store ||= SimpleCacheStore.instance\n end",
"def initialize(d: DEFAULT_D, capacity: DEFAULT_CAPA) # rubocop:disable Naming/MethodParameterName\n __init_without_kw__(d, capacity, false)\n end",
"def initialize(name, substring = T.unsafe(nil)); end",
"def initialize(document)\n @document, @parent = document, document._parent\n @insert_modifier, @delete_modifier =\"$push\", \"$pull\"\n end",
"def initialize parseable\n raise ArgumentError, 'nil parseable' if parseable.nil?\n @parseable = parseable\n\n # fixed offset to avoid collisions with @parseable objects\n @hash = @parseable.hash + hash_offset\n end",
"def initialize(key=nil, parent_cell=nil)\n @closed = false\n @processed = false\n @parent = parent_cell\n @parent.child = self if @parent\n @index = @@sequence += 1\n #puts \"creating node #{@index} with parent: #{@parent}\"\n add_cell(Cell.new(key)) if key\n end",
"def initialize(value)\n @value = value\n @children = Array.new(2)\n @parent = nil\n end",
"def initialize(hash={})\n self.attributes = hash\n end",
"def new()\n #This is a stub, used for indexing\n end",
"def initialize(elements = nil)\n super()\n (elements || {}).each_pair{ |key, value| self[key] = value }\n end",
"def initialize(attr = nil, &block)\n super\n end",
"def initialize(str)\n @doc = AbstractDoc.new(correct_input_for_legacy_interface(str))\n dup_associations_and_attributes\n map_associations\n map_attributes\n end",
"def initialize\n @type_variants = Container.new\n @extension_index = Container.new\n @data_version = VERSION.dup.freeze\n end",
"def initialize(*); end",
"def initialize\n @attributes = {}\n end",
"def initialize(value)\n\t\t@value = value\n\t\t@parent = nil\n\t\t@child_left = nil\n\t\t@child_right = nil\n\tend",
"def initialize (attrs = {})\n @attributes = {}\n @json_attributes = {}\n self.attributes = attrs\n end",
"def initialize(parent = {})\n @symbols = Trie.new\n is_runtime = (Runtime === parent)\n @parent = is_runtime ? {} : parent\n @runtime = is_runtime ? parent : parent.runtime\n end",
"def initialize(id) @id = id; end",
"def initialize(id) @id = id; end",
"def initialize(p)\n _initialize(p)\n end",
"def initialize(o_params)\n params = o_params.dup\n if params.is_a?(Hash)\n @name, @type = params.shift\n @doc = params.delete(:doc) if params.has_key?(:doc)\n @opts = params\n elsif params.is_a?(Array)\n @name = params.shift\n @type = params.shift\n @doc = params.shift\n @opts = params\n end\n end",
"def initialize\n self.compiled = false\n self.transforms_from = {}.with_indifferent_access\n self.transforms_to = {}.with_indifferent_access\n self.custom_serializers = {}.with_indifferent_access\n self.namespaces = {}.with_indifferent_access\n self.facets = {}.with_indifferent_access\n self.extensions = {}.with_indifferent_access\n end",
"def initialize(attrs={})\n from_hash(attrs)\n end",
"def initialize\n @left = @right = self\n @columns = {} # column_id object => Column\n @rows = {} # row_id object => Node\n end",
"def initialize **values\n # Just to do the type check...\n self.class.level_for! **values\n super **values\n end",
"def initialize(_kv_id, _pool_id)\n @kv_id = _kv_id\n @pool_id = _pool_id\n end",
"def initialize(value = nil) \n @value = value\n @parent = nil\n @left_child = nil\n @right_child = nil\n end",
"def initialize(children: [], parent: nil, **opts)\n # opts = { children: [], parent: nil }\n # opts.merge! args\n @depth = 0\n @parent = nil\n @children = []\n @properties = {}\n remove_parent\n self.parent = parent # opts.delete :parent\n add_children children # opts.delete :children\n add_properties opts\n end"
] |
[
"0.7136978",
"0.7051888",
"0.6514573",
"0.6300668",
"0.62334156",
"0.62200534",
"0.6213353",
"0.6191112",
"0.61839515",
"0.6147193",
"0.6139559",
"0.6137576",
"0.6078021",
"0.60666287",
"0.60666287",
"0.60666287",
"0.60666287",
"0.60666287",
"0.60464215",
"0.6040237",
"0.59628165",
"0.59304243",
"0.59304243",
"0.5905216",
"0.58924645",
"0.58830255",
"0.5874548",
"0.5868437",
"0.5868437",
"0.5868437",
"0.5868437",
"0.5868437",
"0.5868437",
"0.5868437",
"0.5868437",
"0.5868437",
"0.5868437",
"0.5868437",
"0.58381915",
"0.5836563",
"0.5836563",
"0.5836563",
"0.5836563",
"0.5836563",
"0.5836563",
"0.58351374",
"0.58199507",
"0.58055073",
"0.5792411",
"0.5785776",
"0.57738096",
"0.57727534",
"0.5771162",
"0.5770609",
"0.57702893",
"0.57694316",
"0.57694316",
"0.57636356",
"0.57622224",
"0.57563335",
"0.5749628",
"0.5748605",
"0.5742877",
"0.57411546",
"0.57295144",
"0.5724948",
"0.5717693",
"0.57076883",
"0.5705903",
"0.56994355",
"0.56834435",
"0.5678837",
"0.5678671",
"0.56739444",
"0.56732094",
"0.56712574",
"0.56681925",
"0.5662048",
"0.56555283",
"0.5654149",
"0.5653545",
"0.5650089",
"0.5647366",
"0.5641689",
"0.5640471",
"0.56389076",
"0.5638508",
"0.5637248",
"0.56363505",
"0.5630239",
"0.56300306",
"0.56300306",
"0.56256986",
"0.56245136",
"0.56193984",
"0.56085235",
"0.5602346",
"0.55981094",
"0.5597947",
"0.5594151",
"0.5590819"
] |
0.0
|
-1
|
Initialize new instance of OpenStruct.
|
def initialize(data=nil, &block)
@table = ::Hash.new(&block)
update!(data || {})
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize\n @config = OpenStruct.new\n end",
"def initialize(options) #:nodoc:\n self.config = OpenStruct.new(options)\n end",
"def initialize(config = {})\n @config = OpenStruct.new(config)\n validate_config!\n end",
"def initialize\n self.imap = OpenStruct.new\n self.smtp = OpenStruct.new\n self.service = OpenStruct.new\n self.application = OpenStruct.new\n end",
"def initialize(type, &block)\n @state = OpenStruct.new(type: type)\n\n self.instance_eval(&block) if block_given?\n end",
"def initialize(options = {})\n @options = OpenStruct.new(options)\n self.class.instance_eval do\n def_delegators :@options, *options.keys\n end\n end",
"def initialize(*contexts, **locals)\n @contexts = contexts.flatten\n\n # Local variables take precedence\n @contexts.unshift ::OpenStruct.new(**locals) if locals.any?\n end",
"def __class__\n OpenStruct2\n end",
"def t2(*args)\n OpenStruct.new\n end",
"def initialize()\n #path to openstudio library\n @lib_path = \"C:\\\\Program Files (x86)\\\\OpenStudio 1.2.0\\\\share\\\\openstudio\\\\OSApp\\\\hvaclibrary\\\\hvac_library.osm\"\n @library = BTAP::FileIO::load_osm(@lib_path, \"OpenStudio_Library\")\n end",
"def initialize() end",
"def initialize(has_fields_of_type=nil)\n super(NAME, {}, VapiStruct)\n\n self.has_fields_of_type = has_fields_of_type\n end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(o_params)\n params = o_params.dup\n if params.is_a?(Hash)\n @name, @type = params.shift\n @doc = params.delete(:doc) if params.has_key?(:doc)\n @opts = params\n elsif params.is_a?(Array)\n @name = params.shift\n @type = params.shift\n @doc = params.shift\n @opts = params\n end\n end",
"def initialize(obj); end",
"def create_eos(o = OpenStruct.new) \n class << (o)\n include EOS\n alias_method :_hash, :deep_inspect\n end unless o.respond_to? :deep_inspect\n o\n end",
"def initialize( *args )\n\t\t\t@data_version = 0\n\t\t\t@structure_version = 0\n\t\t\tsuper\n\t\tend",
"def initialize(resource)\n @attributes = OpenStruct.new(resource.attributes.to_hash)\n end",
"def initialize(name, properties, attributes, struct)\n @name = name\n @properties = properties\n @attributes = attributes\n @struct = struct\n end",
"def initialize(topts = {}, kopts = {}) #:yields: opts_struct\n @options = topts\n kopts.each_pair { |k, v| instance_variable_set(:\"@#{k}\", v) }\n\n return unless block_given?\n\n o = OpenStruct.new(@options)\n yield o\n @options = o.to_h\n end",
"def initialize(hash=nil)\n @table = HashWithIndifferentAccess.new\n\n for k,v in hash\n @table[k] = v\n new_ostruct_member(k)\n end if hash\n end",
"def initialize\n initialize!\n end",
"def initialize\n initialize!\n end",
"def initialize( confighash={} )\n\t\tihash = internify_keys( untaint_values(confighash) )\n\t\tmergedhash = DEFAULTS.merge( ihash, &HashMergeFunction )\n\n\t\t@struct = ConfigStruct.new( mergedhash )\n\t\t@create_time = Time.now\n\t\t@name = nil\n\t\t@loader = nil\n\n\t\tsuper()\n\tend",
"def initialize(oid)\n @oid=oid\n @fields = Tree.new([])\n end",
"def initialize(obj)\n if obj.is_a?(VfsRealFile::Stat)\n stat_init(obj)\n else\n hash_init(obj)\n end\n end",
"def use_openstruct(use_openstruct)\n @@use_openstruct = use_openstruct\n end",
"def initialize(name:, ctype:, parent_struct:, ruby_name: name, default: self.class.default, pointer: false,\n init: {}, ruby_read: true, ruby_write: false, store: self.class.store_default)\n check_init_args(name, parent_struct)\n basic_attributes(name: name, ruby_name: ruby_name, default: default, pointer: pointer, ctype: ctype)\n\n @parent_struct = parent_struct\n @init = init_class.new(**init.merge(parent_typemap: self))\n @ruby_read = ruby_read\n @ruby_write = ruby_write\n @store = store\n end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize\n init\n end",
"def initialize(name, table_oid, table_attr_num, oid, type_length, mod, format)\n @name = name\n @type = Datatype::Base.class_for(oid, mod)\n @table_oid = table_oid\n @table_attr_num = table_attr_num\n @oid = oid\n @type_length = type_length\n @mod = mod\n @format = format\n end",
"def build(base=nil, &block)\n struct = base || SparkleStruct.new\n struct.instance_exec(&block)\n @_struct = struct\n end",
"def initialize(doc=nil)\n\t\t@id=doc[:_id].to_s if !doc.nil?\n @location=Point.new(doc[:metadata][:location]) if !doc.nil?\n end",
"def initialize() # no file name if want to build model manually\n @reRefs = Hash.new(*[]) # references to the entity, hash keyed by entity\n @enums={}; @records = {}\n @ver = nil\n end",
"def initialize()\n end",
"def initialize\n super()\n @name = nil\n @type = nil\n @ref = nil\n @complexType = []\n end",
"def init\n raise NotImplementedError\n end",
"def initialize(ruby_values = nil, struct_value = nil)\n super(self.class.binding_type, ruby_values, struct_value)\n end",
"def initialize(ruby_values = nil, struct_value = nil)\n super(self.class.binding_type, ruby_values, struct_value)\n end",
"def initialize(ruby_values = nil, struct_value = nil)\n super(self.class.binding_type, ruby_values, struct_value)\n end",
"def initialize(ruby_values = nil, struct_value = nil)\n super(self.class.binding_type, ruby_values, struct_value)\n end",
"def initialize(ruby_values = nil, struct_value = nil)\n super(self.class.binding_type, ruby_values, struct_value)\n end",
"def initialize(ruby_values = nil, struct_value = nil)\n super(self.class.binding_type, ruby_values, struct_value)\n end",
"def initialize(ruby_values = nil, struct_value = nil)\n super(self.class.binding_type, ruby_values, struct_value)\n end",
"def initialize(ruby_values = nil, struct_value = nil)\n super(self.class.binding_type, ruby_values, struct_value)\n end",
"def initialize(ruby_values = nil, struct_value = nil)\n super(self.class.binding_type, ruby_values, struct_value)\n end",
"def initialize(ruby_values = nil, struct_value = nil)\n super(self.class.binding_type, ruby_values, struct_value)\n end",
"def initialize(ruby_values = nil, struct_value = nil)\n super(self.class.binding_type, ruby_values, struct_value)\n end",
"def initialize(ruby_values = nil, struct_value = nil)\n super(self.class.binding_type, ruby_values, struct_value)\n end",
"def initialize(ruby_values = nil, struct_value = nil)\n super(self.class.binding_type, ruby_values, struct_value)\n end",
"def initialize(ruby_values = nil, struct_value = nil)\n super(self.class.binding_type, ruby_values, struct_value)\n end",
"def initialize(ruby_values = nil, struct_value = nil)\n super(self.class.binding_type, ruby_values, struct_value)\n end",
"def initialize(ruby_values = nil, struct_value = nil)\n super(self.class.binding_type, ruby_values, struct_value)\n end",
"def initialize(ruby_values = nil, struct_value = nil)\n super(self.class.binding_type, ruby_values, struct_value)\n end",
"def initialize(ruby_values = nil, struct_value = nil)\n super(self.class.binding_type, ruby_values, struct_value)\n end",
"def initialize(ruby_values = nil, struct_value = nil)\n super(self.class.binding_type, ruby_values, struct_value)\n end",
"def initialize(ruby_values = nil, struct_value = nil)\n super(self.class.binding_type, ruby_values, struct_value)\n end",
"def initialize(ruby_values = nil, struct_value = nil)\n super(self.class.binding_type, ruby_values, struct_value)\n end",
"def initialize(ruby_values = nil, struct_value = nil)\n super(self.class.binding_type, ruby_values, struct_value)\n end",
"def initialize(ruby_values = nil, struct_value = nil)\n super(self.class.binding_type, ruby_values, struct_value)\n end",
"def initialize(ruby_values = nil, struct_value = nil)\n super(self.class.binding_type, ruby_values, struct_value)\n end",
"def initialize(ruby_values = nil, struct_value = nil)\n super(self.class.binding_type, ruby_values, struct_value)\n end",
"def initialize(ruby_values = nil, struct_value = nil)\n super(self.class.binding_type, ruby_values, struct_value)\n end",
"def initialize(ruby_values = nil, struct_value = nil)\n super(self.class.binding_type, ruby_values, struct_value)\n end",
"def initialize(ruby_values = nil, struct_value = nil)\n super(self.class.binding_type, ruby_values, struct_value)\n end",
"def initialize(ruby_values = nil, struct_value = nil)\n super(self.class.binding_type, ruby_values, struct_value)\n end",
"def initialize(ruby_values = nil, struct_value = nil)\n super(self.class.binding_type, ruby_values, struct_value)\n end",
"def initialize(ruby_values = nil, struct_value = nil)\n super(self.class.binding_type, ruby_values, struct_value)\n end",
"def initialize(ruby_values = nil, struct_value = nil)\n super(self.class.binding_type, ruby_values, struct_value)\n end",
"def initialize(ruby_values = nil, struct_value = nil)\n super(self.class.binding_type, ruby_values, struct_value)\n end",
"def initialize(ruby_values = nil, struct_value = nil)\n super(self.class.binding_type, ruby_values, struct_value)\n end",
"def initialize(ruby_values = nil, struct_value = nil)\n super(self.class.binding_type, ruby_values, struct_value)\n end",
"def initialize(ruby_values = nil, struct_value = nil)\n super(self.class.binding_type, ruby_values, struct_value)\n end",
"def initialize(ruby_values = nil, struct_value = nil)\n super(self.class.binding_type, ruby_values, struct_value)\n end",
"def init\n end",
"def init\n end",
"def init\n end",
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def initialize(*args)\n if !args.empty? #Got a pointer, want to wrap it\n super\n else\n s = super()\n s[:next_in] = nil\n s[:avail_in] = 0\n s[:total_in] = 0\n s[:next_out] = nil\n s[:avail_out] = 0\n s[:total_out] = 0\n s[:lzma_allocator] = nil\n s[:lzma_internal] = nil\n s[:reserved_ptr1] = nil\n s[:reserved_ptr2] = nil\n s[:reserved_ptr3] = nil\n s[:reserved_ptr4] = nil\n s[:reserved_int1] = 0\n s[:reserved_int2] = 0\n s[:reserved_int3] = 0\n s[:reserved_int4] = 0\n s[:reserved_enum1] = LibLZMA::LZMA_RESERVED_ENUM[:lzma_reserved_enum]\n s[:reserved_enum2] = LibLZMA::LZMA_RESERVED_ENUM[:lzma_reserved_enum]\n s\n end\n end",
"def initialize()\n @metadata = Hash.new()\n return self\n end",
"def initialize(door_hash)\n @door_hash = door_hash\n @inscription = door_hash[:inscription].freeze\n @open_status = door_hash[:open_status]\n @unlocked_status = door_hash[:unlocked_status]\n end",
"def structs\n @__structs__ ||= Structs.new(registry, struct_namespace)\n end",
"def initialize(ruby_values = nil, struct_value = nil)\n super(self.class.binding_type, ruby_values, struct_value)\n end",
"def initialize(ruby_values = nil, struct_value = nil)\n super(self.class.binding_type, ruby_values, struct_value)\n end"
] |
[
"0.77727705",
"0.7448098",
"0.7066031",
"0.69336003",
"0.6808831",
"0.643302",
"0.6394118",
"0.6372422",
"0.6326319",
"0.628851",
"0.6271874",
"0.6200422",
"0.6199778",
"0.6199778",
"0.6199778",
"0.6199778",
"0.6199778",
"0.6175419",
"0.61645967",
"0.6152196",
"0.6128472",
"0.612755",
"0.60816646",
"0.60546404",
"0.5964576",
"0.5963827",
"0.5963827",
"0.59344643",
"0.5925151",
"0.5883243",
"0.58817047",
"0.58614606",
"0.586122",
"0.586122",
"0.586122",
"0.586122",
"0.586122",
"0.586122",
"0.586122",
"0.586122",
"0.586122",
"0.586122",
"0.586122",
"0.5854759",
"0.58421755",
"0.58381516",
"0.5816776",
"0.58145565",
"0.58120716",
"0.58040136",
"0.5801554",
"0.57603127",
"0.57603127",
"0.57603127",
"0.57603127",
"0.57603127",
"0.57603127",
"0.57603127",
"0.57603127",
"0.57603127",
"0.57603127",
"0.57603127",
"0.57603127",
"0.57603127",
"0.57603127",
"0.57603127",
"0.57603127",
"0.57603127",
"0.57603127",
"0.57603127",
"0.57603127",
"0.57603127",
"0.57603127",
"0.57603127",
"0.57603127",
"0.57603127",
"0.57603127",
"0.57603127",
"0.57603127",
"0.57603127",
"0.57603127",
"0.57603127",
"0.57603127",
"0.57603127",
"0.57603127",
"0.57603127",
"0.57603127",
"0.57603127",
"0.57571286",
"0.57571286",
"0.57571286",
"0.5744002",
"0.5744002",
"0.5744002",
"0.5744002",
"0.57357",
"0.57277775",
"0.5727567",
"0.5727405",
"0.5724186",
"0.5724186"
] |
0.0
|
-1
|
Because there is no means of getting the class via a BasicObject instance, we define such a method manually.
|
def __class__
OpenStruct2
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def class\n __getobj__.class\n end",
"def class_obj\n self.class\n end",
"def get_class()\n l = get_type()\n #puts \"Type #{l.class} in #{self.class} , #{self}\"\n l.object_class()\n end",
"def get_class()\n l = get_type()\n #puts \"Type #{l.class} in #{self.class} , #{self}\"\n l.object_class()\n end",
"def can_get_class?(klass); true; end",
"def __class__\n Rubinius.primitive :object_class\n raise PrimitiveFailure, \"Kernel#class primitive failed.\"\n end",
"def class\n @object.class\n end",
"def object_class\n self.class.object_class\n end",
"def class\n object.class\n end",
"def object_class\n @object_class\n end",
"def klass\n object_name.classify.constantize\n end",
"def object_class(klass)\n @object_classes[klass.to_s.tr('-', '_').downcase]\n end",
"def class; end",
"def class; end",
"def class_for(code_object)\n class_name = code_object.class.to_s.split('::').last\n const_get(class_name)\n end",
"def get_class(name)\n # 'self' -- the class from which get_class is called.\n self.const_get(name)\n end",
"def klass\n @object.name if (defined? @object.class.name)\n end",
"def object_class object_type\n object_type.classify.constantize\n end",
"def resolve_class object\n ::Class === object ? object : (::String === object ? (class_for_name object) : nil)\n end",
"def klass; end",
"def klass; end",
"def klass; end",
"def klass; end",
"def klass; end",
"def klass; end",
"def klass; end",
"def klass; end",
"def class_name\n self.class == Class ? self.name : self.class.name\n end",
"def class\n `$q(this.__native__.className)`\n end",
"def class() end",
"def type_klass; end",
"def know_it_all(object)\n object.class\nend",
"def get_class(class_name)\n Module.const_get(class_name)\n rescue\n nil\n end",
"def classes\n [self]\n end",
"def class_name; end",
"def class_name; end",
"def class_for assoc_name\n raise NotImplementedError\n end",
"def class_for assoc_name\n raise NotImplementedError\n end",
"def base_class; end",
"def className\r\n self.class.to_s\r\n end",
"def class_by_name name\n # http://stackoverflow.com/questions/14070369/how-to-instantiate-class-from-name-string-in-rails\n Object.const_get name.to_s\n\n end",
"def _class\n special_attribute('@class'.freeze) || self.class.name.demodulize\n end",
"def class_name\n self.class.to_s\n end",
"def class_name\n self.class.to_s\n end",
"def object_class\n self.class.to_s[/\\A([^:]+)/, 1].singularize.constantize\n rescue\n raise \"Could not determine form class from #{self.class}.\"\n end",
"def klass\n reflection.klass\n end",
"def klass\n reflection.klass\n end",
"def get_object\n class_name = self.target_type.classify\n klass = Object.const_get(class_name)\n return klass.find(self.target_id)\n end",
"def klass\n self.class\n end",
"def current_class( class_code )\n self.classes.select{|c| c.class_code == class_code }.first\n end",
"def type_klass=(_arg0); end",
"def get_class(cname, mdl = Processor)\n mdl.const_get(cname.split(/[\\,\\_]/).map { |p| p.capitalize }.join)\n rescue NameError\n return nil\n end",
"def class_info?; \"#{self.class.name}\" end",
"def class_constant; end",
"def class_constant; end",
"def getRubyClass\n @ruby_class\n end",
"def class_get class_name\n\t\t\t\t@monitor.synchronize do\n\t\t\t\t\tproviders.each do |p|\n\t\t\t\t\t\tbegin\n\t\t\t\t\t\t\treturn p.class_get(class_name) \n\t\t\t\t\t\trescue NotExist;\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\traise \"Class '#{class_name}' doesn't exist!\"\n\t\t\t\tend\n\t\t\tend",
"def get_true_class(obj)\n return obj.true_class\n end",
"def required_class; end",
"def clazz\n Module.const_get(name)\n rescue NameError\n nil\n end",
"def get_class(class_name)\n klass = Module.const_get(class_name)\n return nil unless klass.is_a?(Class)\n return klass\n rescue NameError\n return nil\n end",
"def object_class(explicit_object)\n logger.warn \"##{__method__} is deprecated\"\n explicit_object.is_a?(Symbol) ? explicit_object.to_s.camelize.constantize : explicit_object.class\n @object.respond_to?(field) ? @object.send(field) : ''\n end",
"def class_for(cls)\n return nil unless cls # superclass will return nil when none\n fqn = cls.qualified_type_name\n return classes[fqn] if classes[fqn]\n classes[fqn] = JClass.parse(self, cls)\n end",
"def class\n @cx.class\n end",
"def getKlass #:doc:\n @Klass = self.controller_name.classify.constantize\n @Klass\n end",
"def pearified_classname\n self\n end",
"def target_class\n # Need to do a little bit of work here as Module.const_get doesn't work\n # with nested class names, i.e. JIRA::Resource::Foo.\n #\n # So create a method chain from the class components. This code will\n # unroll to:\n # Module.const_get('JIRA').const_get('Resource').const_get('Foo')\n #\n target_class_name = self.class.name.sub(/Factory$/, '')\n class_components = target_class_name.split('::')\n\n class_components.inject(Module) do |mod, const_name|\n mod.const_get(const_name)\n end\n end",
"def return_classname(obj)\r\n obj.class.name.underscore\r\n end",
"def className\r\n\t\tself.class.to_s\r\n\tend",
"def to_class\n\t\tObject.const_get(self)\n\t\t#ret = eval(self)\n\t\t#deb \"this is a class? cls=#{ret.class}\"\n\t\t#raise \"Exception its not a class!\" if ret.class.to_s != 'Class'\n\t\t#return ret\n\tend",
"def className\n\t\tself.class.to_s\n\tend",
"def className\n\t\tself.class.to_s\n\tend",
"def klass\n info.klass\n end",
"def class_moniker\n self.class.moniker\n end",
"def instance_type; end",
"def get_class_ref(class_name)\n klass = Kernel\n class_name.split(\"::\").each do |name|\n if klass.const_defined? name\n klass = klass.const_get(name)\n else\n return nil\n end\n end\n klass\n end",
"def metaclass\n class << self; self; end;\n end",
"def object_class(opts)\n return unless opts[:class]\n opts[:class].is_a?(String) ? opts[:class].constantize : opts[:class]\n end",
"def alternate_again\n @class\n end",
"def class_name\n name = @klass.name\n name.name\n end",
"def klass\n @klass ||= compute_class(class_name)\n end",
"def klass\n @klass ||= compute_class(class_name)\n end",
"def klass\n @klass ||= compute_class(class_name)\n end",
"def klass\n class_name = self[\"_type\"]\n class_name ? class_name.constantize : nil\n end",
"def get_class(token)\n if @subroutine.key?(token.val)\n @subroutine[token.val].get_class\n else\n @class[token.val].get_class\n end\n end",
"def lookup_class\r\n ObjectSpace.each_object(Class) do |obj|\r\n return obj if obj.ancestors.include?(Rails::Generator::Base) and\r\n obj.name.split('::').last == class_name\r\n end\r\n raise NameError, \"Missing #{class_name} class in #{class_file}\"\r\n end",
"def klass\n @klass ||= begin\n @klass_name.split('::').inject(Object){|n,i| n.const_get(i)}\n rescue NameError => e\n end\n end",
"def BaseClass(name)\n name == \"string\" ? String : Object\nend",
"def BaseClass(name)\n name == \"string\" ? String : Object\nend",
"def klass\n raise NotImplementedError\n end",
"def get_classes( obj )\n cls = obj.class\n print cls.to_s\n while cls.superclass != nil\n cls = cls.superclass\n print ' < ' + cls.to_s\n end\nend",
"def determine_class_name\n clazz = class_for_target\n\n name = clazz.name\n name = clazz.superclass.name if name.nil? || name == ''\n name = ANONYMOUS_CLASS if name.nil? || name == OBJECT_CLASS_NAME\n name\n end",
"def metaclass\n class << self; self end\n end",
"def class=(_arg0); end",
"def method_missing(sym, *args, &block)\n return @klass_hash[sym.to_s]\n end",
"def get_as_class_name obj\n # Get class name\n if obj.is_a?(String)\n ruby_class_name = obj\n elsif obj.is_a?(RocketAMF::Values::TypedHash)\n ruby_class_name = obj.type\n elsif obj.is_a?(Hash)\n return nil\n elsif obj.is_a?(RubyAMF::IntermediateObject)\n ruby_class_name = obj.object.class.name\n else\n ruby_class_name = obj.class.name\n end\n\n # Get AS class name\n as_class_name = @mappings.get_as_class_name ruby_class_name\n\n # Auto-map if necessary, removing namespacing to create mapped class name\n if RubyAMF.configuration.auto_class_mapping && ruby_class_name && as_class_name.nil?\n as_class_name = ruby_class_name.split('::').pop\n @mappings.map :as => as_class_name, :ruby => ruby_class_name\n end\n\n as_class_name\n end",
"def opened_class\nend",
"def get_class_by_type_and_object(type, object)\n if @configuration['types'][type] && klass = @configuration['types'][type][object]\n return get_const_by_name(klass)\n else\n Log.logger_for(:configuration).error(\"No class configuration defined for #{object} and type #{type}\")\n end\n return nil\n end",
"def get_class(name)\n name.split(/::/).inject(Object) { |p, n| p.const_get(n) } \n end",
"def klass(class_name)\n Atlas.const_get(class_name)\n end",
"def metametaclass; self.metaclass.metaclass; end"
] |
[
"0.77118284",
"0.7624681",
"0.7577401",
"0.7577401",
"0.7458778",
"0.7400929",
"0.72558385",
"0.72464436",
"0.7238084",
"0.7238003",
"0.7204249",
"0.7145265",
"0.71246356",
"0.71246356",
"0.70946574",
"0.7038387",
"0.7014537",
"0.6958605",
"0.6938018",
"0.6925835",
"0.6925835",
"0.6925835",
"0.6925835",
"0.6925835",
"0.6925835",
"0.69255906",
"0.69255906",
"0.69193226",
"0.68812174",
"0.6787733",
"0.6777692",
"0.6777067",
"0.6773216",
"0.67731047",
"0.6768446",
"0.6768446",
"0.6715097",
"0.6715097",
"0.6705916",
"0.6679279",
"0.66524136",
"0.6650965",
"0.66477185",
"0.66477185",
"0.66422",
"0.66402394",
"0.66402394",
"0.6628357",
"0.662679",
"0.6624779",
"0.6620017",
"0.6617859",
"0.65634835",
"0.65526766",
"0.65526766",
"0.6543767",
"0.6540205",
"0.6536325",
"0.65251464",
"0.65224296",
"0.65162987",
"0.65080255",
"0.65032375",
"0.6498405",
"0.64934397",
"0.64790463",
"0.64713407",
"0.64686525",
"0.64659464",
"0.6460307",
"0.64585143",
"0.64585143",
"0.6445076",
"0.64435357",
"0.6432222",
"0.64289564",
"0.6424837",
"0.6421697",
"0.64181685",
"0.6417987",
"0.6409479",
"0.6409479",
"0.6409479",
"0.64060605",
"0.6405961",
"0.6396158",
"0.6390853",
"0.63840675",
"0.63840675",
"0.6381065",
"0.6355644",
"0.634644",
"0.6346314",
"0.63436985",
"0.6330654",
"0.6317346",
"0.63143164",
"0.6311308",
"0.63103473",
"0.63088995",
"0.6298121"
] |
0.0
|
-1
|
Duplicate underlying table when OpenStruct is duplicated or cloned.
|
def initialize_copy(original)
super
@table = @table.dup
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize_copy(orig)\n super\n @__table__ = @__table__.dup\n end",
"def initialize_copy(orig)\n super\n @table = @table.dup\n end",
"def _clone(*_)\n new_inst = _klass_new(_fn_name, *_fn_args)\n new_inst._data.replace(__hashish[\n @table.map { |_key, _value|\n if _key.is_a?(::AttributeStruct)\n _key = _key._clone\n else\n _key = _do_dup(_key)\n end\n if _value.is_a?(::AttributeStruct)\n _value = _value._clone\n else\n _value = _do_dup(_value)\n end\n [_key, _value]\n }\n ])\n new_inst\n end",
"def dup\n other = super\n %w{tables table_alias unique_alias where tables key_value_tables}.each do |k|\n other.send(\"#{k}=\", other.send(k).dup)\n end\n other\n end",
"def deep_dup; end",
"def duplicate\n dup.tap do |c|\n c.page = nil\n columns.each do |column|\n c.columns << column.duplicate\n end\n pictures.each do |picture|\n c.pictures << picture.duplicate\n end\n end\n end",
"def copy \n t = @tab.clone ;\n for i in 0..3\n t[i] = t[i].clone\n end\n Table.new(t) ;\n end",
"def copy\n result = HashTablet.new(@table.size)\n each {|element| result.insert(element) }\n return result\n end",
"def dup\n\n # duplicate self\n rta = super\n\n # iterate through array and dup each hash\n rta.each_with_index do |w_hash, index|\n\n # dup the hash at this index\n rta[index] = w_hash.dup\n\n # to be complete, also dup the key/values in the hash, in case another hash/array is nested\n w_hash.each_pair do |k, v|\n rta[index][k] = v.dup if v.is_a? Hash\n end\n end\n\n # now everything should have new object_id's\n rta\n end",
"def deep_dup\n puts \"warning: #{self.class}: deep_dup not implement\"\n end",
"def columns; self.class.columns.dup; end",
"def deep_dup\n Marshal.load(Marshal.dump(self))\n end",
"def clone\n t = self\n c = super\n c.delete_all\n t.each { |r| c << r.clone }\n c.header = c[header_row_index] if header_row_index\n c\n end",
"def copy_rows( field, \n table_struct, \n src_table_name = TABLE_NAME, \n dest_table_name = NEW_TABLE_NAME, \n num_rows = ROWS_PER_TRANSACTION)\n rows = grab_rows(field, src_table_name, num_rows)\n keys_for_delete = insert_rows(rows, field, table_struct, dest_table_name)\n keys_for_delete\nend",
"def dup\n duped_rows = rows.map(&:dup)\n self.class.new(duped_rows)\n end",
"def deep_dup\n new_board = Board.new(false)\n self.grid.each.with_index do |row, idx1|\n row.each.with_index do |cell, idx2|\n if self.grid[idx1][idx2].nil?\n next\n else\n new_board.grid[idx1][idx2] = self.grid[idx1][idx2].dup\n new_board.grid[idx1][idx2].board = new_board\n end\n end\n end\n new_board\n end",
"def dup\n Ably::Models::IdiomaticRubyWrapper.new(attributes.dup, stop_at: stop_at.keys)\n end",
"def deep_dup\n dup\n end",
"def hash_dup\n save\n end",
"def deep_dup\n # noinspection RubyMismatchedReturnType\n dup\n end",
"def deep_clone; end",
"def clone\r\n attrs = self.attributes_before_type_cast\r\n self.class.primary_keys.each {|key| attrs.delete(key.to_s)}\r\n self.class.new do |record|\r\n record.send :instance_variable_set, '@attributes', attrs\r\n end\r\n end",
"def to_h\n @table.dup\n end",
"def try_dup\n self.dup\n end",
"def rebuild(table); end",
"def dup\n new_board = Board.new\n @rows.each_with_index do |row, row_idx|\n row.each_with_index do |pos, col_idx|\n new_pos, new_piece_type, color = [row_idx, col_idx], pos.class, pos.color\n new_board[new_pos] = new_piece_type.new(color, new_board, new_pos) unless pos.is_a?(NullPiece)\n new_board[new_pos] = new_piece_type.instance if pos.is_a?(NullPiece)\n end\n end \n new_board\n end",
"def copy_new_rows\n tables.each(&:copy_new_rows)\n end",
"def composite_clone\n if composite? \n attrs = self.attributes_before_type_cast\n self.class.new do |record|\n record.send :instance_variable_set, '@attributes', attrs\n end \n else\n clone\n end \n end",
"def clone(opts = OPTS)\n c = super(:freeze=>false)\n c.opts.merge!(opts)\n unless opts.each_key{|o| break if COLUMN_CHANGE_OPTS.include?(o)}\n c.clear_columns_cache\n end\n c.freeze if frozen?\n c\n end",
"def dup\n self.class.new(\n self.class.attributes.keys.each_with_object({}) do |k, result|\n val = send(k)\n next if val.nil? || (val.respond_to?(:empty?) && val.empty?)\n\n result[k] = val.is_a?(Array) ? val.map(&:dup) : val.dup\n end\n )\n end",
"def replace(tbl2)\n raise TypeError, \"a Tb expected but #{tbl2.inspect}\" unless Tb === tbl2\n @next_recordid = tbl2.instance_variable_get(:@next_recordid)\n @recordid2index = tbl2.instance_variable_get(:@recordid2index).dup\n @free_index = tbl2.instance_variable_get(:@free_index).dup\n @tbl = Hash[tbl2.instance_variable_get(:@tbl).map {|k, v| [k, v.dup] }]\n @field_list = tbl2.instance_variable_get(:@field_list).dup\n end",
"def initialize_copy(other)\n @series = other.series.dup\n @table = other.table.dup\n super(other)\n end",
"def deep_copy\n field_copy = self.dup\n field_copy.save!\n field_copy\n end",
"def deep_dup\n duplicable? ? dup : self\n end",
"def deep_dup\n duplicable? ? dup : self\n end",
"def dup\n clone = super\n clone.name = \"Clone of #{self.name}\"\n clone.institution_default = false\n # The instance requires an ID for MetadataProfileElement validations.\n clone.save!\n self.elements.each { |e| clone.elements << e.dup }\n clone\n end",
"def clone; end",
"def clone; end",
"def clone; end",
"def ==(other)\n return false unless other.kind_of?(OpenStruct)\n @table == other.table\n end",
"def dup\n Tableau.new @hidden_cards, @cards\n end",
"def clone_head; end",
"def clone\n attr = Hash.new\n\n self.attribute_names.each do |name|\n begin\n attr[name] = read_attribute(name).clone\n rescue TypeError\n attr[name] = read_attribute(name)\n end\n end\n\n cloned_record = self.class.new(attr)\n cloned_record.instance_variable_set \"@new_record\", true\n cloned_record.id = nil\n cloned_record\n end",
"def clone_versioned_model(orig_model, new_model)\n self.class.versioned_columns.each do |col|\n new_model[col.name] = orig_model.send(col.name) if orig_model.has_attribute?(col.name)\n end\n\n clone_inheritance_column(orig_model, new_model)\n end",
"def clone\n copy = super\n transaction do\n copy.save!\n\n %w[\n registration_information support information_source advance_directive\n ].each do |assoc|\n copy.send(\"#{assoc}\\=\", send(assoc).clone) if send(assoc)\n end\n\n %w[\n patient_identifiers languages providers medications allergies conditions\n all_results immunizations encounters procedures medical_equipments social_history insurance_providers\n ].each do |assoc|\n send(assoc).each do |item|\n copy.send(assoc) << item.clone\n end\n end\n\n end\n copy\n end",
"def duplicate()\n bug( \"you must override duplicate()\" )\n end",
"def duplicate\n @copy = self.deep_clone :no_duplicates => true, :never_clone => [:uuid, :updated_at,:created_at]\n @copy.static_page = self.static_page.duplicate\n self.sub_pages.each do |page| \n copy_of_page = page.duplicate\n @copy.sub_pages << copy_of_page\n copy_of_page.save\n end\n @copy.save\n @copy\n end",
"def ==(other)\n return false unless(other.kind_of?(OpenStruct))\n return @__table__ == other.table\n end",
"def clone() end",
"def clone\n self.class.new(@attributes.except(:_id).except(:versions).dup)\n end",
"def dup\n HashWithIndifferentAccess.new(self)\n end",
"def dup_for_reference\n dup.tap do |r|\n r.created_at = self.created_at\n # r.id = nil # done by dup\n # r.instance_variable_set(\"@association_cache\", self.instance_variable_get(:association_cache))\n end\n end",
"def duplicate_embedded(source) #:nodoc:\r\n dest = {}\r\n source.each do |attribute_name, value|\r\n next if attribute_name == '_id' # don't duplicate _id\r\n\r\n if value.class == Array\r\n dest[attribute_name] = []\r\n value.each do |ar|\r\n dest[attribute_name] << duplicate_embedded(ar)\r\n end\r\n else\r\n # if duplicate, string dup is added. For unique fields\r\n add_duplicate = params['dup_fields'].to_s.match(attribute_name + ',')\r\n dest[attribute_name] = value\r\n dest[attribute_name] << ' dup' if add_duplicate\r\n end\r\n end\r\n dest['created_at'] = Time.now if dest['created_at']\r\n dest['updated_at'] = Time.now if dest['updated_at']\r\n dest\r\nend",
"def clone\n newobj = Marshal.load(Marshal.dump(self))\n props = newobj.instance_variable_get(:@props)\n props[:id] = Engine.instance.db.getid\n put_object(newobj)\n newobj\n rescue\n log.error \"Clone failed\"\n nil\n end",
"def deep_dup\n inject(self.class.new) do |new_hash, (key, value)|\n key = key.respond_to?(:deep_dup) ? key.deep_dup : key.dup?\n value = value.respond_to?(:deep_dup) ? value.deep_dup : value.dup?\n new_hash[key] = value\n new_hash\n end\n end",
"def dup\n Marshal::load(Marshal.dump(self))\n end",
"def dup\n self.class.new(to_hash)\n end",
"def eql?(other)\n return false unless other.kind_of?(OpenStruct)\n @table.eql?(other.table)\n end",
"def dup( )\n\t\t\tMarshal.load(Marshal.dump(self))\n\t\tend",
"def clone\n Marshal.load(Marshal.dump self)\n end",
"def dup\n ret = self.class.new\n fields.each do |tag, field|\n val = self.__send__(field.name)\n ret.__send__(\"#{field.name}=\", val)\n end\n return ret\n end",
"def test_dup\n assert_raises(TypeError) do\n @mmap.dup\n end\n end",
"def dup\n Data.new( sheet, @data.map(&:dup) )\n end",
"def dup\n duplicate = ManyValues.new(@details, @attribute)\n duplicate.values = self.values.map { |v| v.dup }\n duplicate\n end",
"def dup\n new_address = super\n new_address.instance_variable_set(:@created_at, nil)\n new_address.send(:update_timestamps)\n new_address\n end",
"def deep_dup\n new_board = Board.new(false)\n\n grid.flatten.compact.each do |piece|\n new_board[piece.pos.dup] =\n Piece.new(piece.pos.dup, new_board, piece.color)\n end\n\n new_board\n end",
"def clone\n end",
"def clone\n @clone = true\n end",
"def copy\n DataFrame.new(@rows.copy, rownames: @rownames.copy, colnames: @colnames.copy)\n end",
"def deep_clone; Marshal::load(Marshal.dump(self)); end",
"def dup\n GameBoard.build(row_size,column_size) {|r,c| self[r,c]}\n end",
"def deep_dup\n duped_board = []\n @board.each_with_index do |row, row_ind|\n duped_board << []\n\n row.each_with_index do |piece, column_ind|\n if piece.nil?\n duped_board[row_ind][column_ind] = nil\n next\n end\n\n new_piece = piece.dup\n duped_board[row_ind][column_ind] = new_piece\n new_piece.position = new_piece.position.dup\n end\n end\n self.class.new(duped_board)\n end",
"def dup\n clone\n end",
"def dup; return self.class.new(RAtlas::dup(@storage)); end",
"def initialize_copy(other)\n super\n @values = Hash[@values]\n @changed_columns = @changed_columns.dup if @changed_columns\n @errors = @errors.dup if @errors\n @this = @this.dup if @this\n self\n end",
"def dup_for_reference\n dup.tap do |r|\n r.created_at = self.created_at\n r.instance_variable_set(\"@association_cache\", self.association_cache)\n end\n end",
"def clone\n end",
"def clone\n end",
"def clone\n end",
"def dup\n empty_board = Board.new(false)\n pieces.each do |piece|\n temp_color = (piece.color == :red) ? :red : :white\n temp_pos = [piece.pos[0], piece.pos[1]]\n temp_kinged = piece.kinged\n temp_piece = Piece.new(empty_board, temp_color, temp_pos, temp_kinged)\n\n # empty_board.add_piece(Piece.new(empty_board, temp_color, temp_pos, temp_kinged), temp_pos)\n end\n\n empty_board\n # duped_rows = rows.map(&:dup)\n #\n # duped_rows.each_with_index do |row, row_idx|\n # row.each_index do |col_idx|\n # next if duped_rows[row_idx].nil?\n # current_cell = duped_rows[row_idx][col_idx]\n #\n # next if current_cell.nil?\n # duped_rows[row_idx][col_idx] = current_cell.dup\n # end\n # end\n # duped_board = self.class.new(duped_rows, false)\n # duped_board.pieces.each do |piece|\n # piece.board = duped_board\n # end\n # duped_board\n\n end",
"def store!(key, value)\n if @nested && Hash === value # value.respond_to?(:to_hash)\n value = OpenStruct2.new(value)\n end\n\n #new_ostruct_member(key) # this is here only for speed bump\n\n @table[key.to_sym] = value\n end",
"def initialize_copy(other)\n super\n @values = Hash[@values]\n @changed_columns = @changed_columns.dup if @changed_columns\n @errors = @errors.dup if @errors\n self\n end",
"def dup\n d = super()\n d.send(:initialize, rows, cols)\n _memcpy(d.gsl, @gsl)\n d\n end",
"def clone\n super\n end",
"def clone\n\t\t\tCData.new self\n\t\tend",
"def initialize_dup( * ) # :nodoc:\n\t\t@hash = deep_copy( @hash )\n\tend",
"def initialize_copy(c)\n @db = c.db\n @opts = Hash[c.opts]\n if cols = c.cache_get(:_columns)\n @cache = {:_columns=>cols}\n else\n @cache = {}\n end\n end",
"def clone_deep\n c = self.clone :include => collection_details\n c.updated_at = nil\n c.created_at = nil\n self.collection_details.each do |detail|\n c.send(detail).each do |d|\n d.created_at = nil\n d.updated_at = nil\n d.person_id = nil\n end\n end\n c\n end",
"def clone\n dup\n end",
"def unlocked_copy\n copy_ = Structure.new\n @indexes.each{ |ai_| copy_.add(ai_.axis_object, ai_.axis_name) }\n copy_\n end",
"def dup\n raise NotImplementedError.new(\"Method 'dup' not implemented by '#{self.class.name}'\")\n end",
"def initialize_copy(other)\n @cells = {}\n other.cells.each do |k, cell|\n @cells[k] = cell.dup\n end\n super(other)\n end",
"def dup\n h = super\n h.fields = @fields.dup\n h.mbox_from = @mbox_from\n h\n end",
"def _deep_copy(value)\n case value\n when Module then value\n when NestedOpenStructWithHashAccess then value.class.new(value.nested_class, value.to_h.deep_transform_values(&method(:_deep_copy)))\n when OpenStruct then value.class.new(value.to_h.deep_transform_values(&method(:_deep_copy)))\n else\n value.dup\n end\n end",
"def dup\n other = EncodingContext.new(@options)\n t = @table\n l = @limit\n other.instance_eval do\n @table = t.dup # shallow copy\n @limit = l\n end\n other\n end",
"def rebind(coordination_model)\n dup\n end",
"def dup \n Daru::Vector.new @data.dup, name: @name, index: @index.dup\n end",
"def clone\n super\n end",
"def duplicate_embedded(source) #:nodoc:\r\n# TODO Works for two embedded levels. Dies with third and more levels.\r\n dest = {}\r\n source.each do |attribute_name, value|\r\n next if attribute_name == '_id' # don't duplicate _id\r\n if value.class == Array\r\n dest[attribute_name] = []\r\n value.each do |ar|\r\n dest[attribute_name] << duplicate_embedded(ar)\r\n end\r\n else \r\n# if duplicate string must be added. Useful for unique attributes\r\n add_duplicate = params['dup_fields'].to_s.match(attribute_name + ',')\r\n dest[attribute_name] = value\r\n dest[attribute_name] << ' dup' if add_duplicate\r\n end\r\n end\r\n dest\r\nend",
"def __clone_buckets\n lim = @_st_tableSize\n lim = lim + lim\n kofs = 0\n while kofs < lim\n v = self.__at(kofs + 1)\n if v._not_equal?(RemoteNil)\n k = self.__at(kofs)\n if k._not_equal?(RemoteNil)\n # a k,v pair\n elsif v._isFixnum\n # internal collision chain\n else\n # a collision bucket\n nbucket = v.clone\n nbucket.__parent=(self)\n self.__at_put(kofs + 1, nbucket )\n end\n end\n kofs += 2\n end\n end"
] |
[
"0.68593657",
"0.68032324",
"0.6569473",
"0.65506077",
"0.6459358",
"0.63797605",
"0.6345265",
"0.61102915",
"0.6106479",
"0.6084783",
"0.60298187",
"0.5973599",
"0.5961",
"0.5950045",
"0.591033",
"0.589985",
"0.5897402",
"0.5868126",
"0.5867543",
"0.58612686",
"0.58525324",
"0.5817063",
"0.5816721",
"0.57969564",
"0.5789333",
"0.5771649",
"0.5753676",
"0.5753234",
"0.5732922",
"0.5728795",
"0.57281995",
"0.57172346",
"0.5715034",
"0.57073665",
"0.57073665",
"0.5696086",
"0.5689295",
"0.5689295",
"0.5689295",
"0.5678074",
"0.5668283",
"0.5665466",
"0.5656853",
"0.5656452",
"0.5646466",
"0.5646403",
"0.5618698",
"0.56127936",
"0.56125635",
"0.561161",
"0.5596748",
"0.55959624",
"0.55821645",
"0.55780244",
"0.55779773",
"0.55777276",
"0.55753386",
"0.5572905",
"0.5547535",
"0.5545539",
"0.55343455",
"0.55342394",
"0.55320764",
"0.5519593",
"0.5504099",
"0.54981786",
"0.5496145",
"0.5495118",
"0.54934615",
"0.5491295",
"0.5491068",
"0.54816604",
"0.548079",
"0.5480209",
"0.5475757",
"0.5473051",
"0.54700047",
"0.54700047",
"0.54700047",
"0.5464614",
"0.5462207",
"0.546028",
"0.5452494",
"0.54349804",
"0.54316485",
"0.5422287",
"0.5420976",
"0.5420413",
"0.54192066",
"0.54188645",
"0.54166484",
"0.5415759",
"0.5406502",
"0.5404983",
"0.54046816",
"0.539706",
"0.5395197",
"0.5394908",
"0.53912264",
"0.5383017"
] |
0.6831622
|
1
|
Dispatch unrecognized member calls.
|
def method_missing(sym, *args, &blk)
str = sym.to_s
type = str[-1,1]
name = str.chomp('=').chomp('!').chomp('?')
case type
when '!'
# TODO: Probably should have an indirect interface to ensure proper
# functonality in all cases.
@table.public_send(name, *args, &blk)
when '='
new_ostruct_member(name)
store!(name, args.first)
when '?'
new_ostruct_member(name)
key?(name)
else
new_ostruct_member(name)
read!(name)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def dispatch\n raise NotImplementedError\n end",
"def dispatch(*_arg0); end",
"def non_index_dispatch\n if binary?\n run(Binary)\n return\n elsif unary?\n run(Unary)\n return\n end\n regular_dispatch\n end",
"def method_missing(undefined_meth_yet,*args,&block)\n \"#{self.class.to_s} doesn't know how to perform :#{undefined_meth_yet}\"\n end",
"def normal_dispatch\n emit_naked_receiver\n emit_selector_replacement\n mutate_receiver\n emit_argument_propagation\n mutate_arguments\n end",
"def method_missing(*rest) end",
"def respond_to_missing?( id, priv = false ) id != :call; end",
"def method_missing(m, *a, &b)\n\ta.empty? ? m : super\nend",
"def method_missing(name, *args)\n\t\t[].send(name, *args) # Proxy nil onto []\n\trescue NoMethodError\n\t\tsuper\n\tend",
"def non_index_dispatch\n case\n when binary_operator?\n run(Binary)\n when attribute_assignment?\n run(AttributeAssignment)\n else\n normal_dispatch\n end\n end",
"def method_missing(method_name, *args)\n\t\tif DELEGATED_METHODS.include?(method_name)\n\t\t\t@user.send(method_name, *args)\n\t\telse\n\t\t\tsuper\n\t\tend\n\tend",
"def method_missing(m, *args, &block)\n # Attempt to call a method on the object directly\n if(method_names.index(m.to_s))\n $DEBUG and puts(\"Attempting to invoke_method '#{m}'\")\n invoke_method(get_method(m.to_s), args)\n else\n super.method_missing(m, *args, &block)\n end\n end",
"def dispatch(msg)\n case msg.message_type\n when Message::METHOD_CALL\n if not @intfs[msg.interface]\n raise InterfaceNotInObject, msg.interface\n end\n meth = @intfs[msg.interface].methods[msg.member.to_sym]\n raise MethodNotInInterface if not meth\n methname = Object.make_method_name(msg.interface, msg.member)\n retdata = method(methname).call(*msg.params)\n\n reply = Message.new.reply_to(msg)\n # I'm sure there is a ruby way to do that\n i = 0\n if meth.rets.size > 0 and not retdata.kind_of?(Array)\n raise InvalidReturnType\n end\n meth.rets.each do |rsig|\n reply.add_param(rsig[1], retdata[i])\n end\n @service.bus.send(reply.marshall)\n end\n end",
"def method_missing(m, *args, &block)\n # ignore\nend",
"def method_missing(method_name, *args, &block)\n if respond_to_missing?(method_name)\n handle_known_exceptions do\n @target.send(method_name, *args, &block)\n end\n else\n super\n end\n end",
"def action_missing(*)\n end",
"def method_missing(meth_name, *args, &block)\n raise \"Cannot call '#{meth_name}' on an undef'd method.\" if method(:name).respond_to?(meth_name)\n Object.instance_method(:method_missing).bind(self).call(meth_name, *args, &block)\n end",
"def method_undefined(*) end",
"def method_missing(mname, *args, &b)\n\t\t\tif self.class.permissive?\n\t\t\t\tself.class.tag mname\n\t\t\t\tif b\n\t\t\t\t\tsend mname, *args, &b\n\t\t\t\telse\n\t\t\t\t\tsend mname, *args\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tsuper\n\t\t\tend\n\t\tend",
"def dispatch\n raise(NotImplemetedError, \"subclass responsability\")\n end",
"def method_missing(sym,*args)\n if !args || args.size == 0\n if @subroutines[sym]\n puts \"CALLING #{sym}\" if @debug\n @subroutines[sym].call\n else\n super.method_missing(sym,args)\n end\n else\n super.method_missing(sym,args)\n end\n end",
"def method_missing(*args)\n compatible_call(*args)\n rescue\n end",
"def method_missing(method_name, *args, &block)\n if Response.instance_methods(false).include?(method_name) || Array.instance_methods(false).include?(method_name)\n self.response.send(method_name, *args, &block)\n else\n super\n end\n end",
"def method_missing(method, *arguments, &block); end",
"def method_missing( missing, *args )\n candidates = methods_that_sound_like( missing.to_s )\n message = \"You called an undefined method: #{missing}.\"\n unless candidates.empty?\n message += \"\\nDid you mean #{candidates.join(' or ')}?\"\n\t\tend\n raise raise NoMethodError.new( message )\n end",
"def method_missing(method, params={})\n call(method, params)\n end",
"def dispatch(name, rcvr, args)\n unless mm = @multimethod_by_name[name]\n raise NameError, 'No method for multmethod #{name}' unless mm\n end\n mm.dispatch(rcvr, args)\n end",
"def method_missing(method, *args, &blk); end",
"def dispatch_msg( msgName, *args )\n if defined? @msgNames and @msgNames.has_key? msgName\n @msgNames[msgName].each do |obj|\n obj.call( *args )\n end\n end\n end",
"def method_missing(meth, *args, &block)\n\n end",
"def do_invocation()\n obj = get_receiver_object\n if obj.nil?\n Undef\n else\n begin\n obj.send(@name)\n rescue NameError\n Undef\n end\n end\n end",
"def method_missing(m, *args, &block)\n end",
"def method_missing(name, *args, &block) # rubocop:disable Style/MethodMissing\n (class << self; self end).add_method(nil, name)\n __send__(name, *args, &block)\n end",
"def method_missing(wh,*therest)\n # xxx internal methods must be protected at some point\n end",
"def method_missing method, *opt\n method.to_s =~ /^do_[A-Z]+$/ ? process_request(*opt) : super\n end",
"def method_missing(name, *args)\n\t\t\tcall name, *args\n\t\tend",
"def method_missing(meth, *args, &block); end",
"def method_missing(meth, *args, &block); end",
"def method_missing(meth, *args, &block); end",
"def method_missing(*)\n invertable nil\n end",
"def method_missing(mth, *args, &block); end",
"def ignore_unexpected_calls!\n return if @ignoring_unexpected_calls # do it once!\n\n @ignoring_unexpected_calls = true\n\n def self.method_missing(sym, *args)\n super if @expected_calls.has_key?(sym)\n end\n\n def self.respond_to?(sym)\n true\n end\n end",
"def _handle_action_missing(*args); end",
"def method_missing(method, *args, &block); end",
"def method_missing m, *a\n @data.send(m, *a)\n end",
"def method_missing(meth, *args); end",
"def method_missing(missing, *args)\n candidates = methods_that_sound_like(missing.to_s)\n\n message = \"You called an undefined method: #{missing}\"\n\n unless candidates.empty?\n message += \"\\nDid you mean #{candidates.join(' or ')}?\"\n end\n\n raise NoMethodError.new(message)\n end",
"def method_missing(m, *arg, &block)\n return @members[m] if @members && @members[m]\n super\n end",
"def __mock_dispatch_spy\n @stub.__mock_disps.values.flatten.each do |disp|\n next unless __mock_defis.key?(disp.msg) # ignore undefined spies\n\n defis = __mock_defis[disp.msg]\n if idx = __mock_find_checked_difi(defis, disp, :index)\n __mock_disps_push(defis.delete_at(idx)) # found, dispatch it\n elsif defis.empty? # show called candidates\n __mock_failed(disp)\n else # show expected candidates\n __mock_failed(disp, defis)\n end\n end\n end",
"def dispatch_responders\n self.full_response, self.responder_ids = try_responding_in_full\n end",
"def dispatch!\n \n # negotiates initial configuration\n @meta = self.negotiate!\n \n # dispatches hash set to the server\n self.dispatch_hashing!\n self.dispatch_hashset!\n \n # dispatches orders\n self.dispatch_orders!\n \n # dispatches messages\n self.handle_messages!\n \n end",
"def method_missing(*)\n nil\n end",
"def method_missing(method, *args, &block)\n method.to_s =~ /^(\\w+)\\?$/ ? !!self[$1] : super\n end",
"def method_missing(method_name, *arguments)\n puts \"#{@name} tried to #{method_name}!\"\n end",
"def `(*args); forbidden(__method__); end",
"def method_missing(m, *args, &block) \n self.to_a.send m, *args, &block\n end",
"def method_missing(method_name, *args); end",
"def method_missing(method_name, *args); end",
"def method_missing(method_name, *args, &block)\n # Quick check to see if changes or was are being called, this check\n # keeps us from needing to parse out the parts if we're not going\n # to use them.\n if method_name =~ /[_](changes|was)$/\n # Break apart the method call\n # TODO: no destructuring because of https://github.com/opal/opal/issues/663\n *parts = method_name.to_s.split('_')\n action = parts.pop\n key = parts.join('_').to_sym\n\n # Handle changes or was calls.\n case action\n when 'changes'\n return changes(key)\n when 'was'\n return was(key)\n end\n end\n\n # Otherwise, run super\n super\n end",
"def method_missing(method, *args, &block)\n Rails.logger.debug(\"#{self.class.name}##{__method__}() looking for: #{method.to_s}\")\n if proxy_u.respond_to?(method)\n block_given? ? proxy_u.send(method, *args, block) :\n (args.size == 0 ? proxy_u.send(method) : proxy_u.send(method, *args))\n else\n super\n end\n end",
"def method_missing method, *args\n if @b.respond_to? method\n @b.send method, *args\n elsif @faces.member?(method.to_sym)\n get_face(method.to_sym)\n else\n raise ::Watir::Exception::WatirException, 'I ran out of ideas in Watirloo'\n end\n end",
"def dispatch_all\n @MapTypes.each do |type|\n self.send(type)\n end\n end",
"def method_missing(symbol, *args, &block)\n load_members\n if @member_class.instance_methods.include? symbol.to_s\n @members.inject([]) { |a, x| a << x.send(symbol) }.flatten\n else\n @members.send(symbol, *args, &block)\n end\n end",
"def method_missing(name, *args)\n\t\t\tcall(name, *args)\n\t\tend",
"def call(*)\n raise NotImplementedError\n end",
"def method_missing(method_name, *args) self end",
"def method_missing(method_name, *args) self end",
"def method_missing(method, *args)\r\n self.class.method_missing(method, *args)\r\n end",
"def method_missing(m, *args, &block)\n self.to_a.send m, *args, &block\n end",
"def use_new_dispatch_api?\n # RODA4: remove this method\n ancestors.each do |mod|\n break if mod == InstanceMethods\n meths = mod.instance_methods(false)\n if meths.include?(:call) && !(meths.include?(:_roda_handle_main_route) || meths.include?(:_roda_run_main_route))\n RodaPlugins.warn <<WARNING\nFalling back to using #call for dispatching for #{self}, due to #call override in #{mod}.\n#{mod} should be fixed to adjust to Roda's new dispatch API, and override _roda_handle_main_route or _roda_run_main_route\nWARNING\n return false\n end\n end\n\n true\n end",
"def method_missing(method, *args)\n if Array.method_defined?(method) && !Object.method_defined?(method)\n if block_given?\n collection.send(method, *args) { |*block_args| yield(*block_args) }\n else\n collection.send(method, *args)\n end\n else\n super\n #message = \"undefined method `#{method.to_s}' for \\\"#{collection}\\\":#{collection.class.to_s}\"\n #raise NoMethodError, message\n end\n end",
"def method_missing(method_name, *_args, &_block)\n @collection.fetch(method_name.to_s) do\n raise \"Could not find `#{method_name}` in #{self.class.name}\"\n end\n end",
"def method_missing(*args)\n puts \"YOU CAN'T DO THAT\"\n end",
"def _dispatch\n case @options[:action]\n when :init\n _init\n when :add\n fail 'No url given (-u option)' if @options[:url].empty?\n fail 'No name given (-n option)' if @options[:name].empty?\n _add\n when :delete\n fail 'No id given (-i option)' if @options[:id].nil?\n _delete\n when :list\n _list\n else\n fail \"Unknown action #{@options[:action]}\"\n end\n end",
"def method_missing(*args)\n result = nil\n orig = args.shift\n class_sym = self.class.name.to_sym\n m = orig.to_s[0,5] == '_DAV_' ? orig : \"_DAV_#{orig}\" # If hell is doing the same thing over and over and expecting a different result this is a hell preventer\n raise NoMethodError.new(\"Undefined method: #{orig} for class #{self}.\") unless respond_to?(m)\n @runner.call(class_sym, :before, orig)\n result = send m, *args\n @runner.call(class_sym, :after, orig)\n result\n end",
"def method_missing(*args)\n puts \"unimplemented: #{args}\"\n end",
"def method_missing(*)\n return nil\n end",
"def method_missing(m, *args, &block)\n and_then { |instance| instance.public_send(m, *args, &block) }\n end",
"def method_missing(:name, *args)\nend",
"def dispatch(msg, metadata: {}, restrict:)\n outputs = @outputs\n \n if restrict && (restrict.size > 0)\n outputs = outputs.reject{|name, out| !restrict.include?(name) }\n end\n \n outputs.each do |name, out|\n out.dispatch(msg, metadata)\n end\n end",
"def method_missing(selector, *args, &block); end",
"def method_missing(name, *args, &block); end",
"def method_missing(name, *args, &block); end",
"def method_missing(name, *args, &block); end",
"def method_missing(name, *args, &block); end",
"def method_missing(method, *args)\n # Break if first argument was not a model record\n return unless args[0].instance_of? model\n\n # Super if allowed_methods not defined or in not included in array\n am = self.class.allowed_methods\n super if am.nil? || !am.include?(method)\n\n resend_method(method, args)\n end",
"def method_missing(method, *args)\n send(method, *args)\n end",
"def method_missing(*arguments); @message.send(*arguments); end",
"def method_missing(m, *args) #:nodoc:\r\n\t\tif @current_object.respond_to?(m)\r\n\t\t\t@current_object.send(m, *args)\r\n\t\telse\r\n\t\t\t_invokeMethod(m, *args)\r\n\t\tend\r\n\tend",
"def method_missing(symbol, *args)\n super(symbol, *args) if actor.nil?\n actor.method(symbol).call(*args)\n end",
"def method_missing(method, *args, &block)\n #$stderr.puts \"Method missing: #{method}\"\n if @_receivers.last.respond_to?(method)\n #$stderr.puts \"Proxy [#{method}] to receiver\"\n @_receivers.last.__send__(method, *args, &block)\n else\n #$stderr.puts \"Proxy [#{method}] to context\"\n @_context.__send__(method, *args, &block)\n end\n end",
"def respond_to_missing?(method_name, include_private = false)\n Response.instance_methods(false).include?(method_name) || Array.instance_methods(false).include?(method_name) || super\n end",
"def method_missing m,*o,&b\n @element.send m,*o,&b\n end",
"def respond_to_missing?(method_name, include_private = false)\n valid?(method_name) || super\n end",
"def method_missing(method_sym, *args, &block)\n method_sym = method_sym.slice(1, method_sym.length) if method_sym[0] == \"_\"\n map { |value| value.send(method_sym, *args, &block) }\n end",
"def method_missing(*args, &block); end",
"def invoked_method()\n obj = get_receiver_object\n if obj.nil?\n Undef\n else\n begin\n obj.method(@name)\n rescue NameError\n Undef\n end\n end\n end",
"def method_missing(name, *args, &block)\n $LOG.error \"Invalid method '#{name}' was called from #{self.class}! \" #+\n # \"Stacktrace: #{e.backtrace}\"\n end",
"def respond_to_missing?(_method_name, _include_all)\n ::Kernel.raise ::NotImplementedError\n end",
"def respond_to_missing?(_method_name, _include_all)\n ::Kernel.raise ::NotImplementedError\n end",
"def method_missing(name, *args, &block)\n return super unless base.respond_to? name# and forward? name\n base.send(name, *args, &block)\n end"
] |
[
"0.6155088",
"0.6102928",
"0.60363436",
"0.59764016",
"0.58773184",
"0.58326364",
"0.5830302",
"0.5755057",
"0.57539195",
"0.5733471",
"0.5726069",
"0.57041013",
"0.57013386",
"0.5638937",
"0.56366897",
"0.5626089",
"0.56252307",
"0.5602234",
"0.55868053",
"0.5565256",
"0.55530834",
"0.55264336",
"0.5506827",
"0.55000865",
"0.54994464",
"0.54877514",
"0.5483009",
"0.5478338",
"0.54627466",
"0.5457707",
"0.54545",
"0.54506445",
"0.5450538",
"0.54472744",
"0.5440767",
"0.5439302",
"0.54355776",
"0.54355776",
"0.54355776",
"0.5433718",
"0.54319",
"0.5425798",
"0.54139495",
"0.5407876",
"0.54047877",
"0.5401751",
"0.53735596",
"0.5370044",
"0.5355228",
"0.5350175",
"0.53487647",
"0.53485113",
"0.53398794",
"0.53328073",
"0.5331455",
"0.5328956",
"0.5326824",
"0.5326824",
"0.5326374",
"0.5323793",
"0.53221846",
"0.53204465",
"0.5301335",
"0.5294136",
"0.5293325",
"0.52870756",
"0.52870756",
"0.5286018",
"0.527088",
"0.5268882",
"0.52624035",
"0.52582926",
"0.52582294",
"0.5257715",
"0.5253125",
"0.5248925",
"0.52392185",
"0.5230029",
"0.52222246",
"0.52179044",
"0.5216642",
"0.5214674",
"0.5214674",
"0.5214674",
"0.5214674",
"0.5209018",
"0.5207455",
"0.5206021",
"0.519778",
"0.51970685",
"0.51959085",
"0.51922417",
"0.5191673",
"0.51828384",
"0.518257",
"0.51805216",
"0.51776356",
"0.5174861",
"0.5171573",
"0.5171573",
"0.51680654"
] |
0.0
|
-1
|
CRUD method for listing all keys.
|
def keys!
@table.keys
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def list_keys()\n # TODO\n end",
"def all_keys\n @cluster.client.list_keys(@name)\n end",
"def list_api_keys(opts = {})\n @transporter.read(:GET, '/1/keys', {}, opts)\n end",
"def list\n @keychain.keys\n end",
"def index\n @key_sets = KeySet.all\n end",
"def index\n @keyholders = Keyholder.all\n end",
"def index\n @keys = Key.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @keys }\n end\n end",
"def list\n render json: Input.all.map{|i| {id: i.id, key: i.key}}\n end",
"def index\n @keyvals = Keyval.all\n end",
"def list_keys\n @keys.keys\n end",
"def index\n @keys = Key.all\n render json: @keys\n end",
"def keys\n ::M2X::Client::Key.list(@client, params.merge(device: self[\"id\"]))\n end",
"def index\n @apikeys = Apikey.all\n end",
"def index\n @apikeys = Apikey.all\n end",
"def list_api_keys(request_options = {})\n client.get(Protocol.index_keys_uri(name), :read, request_options)\n end",
"def get_keys\t\t\n\t\t\tbegin\t\t\t\t\t\t\t\n\t\t\t\tgetkeys = Datastore.new\t\t\t\n\t\t\t\trender :status => 200,\n\t \t\t:json => { :response => \"success\",\n\t \t :status => 200,\n\t \t :info => \"Successfully retrieved all keys\", \n\t \t :data => getkeys.getallkeys }\n\t\t\trescue Exception => e\n\t\t\t\trender :status => :unprocessable_entity,\n\t \t :json => { :response => \"fail\",\n\t \t :status => 401,\n\t :info => e.message }\n\t\t\tend\n\t\tend",
"def all\n @keys\n end",
"def list\n response = db.scan(@table_name)\n response.body['Items'].map { |x| get_key_from_result(x) }\n end",
"def index\n @credential_keys = CredentialKey.all\n end",
"def index\n @keyvalues = Keyvalue.all\n end",
"def fetch_all(key); end",
"def list_keys\n @keydict.keys\n end",
"def keys\n IbmCloudRest.get \"#{@uri}/keys\"\n end",
"def list(keydir)\n\n # FIXME: insert code that connects to the backend and affects the list\n # operation\n #\n # - Convert any exceptions into a failed status result with a meaningful\n # error message.\n #\n\n { :result => nil, :err_msg => 'FIXME: not implemented' }\n end",
"def index\n # it really does the job :-)\n @user_keys = @user_keys.order(:name)\n end",
"def index\n @key_indicate_dictionary = KeyIndicate::Dictionary.first || KeyIndicate::Dictionary.create\n @keys = @key_indicate_dictionary.key_indicate_dictionary_files\n end",
"def index\n @configuration_keys = ConfigurationKey.all\n end",
"def index\n @whiskeys = Whiskey.all\n end",
"def index\n @keys = ApiKey.where(user_id: current_user.id).order(id: :desc).page params[:page] # kaminari\n end",
"def keys(options={})\n get(\"/user/keys\", options, 3)\n end",
"def set_keylist\n @keylist = Keylist.find(params[:id])\n end",
"def keys_for(username)\n @api.client.users.keys.list(user: username).body\n end",
"def hgetall(key); end",
"def hgetall(key); end",
"def all\n scan_supported_keys\n end",
"def get_keys(user=nil) \n\t\tuser = Account.current_account if !user\n\t\tKey.all(:account_id => user.id, :project_id => self.id)\n\tend",
"def keys() end",
"def index\n @keyholders = Keyholder.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @keyholders }\n end\n end",
"def index\n @fokeys = Fokey.all\n end",
"def all(filters_arg = filters)\n filters.merge!(filters_arg)\n\n result = service.list_keys(filters).body\n filters[:marker] = result['Marker']\n self.truncated = result['Truncated']\n load(result['Keys'])\n end",
"def keys\n end",
"def index\n @group_keys = GroupKey.all\n if request.format.html?\n @group_keys = @group_keys.paginate(page: params[:page])\n end\n end",
"def index\n @api_keys = ApiKey.includes(:user)\n end",
"def list\n run do\n print_config_table(columns: %i[key value], skip_blanks: true)\n end\n end",
"def list\n @table.keys\n end",
"def hgetall(key)\n send_command([:hgetall, key], &Hashify)\n end",
"def get_key_list\n read(Common::KEY) || Hash.new\n end",
"def index\n @keystores = Keystore.all\n end",
"def get_all\n verify_connection_url\n\n output = {}\n list.each { |key| output[key.to_sym] = get key }\n output\n end",
"def list(api_params)\n raw = api_request(SSHKEYS, LIST, api_params)\n @ssh_keys = to_hash(raw[:body]) unless raw.nil?\n end",
"def index\n @hks = Hk.all\n end",
"def keys\n end",
"def keys\n @key\n end",
"def keys\n db.keys\n end",
"def index\n @permissions = ApiKeyPermission.where(api_key_id: @key.id).order(id: :desc).page params[:page]\n end",
"def list_keys request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_list_keys_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::ApiKeys::V2::ListKeysResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def fetch_collection_of_keys\n cmd_out, cmd_err, status = fetch_all_gpg_keys\n if status.success?\n [true, create_a_collection_of_keys(cmd_out)]\n else\n [false, cmd_err]\n end\n end",
"def index\n @cryptotables = Cryptotable.all\n retrieve_data\n end",
"def cdb_list(inflate=false)\n rs = Chef::CouchDB.new.list(\"users\", inflate)\n rs[\"rows\"].collect { |r| r[inflate ? \"value\" : \"key\" ]}\n end",
"def index\n @public_keys = PublicKey.all\n end",
"def list(*key)\n objects(*key).to_a\n end",
"def index\n @keycards = Keycard.order(\"number\")\n end",
"def all_keys\r\n keys = dispatch('33').split(',')\r\n #the reponse is \"1,field1,field2,....\" where 1 is success and rest are avail feilds.\r\n keys = keys[1..(keys.length)]\r\n end",
"def index\n @paquet_keys = PaquetKey.all.paginate(:page => params[:page], :per_page => 50)\n end",
"def keys\n @keys ||= LicenseField.all.map(&:key)\n end",
"def get_keys\n @encryption_io.get_keys\n end",
"def keys\n [ name ]\n end",
"def keys\n jiak.client.keys(jiak.bucket)\n end",
"def entries\n @redis.keys('*')\n end",
"def keys\n end",
"def keys\n end",
"def keys\n end",
"def index\n @api_keys = ApiKey.find_all_by_user_id current_user.id\n @new_key = ApiKey.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @api_keys }\n format.json { render :json => @api_keys }\n end\n end",
"def index\n @swift_api_keys = SwiftApiKey.all\n end",
"def index\n @secret_keys = SecretKey.all\n end",
"def get_all(key)\n configuration.hpath(key)\n end",
"def list(selection=nil)\n\n env.config.keypairs.each do |name,provider|\n env.ui.info(\"Keypair name:#{name}\")\n end\n end",
"def index\n @kelas = Kela.all\n end",
"def keys\n begin \n @connection = case params['filter']\n when 'all' \n $redis.keys\n when 'mall'\n $redis.keys 'mall*' \n when 'cache'\n $redis.keys 'mallc*'\n when 'session'\n $redis.keys 'malls*' \n when nil\n $redis.keys.length\n else\n $redis.keys \"#{params['filter']}*\"\n end\n rescue => e\n @connection = {status: 500, message: e.message }\n end \n\n respond_to do |format|\n format.json { render json: @connection }\n end \n end",
"def index\n @lks = Lk.all\n end",
"def index\n add_breadcrumb I18n.t('navs.backend.admins_index'), :backend_admins_path\n @qr = params.fetch(:query){Hash.new}.permit(:key, :status)\n @qr = @qr.select { |k, v| { k => v } unless v.blank? }\n\n qrkey = @qr.delete(:key)\n\n @admins = Admin.by_query(@qr).by_key(qrkey).page(params[:page])\n @qr[:key] = qrkey\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @public_keys }\n end\n end",
"def list_sshkeys(client)\n sshkey_ids = []\n\n # List all keys\n client.ssh_keys.all.each_with_index{ |x, i|\n puts \"[\" + i.to_s + \"] [SSHKey] id: \" + x.id.to_s + \" , name: \" + x.name\n sshkey_ids << x.id\n }\n\n\treturn sshkey_ids\nend",
"def keys(*) end",
"def keys\n raise \"Must implement #{self.class.name}#keys method to return lookup key\"\n end",
"def keys\n list.keys\n end",
"def display_keys\n students.each_key { |key| puts \"- #{key}\" }\nend",
"def all\n unless @all_loaded\n @all = keys.map { |key| get(key) }\n @all_loaded = true\n end\n\n @all\n end",
"def keys\n @keys ||= fields.order(:fieldnum).select do |field|\n field.useedit & 1 == 1\n end.map do |field|\n field.fieldname.downcase\n end\n end",
"def list\n get()\n end",
"def keys\n\t\tsuper + self.class.keys\n\tend",
"def deploy_keys(repo, options = {})\n paginate \"#{Repository.path repo}/keys\", options\n end",
"def key_ids\n @keys.keys\n end",
"def list\n @table.keys # values\n end",
"def keys; end",
"def keys; end",
"def keys; end",
"def keys; end",
"def keys; end",
"def keys; end",
"def keys; end"
] |
[
"0.7555959",
"0.7472145",
"0.71525234",
"0.70560294",
"0.69745076",
"0.6941038",
"0.6895926",
"0.68509346",
"0.6848772",
"0.68449676",
"0.68249434",
"0.681108",
"0.67805725",
"0.67805725",
"0.675586",
"0.67461264",
"0.673087",
"0.6728465",
"0.6718963",
"0.6704799",
"0.667135",
"0.6655894",
"0.6618517",
"0.6590857",
"0.65802175",
"0.6579195",
"0.65380806",
"0.64558834",
"0.64204407",
"0.6417645",
"0.64170754",
"0.64098793",
"0.6366389",
"0.6366389",
"0.63219744",
"0.6306043",
"0.6305595",
"0.63013965",
"0.6299401",
"0.6295717",
"0.6281295",
"0.62807095",
"0.6265551",
"0.6255916",
"0.6248944",
"0.62327296",
"0.62234956",
"0.6222435",
"0.6171462",
"0.616296",
"0.61605906",
"0.61462635",
"0.6138297",
"0.6136335",
"0.6121945",
"0.6114844",
"0.61144805",
"0.6101986",
"0.60995793",
"0.60610956",
"0.60503876",
"0.6040562",
"0.6028455",
"0.60115093",
"0.60005337",
"0.59985626",
"0.59871995",
"0.59722584",
"0.5970878",
"0.5968743",
"0.5968743",
"0.5968743",
"0.595738",
"0.59453654",
"0.59390056",
"0.5938954",
"0.5925088",
"0.5916482",
"0.5916337",
"0.588907",
"0.5884128",
"0.58769184",
"0.5875913",
"0.5872248",
"0.58699346",
"0.5869781",
"0.58420855",
"0.5828892",
"0.5810129",
"0.5802336",
"0.57972854",
"0.5779526",
"0.5774039",
"0.5771636",
"0.57712996",
"0.57712996",
"0.57712996",
"0.57712996",
"0.57712996",
"0.57712996",
"0.57712996"
] |
0.0
|
-1
|
Also a CRUD method like read!, but for checking for the existence of a key.
|
def key?(key)
@table.key?(key.to_sym)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def exists?\n retrieve\n true\n rescue Error::NoSuchKey\n false\n end",
"def has_key?(key); end",
"def has_key?(key); end",
"def has_key? key; key? key; end",
"def exist?(key)\n\n end",
"def key?(key); end",
"def key?(key); end",
"def key?(key); end",
"def key?(key); end",
"def key?(key); end",
"def key?(key); end",
"def key?(key)\n timeout_retry(3, 3){\n write \"EXISTS #{key}\\r\\n\"\n integer_reply == 1\n }\n end",
"def has_key?(key)\n !get(key).nil?\n end",
"def has_key?(key)\n !get(key).nil?\n end",
"def exists(key)\n call(key, [:exists, key], transform: Redis::Boolify, read: true)\n end",
"def exists?(key)\n unimplemented\n end",
"def key?(key)\n !self[key].nil?\n end",
"def exist?(key)\n store.key?(key)\n end",
"def exist? _key\n store.transaction(:read_only) do |s|\n s.roots.any? { |r| r.to_sym == _key.to_sym }\n end\n end",
"def exists?(key)\n raise \"Method not implemented. Called abstract class.\"\n end",
"def exist?(key)\n raise NotImplementedError\n end",
"def has_key?(key)\n @table.get(key) != nil\n end",
"def has_key?(key)\n @db.each_key do\n\t|k|\n\treturn true if k == key\n end\n end",
"def has_key?(key)\n raise NotImplementedError\n end",
"def exist?(key)\n with_client do |client|\n !client.exists(build_key(key)).zero?\n end\n end",
"def has_key?(key)\n super(convert_key(key))\n end",
"def has_key? key\n @lock.read_sync{ @data.has_key? key }\n end",
"def has_key?(key)\n super(convert_key(key))\n end",
"def is_key_exist(key)\r\n (@redis.exists key) ? true : false \r\n end",
"def key?\n @key\n end",
"def key?\n @key\n end",
"def exists?(key)\n key.present? && manager.key?(key)\n end",
"def has_key?(key)\n return self.fetch(key) ? true : false\n end",
"def has_key?(key)\n !!fetch(key)\n rescue ContextMiss\n false\n end",
"def has_key?(p0) end",
"def key?(key)\n super(convert_key(key))\n end",
"def key?(key)\n raise NotImplementedError\n end",
"def exist?(key)\n raise \"subclass responsibility\"\n end",
"def key?(key, options = {})\n load(key, options) != nil\n end",
"def key?(key)\n super(convert_key(key))\n end",
"def key?(key)\n super(convert_key(key))\n end",
"def exist?(key)\n !find(key).nil?\n end",
"def document_exists?(key)\n return nil unless key\n CouchbaseDocStore.document_exists?(key)\n end",
"def has_key?(field_name); end",
"def exists(key)\n\n # FIXME: insert code that connects to the backend and affects the exists\n # operation\n #\n # - Convert any exceptions into a failed status result with a meaningful\n # error message.\n #\n\n { :result => nil, :err_msg => 'FIXME: not implemented' }\n end",
"def has?(key) ; @docs.member?(key) end",
"def has_key?(key)\n @stored[key] && !@stored[key].empty? ? true : false\n end",
"def key?\n return true if @key; false\n end",
"def exists(key)\n mon_synchronize do\n perform [\"exists\", key], proc: T_BOOL\n end\n end",
"def key?(key)\n self.reload if @should_reload\n return @data.key?(key.to_sym)\n end",
"def key?(key)\n table.key?(key)\n end",
"def key?(key)\n !(head && head.commit.tree / key_for(key)).nil?\n end",
"def key?(key)\n !(head && head.commit.tree / key_for(key)).nil?\n end",
"def get!(key)\n get(key) || raise(Cooler::KeyNotFound)\n end",
"def key?(key)\n public_method_defined?(key.to_sym)\n end",
"def key?(key)\n\t\t\t\tif key\n\t\t\t\t\t@keyed.key?(key)\n\t\t\t\tend\n\t\t\tend",
"def exists(key)\n mon_synchronize do\n perform [\"exists\", key], :proc => T_BOOL\n end\n end",
"def key?(key)\n configuration.key?(key)\n end",
"def has_key?(key)\n return to_h().has_key?(key)\n end",
"def key?(*) end",
"def key?(name)\n raw.key?(name.to_s)\n end",
"def exist(key)\n check_return_code(\n Lib.memcached_exist(@struct, key),\n key\n )\n end",
"def exist?(key)\n !@store.select { |i| i[:key] == build_key(key) }.empty?\n end",
"def has_key(key, pos= 0, len= -1)\n end",
"def key?(key)\n @attr.key?(key)\n end",
"def exist?(key)\n jiak.client.exist?(jiak.bucket,key)\n end",
"def has_key?(key)\n !find_node(key).nil?\n end",
"def has?(key)\n respond_to? key\n end",
"def key?(key)\n in_transaction\n @table.key? key\n end",
"def contains?(key)\n not get(key).nil?\n end",
"def exists(key, options = nil)\n policy = create_policy(options, Policy, default_read_policy)\n command = ExistsCommand.new(@cluster, policy, key)\n execute_command(command)\n command.exists\n end",
"def has_key?(key)\n keys.include?(key)\n end",
"def exist?(key, options = {})\n exist(key)\n true\n rescue NotFound\n false\n rescue Error => e\n log_exception e\n end",
"def key?(key)\n @items.key?(key)\n end",
"def has_key?( key )\n key = UniMap.str_to_key( key ) unless key.is_a?( Key )\n key && contains_key( key )\n end",
"def key?(name)\n @data.key?(name.to_s)\n end",
"def required key\n if !has?(key)\n $stderr.print self\n raise \"Key #{key} does not exist\"\n end\n self[key]\n end",
"def key?(key)\n return false if key.nil?\n return true if self.class.mutable? && mutations.key?(key)\n\n respond_to?(key) || fallback_data.key?(key)\n end",
"def has_key?(key)\n @cache.has_key?(key)\n end",
"def include_key?(key)\n\t\t\ttrue\n\t\tend",
"def has_key?(key)\n if Dottie.dottie_key?(key)\n Dottie.has_key?(wrapped_object_or_self, key)\n else\n super\n end\n end",
"def exists?(key)\n @redis.exists(prefix(key))\n end",
"def persisted?( *args )\n\n has_key = false\n no_key = false\n key = nil\n case args.count\n when 1\n key = args[0]\n when 0\n no_key = true\n end\n\n # if we have no args we are asking whether any keys exist\n if no_key\n \n has_key = true unless ( @parent_index || @parent_bucket ).count == 0\n \n else\n \n serialized_key = nil\n if @parent_index\n serialized_key = @parent_bucket.parent_adapter.class::SerializationClass.__send__( @parent_bucket.parent_adapter.class::SerializationMethod, key )\n else\n serialized_key = key\n end\n\n has_key = @cursor_instance.jump( serialized_key )\n\n end\n \n return has_key\n\n end",
"def read(key)\n exists?(key) ? @data[key] : nil\n end",
"def exists?(key)\n # Use recommended binary-returning method create [with this redis-rb commit](https://github.com/redis/redis-rb/commit/bf42fc9e0db4a1719d9b1ecc65aeb20425d44427).\n return Lit.redis.exists?(key) if Lit.redis.respond_to?(:exists?)\n\n # Fall back with older gem\n Lit.redis.exists(key)\n end",
"def exist?(key)\n instrument :exist, key: key do |payload|\n id = map_key_to_id(key)\n answer = id.present?\n\n payload[:exist] = answer\n answer\n end\n end",
"def key?(key)\n @configuration.key?(key)\n end",
"def file_exists?(key)\n result = http.head([200,404], luwak, escape(key))\n result[:code] == 200\n end",
"def has_key?(key)\n dummy = Pair.new(key,nil)\n return @tree.get(dummy)\n end",
"def include?(key)\n # Ensure a Ruby true is returned\n item_exists(key) == true\n end",
"def contains?(key)\n @key_data.has_key?(key)\n end",
"def key_set?\n !attributes['key'].nil?\n end",
"def valid_key? key\n (not key.nil?) and (FileCreator::valid_key?(key.to_sym))\n end",
"def exists?\n begin \n CouchDB.get uri\n true\n rescue\n false\n end \n end",
"def call\n @key ? read[@key] : read\n end",
"def has_key?(value)\n ensure_loaded\n value = lookup_key(value)\n (@info.has_key?(value) || @new_info.has_key?(value)) && !!(self[value])\n end",
"def has_key?(key)\n @hash.has_key?(key)\n end",
"def key_item?\n fail NotImplementedError\n end",
"def has_key?(key)\n configs.has_key?(key) || store.has_key?(key) \n end",
"def has_key?(key)\n self.body.is_a?(Hash) && self.body.has_key?(key)\n end"
] |
[
"0.78772205",
"0.75415194",
"0.75415194",
"0.74715066",
"0.7276478",
"0.7242052",
"0.7242052",
"0.7242052",
"0.7242052",
"0.7242052",
"0.7242052",
"0.71487623",
"0.7146235",
"0.7146235",
"0.71323776",
"0.70975864",
"0.7080983",
"0.70750767",
"0.7072684",
"0.70381165",
"0.70351636",
"0.70029485",
"0.6969576",
"0.6940384",
"0.6934003",
"0.6930949",
"0.69271576",
"0.69264156",
"0.69244313",
"0.687806",
"0.687806",
"0.6872279",
"0.6866554",
"0.6864519",
"0.68377686",
"0.68252355",
"0.68249035",
"0.68129236",
"0.67893475",
"0.6786303",
"0.6786303",
"0.67541564",
"0.6732553",
"0.67275095",
"0.6725861",
"0.67170745",
"0.6702483",
"0.66975296",
"0.6666648",
"0.6642997",
"0.6635314",
"0.6604339",
"0.6604339",
"0.6585289",
"0.6584572",
"0.6583636",
"0.65575874",
"0.65571105",
"0.6553241",
"0.65528005",
"0.65520704",
"0.654487",
"0.65338093",
"0.65329003",
"0.65297806",
"0.652015",
"0.65168005",
"0.6516171",
"0.65124404",
"0.6506544",
"0.6505325",
"0.6489522",
"0.6458588",
"0.64312273",
"0.6421927",
"0.64135855",
"0.6406044",
"0.63861936",
"0.6382411",
"0.6381021",
"0.63808274",
"0.63803536",
"0.637719",
"0.6373828",
"0.63612074",
"0.6350543",
"0.6338828",
"0.63382083",
"0.6327722",
"0.6323103",
"0.6307395",
"0.63011485",
"0.6288951",
"0.62509674",
"0.624946",
"0.6238721",
"0.62281203",
"0.6224611",
"0.6218194",
"0.62153435"
] |
0.6340939
|
86
|
The CRUD method for read.
|
def read!(key)
@table[key.to_sym]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def row\n @record = find_if_allowed(params[:id], :read)\n respond_to_action(:row)\n end",
"def set_read\n @read = Read.find(params[:id])\n end",
"def read_todo\n update\n end",
"def crud *args\n @crud = args.first if args.size > 0\n end",
"def read\n super\n\n self.fetch\n\n self.items\n end",
"def read!\n self.update_attribute(:status, READ)\n end",
"def read(id)\n # do not respond with anything\n end",
"def _crud(for_select = true)\n fetch_array_for $_crud, for_select\n end",
"def set_crud\n @crud = Crud.find(params[:id])\n end",
"def read\n end",
"def index\n @reads = Read.all\n end",
"def create\n @read = Read.new(read_params)\n\n respond_to do |format|\n if @read.save\n format.html { redirect_to @read, notice: 'Read was successfully created.' }\n format.json { render :show, status: :created, location: @read }\n else\n format.html { render :new }\n format.json { render json: @read.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @read.update(read_params)\n format.html { redirect_to @read, notice: 'Read was successfully updated.' }\n format.json { render :show, status: :ok, location: @read }\n else\n format.html { render :edit }\n format.json { render json: @read.errors, status: :unprocessable_entity }\n end\n end\n end",
"def read_permitted?\n true\n end",
"def edit\n\n end",
"def edit\n \n end",
"def read(_request)\n raise NotImplementedError, 'Implement this method in your strategy'\n end",
"def read_params\n params.require(:read).permit(:data_leitura, :qtd_lido, :book_id)\n end",
"def retrieve\n end",
"def read(id)\n perform(:get, \"#{@resource_type}/#{id}\")\n end",
"def read\n end",
"def read\n end",
"def read\n end",
"def read\n end",
"def read\n super\n\n self.fetch\n\n index = self.pages['index']\n\n self.build_relationships(index, self.pages_to_list)\n\n # Locomotive::Mounter.with_locale(:en) { self.to_s } # DEBUG\n\n # self.to_s\n\n self.pages\n end",
"def read(*args)\n #This is a stub, used for indexing\n end",
"def edit\n # TODO: ensure is admin\n operation = params[:oper]\n if operation == 'edit'\n update\n elsif operation == 'del'\n destroy\n elsif operation == 'add'\n create\n end \n end",
"def read\n raise NotImplementedError\n end",
"def set_read_book\n @read_book = ReadBook.find(params[:id])\n end",
"def resource\n\n end",
"def edit\n @reader = current_reader\n end",
"def read\nend",
"def read\n _read\n end",
"def edit\n raise NotImplementedError\n end",
"def new\n @read = Read.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @read }\n end\n end",
"def read(query)\n raise NotImplementedError, \"#{self.class}#read not implemented\"\n end",
"def edit\n resource.before_actions[:edit].call(@record) if resource.before_actions[:edit]\n end",
"def edit\n\t\t\n\tend",
"def edit\n @record = Record.find(params[:id])\n end",
"def read\n \n end",
"def reader\n # Always reopen the readable database so we get live index data\n # TODO: make this configurable\n @reader.reopen\n @reader\n end",
"def edit\n load_data\n end",
"def get\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def read\n load_column(read_attribute)\n end",
"def set_readbook\n @readbook = Readbook.find(params[:id])\n end",
"def read\n @message = Message.find(params[:id])\n @message.read(current_user)\n respond_to do |format|\n format.html # read.html.erb\n format.json { render json: @message }\n end\n end",
"def edit\r\n end",
"def read_index\n all_tasks = @model.read\n @view.show_index(all_tasks)\n\tend",
"def do_nested\n @record = find_if_allowed(params[:id], :read)\n end",
"def edit\n\n end",
"def set_read_file\n @read_file = ReadFile.find(params[:id])\n end",
"def show\n\n @breadcrumb = 'read'\n @reading = Reading.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reading }\n end\n end",
"def edit\n @single = Single.find(params[:id])\n end",
"def read_note(note)\n return false unless allow_feature?(:reader_list)\n return nil if note.blank?\n\n action = User.find_action(:read, target: note, user: self)\n if action\n action.touch\n return action\n end\n\n action = User.create_action(:read, target: note, user: self)\n note.reload\n action\n end",
"def edit\n #Nothing necessary\n end",
"def create\n update\n end",
"def edit\n\n\tend",
"def edit\n\n\tend",
"def edit\n\n\tend",
"def edit\n\n\tend",
"def edit\n \n end",
"def edit\n \n end",
"def edit\n \n end",
"def edit\n \n end",
"def edit\n \n end",
"def edit\n \n end",
"def edit\n \n end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end"
] |
[
"0.6681119",
"0.662243",
"0.64992857",
"0.6391451",
"0.6292462",
"0.62714493",
"0.6252685",
"0.61405337",
"0.6110801",
"0.6075154",
"0.60655034",
"0.6006291",
"0.59694076",
"0.5932711",
"0.5924489",
"0.5915601",
"0.5893109",
"0.5884345",
"0.586076",
"0.5797691",
"0.57943875",
"0.57943875",
"0.57943875",
"0.57943875",
"0.57778394",
"0.57721615",
"0.57676655",
"0.57382005",
"0.5734607",
"0.5734073",
"0.5712039",
"0.57014775",
"0.56960076",
"0.5684709",
"0.5682518",
"0.565879",
"0.56506336",
"0.56328136",
"0.56028885",
"0.5602491",
"0.55550104",
"0.553084",
"0.55213356",
"0.5518983",
"0.5518983",
"0.5518983",
"0.5518983",
"0.5518983",
"0.5518983",
"0.5518983",
"0.5518983",
"0.5518983",
"0.5518983",
"0.5518983",
"0.5518983",
"0.5518983",
"0.5511717",
"0.5510758",
"0.5507539",
"0.55072284",
"0.5502228",
"0.54906344",
"0.54832953",
"0.5483073",
"0.54773146",
"0.5470451",
"0.5460493",
"0.5456169",
"0.5453625",
"0.54500455",
"0.54500455",
"0.54500455",
"0.54500455",
"0.5449512",
"0.5449512",
"0.5449512",
"0.5449512",
"0.5449512",
"0.5449512",
"0.5449512",
"0.54429525",
"0.54429525",
"0.54429525",
"0.54429525",
"0.54429525",
"0.54429525",
"0.54429525",
"0.54429525",
"0.54429525",
"0.54429525",
"0.54429525",
"0.54429525",
"0.54429525",
"0.54429525",
"0.54429525",
"0.54429525",
"0.54429525",
"0.54429525",
"0.54429525",
"0.54429525",
"0.54429525"
] |
0.0
|
-1
|
The CRUD method for create and update.
|
def store!(key, value)
if @nested && Hash === value # value.respond_to?(:to_hash)
value = OpenStruct2.new(value)
end
#new_ostruct_member(key) # this is here only for speed bump
@table[key.to_sym] = value
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n update\n end",
"def update\n create\n end",
"def update\n create\n end",
"def create\n update\n end",
"def update\n create\n end",
"def update\n create\n end",
"def save\r\n new? ? create : update\r\n end",
"def create\n end",
"def save\n new? ? create : update\n end",
"def save\n new? ? create : update\n end",
"def save\n new? ? create : update\n end",
"def save\n if new_record?\n create\n else\n update\n end\n end",
"def create\r\n end",
"def create\n \n end",
"def create\n end",
"def create\r\n\r\n\r\n end",
"def create \n end",
"def create \n end",
"def save\n self.new_record ? self.create : self.update\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def update\n @create = Create.find(params[:id])\n\n respond_to do |format|\n if @create.update_attributes(params[:create])\n format.html { redirect_to @create, notice: 'Create was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @create.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save\n id.nil? ? create : update\n end",
"def update\n create_or_update\n end",
"def save\n\t if self.id.nil? || self.id.empty?\n\t create\n\t\telse\n\t\t update\n\t\tend\n\tend",
"def save\n\t if self.id.nil? || self.id.empty?\n\t create\n\t\telse\n\t\t update\n\t\tend\n\tend",
"def create; end",
"def create; end",
"def create; end",
"def create; end",
"def create\n\n\tend",
"def edit\n \n end",
"def save\n if new?\n return create()\n else\n return update()\n end\n end",
"def crud *args\n @crud = args.first if args.size > 0\n end",
"def create\t\t\t\t\t\t\t\t\t# Creates record in db and redirects (porbably to index)\n\t\t@update = Update.new(updates_params)\t# Passes only title and desc.\n\n \trespond_to do |format|\t\t\t\t\t# All this is doing is rendering stuff in case of json\n \t\tif @update.save\n \t\tformat.html { redirect_to @update, notice: 'New update posted! w00t' }\n \t\tformat.json { render :show, status: :created, location: @update }\n \t\telse\n \t\tformat.html { render :new }\n \t\t\tformat.json { render json: @update.errors, status: :unprocessable_entity }\n \t\tend\n \tend\n\tend",
"def create\n \n end",
"def create\n \n end",
"def create\n \n end",
"def create\n \n end",
"def create\n \n end",
"def create\n \n end",
"def create\n \n end",
"def create\n \n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def save\n if self.id.nil?\n create\n else\n update\n end\n end",
"def update\n put :update\n end",
"def update\n\n\tend",
"def update\n\n\tend",
"def save\n new? ? insert : update\n end",
"def create\n #\n end",
"def create\n #\n end",
"def create\n #\n end",
"def create\n\n end",
"def create\n\n end",
"def create\n\n end",
"def create\n\n end",
"def create\n\n end",
"def create\n\n end",
"def create\n\n end"
] |
[
"0.7813967",
"0.7604371",
"0.75492084",
"0.7517737",
"0.737727",
"0.737727",
"0.6725285",
"0.667987",
"0.6584176",
"0.6584176",
"0.6584176",
"0.6557322",
"0.6502714",
"0.64567655",
"0.64540184",
"0.64481646",
"0.64188004",
"0.64188004",
"0.63816524",
"0.63583964",
"0.63583964",
"0.63583964",
"0.6344321",
"0.6290129",
"0.6284536",
"0.62774795",
"0.62774795",
"0.6249542",
"0.6249542",
"0.6249542",
"0.6249542",
"0.6247577",
"0.6232422",
"0.6223494",
"0.62220633",
"0.6212373",
"0.6211754",
"0.6211754",
"0.6211754",
"0.6211754",
"0.6211754",
"0.6211754",
"0.6211754",
"0.6211754",
"0.6207833",
"0.6207833",
"0.6207833",
"0.6207833",
"0.6207833",
"0.6207833",
"0.6207833",
"0.6207833",
"0.6207833",
"0.6207833",
"0.6207833",
"0.6207833",
"0.6207833",
"0.6207833",
"0.6207833",
"0.6207833",
"0.6207833",
"0.6207833",
"0.6207833",
"0.6207833",
"0.6207833",
"0.6207833",
"0.6207833",
"0.6207833",
"0.6207833",
"0.6207833",
"0.6207833",
"0.6207833",
"0.6207833",
"0.6207833",
"0.6207833",
"0.6207833",
"0.6207833",
"0.6207833",
"0.6207833",
"0.6207833",
"0.6207833",
"0.6207833",
"0.6207833",
"0.6207833",
"0.6207833",
"0.6207833",
"0.62031114",
"0.6200157",
"0.619681",
"0.619681",
"0.6182175",
"0.6179071",
"0.6179071",
"0.6179071",
"0.616229",
"0.616229",
"0.616229",
"0.616229",
"0.616229",
"0.616229",
"0.616229"
] |
0.0
|
-1
|
The CRUD method for destroy.
|
def delete!(key)
@table.delete(key.to_sym)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\r\n end",
"def destroy\r\n\r\n end",
"def delete\n destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\r\n end",
"def destroy\r\n end",
"def destroy; delete end",
"def destroy\n\n end",
"def destroy\n\n end",
"def destroy\n\t\tend",
"def destroy \r\n\r\n end",
"def destroy\n \n end",
"def destroy\n \n end",
"def destroy\n \n end",
"def destroy\n \n end",
"def destroy\n \n end",
"def destroy\n \n end",
"def destroy\n \n end",
"def destroy\n \n end",
"def destroy\n \n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def delete\n destroy\n end",
"def delete\n destroy\n end",
"def delete\n end",
"def destroy\n\t\t\n\tend",
"def destroy\n \n end",
"def destroy\n\n end",
"def destroy\n\n end",
"def destroy\n\n end",
"def destroy\n\n end",
"def destroy\n\n end",
"def destroy\n\n end",
"def destroy\n\n end",
"def destroy\n\n end",
"def destroy\n\n end",
"def destroy\n\n end",
"def destroy\n\n end",
"def destroy\n\n end",
"def destroy\n\n end"
] |
[
"0.7837561",
"0.77394795",
"0.7730291",
"0.7719497",
"0.7719497",
"0.7719497",
"0.7719497",
"0.7719497",
"0.7704295",
"0.7704295",
"0.7672396",
"0.76595765",
"0.76595765",
"0.76516384",
"0.7608896",
"0.7586135",
"0.7586135",
"0.7545908",
"0.7545908",
"0.7545908",
"0.7545908",
"0.7545908",
"0.7545908",
"0.7545908",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.75200427",
"0.7517733",
"0.751355",
"0.751355",
"0.74997336",
"0.7493202",
"0.74922717",
"0.74843466",
"0.74843466",
"0.74843466",
"0.74843466",
"0.74843466",
"0.74843466",
"0.74843466",
"0.74843466",
"0.74843466",
"0.74843466",
"0.74843466",
"0.74843466",
"0.74843466"
] |
0.0
|
-1
|
Same as `delete!`. This method provides compatibility with the original OpenStruct class.
|
def delete_field(key)
@table.delete(key.to_sym)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete(obj) ; end",
"def delete(object); end",
"def delete!\n delete( nil, true ) \n end",
"def delete(_spec)\n raise NotImplementedError, not_implemented_msg(:delete)\n end",
"def delete(o); removeObject o end",
"def delete\n NotImplemented\n end",
"def delete\n NotImplemented\n end",
"def delete(oid)\n end",
"def delete(name, options = T.unsafe(nil)); end",
"def delete!(object)\n raise NotImplementedError\n end",
"def delete!\n delete(:force => true)\n nil\n end",
"def delete\n raise NotImplementedError\n end",
"def aws_obj_delete(opts)\n opts[:obj].delete\n end",
"def delete\n raise NotImplementedError\n end",
"def delete(o)\n @hash.delete(o)\n self\n end",
"def delete(o)\n @hash.delete(o)\n self\n end",
"def delete!\n delete_if { true }\n end",
"def delete(kind, key, version)\n end",
"def delete(opts = nil)\n raise NotImplementedError, NOTIMPL_MSG\n end",
"def delete\n raise NotImplementedError\n end",
"def delete\n raise NotImplementedError\n end",
"def delete(*args, &block)\n map_method(:delete, args, &block)\n end",
"def delete(obj)\n true\n end",
"def delete!(to_delete)\n need_to_undef = parent && parent.respond_to?(to_delete) && parent.send(to_delete).eql?(@_componentable_container[to_delete])\n\n obj = @_componentable_container.delete(to_delete)\n\n if need_to_undef\n parent.instance_eval \"undef #{to_delete}\"\n end\n\n obj\n end",
"def delete(value)\n raise NotImplementedError, \"Please implement delete\"\n end",
"def delete(key); end",
"def delete(key); end",
"def delete(key); end",
"def delete(key); end",
"def delete(key); end",
"def delete\n delete_record\n freeze\n end",
"def del\n delete\n end",
"def delete!\n clear!\n delete\n end",
"def delete(key, &block); end",
"def delete!(*rest) end",
"def delete\n # TODO: implement delete\n end",
"def delete\n CMark.node_unlink(@pointer)\n end",
"def delete(data = :object)\n end",
"def delete(value)\n end",
"def delete(value)\n end",
"def delete(*)\n unavailable_method\n end",
"def delete(*)\n unavailable_method\n end",
"def delete(*)\n unavailable_method\n end",
"def delete(*)\n unavailable_method\n end",
"def delete(*)\n unavailable_method\n end",
"def delete(*)\n unavailable_method\n end",
"def op_destroy!(field)\n operate_field! field, { __op: :Delete }.freeze\n end",
"def delete(key)\n unimplemented\n end",
"def delete\n bucket.update(:deleted, self)\n freeze\n self.class.delete(key, bucket.name)\n end",
"def delete\n data.delete( self ); self\n end",
"def delete(o)\n @val &= ~(1 << o) if valid_member?(o)\n self\n end",
"def delete(attrs = {}, request_opts = {})\n self.new(attrs).delete(request_opts)\n end",
"def delete(name); end",
"def delete(name); end",
"def delete\n self.store -= self\n end",
"def delete(key)\n raise NotImplementedError\n end",
"def delete(key)\n\n end",
"def delete(record)\n record.del\n end",
"def free\n Tidylib.buf_free(@struct)\n end",
"def hdel(key, *fields); end",
"def unstore(*args, &block)\n delete(*args, &block)\n end",
"def del(*args); end",
"def delete! _key = nil\n ::Kernel.raise DerivedError\n end",
"def delete(attribute); end",
"def delete(object)\n obj = super(object)\n @all_goids.delete(obj.goid) if obj\n end",
"def delete\n @delete_mixin.json_dict = @json_dict\n @delete_mixin._deleted = @_deleted\n @delete_mixin.delete\n @json_dict = @delete_mixin.json_dict\n @_deleted = @delete_mixin._deleted\n end",
"def deleted?(name, options = T.unsafe(nil)); end",
"def delete(arg_)\n @config.lock\n\n @mutex.synchronize do\n if (objdata_ = _get_objdata(arg_))\n @objects.delete(objdata_[0].object_id)\n objdata_[2].each_key{ |tup_| _remove_tuple(objdata_, tup_) }\n end\n end\n self\n end",
"def op_del(attrname = nil)\n attrname ||= pop\n push pop.dup\n peek.delete(attrname)\n end",
"def delete(key)\n if Dottie.dottie_key?(key)\n Dottie.delete(wrapped_object_or_self, key)\n else\n super\n end\n end",
"def delete key\n find_slot(key)&.free\nend",
"def delete\n object.destroy rescue nil\n end",
"def destroy; delete end",
"def delete(*)\n unavailable_method\n end",
"def delete(key)\n raise NotImplementedError\n end",
"def delete(key)\n raise NotImplementedError\n end",
"def delete\n unavailable_method\n end",
"def delete( *regexs )\n self.dup.delete!( *regexs )\n end",
"def delete \n @data = {} \n end",
"def destroy\n #primitives in structs are without parent\n parent and parent.children.delete self\n end",
"def delete\n object.delete(:version_id => @version_id)\n end",
"def destroy\n delete\n freeze\n end",
"def delete!\n raise \"A database must be setted\" unless self.database\n response = database.delete self\n pristine_copy\n response\n end",
"def delete(type, key)\n raise Dis::Errors::ReadOnlyError if readonly?\n\n delete!(type, key)\n end",
"def delete\n out = _delete(id) if @store\n @id = nil\n @store = nil\n out\n end",
"def delete_version\n @object.delete(:version)\n end",
"def _destroy_delete\n delete\n end",
"def _destroy_delete\n delete\n end",
"def delete\n namespace.delete(dn)\n @attributes = (@original_attributes||{}).merge(@attributes)\n @original_attributes = nil\n self\n end",
"def delete\n destroy\n # update_attributes(deleted: true)\n end",
"def delete( key )\n fail NotImplementedError\n end",
"def delete!\n request! :delete\n end",
"def delete; raise ActiveRecord::ReadOnlyRecord; end",
"def delete(element); end",
"def delete(object)\n raise UnsupportedOperation\n end",
"def __delete_version(data)\n data.delete(self.class::VERSION_MEMBER.to_sym)\n end",
"def delete(key)\n raise \"Method not implemented. Called abstract class.\"\n end",
"def lbDelete _obj, _args\n \"_obj lbDelete _args;\" \n end",
"def delete key\n rv = self[key]\n self.removeField key\n return rv\n end",
"def delete_from_disk; end",
"def delete key\n @internal_hash[key].clear\n end"
] |
[
"0.7251308",
"0.6956473",
"0.69302255",
"0.6850544",
"0.68320084",
"0.6680585",
"0.6680585",
"0.6667947",
"0.66427904",
"0.66235524",
"0.6477377",
"0.64734286",
"0.6454753",
"0.64530385",
"0.64181405",
"0.64181405",
"0.64160985",
"0.6407099",
"0.63583964",
"0.63326466",
"0.63326466",
"0.63229704",
"0.6314228",
"0.6287704",
"0.62634516",
"0.62189394",
"0.62189394",
"0.62189394",
"0.62189394",
"0.62189394",
"0.6202743",
"0.6184448",
"0.6175615",
"0.6132942",
"0.6127155",
"0.6125667",
"0.61255306",
"0.6115098",
"0.6106793",
"0.6106793",
"0.6103632",
"0.6103632",
"0.6103632",
"0.6103632",
"0.6103632",
"0.6103632",
"0.6087412",
"0.60774505",
"0.60585225",
"0.6044044",
"0.60438716",
"0.6041453",
"0.603206",
"0.603206",
"0.60296685",
"0.6010376",
"0.60045564",
"0.6003963",
"0.5991247",
"0.59904826",
"0.5963103",
"0.5962094",
"0.5959392",
"0.595721",
"0.59469205",
"0.59458756",
"0.59310263",
"0.59260315",
"0.5918864",
"0.5917853",
"0.5917034",
"0.5912202",
"0.59093076",
"0.5902422",
"0.5898905",
"0.5898905",
"0.5881962",
"0.58783984",
"0.5870049",
"0.5869247",
"0.5869172",
"0.58689964",
"0.5868761",
"0.5868619",
"0.5860034",
"0.585988",
"0.5852405",
"0.5852405",
"0.5851114",
"0.58509594",
"0.5846814",
"0.5844282",
"0.58354044",
"0.5832618",
"0.5831243",
"0.5826159",
"0.58202",
"0.58188444",
"0.5813819",
"0.58094",
"0.57844955"
] |
0.0
|
-1
|
Merge this OpenStruct with another OpenStruct or Hash object returning a new OpenStruct instance. IMPORTANT! This method does not act inplace like `Hashmerge!`, rather it works like `Hashmerge`.
|
def merge!(other)
o = dup
other.each do |k,v|
o.store!(k,v)
end
o
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def merge!( other )\n\t\t\tcase other\n\t\t\twhen Hash\n\t\t\t\t@hash = self.to_h.merge( other,\n\t\t\t\t\t&HashMergeFunction )\n\n\t\t\twhen ConfigStruct\n\t\t\t\t@hash = self.to_h.merge( other.to_h,\n\t\t\t\t\t&HashMergeFunction )\n\n\t\t\twhen Arrow::Config\n\t\t\t\t@hash = self.to_h.merge( other.struct.to_h,\n\t\t\t\t\t&HashMergeFunction )\n\n\t\t\telse\n\t\t\t\traise TypeError,\n\t\t\t\t\t\"Don't know how to merge with a %p\" % other.class\n\t\t\tend\n\n\t\t\t# :TODO: Actually check to see if anything has changed?\n\t\t\t@dirty = true\n\n\t\t\treturn self\n\t\tend",
"def merge(other)\n self.class[Utils.merge(to_h, other)]\n end",
"def merge(other)\n self.class.new(*structures, other)\n end",
"def merge other_hash\n self.class.new nested_class, to_h.merge((other_hash if other_hash.is_a? Hash) || other_hash.to_h)\n end",
"def deep_merge other_in, options_in = {}\n return self if other_in.nil? or other_in.blank?\n\n options = { mode: :append }.merge(options_in)\n\n other =\n if other_in.is_a?(OpenStruct)\n other_in.dup\n elsif other_in.is_a?(Hash)\n other_in.to_os\n else\n OpenStruct.new(nil => other_in)\n end\n\n self.reduce(other) do |res, key, value|\n res[key] =\n if res.table.keys.include?(key)\n case value\n when Hash, OpenStruct\n value.deep_merge(res[key], options)\n when Array\n value.concat([res[key]].compact.flatten(1))\n when NilClass\n res[key]\n else\n value_out =\n if options[:mode] == :append\n [res[key], value].compact.flatten(1)\n elsif options[:mode] == :prepend\n [value, res[key]].compact.flatten(1)\n else\n value\n end\n\n if value_out.is_a?(Array) && options[:dedup]\n value_out.uniq\n else\n value_out\n end\n end\n else\n value\n end\n\n res\n end\n end",
"def merge(other_hash)\n ret = self.class.new.merge!(self)\n ret.merge!(other_hash) if other_hash != self\n return ret\n end",
"def merge\n a_hash = without_empty_values @a.to_h\n b_hash = without_empty_values @b.to_h\n\n @a.class.new a_hash.merge b_hash\n end",
"def deep_merge(other_hash, &blk)\n dup.deep_update(other_hash, &blk)\n end",
"def merge!(other)\n @hash.merge!(other.hash)\n end",
"def merge(other_hash); end",
"def merge! other_hash\n @table.merge!(nested_class, (other_hash if other_hash.is_a? Hash) || other_hash.to_h)\n end",
"def +(other_hash)\n other_hash ||= {}\n unless other_hash.is_a? Hash\n raise \"cannot merge #{other_hash.inspect} (#{other_hash.class})\" +\n \" into #{self} (Hash)\"\n end\n self.merge(other_hash || {})\n end",
"def merge(other)\n dup.update(other)\n end",
"def _deep_merge(hash, other_hash); end",
"def merge_hash!(hash)\n merge!(self.class.from_hash(hash))\n end",
"def shallow_merge(other_hash); end",
"def merge(other)\n assert_archive other\n\n data = deep_clone(@data)\n merge_data data, other.as_json, other.uri\n\n self.class.new data\n end",
"def merge(hash)\n self.dup.update(hash)\n end",
"def deep_merge(other, &bloc)\n other.keys.inject(dup) do |result, key|\n begin\n case result[key]\n when Hash\n if other[key].is_a?(Hash)\n result[key] = result[key].deep_merge(other[key], &bloc)\n result\n else\n raise MergeConflict\n end\n when nil then result.merge key => other[key]\n else\n raise MergeConflict\n end\n rescue MergeConflict\n if bloc.nil?\n result[key] = other[key]\n else\n result[key] = bloc.call(result, other, key) \n end\n result\n end\n end\n \n end",
"def merge(other)\n self.class.new.tap do |result|\n result.merge!(self)\n result.merge!(other)\n end\n end",
"def deep_merge!(other)\n merger = proc do |key, v1, v2|\n Hash === v1 && Hash === v2 ? v1.merge(v2, &merger) : v2\n end\n self.merge! other, &merger\n end",
"def merge(other)\n # By default just take the other change if applicable\n other.instance_of?(self.class) && other.key == key ? other : self\n end",
"def merge!(other)\n case other\n when Hash\n data = other\n when FileStore\n data = other.to_h\n end\n data.each do |name, value|\n @data[name.to_s] = value \n end\n end",
"def deep_merge!(other_hash)\n other_hash.each do |k,v|\n (class << (tv = self[k]); self; end).send :include, Hashie::Extensions::DeepMerge\n self[k] = tv.is_a?(::Hash) && v.is_a?(::Hash) ? tv.deep_merge(v) : v\n end\n self\n end",
"def merge!(other)\n raise Exception::OptionShouldBeRecursive.new(other) unless Utils.recursive?(other)\n\n if other.is_a?(self.class)\n structures.concat(other.structures)\n else\n structures << other\n end\n\n dirty!\n end",
"def merge(hash); end",
"def merge(hash); end",
"def merge(hash); end",
"def merge( other )\n clone.merge!( other )\n end",
"def merge(other)\n merged = dup\n\n merged.members.each do |key|\n merged[key] = other[key] if other[key]\n end\n\n return merged\n end",
"def merge!(other_hash); end",
"def shallow_merge(other_hash)\n dup.shallow_update(other_hash)\n end",
"def merge(other, &block)\n dup.merge!(other, &block)\n end",
"def merge(other)\n self.dup.tap do |v|\n v.merge!(other)\n end\n end",
"def deep_merge!(other_hash, &block); end",
"def merge!(other_hash)\n @parameters.merge!(other_hash.to_h)\n self\n end",
"def merge hash = {}\n original.merge(hash)\n end",
"def merge(other); end",
"def merge( other )\n self.dup.merge!(other)\n end",
"def deep_merge(other_hash)\n self.merge(other_hash) do |key, oldval, newval|\n oldval = oldval.to_hash if oldval.respond_to?(:to_hash)\n newval = newval.to_hash if newval.respond_to?(:to_hash)\n oldval.class.to_s == 'Hash' && newval.class.to_s == 'Hash' ? oldval.deep_merge(newval) : newval\n end\n end",
"def merge(other)\n dup.merge!(other)\n end",
"def deep_merge!(other_hash)\n other_hash.each_pair do |k,v|\n tv = self[k]\n self[k] = tv.is_a?(Hash) && v.is_a?(Hash) ? tv.deep_merge(v) : v\n end\n self\n end",
"def deep_merge!(other_hash)\n other_hash.each_pair do |k,v|\n tv = self[k]\n self[k] = tv.is_a?(Hash) && v.is_a?(Hash) ? tv.deep_merge(v) : v\n end\n self\n end",
"def deep_merge!(other_hash)\n other_hash.each_pair do |k,v|\n tv = self[k]\n self[k] = tv.is_a?(::Hash) && v.is_a?(::Hash) ? tv.deep_merge(v) : v\n end\n self\n end",
"def deep_merge!(other_hash, &block)\n other_hash.each_pair do |k,v|\n tv = self[k]\n if tv.is_a?(Hash) && v.is_a?(Hash)\n self[k] = tv.deep_merge(v, &block)\n else\n self[k] = block && tv ? block.call(k, tv, v) : v\n end\n end\n self\n end",
"def merge!(other)\n other.each_pair do |key, value|\n value = yield(convert_key(key), self[key], convert_value(value)) if block_given? && self[key]\n self[key] = value\n end\n self\n end",
"def merge!(other_hash)\n @lock.synchronize do\n other_hash.each { |key, value| self[key] = value }\n end\n end",
"def merge!(other_hash)\n @lock.synchronize do\n other_hash.each { |key, value| self[key] = value }\n end\n end",
"def deep_merge!(other_hash, &block)\n other_hash.each_pair do |current_key, other_value|\n this_value = self[current_key]\n\n self[current_key] = if this_value.is_a?(Hash) && other_value.is_a?(Hash)\n this_value.deep_merge(other_value, &block)\n else\n if block_given? && key?(current_key)\n block.call(current_key, this_value, other_value)\n else\n other_value\n end\n end\n end\n\n self\n end",
"def merge(other, &block)\n h = {}\n raise \"can't convert argument into Hash\" unless other.respond_to?(:to_hash)\n other = other.to_hash\n self.each_key{|k| h[k] = self[k]}\n if block\n other.each_key{|k|\n h[k] = (self.has_key?(k))? block.call(k, self[k], other[k]): other[k]\n }\n else\n other.each_key{|k| h[k] = other[k]}\n end\n h\n end",
"def deep_merge!(other_hash = {})\n replace(deep_merge(other_hash))\n end",
"def merge(base_hash, derived_hash, **opts); end",
"def deep_merge!(other_hash, &block)\n merge!(other_hash) do |key, this_val, other_val|\n # We can't use use this.val.is_a?(Hash) because inside the refinement\n # returns false:\n # - refined_hash.class != Hash\n if this_val.class.name == \"Hash\" && other_val.class.name == \"Hash\"\n this_val.deep_merge(other_val, &block)\n elsif block_given?\n block.call(key, this_val, other_val)\n else\n other_val\n end\n end\n end",
"def merge!(other)\n other.read_present.each do |k, v|\n write(k, v)\n end\n\n self\n end",
"def merge!(other)\n update!(other.value)\n end",
"def merge(hash)\n @hash.merge!(hash) if hash.respond_to?(:keys) && hash.any?\n self\n end",
"def merge!(*other_hashes, &blk); end",
"def merge(other)\n attributes = @attributes.merge(other.attributes)\n excluded = @excluded.dup.concat(other.excluded)\n self.class.new(prefix, attributes, excluded)\n end",
"def merge(other_hash)\n new_instance_with_inherited_permitted_status(\n @parameters.merge(other_hash.to_h)\n )\n end",
"def deep_merge!(*other_hashes, &blk); end",
"def merge(*other_hashes, &blk); end",
"def deep_merge(*other_hashes, &blk); end",
"def merge( other )\n\t\t\tself.dup.merge!( other )\n\t\tend",
"def deep_merge(other)\n merger = lambda do |key, a, b|\n (a.is_a?(Hash) && b.is_a?(Hash)) ? a.merge(b, &merger) : b\n end\n\n merge(other, &merger)\n end",
"def merge(other)\n @options[:last_received_time] ||= other.last_received_time\n @options[:idle] ||= other.idle\n @options[:next_directive] ||= other.next_directive\n @options[:next_method] ||= other.next_method\n @options[:data] ||= other.data\n @options[:parse_next] ||= other.parse_next\n end",
"def merge(base_hash, derived_hash); end",
"def merge(...)\n self.clone.merge!(...)\n end",
"def merge(hash)\n hash.each_value { |v| self << v }\n end",
"def merge!(hash); end",
"def deep_merge!(other_hash)\n replace(deep_merge(other_hash))\n end",
"def deep_merge!(other_hash, append: :auto, &block)\n\t\t\t\treturn self unless other_hash\n\t\t\t\tother_hash.each_pair do |k,v|\n\t\t\t\t\ttv = self[k]\n\t\t\t\t\tcase\n\t\t\t\t\twhen tv.is_a?(Hash) && v.is_a?(Hash)\n\t\t\t\t\t\tself[k] = tv.deep_merge(v, &block)\n\t\t\t\t\twhen tv.is_a?(Array) && v.is_a?(Array)\n\t\t\t\t\t\tif append==:auto and v.length > 0 && v.first.nil? then\n\t\t\t\t\t\t\t#hack: if the array begins with nil, we append the new\n\t\t\t\t\t\t\t#value rather than overwrite it\n\t\t\t\t\t\t\tv.shift\n\t\t\t\t\t\t\tself[k] += v\n\t\t\t\t\t\telsif append && append != :auto\n\t\t\t\t\t\t\tself[k] += v\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tself[k] = block && tv ? block.call(k, tv, v) : v\n\t\t\t\t\t\tend\n\t\t\t\t\twhen tv.nil? && v.is_a?(Array)\n\t\t\t\t\t\t#here we still need to remove nil (see above)\n\t\t\t\t\t\tif append==:auto and v.length > 0 && v.first.nil? then\n\t\t\t\t\t\t\tv.shift\n\t\t\t\t\t\t\tself[k]=v\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tself[k] = block && tv ? block.call(k, tv, v) : v\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\tself[k] = block && tv ? block.call(k, tv, v) : v\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tself\n\t\t\tend",
"def deep_merge(other_hash)\n dup.deep_merge!(other_hash)\n end",
"def merge!(other)\n assert_archive other\n clear_caches\n\n merge_data @data, other.as_json, other.uri\n nil\n end",
"def deep_merge!(other_hash, &block)\n merge!(other_hash) do |key, this_val, other_val|\n if this_val.is_a?(Hash) && other_val.is_a?(Hash)\n this_val.deep_merge(other_val, &block)\n elsif block_given?\n block.call(key, this_val, other_val)\n else\n other_val\n end\n end\n end",
"def merge(other)\n dup.merge!(other)\n end",
"def merge(other_hash, &block)\n to_h.merge(other_hash, &block).reduce(self.class.new) do |map, pair|\n map[pair.first] = pair.last\n map\n end\n end",
"def merge(other_hash, &block)\n to_h.merge(other_hash, &block).reduce(self.class.new) do |map, pair|\n map[pair.first] = pair.last\n map\n end\n end",
"def deep_merge(source, hash); end",
"def deep_merge(source, hash); end",
"def deep_merge!(other_hash)\n replace(deep_merge(other_hash))\n end",
"def merge lhs, rhs\n if rhs.respond_to?(:empty?) && rhs.empty?\n lhs\n elsif lhs.respond_to?(:merge)\n if rhs.respond_to?(:merge)\n string_keys(lhs).merge(string_keys(rhs))\n else\n rhs\n end\n else\n rhs\n end\n end",
"def deep_merge!(hash_or_config)\n return self if hash_or_config.nil?\n other_config = convert hash_or_config\n other_config.each do |key, other_value|\n value = has_key?(key) && self[key]\n self[key] = if ConfigNode === value && ConfigNode === other_value\n value.deep_merge!(other_value)\n elsif ConfigNode === value && other_value.nil?\n self[key]\n else\n other_value\n end\n end\n self\n end",
"def deep_merge!(target, hash); end",
"def deep_merge!(target, hash); end",
"def merge(other)\n schema(other.keys)\n end",
"def merge(hash)\n to_hash.merge(hash)\n end",
"def merge(hash)\n to_hash.merge(hash)\n end",
"def merge(hash)\n to_hash.merge(hash)\n end",
"def merge(hash)\n to_hash.merge(hash)\n end",
"def merge(hash)\n to_hash.merge(hash)\n end",
"def merge(hash)\n to_hash.merge(hash)\n end",
"def reverse_merge!(other_hash)\n super(self.class.new(other_hash))\n end",
"def deep_merge!(hsh1, hsh2)\n raise TypeError unless hsh1.is_a?(Hash) && hsh2.is_a?(Hash)\n\n hsh1.merge!(hsh2) { |_, v1, v2| deep_merge!(v1, v2) }\n end",
"def rh_merge(data)\n _rh_merge(clone, data)\n end",
"def merge_from(other)\n @title = other.title unless other.title.to_s.empty?\n @descriptions[:default] = other.descriptions[:default] unless other.descriptions[:default].to_s.empty?\n @impact = other.impact unless other.impact.nil?\n other.tags.each do |ot|\n tag = @tags.detect { |t| t.key == ot.key }\n tag ? tag.value = ot.value : @tags.push(ot)\n end\n self\n end",
"def deep_merge!(other_hash)\n replace(deep_merge(other_hash))\n end",
"def deep_merge!(other_hash, &block)\n merge!(other_hash) do |key, this_val, other_val|\n if this_val.is_a?(Hash) && other_val.is_a?(Hash)\n this_val.deep_merge(other_val, &block)\n elsif block_given?\n block.call(key, this_val, other_val)\n else\n other_val\n end\n end\n end",
"def deep_merge h1,h2\n r = h1.is_a?(HashWithIndifferentAccess) ? HashWithIndifferentAccess.new : Hash.new\n h1.each do |k1,v1|\n if v1.is_a?(Hash) && h2[k1].is_a?(Hash)\n r[k1] = deep_merge(h1[k1], h2[k1])\n else\n r[k1] = v1\n end\n end\n h2.each do |k2,v2|\n unless h1.key?(k2)\n r[k2] = v2\n end\n end\n r\n end",
"def deep_merge!(other_hash)\r\n replace(deep_merge(other_hash))\r\n end",
"def merge!(other)\n\t\tALL.each do |key|\n\t\t\tincrement(key, other.get(key))\n\t\tend\n\t\tself\n\tend"
] |
[
"0.77517265",
"0.7082207",
"0.70508945",
"0.69744617",
"0.6943111",
"0.6847997",
"0.68381506",
"0.66483843",
"0.66106963",
"0.66037697",
"0.64850116",
"0.64713126",
"0.63833255",
"0.63762534",
"0.6363829",
"0.6363016",
"0.63620716",
"0.63339067",
"0.6333791",
"0.63199484",
"0.6308548",
"0.6297758",
"0.6296836",
"0.6294996",
"0.6290438",
"0.62707555",
"0.62707555",
"0.62707555",
"0.62613785",
"0.62552774",
"0.62425977",
"0.62370527",
"0.6233489",
"0.6232398",
"0.6226106",
"0.6212546",
"0.62104386",
"0.6209772",
"0.6206841",
"0.6187998",
"0.6181845",
"0.6162721",
"0.6162721",
"0.6157581",
"0.61519915",
"0.615083",
"0.614695",
"0.614695",
"0.61427057",
"0.6141309",
"0.6129802",
"0.6125225",
"0.6115699",
"0.6083889",
"0.60671616",
"0.60451496",
"0.60356516",
"0.60302263",
"0.60208595",
"0.6015903",
"0.6009614",
"0.5992999",
"0.5990056",
"0.59878236",
"0.5970787",
"0.5959943",
"0.5950786",
"0.59467447",
"0.59431934",
"0.59396315",
"0.5939526",
"0.5934882",
"0.5932538",
"0.59296745",
"0.59277284",
"0.5910866",
"0.5910866",
"0.5907674",
"0.5907674",
"0.5897961",
"0.589652",
"0.5893896",
"0.5882182",
"0.5882182",
"0.58756655",
"0.58687174",
"0.58687174",
"0.58687174",
"0.58687174",
"0.58687174",
"0.58687174",
"0.58685315",
"0.58632296",
"0.58615243",
"0.58540845",
"0.5851056",
"0.5843764",
"0.58288276",
"0.5811056",
"0.5804391"
] |
0.5818622
|
98
|
Get a duplicate of the underlying table.
|
def to_h
@table.dup
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def copy\n result = HashTablet.new(@table.size)\n each {|element| result.insert(element) }\n return result\n end",
"def dup\n duped_rows = rows.map(&:dup)\n self.class.new(duped_rows)\n end",
"def dup\n other = super\n %w{tables table_alias unique_alias where tables key_value_tables}.each do |k|\n other.send(\"#{k}=\", other.send(k).dup)\n end\n other\n end",
"def copy \n t = @tab.clone ;\n for i in 0..3\n t[i] = t[i].clone\n end\n Table.new(t) ;\n end",
"def dup\n Data.new( sheet, @data.map(&:dup) )\n end",
"def dup\n clone\n end",
"def dup\n self.class.new.tap { |obj| reverse_dup_copy obj }\n end",
"def try_dup\n self.dup\n end",
"def duplicate\n dup.tap do |c|\n c.page = nil\n columns.each do |column|\n c.columns << column.duplicate\n end\n pictures.each do |picture|\n c.pictures << picture.duplicate\n end\n end\n end",
"def dup\n self\n end",
"def dup\n self\n end",
"def dup\n self\n end",
"def dup\n copy(false)\n end",
"def clone\n dup\n end",
"def dup\n new_board = ChessBoard.new\n new_board.rows = self.rows.map(&:dup)\n new_board\n end",
"def dup\n copy = super\n copy.clear_puzzle\n @puzzle.each_with_index do |entry, index|\n copy[index] = entry\n end\n copy\n end",
"def dup\n GameBoard.build(row_size,column_size) {|r,c| self[r,c]}\n end",
"def dup\n self.class.new(to_hash)\n end",
"def dup\n # noinspection RubyMismatchedReturnType\n self.class.new(object.presence)\n end",
"def dup\n new_board = Board.new\n @rows.each_with_index do |row, row_idx|\n row.each_with_index do |pos, col_idx|\n new_pos, new_piece_type, color = [row_idx, col_idx], pos.class, pos.color\n new_board[new_pos] = new_piece_type.new(color, new_board, new_pos) unless pos.is_a?(NullPiece)\n new_board[new_pos] = new_piece_type.instance if pos.is_a?(NullPiece)\n end\n end \n new_board\n end",
"def initialize_copy(original)\n super\n @table = @table.dup\n end",
"def copy\n DataFrame.new(@rows.copy, rownames: @rownames.copy, colnames: @colnames.copy)\n end",
"def dup\n ret = self.class.new\n fields.each do |tag, field|\n val = self.__send__(field.name)\n ret.__send__(\"#{field.name}=\", val)\n end\n return ret\n end",
"def clone\n other = dup\n other.freeze if self.frozen?\n other\n end",
"def copy\n\t\t\treturn self.dup\n\t\tend",
"def dup\n duplicate = ManyValues.new(@details, @attribute)\n duplicate.values = self.values.map { |v| v.dup }\n duplicate\n end",
"def clone\n self.copy\n end",
"def clone\n self.copy\n end",
"def dup\n\n # duplicate self\n rta = super\n\n # iterate through array and dup each hash\n rta.each_with_index do |w_hash, index|\n\n # dup the hash at this index\n rta[index] = w_hash.dup\n\n # to be complete, also dup the key/values in the hash, in case another hash/array is nested\n w_hash.each_pair do |k, v|\n rta[index][k] = v.dup if v.is_a? Hash\n end\n end\n\n # now everything should have new object_id's\n rta\n end",
"def clone\n Matrix.rows(@rows)\n end",
"def deep_dup\n # noinspection RubyMismatchedReturnType\n dup\n end",
"def clone\n self\n end",
"def dup; return self.class.new(RAtlas::dup(@storage)); end",
"def clone\n other = dup\n other.freeze if frozen?\n other\n end",
"def initialize_copy(orig)\n super\n @table = @table.dup\n end",
"def dup\n self.class.new(\n self.class.attributes.keys.each_with_object({}) do |k, result|\n val = send(k)\n next if val.nil? || (val.respond_to?(:empty?) && val.empty?)\n\n result[k] = val.is_a?(Array) ? val.map(&:dup) : val.dup\n end\n )\n end",
"def dup\n Ably::Models::IdiomaticRubyWrapper.new(attributes.dup, stop_at: stop_at.keys)\n end",
"def dup_for_reference\n dup.tap do |r|\n r.created_at = self.created_at\n # r.id = nil # done by dup\n # r.instance_variable_set(\"@association_cache\", self.instance_variable_get(:association_cache))\n end\n end",
"def clone\n o = dup\n o.freeze if frozen?\n o\n end",
"def copy\n dup\n end",
"def dup\n s = Sheet.new( name, workbook )\n d = data\n unless d.nil?\n d = d.dup\n s.load( d.all, header_rows )\n d.sheet = s\n end\n s\n end",
"def dup\n gridcpy = Grid.new(@num_rows,@num_columns)\n for r in 0...@num_rows\n for c in 0...@num_columns\n cur_cell = self.getCell(r,c)\n gridcpy.getCell(r,c).living = cur_cell.living\n gridcpy.getCell(r,c).neighbors = cur_cell.neighbors \n end # end col loop\n end # end row loop\n return gridcpy\n end",
"def clone\n t = self\n c = super\n c.delete_all\n t.each { |r| c << r.clone }\n c.header = c[header_row_index] if header_row_index\n c\n end",
"def dup\n\n Workitem.new(Rufus::Json.dup(@h))\n end",
"def dup_for_reference\n dup.tap do |r|\n r.created_at = self.created_at\n r.instance_variable_set(\"@association_cache\", self.association_cache)\n end\n end",
"def dup\n Tableau.new @hidden_cards, @cards\n end",
"def deep_dup\n dup\n end",
"def dup\n raise NotImplementedError.new(\"Method 'dup' not implemented by '#{self.class.name}'\")\n end",
"def dup \n Daru::Vector.new @data.dup, name: @name, index: @index.dup\n end",
"def dup\n other = EncodingContext.new(@options)\n t = @table\n l = @limit\n other.instance_eval do\n @table = t.dup # shallow copy\n @limit = l\n end\n other\n end",
"def deep_dup; end",
"def clone\n self\n end",
"def copy_new_rows\n tables.each(&:copy_new_rows)\n end",
"def deep_dup\n duplicable? ? dup : self\n end",
"def deep_dup\n duplicable? ? dup : self\n end",
"def clone\n copy(false)\n end",
"def dup\n HashWithIndifferentAccess.new(self)\n end",
"def replicate\n\n self.class.new(document, ref, source: source.dup)\n end",
"def dup\n return Card.new(self.suit, self.rank)\n end",
"def clone\n self.class.new(@attributes.except(:_id).except(:versions).dup)\n end",
"def dup\n self.class.new(@value, **(@object || {}))\n end",
"def initialize_copy(orig)\n super\n @__table__ = @__table__.dup\n end",
"def clone\n @clone ||= super\n end",
"def dup\n end",
"def dup\n end",
"def dup\n clone = super\n clone.name = \"Clone of #{self.name}\"\n clone.institution_default = false\n # The instance requires an ID for MetadataProfileElement validations.\n clone.save!\n self.elements.each { |e| clone.elements << e.dup }\n clone\n end",
"def clone\n return (Matrix.new(@x,@y) do |i,j| self[i][j].clone end)\n end",
"def dup\n self.class.new(color, board, pos)\n end",
"def hash_dup\n save\n end",
"def copy\n self.class.new.tap do |obj|\n self.each_pair do |key, val|\n obj.set(key => (val.is_a?(Array) or val.is_a?(Hash)) ? val.clone : val)\n end\n end\n end",
"def copy\n self.class.new.tap do |obj|\n self.each_pair do |key, val|\n obj.set(key => (val.is_a?(Array) or val.is_a?(Hash)) ? val.clone : val)\n end\n end\n end",
"def dup\n result = self.class.new(dimension, geometric_resolution, order)\n result.send(:initialize_copy, self)\n result\n end",
"def dup\n return super unless post_id\n clone = super\n clone.post_id = nil\n clone\n end",
"def full_dup(progress={})\r\n progress[object_id] = result = dup\r\n exclude = full_dup_exclude\r\n\r\n if exclude.empty?\r\n result.full_dup_no_exclusions(progress)\r\n else\r\n result.full_dup_with_exclusions(progress, exclude)\r\n end\r\n\r\n result\r\n end",
"def _clone(*_)\n new_inst = _klass_new(_fn_name, *_fn_args)\n new_inst._data.replace(__hashish[\n @table.map { |_key, _value|\n if _key.is_a?(::AttributeStruct)\n _key = _key._clone\n else\n _key = _do_dup(_key)\n end\n if _value.is_a?(::AttributeStruct)\n _value = _value._clone\n else\n _value = _do_dup(_value)\n end\n [_key, _value]\n }\n ])\n new_inst\n end",
"def duplicate\n @copy = self.deep_clone :no_duplicates => true, :never_clone => [:uuid, :updated_at,:created_at]\n @copy.static_page = self.static_page.duplicate\n self.sub_pages.each do |page| \n copy_of_page = page.duplicate\n @copy.sub_pages << copy_of_page\n copy_of_page.save\n end\n @copy.save\n @copy\n end",
"def dup\n returning self.class.new do |resource|\n resource.attributes = @attributes\n end\n end",
"def dup\n result = self.class.new(geometric_resolution, order)\n result.initialize_copy(self)\n result\n end",
"def dup\n wb = Workbook.new\n self.each { |s| wb.add s.dup }\n wb\n end",
"def clone\n end",
"def clone\n @clone = true\n end",
"def dup\n copy = Rubinius.invoke_primitive(:object_class, self).allocate\n\n Rubinius.invoke_primitive :object_copy_object, copy, self\n\n Rubinius.privately do\n copy.initialize_copy self\n end\n copy\n end",
"def clone; end",
"def clone; end",
"def clone; end",
"def deep_dup(index = {})\n return index[object_id] if index.key? object_id\n\n deep_dup_enumerable(self, index) { |new, k, v| new[k] = v }\n end",
"def dup\n empty_board = Board.new(false)\n pieces.each do |piece|\n temp_color = (piece.color == :red) ? :red : :white\n temp_pos = [piece.pos[0], piece.pos[1]]\n temp_kinged = piece.kinged\n temp_piece = Piece.new(empty_board, temp_color, temp_pos, temp_kinged)\n\n # empty_board.add_piece(Piece.new(empty_board, temp_color, temp_pos, temp_kinged), temp_pos)\n end\n\n empty_board\n # duped_rows = rows.map(&:dup)\n #\n # duped_rows.each_with_index do |row, row_idx|\n # row.each_index do |col_idx|\n # next if duped_rows[row_idx].nil?\n # current_cell = duped_rows[row_idx][col_idx]\n #\n # next if current_cell.nil?\n # duped_rows[row_idx][col_idx] = current_cell.dup\n # end\n # end\n # duped_board = self.class.new(duped_rows, false)\n # duped_board.pieces.each do |piece|\n # piece.board = duped_board\n # end\n # duped_board\n\n end",
"def dup\n duplicate = Intelligence::Ec::Individual.new({\n algorithm: @algorithm,\n dimensions: @dimensions\n })\n duplicate.chromosome = @chromosome.dup\n duplicate.fitness = @fitness\n duplicate\n end",
"def deep_copy\n return Matrix.new(\n @matrix.map{|row| row.map{|e| e.dup}},\n @rownames.map{|e| e.dup},\n @colnames.map{|e| e.dup}\n )\n end",
"def dup\n copy = super\n @grid = @grid.dup\n copy\n end",
"def dup\n obj = super\n obj.duplicated_from = self\n obj.resource = self.resource_file\n uhook_duplicated_object(obj)\n\n obj\n end",
"def dup \n Daru::Vector.new @vector.dup, name: @name, index: @index.dup\n end",
"def clone\n end",
"def clone\n end",
"def clone\n end",
"def dup\n self.class.new(self, self.default)\n end",
"def clone() end",
"def deep_dup\n new_board = Board.new(false)\n self.grid.each.with_index do |row, idx1|\n row.each.with_index do |cell, idx2|\n if self.grid[idx1][idx2].nil?\n next\n else\n new_board.grid[idx1][idx2] = self.grid[idx1][idx2].dup\n new_board.grid[idx1][idx2].board = new_board\n end\n end\n end\n new_board\n end",
"def dup\n d = super()\n d.send(:initialize, rows, cols)\n _memcpy(d.gsl, @gsl)\n d\n end",
"def clone\n raise NotImplementedError\n end"
] |
[
"0.74288404",
"0.73790216",
"0.70681274",
"0.6883358",
"0.66663337",
"0.6583027",
"0.65611506",
"0.65455395",
"0.65279907",
"0.6424239",
"0.6424239",
"0.6424239",
"0.64204115",
"0.6402175",
"0.63907206",
"0.6321653",
"0.6301223",
"0.6236129",
"0.6233999",
"0.62304825",
"0.6219129",
"0.62175983",
"0.6198264",
"0.61978614",
"0.61777276",
"0.6171263",
"0.6162773",
"0.6162773",
"0.6134962",
"0.61292684",
"0.612349",
"0.61153215",
"0.61046076",
"0.61022127",
"0.6099874",
"0.60753554",
"0.607112",
"0.6060443",
"0.6060389",
"0.6008043",
"0.5988526",
"0.59837496",
"0.5979928",
"0.5969647",
"0.5968164",
"0.59581417",
"0.59580624",
"0.59545845",
"0.59531116",
"0.5952702",
"0.59505117",
"0.593662",
"0.59313947",
"0.59012693",
"0.59012693",
"0.58989155",
"0.5883638",
"0.58690596",
"0.5863395",
"0.58555055",
"0.5846257",
"0.58236915",
"0.5820364",
"0.58109134",
"0.58109134",
"0.5800217",
"0.57896215",
"0.57865256",
"0.5781956",
"0.57748824",
"0.57748824",
"0.57659644",
"0.57562405",
"0.5755161",
"0.57506585",
"0.5734106",
"0.57223904",
"0.5707675",
"0.570294",
"0.5698723",
"0.56952274",
"0.5693265",
"0.56787854",
"0.56787854",
"0.56787854",
"0.5672898",
"0.5647333",
"0.56462586",
"0.56370515",
"0.5634682",
"0.5625455",
"0.5625081",
"0.5615606",
"0.5615606",
"0.5615606",
"0.56142306",
"0.5606497",
"0.56006926",
"0.5591807",
"0.55868715"
] |
0.5966058
|
45
|
TODO: Should OpenStruct2 support to_hash ? alias :to_hash :to_h Create an enumerator based on `each!`.
|
def to_enum(methname=:each!)
# Why has Ruby 2 deprecated this form?
#::Enumerator.new(self, methname)
::Enumerator.new do |y|
__send__(methname) do |*a|
y.yield *a
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def each(&block)\n to_h.each(&block)\n end",
"def each(&blk)\n to_h.each(&blk)\n end",
"def each\n self.to_hash.each\n end",
"def each_hash\n if block_given?\n while row = next_hash\n yield row\n end\n else\n self.enum_for(:each_hash)\n end\n end",
"def each(&blk)\n enum = Enumerator.new do |y|\n @converted.each {|k, v| y.yield(k,v) }\n @hash.each {|k,v| y.yield(k, self.move_value(k)) }\n end\n if blk.nil?\n enum\n else\n enum.each do |k,v|\n blk.call(k,v)\n end\n end\n end",
"def each_hash(result) # :nodoc:\n raise NotImplementedError\n end",
"def to_hash\r\n result = {}\r\n each do |elt|\r\n result[elt] = yield(elt)\r\n end\r\n result\r\n end",
"def to_h()\n #This is a stub, used for indexing\n end",
"def to_h\n (@value || HashBuilder.new(&@block)).to_h\n end",
"def to_h; end",
"def to_h; end",
"def to_h; end",
"def to_h; end",
"def each\n\n return unless block_given?\n self.to_h.each { |k, v| yield(k, v) }\n end",
"def each(&block)\n return to_enum :each unless block_given?\n @data.keys.each(&block)\n end",
"def hashes_to_ostruct object # {{{\n\n return case object\n when Hash\n object = object.clone\n object.each { |key, value| object[key] = hashes_to_ostruct(value) }\n OpenStruct.new( object )\n when Array\n object = object.clone\n object.map! { |i| hashes_to_ostruct(i) }\n else\n object\n end\n\n end",
"def to_h\n to_hash\n end",
"def to_h\n\t\t\thash = Hash.new(nil)\n\t\t\teach_pair { |key, value| hash[key] = value }\n\t\t\thash.freeze\n\t\tend",
"def to_h\n @hash\n end",
"def to_h\n @hash\n end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def map_to_h(&block)\n [self, map(&block)].transpose.to_h\n end",
"def each\n return to_enum(:each) unless block_given?\n @entry.each { |key, value| yield [key, value] }\n end",
"def to_h\n Hash[self]\n end",
"def nested_hash obj\n if obj.kind_of? Array\n obj.map(&method(__method__))\n elsif obj.respond_to?(:to_h)\n obj.to_h.each_with_object({}) do |(k,v), acc|\n acc[k] = case v\n when Hash,OpenStruct then send(__method__,v)\n when Array then v.map(&method(__method__))\n else v\n end\n end\n else\n obj\n end\n end",
"def to_hash\n memoize(:to_hash) do\n _process_hashed(structures.inject({}) { |acc, elem| Utils.merge(acc, elem) })\n end\n end",
"def each(&block)\n hash.each(&block)\n end",
"def hash\n to_a.hash\n end",
"def fields_hash\n each_pair.to_h\n end",
"def to_h\n @_hash.dup\n end",
"def to_hash(object)\n result = object\n case result\n when OpenStruct\n result = result.marshal_dump\n result.each do |k, v|\n result[k] = to_hash(v)\n end\n when Array\n result = result.map { |v| to_hash(v) }\n end\n result\n end",
"def each &block\n if block_given?\n iterate_each &block\n self\n else\n self.to_enum\n end\n end",
"def ostruct_to_hash(ostruct, hash = {})\n ostruct.each_pair do |k, v|\n hash[k] = v.is_a?(OpenStruct) ? ostruct_to_hash(v) : v\n end\n\n hash\n end",
"def each(&block)\n @hash.each(&block)\n end",
"def to_hash(*)\n mapper.new(self).to_hash\n end",
"def __convert hash #:nodoc:\n instance = self.class.new\n hash.each do |k, v|\n k = k.to_s if !k.respond_to?(:to_sym) && k.respond_to?(:to_s)\n instance.new_ostruct_member k\n if v.is_a?(Hash)\n v = v[\"type\"] == \"hash\" ? v[\"contents\"] : __convert(v)\n elsif v.is_a?(Array)\n v = v.map{|e| e.instance_of?(Hash) ? __convert(e) : e}\n end\n instance.send \"#{k}=\".to_sym, v\n end\n instance\n end",
"def with_values!\n each_with_object self do |(k, v), hsh| hsh[ k ] = yield v end\n end",
"def to_h\n hash = {}\n each_with_name{ |v, n| hash[n] = v}\n hash\n end",
"def to_h\n @hash.dup\n end",
"def recursive_to_h(struct)\n if struct.is_a?(Array)\n return struct.map { |v| v.is_a?(OpenStruct) || v.is_a?(Array) || v.is_a?(Hash) ? recursive_to_h(v) : v }\n end\n\n hash = {}\n\n struct.each_pair do |k, v|\n recursive_val = v.is_a?(OpenStruct) || v.is_a?(Array) || v.is_a?(Hash)\n hash[k] = recursive_val ? recursive_to_h(v) : v\n end\n hash\n end",
"def each\n @hash.each_key { |o| yield(o) }\n self\n end",
"def to_h\n Hash[ data.map {|k,v| v.is_a?(StructHash) ? [k, v.to_h] : [k, v] } ]\n end",
"def to_h\n h = {}\n each_pair {|key, value| h[key] = value}\n h\n end",
"def modify_values!\n each_with_object self do |hash_pair, ꜧ|\n ꜧ[ hash_pair[0] ] = yield( hash_pair )\n end\n end",
"def to_h\n private_to_h\n end",
"def to_h\n private_to_h\n end",
"def convert_each!(opts=OPTS, &block)\n np = !@capture\n\n _capture!(nil, opts) do\n case keys = opts[:keys]\n when nil\n keys = (0...@obj.length)\n\n valid = if @obj.is_a?(Array)\n true\n else\n keys = keys.map(&:to_s)\n keys.all?{|k| @obj.has_key?(k)}\n end\n\n unless valid\n handle_error(nil, :invalid_type, \"convert_each! called on object not an array or hash with keys '0'..'N'\")\n next \n end\n when Array\n # nothing to do\n when Proc, Method\n keys = keys.call(@obj)\n else\n raise ProgrammerError, \"unsupported convert_each! :keys option: #{keys.inspect}\"\n end\n\n keys.map do |i|\n begin\n if v = subkey([i], opts.fetch(:raise, true))\n yield v\n v.nested_params if np \n end\n rescue => e\n handle_error(i, :invalid_type, e)\n end\n end\n end\n end",
"def each(&block)\n block or return enum_for(__method__) { size }\n @hash.each_key(&block)\n self\n end",
"def to_hash\n Hash.instance_method(:to_hash).bind(self).call\n end",
"def hashes2ostruct(object)\n return case object\n when Hash\n object = object.clone\n object.each do |key, value|\n object[key] = hashes2ostruct(value)\n end\n OpenStruct.new(object)\n when Array\n object = object.clone\n object.map! { |i| hashes2ostruct(i) }\n else\n object\n end\n end",
"def hashes2ostruct(object)\n return case object\n when Hash\n object = object.clone\n object.each do |key, value|\n object[key] = hashes2ostruct(value)\n end\n OpenStruct.new(object)\n when Array\n object = object.clone\n object.map! { |i| hashes2ostruct(i) }\n else\n object\n end\n end",
"def each(&block)\n if block\n to_enum.each(&block)\n return nil\n else\n return to_enum\n end\n end",
"def as_hash\n @hash\n end",
"def each\n if block_given?\n while row = shift\n yield row\n end\n else\n to_enum\n end\n end",
"def hmap\n return map unless block_given?\n map { |k, v| yield(k, v) }.compact.to_h\n end",
"def nested_struct obj\n case obj\n when Hash\n obj.each_with_object(OpenStruct.new) do |(k,v), acc|\n acc[k]= case v\n when Hash then send(__method__,v)\n when Array then v.map(&method(__method__))\n else v\n end\n end.\n tap{|x| x.define_singleton_method(:keys){ obj.to_h.keys }}.\n tap{|x| x.define_singleton_method(:values){ AwsDevUtils::Utils.nested_struct obj.to_h.values }}\n when Array\n obj.map(&method(__method__))\n else\n obj\n end\n end",
"def to_hash() end",
"def modify\n each_with_object self.class.new do |hash_pair, ꜧ|\n key, val = yield hash_pair\n ꜧ[key] = val\n end\n end",
"def each(&block)\n return to_enum unless block_given?\n @map.each(&block)\n self\n end",
"def to_h\n raise NotImplementedError, '`#to_h` method must be implemented'\n end",
"def to_h\n @hash.dup\n end",
"def modify_values\n each_with_object self.class.new do |hash_pair, ꜧ|\n ꜧ[ hash_pair[0] ] = yield( hash_pair )\n end\n end",
"def each\n return unless @result\n\n @result.each(as: :hash, symbolize_keys: true) do |row|\n next unless row # This sometimes happens when streaming results...\n row = Hash[row.map { |k, v| [k, v.to_s] }] if @type_translation == :string\n yield row\n end\n end",
"def to_h\n Hash[all_entries]\n end",
"def to_hash\n Hash[to_a]\n end",
"def to_hash\n Hash[self]\n end",
"def to_h\n\n @h\n end",
"def to_h\n each_with_object({}) { |attr, h| h[attr.name] = attr }\n end",
"def test_0660_each_with_object\n @@log.debug \"test_0660_each_with_object starts\" if @@log.debug?\n assert_respond_to(@list, :each_with_object, \"test_0660_each_with_object_respond\")\n # Type check\n enum = @list.each_with_object({})\n result = enum.is_a? Enumerator\n assert(result,\"test_0660_each_with_object_class\") \n # With block - build a Hash\n hash = @list.each_with_object({}) do |item, memo|\n memo[item.last] = item.ndata\n end\n assert_equal(hash,\n {\"Newman\"=>4, \"Barker\"=>3, \"Bronson\"=>2, \"Dev\"=>1},\n \"test_0660_each_with_object_hash\")\n # With block - build an Array\n csvs = @list.each_with_object([]) { |item, memo|\n memo << \"#{item.last}\"\n }.join(\",\")\n assert(csvs == \"Newman,Barker,Bronson,Dev\", \"test_0660_each_with_object_array\")\n #\n @@log.debug \"test_0660_each_with_object ends\" if @@log.debug?\n end",
"def to_h\n h = {}\n each_pair {|k,v| h[k] = v}\n h\n end",
"def to_h\n hsh = {}\n each do |b|\n b.each { |sb| hsh[sb.key] = sb.value }\n end\n hsh\n end",
"def _convert_ostruct(obj)\n return OpenStruct.new(Hash[obj.map { |k, v| [k, _convert_ostruct(v)] }]).freeze if obj.is_a?(Hash)\n return obj.map { |v| _convert_ostruct(v) }.freeze if obj.is_a?(Array)\n obj\n end",
"def each\n\t\t\t@enumvalues ||= {}\n\t\t\t@enumvalues.each_value { |enumvalue| yield enumvalue }\n\t\tend",
"def hash\n @hash ||= self.to_a.hash\n end",
"def hash\n [].hash\n end",
"def my_each_with_index\n return self unless block_given?\n hash = Hash.new(0)\n for h in self\n yield h, self.index(h)\n hash.merge! self.index(h) => h\n end\n return hash\n end",
"def to_hash\n raise NotImplementedError\n end",
"def _hash(obj)\n obj.transform_values { |v| _renc(v) }\n end",
"def each\n @internal_hash.each { |k,_| yield k }\n end",
"def hash2os(hash)\n hash.each_key do |key|\n hash[key] = hash2os(hash[key]) if hash[key].is_a?(Hash)\n chk_array(hash[key]) if hash[key].is_a?(Array)\n end\n hash = OpenStruct.new(hash)\n end",
"def each( &block ) # :yield: member, value\n\t\t\t@hash.each( &block )\n\t\tend",
"def to_hash\n @hash.dup\n end",
"def to_hash\n to_a.hash\n end",
"def to_h\n if merge_ee?\n deep_merge(@hash, @ee_hash)\n else\n @hash\n end\n end",
"def each\n return enum_for(__method__) unless block_given?\n @raw.each_pair do |key, value|\n yield key, value\n end\n self\n end",
"def robust_enumerator(collection)\n case collection\n when Hash, Struct\n collection.each_pair.to_a\n when Array\n Enumerator.new do |y|\n cur = collection.size\n until cur.zero?\n pos = collection.size - cur\n y << [pos, collection[pos]]\n cur -= 1\n end\n end\n when ->(c) { c.respond_to?(:each_pair) }\n collection.each_pair.to_a\n else\n fail TypeError, \"Can't dig/* in #{collection.class}\"\n end\n end",
"def to_hash\n @hash\n end",
"def to_hash\n @hash\n end",
"def to_hash\n h = {}\n each_pair { |k,v| h[k] = v }\n h\n end",
"def to_h\n @values.dup\n end",
"def a_to_h\n self.map.with_index.to_h.invert\n end",
"def hash_mapped_struct\n set_field_getter {|obj, name| obj[name.to_sym] }\n set_field_setter {|obj, name, value| obj[name.to_sym] = value }\n end",
"def to_h\n @collection.to_hash\n end",
"def each\n pos = hash_size\n hoff0 = @hashes[0]\n while pos < hoff0\n key, value = *read_entry(pos)\n yield(key,value)\n pos += key.length + value.length + hashref_size\n end\n end",
"def to_h\n Hash[ self ]\n end"
] |
[
"0.6940512",
"0.69024974",
"0.67601156",
"0.65915114",
"0.65010214",
"0.64992464",
"0.64917105",
"0.62673455",
"0.61414164",
"0.6105258",
"0.6105258",
"0.6105258",
"0.6105258",
"0.6096157",
"0.60916126",
"0.6046219",
"0.6031621",
"0.6024084",
"0.5987481",
"0.5987481",
"0.5947629",
"0.5947629",
"0.5947629",
"0.5947629",
"0.5947629",
"0.5947629",
"0.5937315",
"0.59245944",
"0.59168196",
"0.5908293",
"0.58964163",
"0.58937407",
"0.5871144",
"0.587036",
"0.5869906",
"0.5865926",
"0.5863953",
"0.58581513",
"0.5853568",
"0.58493006",
"0.58449143",
"0.5842164",
"0.58269906",
"0.58126515",
"0.5797483",
"0.5786561",
"0.5782709",
"0.57776517",
"0.5776229",
"0.5755515",
"0.5755515",
"0.5753669",
"0.5752421",
"0.57516587",
"0.57453513",
"0.57453513",
"0.5742276",
"0.5736548",
"0.5728679",
"0.5725378",
"0.5721974",
"0.57194847",
"0.5716377",
"0.57136726",
"0.57102215",
"0.5702825",
"0.5702441",
"0.5695759",
"0.5691974",
"0.5687994",
"0.56876826",
"0.567715",
"0.56581473",
"0.5654945",
"0.56526476",
"0.5638907",
"0.56375784",
"0.5634226",
"0.5631909",
"0.56302875",
"0.5629352",
"0.56212366",
"0.5619615",
"0.56125194",
"0.5611484",
"0.56109256",
"0.561037",
"0.5593903",
"0.55885816",
"0.55873287",
"0.558663",
"0.55835015",
"0.55835015",
"0.55817264",
"0.55803126",
"0.55723405",
"0.5565776",
"0.556471",
"0.5561622",
"0.5561148"
] |
0.5749021
|
54
|
Is the OpenStruct instance frozen?
|
def frozen?
@table.frozen?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def frozen?() end",
"def frozen?() end",
"def frozen?\n @attributes.frozen?\n end",
"def frozen?\n @attributes.frozen?\n end",
"def frozen?\n @attributes.frozen?\n end",
"def frozen?\n @frozen\n end",
"def frozen?\n @frozen\n end",
"def frozen?\n true\n end",
"def frozen?\n !!@frozen\n end",
"def frozen?; end",
"def readonly?\n frozen?\n end",
"def fully_frozen?(progress={})\n return false unless frozen?\n\n progress[object_id] = self\n\n instance_variables.each do |name|\n value = instance_variable_get(name)\n return false unless progress[value.object_id] || value.fully_frozen?(progress)\n end\n\n true\n end",
"def fully_frozen?(progress={})\n return false unless frozen?\n\n progress[object_id] = self\n\n each do |value|\n return false unless progress[value.object_id] || value.fully_frozen?(progress)\n end\n\n true\n end",
"def unfreeze?\n return data.unfreeze\n end",
"def struct?\n is_struct\n end",
"def frozen\n info[\"frozen\"]\n end",
"def frozen?\n reload\n @properties.frozen?\n end",
"def frozen!\n @frozen = true\n end",
"def rec_was_frozen\n if changed? && rec_frozen then\n return !( changed_attributes.key?( :freeze_date ) && changed_attributes[ :freeze_date ].nil? )\n else\n return false\n end\n end",
"def frozen?\n update_state()\n return @society_state == FROZEN\n end",
"def check_frozen\n if rec_was_frozen && changed? then\n errors.add( :base, I18n.t( 'cfr_records.msg.frozen_rec' ))\n return false\n else\n return true\n end\n end",
"def operation_produces_immutable_object?(param0 = T.unsafe(nil)); end",
"def freeze\n @frozen = true\n end",
"def freeze!\n @frozen = true\n end",
"def isStructType(obj)\n return ( obj.kind_of? FFI::Struct)\n end",
"def secure?\n (frozen? || lock?) && self.class.closed? && strict?\n end",
"def frozen?\n !%w(started unsubmitted).include?(self.status)\n end",
"def __class__\n OpenStruct2\n end",
"def stale?(object = T.unsafe(nil), **freshness_kwargs); end",
"def unfreeze\r\n self.update_attribute(:is_freezed, false)\r\n end",
"def freezed?\n false\n end",
"def global_frozen?(account)\n return false if account == Crypto.xrp_account\n sle = state_map.read(Indexes::account(account))\n return sle && sle.flag?(:global_freeze)\n end",
"def unfreeze; end",
"def frozen?(account, iou)\n return false if iou[:currency] == 'XRP'\n\n sle = state_map.read(Indexes::account(iou[:account]))\n return true if sle && sle.flag?(:global_freeze)\n\n return false if iou[:account] == account\n\n sle = state_map.read(Indexes::line(account, iou))\n sle && sle.flag?(iou[:account] > account ? :high_freeze :\n :low_freeze)\n end",
"def readonly?\n self.class != real_class\n end",
"def freeze\r\n self.update_attribute(:is_freezed, true)\r\n end",
"def dirty?\n flags & 0x1 == 0x1\n end",
"def defensive\n return (@attributes & 0x10 == 0x10)\n end",
"def freeze\n end",
"def freeze\n end",
"def attached?\n !!@__parent_struct\n end",
"def freeze() end",
"def freeze() end",
"def freeze\n update_attribute :status, STATUS_FROZEN\n end",
"def use_openstruct(use_openstruct)\n @@use_openstruct = use_openstruct\n end",
"def able_to_set_updated_at?\n !frozen? && !timeless? && (new_record? || changed?)\n end",
"def freeze\n @hash.freeze\n end",
"def can_be_dumped_as_copy?(object)\n begin\n copy = object.class.allocate\n Marshal.dump(copy)\n true\n rescue StandardError\n false\n end\n end",
"def deep_freeze!\n replace deep_thaw.deep_freeze\n end",
"def can_be_fully_dumped?(object)\n begin\n Marshal.dump(object)\n true\n rescue TypeError, IOError\n false\n end\n end",
"def convert_to_openstruct?(options) # :nodoc:\n @@use_openstruct ? Options.new(options) : options\n end",
"def freeze; end",
"def packed?\n @packed\n end",
"def ==(other)\n return false unless(other.kind_of?(OpenStruct))\n return @__table__ == other.table\n end",
"def freeze\n unless frozen?\n @left.freeze\n @middle.freeze\n @right.freeze\n @frozen = true\n end\n self\n end",
"def stale?(thing)\n not fresh?(thing)\n end",
"def cell_asset_frozen(state)\n\t\t@cellAssets_frozen[state]\n\tend",
"def writable_real?() end",
"def owned?\n locked? && @object.size == @uuid.size && @object.download.read == @uuid\n end",
"def main\n #\n # Any object may be frozen by calling its freeze() method. A frozen object\n # becomes immutable. Once frozen, there is no way to \"thaw\" an object.\n #\n s = \"ice\"\n s.freeze\n puts s.frozen?\n #s.upcase! # TypeError: can't modify frozen string; uncomment to test\n \n #\n # An object may be marked as tainted by calling its taint() method. Once an\n # object is tainted, any objects derived from it will also be tainted.\n # Copies of tainted objects made with clone() and dup() remain tainted.\n # A tainted object may be untainted with the untaint() method.\n #\n s = \"untrusted\"\n s.taint\n puts s.tainted?\n puts s.upcase.tainted?\n \n #\n # clone() and dup() return a shallow copy of the object on which they are invoked.\n # Classes can also override the clone and dup methods directly to produce\n # any kind of copy they desire.\n # clone() copies both the frozen and tainted state of an object, where as dup()\n # only copies the tainted state; calling dup on a frozen object returns\n # an unfrozen copy.\n #\n t = \"test\"\n t.taint\n t.freeze\n c = t.clone\n d = t.dup\n puts c.frozen?\n puts c.tainted?\n puts d.frozen?\n puts d.tainted?\nend",
"def clone(freeze: T.unsafe(nil)); end",
"def freeze\n attributes.freeze\n end",
"def readonly?\n raise \"Not yet implemented\"\n end",
"def stable\n self[:draft] == false && self[:prerelease] == false\n end",
"def plain_old_ruby_object\n\t\treturn false\n\tend",
"def freeze\n @attributes.freeze; self\n end",
"def freeze\n @attributes.freeze; self\n end",
"def attributes_available?\n @opened ? (@attr_dbf ? true : false) : nil\n end",
"def nullable?\n mode == \"NULLABLE\"\n end",
"def freeze\n @deserialization_map.freeze\n @serialization_map.freeze\n @serialization_module.freeze if @serialization_module\n\n super\n end",
"def deep_freeze(value)\n case value\n when Numeric, Symbol, TrueClass, FalseClass, NilClass\n # These are immutable values, we can safely ignore them\n value\n when String\n value.dup.freeze\n when Array\n value.map do |entry|\n deep_freeze(entry)\n end.freeze\n when Hash\n value.inject({}) do |hash, (key, value)|\n hash[deep_freeze(key)] = deep_freeze(value)\n hash\n end.freeze\n else\n raise DeepFreezeError, \"Cannot deep freeze #{value}:#{value.class}\"\n end\n end",
"def notCached(obj)\n n = @cache[obj]\n if n\n whdr TYPE_CREF, n\n false\n else\n # Check stream mode, bin and strings only\n unless @stream_mode\n @cache[obj] = @cache.length\n end\n true\n end\n end",
"def initialize_state?(object); end",
"def freeze\n @candidate.freeze\n @io_corr.freeze\n end",
"def observe\n return (@attributes & 0x20 == 0x20)\n end",
"def !\n !__getobj__\n end",
"def binary?\n @kind == :binary\n end",
"def readonly?() \n return true\n end",
"def dirty?\n return !self.headers.first(:name => :dirty).nil?\n end",
"def ==(other)\n return false unless other.kind_of?(OpenStruct)\n @table == other.table\n end",
"def writeable?(off); Ragweed::Wrap32::writeable? @h, off; end",
"def binary_required?\n @binary_required\n end",
"def frozen?(file)\n file.words.at(file.content_offset + offset + size - 1) == end_marker\n end",
"def freeze\n @attributes.freeze\n self\n end",
"def binary?\n @binary\n end",
"def fresh?\n not stale?\n end",
"def undumpable?(object)\n !can_be_fully_dumped?(object) && !can_be_dumped_as_copy?(object)\n end",
"def detached?\n @obj.nil?\n end",
"def detached?\n @obj.nil?\n end",
"def immutable?\n !mutable?\n end",
"def binary? # :nodoc:\n false\n end",
"def outdated?(obj)\n outdatedness_reasons_for(obj).any?\n end",
"def new_ostruct_member(name)\n name = name.to_sym\n unless singleton_class.method_defined?(name)\n define_singleton_method(name) { @table[name] }\n define_singleton_method(\"#{name}=\") do |x|\n raise TypeError, \"can't modify frozen #{self.class}\", caller(10) if self.frozen?\n modifiable[name] = x\n end\n end\n name\n end",
"def readonly?\n return true\n end",
"def mutable?\n writable?\n end",
"def dirty?(object)\n state(object).transient? || mapper.dirty?(object)\n end",
"def bare?\n return (bare == true)\n end",
"def initialized?\n !(version.zero?)\n end",
"def estConsomable()\n\t\treturn false\n\tend",
"def locked?\n fetch_lock_info\n\n obj_exists_and_is_not_type? obj: @lock_info, type: []\n end"
] |
[
"0.7536829",
"0.7536829",
"0.7390689",
"0.7390689",
"0.7390689",
"0.7362908",
"0.7353042",
"0.73066247",
"0.7267572",
"0.7050422",
"0.6852889",
"0.6750952",
"0.66789526",
"0.6669021",
"0.64821494",
"0.6469455",
"0.64513123",
"0.6421969",
"0.64070344",
"0.636914",
"0.6222742",
"0.6107256",
"0.61053157",
"0.6074999",
"0.59523034",
"0.5945559",
"0.5900251",
"0.5791063",
"0.5738424",
"0.56486547",
"0.5647494",
"0.5628914",
"0.5596626",
"0.5554298",
"0.5503733",
"0.5503605",
"0.5496913",
"0.54542327",
"0.54442537",
"0.54442537",
"0.54388523",
"0.5421708",
"0.5421708",
"0.54186213",
"0.5393444",
"0.53891146",
"0.53800565",
"0.53705525",
"0.535504",
"0.533853",
"0.53286064",
"0.5309791",
"0.53012705",
"0.5271271",
"0.5261939",
"0.52604777",
"0.5254457",
"0.5251218",
"0.52485484",
"0.5246304",
"0.5229385",
"0.5228924",
"0.52283067",
"0.52238053",
"0.5211725",
"0.520484",
"0.520484",
"0.5198283",
"0.51895195",
"0.5188392",
"0.51848865",
"0.5183148",
"0.51823694",
"0.5181681",
"0.5164158",
"0.5163714",
"0.5163338",
"0.5162759",
"0.51518846",
"0.5148331",
"0.5142462",
"0.5136904",
"0.51319426",
"0.5123969",
"0.51109654",
"0.51086634",
"0.5107922",
"0.50885683",
"0.50885683",
"0.508443",
"0.5083429",
"0.50513005",
"0.5047656",
"0.5044906",
"0.50431114",
"0.50407267",
"0.50334513",
"0.5020941",
"0.50194424",
"0.5013309"
] |
0.6607275
|
14
|
Is the OpenStruct void of entries?
|
def empty?
@table.empty?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def struct?\n is_struct\n end",
"def record?\n type == \"RECORD\" || type == \"STRUCT\"\n end",
"def _rh_struct_changing_ok?(result, key, data)\n return true unless [Array, Hash].include?(data[key].class) ||\n [Array, Hash].include?(result[key].class)\n\n # result or value are structure (Hash or Array)\n if result.is_a?(Hash)\n control = result[:__struct_changing]\n else\n control = result[0][:__struct_changing]\n key -= 1\n end\n return true if control.is_a?(Array) && control.include?(key)\n\n false\n end",
"def isStructType(obj)\n return ( obj.kind_of? FFI::Struct)\n end",
"def void?\n self.class == Sequence and empty?\n end",
"def checkEntry(entry)\n if entry then\n if entry.getDef == Def.VOID\n return entry\n end\n end\n nil\n end",
"def empty?\n @pointer >= @enum.size\n end",
"def writeable?(off); Ragweed::Wrap32::writeable? @h, off; end",
"def unknow\r\n return false unless unknow?\r\n @unknow.shift\r\n end",
"def operation_produces_immutable_object?(param0 = T.unsafe(nil)); end",
"def valid?(struct)\n return true if whitelisted_value?(struct)\n\n struct.is_a?(Hash) && valid_struct?(struct)\n end",
"def unaligned?\n value == :none\n end",
"def valid?\n expected = {}\n\n count = 0\n self.each_unsafe do |k,v|\n return false if @data[k][2] != v\n count += 1\n end\n count == @data.count\n end",
"def valid?\n return (@kind != ACTNone)\n end",
"def mmap?\n @m.nil? == false\n end",
"def defensive\n return (@attributes & 0x10 == 0x10)\n end",
"def object_dtype?\n dtype == :object\n end",
"def make_object?(element)\n element && !HappyMapper::Item::Types.include?(element.type)\n end",
"def complete?\n @bytes == [[0, @length - 1, true]]\n end",
"def is_key_entry(aliaz)\n\n end",
"def is_ok ( addr )\n\tindex = addr - @base\n\treturn true if @map[index] == \"X\"\n\treturn true if @map[index] == \"I\"\n\treturn false\n end",
"def improper_pair?\n @cdr != NULL\n end",
"def has_return_value?\n @return_value.type != VoidType\n end",
"def valid?(entry)\n true\n end",
"def full?\n flags & 0x2 == 0x2\n end",
"def empty?\n @structure.empty?\n end",
"def entry?\n true\n end",
"def size?() end",
"def observe\n return (@attributes & 0x20 == 0x20)\n end",
"def atom?(object)\n ! pair?(object)\nend",
"def instruction?\n not elements.select { |e| e.respond_to?(:to_bin) }.empty?\n end",
"def empty?\n @h.empty?\n end",
"def verify#todo\n #if its a fault, then its a no for sure\n #otherwise make sure all the fields are the right type, and are initialized etc\n true\n end",
"def binary?\n @kind == :binary\n end",
"def bool\n i8u != 0\n end",
"def possible?\n entries.size > 1\n end",
"def any_fields?\n num_fields.positive?\n end",
"def has_destroy_flag?(hash)\n ActiveFedora::Type::Boolean.new.cast(hash['_destroy'])\n end",
"def release? key=:any\n return @data.include? :up if key == :any\n @data[key] == :up\n end",
"def has_to_data?\n @types.any? { |type| type.has_to_data? }\n end",
"def specialization(e, a)\n case e\n when PStructType\n a.is_a?(PHashType)\n when PTupleType\n a.is_a?(PArrayType)\n else\n false\n end\n end",
"def has_destroy_flag?( hash )\n ActiveFedora::Type::Boolean.new.cast( hash['_destroy'] )\n end",
"def aligned_ok(size)\n (size & (2 * size_t - 1)).zero?\n end",
"def ac_has_src(file_hash, pc)\n\tfile_hash.each do |filename, debug_line_arr|\n\t\tdebug_line_arr.each do |line_info|\n\t\t\tif Integer(line_info.pc) == Integer('0x' + pc)\n\t\t\t\tfinal_tuple = OpenStruct.new\n\t\t\t\tfinal_tuple.pc = pc\n\t\t\t\tfinal_tuple.filename = line_info.filename\n\t\t\t\tfinal_tuple.row = line_info.row\n\t\t\t\tfinal_tuple.gray = line_info.gray\n\t\t\t\treturn true, final_tuple\n\t\t\tend\t\n\t\tend\n\tend\n\t# Not found\n\tfinal_tuple = OpenStruct.new\n\tfinal_tuple.pc = pc\n\tfinal_tuple.filename = nil\n\tfinal_tuple.row = nil\n\tfinal_tuple.gray = nil\n\treturn false, final_tuple \nend",
"def verify_fields(fbe_struct_size)\n fbe_current_size = 4 + 4\n\n if (fbe_current_size + id.fbe_size) > fbe_struct_size\n return true\n end\n unless id.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += id.fbe_size\n\n if (fbe_current_size + symbol.fbe_size) > fbe_struct_size\n return true\n end\n unless symbol.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += symbol.fbe_size\n\n if (fbe_current_size + side.fbe_size) > fbe_struct_size\n return true\n end\n unless side.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += side.fbe_size\n\n if (fbe_current_size + type.fbe_size) > fbe_struct_size\n return true\n end\n unless type.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += type.fbe_size\n\n if (fbe_current_size + price.fbe_size) > fbe_struct_size\n return true\n end\n unless price.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += price.fbe_size\n\n if (fbe_current_size + volume.fbe_size) > fbe_struct_size\n return true\n end\n unless volume.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += volume.fbe_size\n\n true\n end",
"def kind_of?(p0) end",
"def has_destroy_flag?(hash)\n ActiveFedora::Type::Boolean.new.cast(hash['_destroy'])\n end",
"def has_destroy_flag?(hash)\n ActiveFedora::Type::Boolean.new.cast(hash['_destroy'])\n end",
"def member?(p0) end",
"def member?(p0) end",
"def member?(p0) end",
"def full?\n !@state.include?(nil)\n end",
"def unnamed?\n @keys == nil\n end",
"def empty?\n @info.empty?\n end",
"def empty?\n @info.empty?\n end",
"def empty?\n @info.empty?\n end",
"def empty?\n @info.empty?\n end",
"def has_interesting_events?\n has_structure_updates? || has_event_propagation_updates?\n end",
"def has_interesting_events?\n has_structure_updates? || has_event_propagation_updates?\n end",
"def isUnionType(obj)\n return obj.kind_of? FFI::Union\n end",
"def my_none?\n if self.class == Array\n my_each do |value|\n # stop if any item is true\n return false if yield(value)\n end\n elsif self.class == Hash\n my_each do |key, value|\n # stop if any item is true\n return false if yield(key, value)\n end\n end\n\n true\n end",
"def has_fields?\n num_fields > 0\n end",
"def check_eof( row )\n @eof = !row.has_key?( :row )\n end",
"def should_call_to_h?(value)\n value.respond_to?(:to_h) && !value.kind_of?(Array)\n end",
"def respond_to?( sym )\n\t\treturn true if @struct.member?( sym.to_s.sub(/(=|\\?)$/, '') )\n\t\tsuper\n\tend",
"def any?\n inserted > 0\n end",
"def do_not_wrap?(node)\n node.ignored? ||\n (node.moved_to && node.moved_to != self.code) ||\n !node.public? ||\n (node.is_a?(RbGCCXML::Struct) && node.incomplete?) ||\n node.is_a?(RbGCCXML::FundamentalType)\n end",
"def exists?\n data != {}\n end",
"def is_struct_type?(type)\n return type.kind_of? Array\n end",
"def dirty?\n flags & 0x1 == 0x1\n end",
"def event?\n entry_type == :event\n end",
"def eof?()\n #This is a stub, used for indexing\n end",
"def locode_data?(row)\n !row[2].nil?\n end",
"def complete?\r\n cur_values.all{ |value| value!=nil }\r\n end",
"def fireplace_present?\n $structures.any?{|structure| structure.is_a? Fireplace }\n end",
"def null?(record)\n type.nullable? && record[:header][:field_nulls][position]\n end",
"def missing_check v \n v.one_of_type? Hash, LinkSpec\n end",
"def info_only\n if @type == RECORD\n @changed_records.all? { |r| r.type == RecordChange::IGNORED }\n else\n false\n end\n end",
"def has_destroy_flag?(hash)\n Type::Boolean.new.cast(hash['_destroy'])\n end",
"def multi_arged?\n !first.is_a?(Hash) && first.resizable? || size > 1\n end",
"def data?\n dis_data.any?\n end",
"def map_field?(field_descriptor)\n (field_descriptor.label == :repeated) &&\n (field_descriptor.subtype.name.include? '_MapEntry_')\n end",
"def isPointerType(obj)\n return ( obj.kind_of? FFI::Pointer or obj.kind_of? NiceFFI::TypedPointer )\n end",
"def primitive?\n false\n end",
"def verify_fields(fbe_struct_size)\n fbe_current_size = 4 + 4\n\n if (fbe_current_size + id.fbe_size) > fbe_struct_size\n return true\n end\n unless id.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += id.fbe_size\n\n if (fbe_current_size + name.fbe_size) > fbe_struct_size\n return true\n end\n unless name.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += name.fbe_size\n\n if (fbe_current_size + state.fbe_size) > fbe_struct_size\n return true\n end\n unless state.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += state.fbe_size\n\n if (fbe_current_size + wallet.fbe_size) > fbe_struct_size\n return true\n end\n unless wallet.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += wallet.fbe_size\n\n if (fbe_current_size + asset.fbe_size) > fbe_struct_size\n return true\n end\n unless asset.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += asset.fbe_size\n\n if (fbe_current_size + orders.fbe_size) > fbe_struct_size\n return true\n end\n unless orders.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += orders.fbe_size\n\n true\n end",
"def pointer?; false; end",
"def recognized?\n return !self.etypes.empty?\n end",
"def pair?\n !null?\n end",
"def unprocessable?\n dump_type != PROCESSABLE_EVENT_TYPE\n end",
"def object_type?\n !value_type?\n end",
"def my_all?\n if self.class == Array\n my_each do |value|\n # stop if item is flagged\n return false unless yield(value)\n end\n elsif self.class == Hash\n my_each do |key, value|\n return false unless yield(key, value)\n end\n end\n true\n end",
"def aligned?\n\t\treturn true if clear?\n\t\t\n\t\t!self.any? { |event_id, state|\n\t\t\tDungeon_Crawler.dungeon.event_hash[event_id].state != state\n\t\t}\n\tend",
"def complete?\n keys.all?(&:complete?)\n end",
"def _isLoadableMember(attr)\n return ( (not attr.nil?) and (isPointerType(attr) and # ( Haystack.hasRef?(attr.class) ) and\n not isFunctionType(attr) ) or\n isStructType(attr) or isCStringPointer(attr) or\n (isArrayType(attr) and not isBasicTypeArrayType(attr) ) ) # should we iterate on Basictypes ? no\n end",
"def any?\n raw? || stored?\n end",
"def atom?(a)\n a.class != Cons\nend",
"def primitive?\n false\n end",
"def tuple_valued?()\n @definition.type.named_type?\n end",
"def stored?\n !attributes['e_tag'].nil?\n end",
"def healthy?() raw && raw.is_a?(Hash) end",
"def no_subfields?(**args)\n !any_subfields(args)\n end"
] |
[
"0.61902076",
"0.60318637",
"0.5858741",
"0.57617694",
"0.56618524",
"0.5648251",
"0.56193864",
"0.5518154",
"0.5501217",
"0.5436818",
"0.54151493",
"0.5414562",
"0.5376465",
"0.53686726",
"0.5365158",
"0.53529996",
"0.53336716",
"0.5330013",
"0.53024656",
"0.5302391",
"0.52994543",
"0.5268973",
"0.5268486",
"0.526142",
"0.5227531",
"0.52239037",
"0.52143115",
"0.5214056",
"0.5212601",
"0.52053654",
"0.5192904",
"0.51738304",
"0.5165385",
"0.51629657",
"0.51607746",
"0.51539034",
"0.5136549",
"0.5124631",
"0.5115666",
"0.510567",
"0.5103254",
"0.50995487",
"0.5078866",
"0.5074968",
"0.5073683",
"0.50723845",
"0.5066402",
"0.5066402",
"0.5058316",
"0.5058316",
"0.5058316",
"0.50482327",
"0.5047421",
"0.5046473",
"0.5046473",
"0.5046473",
"0.5046473",
"0.5038692",
"0.5038692",
"0.5037805",
"0.50349176",
"0.50348216",
"0.5031832",
"0.50301754",
"0.50217974",
"0.50199324",
"0.5019398",
"0.5018085",
"0.5015144",
"0.5009847",
"0.50066453",
"0.5005084",
"0.50049615",
"0.5004153",
"0.5002037",
"0.49965772",
"0.49952376",
"0.49920633",
"0.49903622",
"0.49865574",
"0.49856496",
"0.49836957",
"0.4980875",
"0.49801874",
"0.497804",
"0.49734426",
"0.49650976",
"0.4962864",
"0.49620983",
"0.4958788",
"0.4957681",
"0.49522698",
"0.49500492",
"0.4948118",
"0.49451682",
"0.49426976",
"0.4942695",
"0.49418548",
"0.49384183",
"0.49372488",
"0.49356893"
] |
0.0
|
-1
|
Two OpenStructs are equal if they are the same class and their underlying tables are equal.
|
def eql?(other)
return false unless(other.kind_of?(__class__))
return @table == other.table #to_h
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def ==(other)\n return false unless(other.kind_of?(OpenStruct))\n return @__table__ == other.table\n end",
"def ==(other)\n return false unless other.kind_of?(OpenStruct)\n @table == other.table\n end",
"def eql?(other)\n return false unless other.kind_of?(OpenStruct)\n @table.eql?(other.table)\n end",
"def ==(other)\n if !other.is_a?(Mimi::Core::Struct) && !other.is_a?(Hash)\n raise TypeError, \"Cannot compare Mimi::Core::Struct and #{other.class}\"\n end\n other_as_hash = other.is_a?(Hash) ? other : other.to_h\n self.to_h == other_as_hash\n end",
"def ==(other)\n return false unless(other.kind_of?(__class__))\n return @table == other.table #to_h\n end",
"def == other\n self.class == other.class and\n self.name == other.name and\n self.rw == other.rw and\n self.singleton == other.singleton\n end",
"def lane_equal other_sample\n [:genome, :protocol].each do |lane_data|\n # puts \"#{self.send(lane_data)}\"\n if self.send(lane_data) != other_sample.send(lane_data)\n return false\n end\n end\n true\n end",
"def ==(other)\n return false if self.class.to_s != other.class.to_s\n return pkeys() == other.pkeys()\n end",
"def ==(other)\n self.class == other.class &&\n self.attributes == other.attributes\n end",
"def eql?(other)\n self.class === other and @version == other._version\n end",
"def eql?(other)\n self.class === other and @version == other._version\n end",
"def bt_same_snapshot?(other)\n bt_snapshot_attributes == other.bt_snapshot_attributes\n end",
"def ==(other)\n return false unless self.class == other.class\n self.attributes == other.attributes\n end",
"def eql?(other)\n return false unless self.class == other.class\n self.key_attributes == other.key_attributes\n end",
"def __class__\n OpenStruct2\n end",
"def ==(other)\n self.class == other.class &&\n attributes == other.attributes\n end",
"def ==(other)\n self.class==other.class && self.hash==other.hash\n end",
"def eql? other\n self.class === other and @version == other.version\n end",
"def eql?(other)\n self.class === other and @version == other.version\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n class_id == o.class_id &&\n object_type == o.object_type &&\n accessibility_summary == o.accessibility_summary &&\n data_block_size == o.data_block_size &&\n host_mount_status == o.host_mount_status &&\n in_use == o.in_use &&\n kind == o.kind &&\n last_access_time == o.last_access_time &&\n last_modified_time == o.last_modified_time &&\n mount_status == o.mount_status &&\n mount_summary == o.mount_summary &&\n provisioned_capacity == o.provisioned_capacity &&\n provisioned_volume_capacity_utilization == o.provisioned_volume_capacity_utilization &&\n type == o.type &&\n un_compressed_used_bytes == o.un_compressed_used_bytes &&\n uuid == o.uuid &&\n volume_count == o.volume_count &&\n cluster == o.cluster &&\n volumes == o.volumes\n end",
"def eql?(other)\n self.class.eql?(other.class) &&\n @primary_keys == other.primary_keys &&\n @columns == other.columns &&\n @with == other.with\n end",
"def eql?(rhs_)\n rhs_.equal?(self) ||\n rhs_.is_a?(Structure) &&\n @parent.eql?(rhs_.instance_variable_get(:@parent)) &&\n @indexes.eql?(rhs_.instance_variable_get(:@indexes))\n end",
"def ==(other)\n @klass == other.class && @attributes == strip_active_record(other)\n end",
"def ==(other)\n return false if !other\n data == other.data && version == other.version\n end",
"def == other\n if other.respond_to? :headings and other.respond_to? :rows\n headings == other.headings and rows == other.rows\n end\n end",
"def equal?(other)\n other.respond_to?(:mol) && mol.equal?(other.mol) && id == other.id \n end",
"def eql?(other)\n if (astVal.class == CTObject)\n data = Marshal.dump(astVal.rawObject)\n dataOther = Marshal.dump(other.astVal.rawObject)\n return data.eql?(dataOther)\n elsif(astVal.class == PartialObject && self.name != Helpers.selfIdentifier)\n #check only the compile time vars in the store of the partial object.\n astVal.store.eql?(other.astVal.store)\n else\n true\n end\n end",
"def ==(other)\n # TODO: This can be made faster by\n # comparing hashes for stored objects.\n other.read == read\n end",
"def ==(other)\n return false unless other\n return false unless @table.size == other.size\n @table.each do |k,v|\n return false unless other[k] == v\n end\n true\n end",
"def ==(other)\n @klass == other.klass && @version == other.version && @timestamp == other.timestamp\n end",
"def eql?(other)\n other.class == self.class &&\n other.logical_path == self.logical_path &&\n other.mtime.to_i == self.mtime.to_i &&\n other.digest == self.digest\n end",
"def ==(other) # :nodoc:\n @attrs == other.attrs\n end",
"def eql?(other)\n other.is_a?(JiakSchema) &&\n compare_fields(@allowed_fields,other.allowed_fields) &&\n compare_fields(@required_fields,other.required_fields) &&\n compare_fields(@read_mask,other.read_mask) &&\n compare_fields(@write_mask,other.write_mask)\n end",
"def ==(rhs_)\n if rhs_.equal?(self)\n true\n elsif rhs_.is_a?(Structure)\n rhs_indexes_ = rhs_.instance_variable_get(:@indexes)\n if rhs_indexes_.size == @indexes.size\n rhs_indexes_.each_with_index do |rhs_ai_, i_|\n lhs_ai_ = @indexes[i_]\n return false unless lhs_ai_.axis_object == rhs_ai_.axis_object && lhs_ai_.axis_name == rhs_ai_.axis_name\n end\n return true\n end\n false\n else\n false\n end\n end",
"def eql?(other)\n self.class.equal?(other.class) && cells == other.cells\n end",
"def ==(other)\n other.kind_of?(self.class) &&\n @name == other.name && @columns == other.columns && @unique == other.unique?\n end",
"def == other\n return false if other == nil\n if other.is_a?(Universa::HashId)\n super\n else\n if other.size == 96\n bytes == other\n else\n to_s == other\n end\n end\n end",
"def eql?(other)\n return false unless other.captures_hash == captures_hash\n return false unless other.squares_hash == squares_hash\n return false unless other.turn == turn\n return false unless other.state == state\n\n true\n end",
"def ===(other)\n required = self.class.required_attributes\n\n other.respond_to?(:keys) && (common = other.keys & required) &&\n common.size == other.keys.size && common.size == required.size\n end",
"def ==(other)\n return false if other.class != self.class\n attr_hash == other.attr_hash\n end",
"def eql?(other)\n self.class == other.class && rows == other.rows\n end",
"def eql?(other)\n instance_of?(other.class) && name == other.name && imports == other.imports\n end",
"def == other\n return @hash == other.hash if other.class <= Blobject\n return @hash == other if other.class <= Hash\n super\n end",
"def test_column_names_equals_of_class_table_schema_difference\n namesABC = %w(columnA columnB columnC)\n [\n [[] , [] , true ],\n [%w(id) , %w(id) , true ],\n [namesABC, %w(columnA columnB columnC), true ],\n [namesABC, %w(columnA columnB columnD), false],\n [namesABC, %w(columnI columnB columnC), false],\n ].each do |column_names1, column_names2, expected|\n table_schema1 = make_table_schema_mock(column_names1)\n table_schema2 = make_table_schema_mock(column_names2)\n ts_diff = TableSchemaDifference.new(table_schema1, table_schema2)\n assert_equal(expected, ts_diff.column_names_equals?, \"TableSchemaDifference#column_names_equals?\")\n end\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n apm_scanned_bytes == o.apm_scanned_bytes &&\n events_scanned_bytes == o.events_scanned_bytes &&\n hour == o.hour &&\n logs_scanned_bytes == o.logs_scanned_bytes &&\n org_name == o.org_name &&\n public_id == o.public_id &&\n rum_scanned_bytes == o.rum_scanned_bytes &&\n total_scanned_bytes == o.total_scanned_bytes\n end",
"def ==(other)\n return false unless other.kind_of?(ObjectifiedSessions::FieldDefinition)\n session_class == other.send(:session_class) && name == other.name && storage_name == other.storage_name &&\n type == other.send(:type) && visibility == other.send(:visibility)\n end",
"def ==(other)\n other.is_a?(Chunk) &&\n other.name == self.name &&\n other.size == self.size &&\n other.header == self.header &&\n other.data == self.data\n end",
"def ==(other)\n return false unless other.is_a?(Binary)\n\n type == other.type && data == other.data\n end",
"def ==(other)\n case other\n when Osgb::Point\n other = other.transform_to(self.datum) unless other.datum == self.datum\n self.lat == other.lat && self.lng == other.lng && self.datum == other.datum\n when Array\n self.to_a == other\n when String\n self == other.to_latlng(:datum => self.datum) # serves to normalise string representation\n end\n end",
"def ==(other)\n return true if self.equal?(other)\n self.class == other.class &&\n file_info == other.file_info &&\n output_path == other.output_path &&\n encoding == other.encoding &&\n recognize_lists == other.recognize_lists &&\n leading_spaces == other.leading_spaces &&\n trailing_spaces == other.trailing_spaces &&\n enable_pagination == other.enable_pagination\n end",
"def == (other)\n return true if self.equal?(other)\n return false if self.class != other.class\n self.class.fields.all? { |f| self.field_get(f) == other.field_get(f) }\n end",
"def eql?(other)\n return false if (other.nil? or self.class != other.class)\n ova = other.instance_variables\n iv = instance_variables\n return false if ova.size != iv.size\n iv.each do |vid|\n return false if instance_variable_get(vid) != other.instance_variable_get(vid)\n end\n true\n end",
"def ==(other)\n return false unless other.instance_of? self.class\n attributes == other.attributes\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n save_format == o.save_format &&\n lookup_paths == o.lookup_paths &&\n file_name == o.file_name &&\n file_format == o.file_format &&\n show_grid == o.show_grid &&\n show_rulers == o.show_rulers &&\n show_ui == o.show_ui &&\n orientation_box == o.orientation_box &&\n up_vector == o.up_vector &&\n far_plane == o.far_plane &&\n near_plane == o.near_plane &&\n look_at == o.look_at &&\n camera_position == o.camera_position &&\n field_of_view == o.field_of_view\n end",
"def ==(other)\n self.type == other.type && self.row == other.row && self.key == other.key && self.value == other.value\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n self_uri == o.self_uri &&\n alternate_links == o.alternate_links &&\n index == o.index &&\n orientation == o.orientation &&\n size == o.size &&\n type == o.type &&\n shape == o.shape\n end",
"def ==(other)\n self.attributes == (other.respond(:attributes) || {} )\n end",
"def ==(other)\n self.class == other.class &&\n longitude == other.longitude &&\n latitude == other.latitude &&\n elevation == other.elevation &&\n time == other.time\n end",
"def == other\n return ((other.mapname == @mapname) and (other.map == @map))\n end",
"def eql?(other)\n return false unless other.class == self.class\n\n return identity == other.identity &&\n attributes == other.attributes &&\n session == other.session\n end",
"def ==(other)\n return false if other.nil? || !other.respond_to?(:attributes)\n attributes == other.attributes\n end",
"def eql?(p0) end",
"def eql?(p0) end",
"def eql?(p0) end",
"def eql?(p0) end",
"def eql?(p0) end",
"def eql?(p0) end",
"def eql?(p0) end",
"def ==(other)\n info == other.info rescue false\n end",
"def eql?(other)\n return false unless other.respond_to?(:coords)\n equal = true\n self.coords.each_with_index do |c, i|\n if (c - other.coords.to_a[i])**2 > PRECISION\n equal = false\n break\n end\n end\n equal\n end",
"def ==(other)\n return true if self.equal?(other)\n self.class == other.class &&\n page_size == other.page_size &&\n field_labels == other.field_labels &&\n date_time_format == other.date_time_format &&\n time_zone_offset == other.time_zone_offset\n end",
"def ==(other)\n pointer == other.pointer\n rescue NoMethodError\n super\n end",
"def ==(other)\n return false if other.nil?\n return false unless self.name == other.name\n return false unless Array.wrap(self.columns).collect(&:to_s).sort == Array.wrap(other.columns).collect(&:to_s).sort\n return false unless !!self.unique == !!other.unique\n return false unless Array.wrap(self.lengths).compact.sort == Array.wrap(other.lengths).compact.sort\n return false unless self.conditions == other.conditions\n return false unless self.expression == other.expression\n return false unless self.kind == other.kind\n return false unless self.operator_classes == other.operator_classes\n return false unless !!self.case_sensitive? == !!other.case_sensitive?\n true\n end",
"def eql?(other)\n self.class.eql?(other.class) &&\n self._name.eql?(other._name) &&\n self._type.eql?(other._type) &&\n self._klass.eql?(other._klass)\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n height == o.height &&\n id == o.id &&\n is_mobile == o.is_mobile &&\n name == o.name &&\n width == o.width\n end",
"def eql?(ct); end",
"def eql?(ct); end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n class_id == o.class_id &&\n object_type == o.object_type &&\n block_size == o.block_size &&\n bootable == o.bootable &&\n configuration_checkpoint == o.configuration_checkpoint &&\n configuration_state == o.configuration_state &&\n discovered_path == o.discovered_path &&\n disk_id == o.disk_id &&\n disk_state == o.disk_state &&\n drive_firmware == o.drive_firmware &&\n drive_state == o.drive_state &&\n fde_capable == o.fde_capable &&\n hot_spare_type == o.hot_spare_type &&\n link_speed == o.link_speed &&\n link_state == o.link_state &&\n num_blocks == o.num_blocks &&\n oper_power_state == o.oper_power_state &&\n oper_qualifier_reason == o.oper_qualifier_reason &&\n operability == o.operability &&\n physical_block_size == o.physical_block_size &&\n pid == o.pid &&\n protocol == o.protocol &&\n raw_size == o.raw_size &&\n secured == o.secured &&\n size == o.size &&\n thermal == o.thermal &&\n type == o.type &&\n variant_type == o.variant_type &&\n inventory_device_info == o.inventory_device_info &&\n locator_led == o.locator_led &&\n physical_disk_extensions == o.physical_disk_extensions &&\n registered_device == o.registered_device &&\n running_firmware == o.running_firmware &&\n sas_ports == o.sas_ports &&\n storage_controller == o.storage_controller &&\n storage_enclosure == o.storage_enclosure\n end",
"def eql?( other )\n\t\treturn false unless other.class.eql?( self.class )\n\t\treturn self.hash == other.hash\n\tend",
"def eql?(other)\n self.equal?(other) ||\n (self.class.eql?(other.class) &&\n self.datatype.eql?(other.datatype) &&\n self == other)\n end",
"def ==(other)\n return false unless self.class === other\n other.row == @row &&\n other.column == @column &&\n other.status == @status\n end",
"def eql?(other)\n return false if (other.nil? or self.class != other.class)\n return false unless super(other)\n return false unless self.attributes == other.attributes\n return false unless self.nodes == other.nodes\n true\n end",
"def == other\n if other.respond_to? :render and other.respond_to? :rows\n self.headings == other.headings and self.rows == other.rows\n end\n end",
"def eql?(rhs_)\n self.equal?(rhs_) ||\n rhs_.is_a?(Table) &&\n @structure.eql?(rhs_.structure) && @parent.eql?(rhs_.parent) &&\n rhs_.instance_variable_get(:@offset) == @offset &&\n rhs_.instance_variable_get(:@vals).eql?(@vals)\n end",
"def ==(other)\n attributes == other.attributes\n end",
"def ==(other)\n return false unless other.is_a? SparseMatrix\n return false unless self.internalRepItemCount == other.internalRepItemCount\n self.each_with_index {|index,val|\n return false unless other[index] == val\n }\n end",
"def objects_equal?(x, y)\n if x.nil?\n y.nil?\n elsif y.nil?\n nil\n elsif x.is_a?(Hash)\n return nil unless y.is_a?(Hash)\n return nil unless x.size == y.size\n x.each do|k, v|\n return nil unless objects_equal?(v, y[k])\n end\n true\n elsif x.is_a?(Array)\n return nil unless y.is_a?(Array)\n return nil unless x.size == y.size\n for i in 0..x.size\n return nil unless objects_equal?(x[i], y[i])\n end\n true\n else\n return nil if y.is_a?(Hash) || y.is_a?(Array)\n x == y\n end\n end",
"def ==(other); false; end",
"def == (other)\n Version.compare(self, other) == 0\n end",
"def ==(other)\n return false if other.class != self.class\n if @name != other.name ||\n @race != other.race ||\n @health != other.health ||\n @attributes != other.attributes ||\n @body_parts.length != other.body_parts.length ||\n @body_parts.each_with_index{|bp,i| bp == other.body_parts[i]}.include?(false) ||\n @statuses.length != other.statuses.length ||\n @statuses.each_with_index{|bp,i| bp == other.statuses[i]}.include?(false) #CK4, this and the prior line may not be ready for prime time\n return false\n end\n return true\n end",
"def eql?(other)\n other.class == self.class && other.members.eql?(self.members)\n end",
"def ==(other)\n return false if self.class != other.class\n fields.all? do |field|\n name = field[:name]\n instance_variable_get(name) ==\n other.instance_variable_get(name)\n end\n end",
"def == other\n self.class == other.class && self.name == other.name\n end",
"def union_compatible?(other)\n header == other.header\n end",
"def ==(other)\n\n return false if other.class != self.class\n self.h.fei == other.h.fei\n end",
"def eql?(other)\n return false if self.class != other.class\n self.to_hash == (other.respond_to?(:to_hash) ? other.to_hash : nil)\n end",
"def eql?(other)\n other.is_a?(self.class) && !self.class.comparison_attrs.find{|a| send(a) != other.send(a)}\n end",
"def == (other)\n @filas.times do |i|\n @columnas.times do |j|\n if at(i, j) != other.at(i,j)\n return false\n end\n end\n end\n \n return true\n end",
"def == (other)\n @filas.times do |i|\n @columnas.times do |j|\n if at(i, j) != other.at(i,j)\n return false\n end\n end\n end\n \n return true\n end",
"def ==(other)\n other.present? && self.attributes == other.attributes\n end"
] |
[
"0.76104766",
"0.7567616",
"0.7403301",
"0.64618784",
"0.61663723",
"0.5961068",
"0.5952073",
"0.5893045",
"0.58796304",
"0.5873959",
"0.5873959",
"0.58504134",
"0.58202946",
"0.58157176",
"0.5813757",
"0.5806541",
"0.57774997",
"0.5773605",
"0.57570875",
"0.57518107",
"0.5751434",
"0.5748731",
"0.57339567",
"0.5726773",
"0.5725562",
"0.5719118",
"0.5716337",
"0.5712814",
"0.5707539",
"0.5687638",
"0.5684395",
"0.56770164",
"0.5671968",
"0.5658198",
"0.565815",
"0.5641827",
"0.5640078",
"0.5635377",
"0.5633982",
"0.5632842",
"0.56267804",
"0.56232774",
"0.56232387",
"0.56230295",
"0.5622392",
"0.5620642",
"0.56197476",
"0.5612202",
"0.5609283",
"0.56077963",
"0.56076264",
"0.5588774",
"0.5570719",
"0.5570027",
"0.5567029",
"0.5566397",
"0.55518025",
"0.5549242",
"0.55470085",
"0.55432004",
"0.55352783",
"0.5532174",
"0.5532174",
"0.5532174",
"0.55316657",
"0.55316657",
"0.55316657",
"0.55316657",
"0.5531441",
"0.55290806",
"0.5525883",
"0.55246055",
"0.55225515",
"0.5521034",
"0.5517409",
"0.55169004",
"0.55169004",
"0.55073667",
"0.5507085",
"0.55020976",
"0.5500577",
"0.5495516",
"0.54848397",
"0.54843235",
"0.54826784",
"0.54825544",
"0.5481075",
"0.5467695",
"0.5465475",
"0.546121",
"0.5461049",
"0.54542893",
"0.5452043",
"0.54443586",
"0.54429555",
"0.5441074",
"0.54308146",
"0.54294515",
"0.54294515",
"0.54264015"
] |
0.62231433
|
4
|
Two OpenStructs are equal if they are the same class and their underlying tables are equal. TODO: Why not equal for other hash types, e.g. via to_h?
|
def ==(other)
return false unless(other.kind_of?(__class__))
return @table == other.table #to_h
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def ==(other)\n return false unless(other.kind_of?(OpenStruct))\n return @__table__ == other.table\n end",
"def ==(other)\n return false unless other.kind_of?(OpenStruct)\n @table == other.table\n end",
"def eql?(other)\n return false unless other.kind_of?(OpenStruct)\n @table.eql?(other.table)\n end",
"def ==(other)\n if !other.is_a?(Mimi::Core::Struct) && !other.is_a?(Hash)\n raise TypeError, \"Cannot compare Mimi::Core::Struct and #{other.class}\"\n end\n other_as_hash = other.is_a?(Hash) ? other : other.to_h\n self.to_h == other_as_hash\n end",
"def ==(other)\n self.class==other.class && self.hash==other.hash\n end",
"def eql?(other)\n return false unless(other.kind_of?(__class__))\n return @table == other.table #to_h\n end",
"def == other\n return false if other == nil\n if other.is_a?(Universa::HashId)\n super\n else\n if other.size == 96\n bytes == other\n else\n to_s == other\n end\n end\n end",
"def == other\n return @hash == other.hash if other.class <= Blobject\n return @hash == other if other.class <= Hash\n super\n end",
"def test_Hash_InstanceMethods_Equality\n\t\th1 = { 'a'=>1, 'c'=>2 }\n\t\th2 = { 7=>35, 'c'=>2, 'a'=>1 }\n\t\th3 = { 'a'=>1, 'c'=>2, 7=>35 }\n\t\th4 = { 'a'=>1, 'd'=>2, 'f'=>35 }\n\t\tassert_equal(false, h1 == h2)\n\t\tassert_equal(true, h2 == h3)\n\t\tassert_equal(false, h3 == h4)\n\tend",
"def ==(other)\n return false if self.class.to_s != other.class.to_s\n return pkeys() == other.pkeys()\n end",
"def ==(other)\n self.hash == other.hash\n end",
"def ==(other)\n self.to_hash == other.to_hash\n end",
"def eql?( other )\n\t\treturn false unless other.class.eql?( self.class )\n\t\treturn self.hash == other.hash\n\tend",
"def ==(other)\n if other&.respond_to?(:to_h)\n to_h == other.to_h\n elsif other.respond_to?(:to_hash)\n to_h == other.to_hash\n else\n false\n end\n end",
"def ==(other)\n hash == other.hash\n end",
"def ==(other)\n hash == other.hash\n end",
"def ==(other)\n self.to_hash == other.to_hash\n end",
"def eql?(other)\n @hash.hash == other.hash\n end",
"def eql?(other)\n return false if self.class != other.class\n self.to_hash == (other.respond_to?(:to_hash) ? other.to_hash : nil)\n end",
"def eql?(other)\n return false unless self.class == other.class\n self.key_attributes == other.key_attributes\n end",
"def ==(other)\n @hash == other.to_h\n end",
"def ==(other)\n return false unless other.class == self.class\n\n to_h == other.to_h\n end",
"def ==(other)\n other.respond_to?(:to_h) && other.to_h == to_h\n end",
"def ==(other)\n @hash == other.hash\n end",
"def same_byte_length?(hash1, hash2)\n hash1.to_s.length == hash2.to_s.length\n end",
"def eql?(other)\n @hash == other.hash\n end",
"def eql?(other)\n hash == other.hash\n end",
"def assert_hash_equals(map1, map2)\r\n if (map1.size != map2.size)\r\n diff = map1.keys - map2.keys\r\n p \">>> Diff #{diff.join(',')}\"\r\n p \">>> #{map1.keys.sort { |a,b| a.to_s <=> b.to_s }.join(',')}\"\r\n p \">>> #{map2.keys.sort { |a,b| a.to_s <=> b.to_s }.join(',')}\"\r\n assert_equal map1.size, map2.size, \"Maps are not the same size.\"\r\n end\r\n\r\n map1.each_pair do |k,v|\r\n assert_not_nil map2[k], \"Unable to find key '#{k}'\"\r\n v1 = map2[k]\r\n assert_not_nil v1, \"Unable to find value for key '#{k}'\"\r\n if ( v.size != v1.size )\r\n diff = v.keys - v1.keys\r\n p \">>> Diff #{diff.join(',')}\"\r\n p \">>> #{v.keys.sort { |a,b| a.to_s <=> b.to_s }.join(',')}\"\r\n p \">>> #{v1.keys.sort { |a,b| a.to_s <=> b.to_s }.join(',')}\" \r\n assert_equal v.size, v1.size, \"Attribute for #{k} maps are not the same size\"\r\n end\r\n v.each do |k,v|\r\n assert_not_nil v1[k], \"Unable to find attribute for key '#{k}'\"\r\n assert_equal v, v1[k], \"Attribute mismatch for key '#{k}'\"\r\n end \r\n end\r\n end",
"def eql?(other)\r\n\t\treturn hash == other.hash\r\n\tend",
"def ===(other)\n required = self.class.required_attributes\n\n other.respond_to?(:keys) && (common = other.keys & required) &&\n common.size == other.keys.size && common.size == required.size\n end",
"def ==(other)\n to_hash == other.to_hash\n end",
"def ==(other)\n to_hash == other.to_hash\n end",
"def test_same_hashes\r\n\t\ts = \"Addr1<Addr2(100):Addr3<Addr4(500)\"\r\n\t\ttb = Block.new(0,0,s,0.0,\"90a2\")\r\n\t\ttb.set_calculated_hash(\"90a2\")\r\n\t\t\r\n\t\tassert_equal(1, tb.compare_current_hash)\r\n\tend",
"def objects_equal?(x, y)\n if x.nil?\n y.nil?\n elsif y.nil?\n nil\n elsif x.is_a?(Hash)\n return nil unless y.is_a?(Hash)\n return nil unless x.size == y.size\n x.each do|k, v|\n return nil unless objects_equal?(v, y[k])\n end\n true\n elsif x.is_a?(Array)\n return nil unless y.is_a?(Array)\n return nil unless x.size == y.size\n for i in 0..x.size\n return nil unless objects_equal?(x[i], y[i])\n end\n true\n else\n return nil if y.is_a?(Hash) || y.is_a?(Array)\n x == y\n end\n end",
"def == other\n if other.respond_to? :headings and other.respond_to? :rows\n headings == other.headings and rows == other.rows\n end\n end",
"def bt_same_snapshot?(other)\n bt_snapshot_attributes == other.bt_snapshot_attributes\n end",
"def ==(other)\n case other\n when self.class\n hash == other.hash\n else\n false\n end\n end",
"def ==(other)\n # TODO: This can be made faster by\n # comparing hashes for stored objects.\n other.read == read\n end",
"def eql?(other)\r\n other.class == self.class && other.hash == self.hash && _eql?(other)\r\n end",
"def ==(other)\n to_hash == other.to_hash\n end",
"def ==(other)\n other.is_a?(Chunk) &&\n other.name == self.name &&\n other.size == self.size &&\n other.header == self.header &&\n other.data == self.data\n end",
"def eql?(other)\n self.class === other and @version == other._version\n end",
"def eql?(other)\n self.class === other and @version == other._version\n end",
"def == other\n return false unless other.is_a?(RemoteHash)\n secret == other.secret\n end",
"def ==(other)\n return false if other.class != self.class\n attr_hash == other.attr_hash\n end",
"def == other\n self.class == other.class and\n self.name == other.name and\n self.rw == other.rw and\n self.singleton == other.singleton\n end",
"def ==(other)\n return false unless other\n return false unless @table.size == other.size\n @table.each do |k,v|\n return false unless other[k] == v\n end\n true\n end",
"def ==(other)\n return false unless other.respond_to? :size and\n size == other.size and\n other.respond_to? :[]\n each { |key, value| return false unless self[key] == other[key] }\n return true\n end",
"def eql?(other)\n other.class == self.class &&\n other.logical_path == self.logical_path &&\n other.mtime.to_i == self.mtime.to_i &&\n other.digest == self.digest\n end",
"def ==(another)\n another.respond_to?(:to_hash) && to_hash == another.to_hash\n end",
"def time_safe_equals(a, b)\n a.hash == b.hash && a == b\n end",
"def ==(other)\n self.class == other.class &&\n self.attributes == other.attributes\n end",
"def ==(another)\n self.to_hash == another.to_hash\n end",
"def eql?(other)\n self.class.eql?(other.class) &&\n @primary_keys == other.primary_keys &&\n @columns == other.columns &&\n @with == other.with\n end",
"def test_equality_simple\n value1_ = ::Versionomy.create(:major => 2, :minor => 0, :release_type => :alpha, :alpha_version => 5)\n value2_ = ::Versionomy.create(:major => 2, :release_type => :alpha, :alpha_version => 5)\n assert_equal(value2_, value1_)\n assert_equal(value2_.hash, value1_.hash)\n end",
"def ==(other)\n\n return false if other.class != self.class\n self.h.fei == other.h.fei\n end",
"def ==(other)\n super || @hash == other.hash\n end",
"def eql? other\n self.class === other and @version == other.version\n end",
"def __class__\n OpenStruct2\n end",
"def ==(other)\n return false unless other.is_a?(Binary)\n\n type == other.type && data == other.data\n end",
"def == other\n if other.respond_to? :render and other.respond_to? :rows\n self.headings == other.headings and self.rows == other.rows\n end\n end",
"def ==(other)\n self.class == other.class &&\n attributes == other.attributes\n end",
"def eql?(other)\n self.class === other and @version == other.version\n end",
"def eql?(another)\n self.to_hash == another.to_hash\n end",
"def eql?(other)\n return false unless other.captures_hash == captures_hash\n return false unless other.squares_hash == squares_hash\n return false unless other.turn == turn\n return false unless other.state == state\n\n true\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n apm_scanned_bytes == o.apm_scanned_bytes &&\n events_scanned_bytes == o.events_scanned_bytes &&\n hour == o.hour &&\n logs_scanned_bytes == o.logs_scanned_bytes &&\n org_name == o.org_name &&\n public_id == o.public_id &&\n rum_scanned_bytes == o.rum_scanned_bytes &&\n total_scanned_bytes == o.total_scanned_bytes\n end",
"def ==(other)\n self.type == other.type && self.row == other.row && self.key == other.key && self.value == other.value\n end",
"def ==(other)\n return false if !other\n data == other.data && version == other.version\n end",
"def ==(other)\n other.kind_of?(model) && other.hash == hash\n end",
"def ==(other)\n return false unless other.respond_to? :size and\n size == other.size and\n other.respond_to? :[]\n each { |key, value| return false unless self[key] == other[key] }\n return true\n end",
"def ==(other)\n # TODO: Below is needed?\n # object_equivalence = super\n # return true if object_equivalence\n \n raise TypeError, 'other must respond to #to_hash or #to_h' unless other.respond_to?(:to_hash) || other.respond_to?(:to_h)\n other = other.to_hash rescue other.to_h\n \n other == to_h\n end",
"def test_different_hashes\r\n\t\ts = \"Addr1<Addr2(100):Addr3<Addr4(500)\"\r\n\t\ttb = Block.new(0,0,s,0.0,\"90a2\")\r\n\t\ttb.set_calculated_hash(\"10b4\")\r\n\t\t\r\n\t\tassert_equal(0, tb.compare_current_hash)\r\n\tend",
"def ==(other)\n @klass == other.klass && @version == other.version && @timestamp == other.timestamp\n end",
"def eql?(other)\n other.is_a?(JiakSchema) &&\n compare_fields(@allowed_fields,other.allowed_fields) &&\n compare_fields(@required_fields,other.required_fields) &&\n compare_fields(@read_mask,other.read_mask) &&\n compare_fields(@write_mask,other.write_mask)\n end",
"def eql?(rhs_)\n rhs_.equal?(self) ||\n rhs_.is_a?(Structure) &&\n @parent.eql?(rhs_.instance_variable_get(:@parent)) &&\n @indexes.eql?(rhs_.instance_variable_get(:@indexes))\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n class_id == o.class_id &&\n object_type == o.object_type &&\n accessibility_summary == o.accessibility_summary &&\n data_block_size == o.data_block_size &&\n host_mount_status == o.host_mount_status &&\n in_use == o.in_use &&\n kind == o.kind &&\n last_access_time == o.last_access_time &&\n last_modified_time == o.last_modified_time &&\n mount_status == o.mount_status &&\n mount_summary == o.mount_summary &&\n provisioned_capacity == o.provisioned_capacity &&\n provisioned_volume_capacity_utilization == o.provisioned_volume_capacity_utilization &&\n type == o.type &&\n un_compressed_used_bytes == o.un_compressed_used_bytes &&\n uuid == o.uuid &&\n volume_count == o.volume_count &&\n cluster == o.cluster &&\n volumes == o.volumes\n end",
"def lane_equal other_sample\n [:genome, :protocol].each do |lane_data|\n # puts \"#{self.send(lane_data)}\"\n if self.send(lane_data) != other_sample.send(lane_data)\n return false\n end\n end\n true\n end",
"def ==(other)\n a = to_h\n b = other.to_h\n a.delete(:_id)\n b.delete(:_id)\n a == b\n end",
"def ==(other)\n other = coerce(other)\n header == other.header &&\n to_set == other.to_set\n end",
"def eql?(other)\n self.class == other.class && key == other.key\n end",
"def ==(other)\n return false unless self.class == other.class\n self.attributes == other.attributes\n end",
"def eql?(other)\n if (astVal.class == CTObject)\n data = Marshal.dump(astVal.rawObject)\n dataOther = Marshal.dump(other.astVal.rawObject)\n return data.eql?(dataOther)\n elsif(astVal.class == PartialObject && self.name != Helpers.selfIdentifier)\n #check only the compile time vars in the store of the partial object.\n astVal.store.eql?(other.astVal.store)\n else\n true\n end\n end",
"def ==(other)\n case other\n when MotionMap::Map\n return false if keys != other.keys\n super(other)\n\n when Hash\n self == MotionMap::Map.from_hash(other, self)\n\n else\n false\n end\n end",
"def ==(other)\n return false unless other.kind_of?(ObjectifiedSessions::FieldDefinition)\n session_class == other.send(:session_class) && name == other.name && storage_name == other.storage_name &&\n type == other.send(:type) && visibility == other.send(:visibility)\n end",
"def equal?(other)\n other.respond_to?(:mol) && mol.equal?(other.mol) && id == other.id \n end",
"def ==(other)\n return false unless other.kind_of?(self.class) || other.kind_of?(Hash)\n\n other = other.to_hash if other.kind_of?(self.class)\n to_hash == other\n end",
"def eql?(other)\n return self.instance_variables.all?{ |v|\n self.instance_variable_get(v).hash == other.instance_variable_get(v).hash\n }\n end",
"def eql_when_keys_compared? other\n return true if self.object_id == other.object_id\n return false unless self.class == other.class\n keys1 = sort_keys(self.keys)\n keys2 = sort_keys(other.keys)\n return false unless keys1.eql?(keys2)\n (0...keys1.size).each do |index|\n # Handle odd cases where eql? and == behavior differently\n return false unless self[keys1[index]].eql?(other[keys2[index]]) || self[keys1[index]] == other[keys2[index]]\n end\n true\n end",
"def equals( t2 )\n t1 = self.clone\n t1.toK\n t2.toK\n if t1.value == t2.value then return true\n else return false\n end\n end",
"def == other\n return ((other.mapname == @mapname) and (other.map == @map))\n end",
"def eql?(ha)\n return false if self.length != ha.length\n return true if (0...self.length).all? { |i| self.fetch(i).eql?(ha.fetch(i)) }\n return false\n end",
"def ==(other)\n other.kind_of?(self.class) &&\n @name == other.name && @columns == other.columns && @unique == other.unique?\n end",
"def objects_equal?(other)\n other.is_a?(Linkage::MetaObject) && other.object == self.object\n end",
"def ==(other)\n self.key == other.key and self.bucket == other.bucket\n end",
"def eql?(other)\n return false unless other.class == self.class\n\n return identity == other.identity &&\n attributes == other.attributes &&\n session == other.session\n end",
"def eql?(p0) end",
"def eql?(p0) end",
"def eql?(p0) end",
"def eql?(p0) end",
"def eql?(p0) end"
] |
[
"0.74287903",
"0.7335508",
"0.7214028",
"0.6960794",
"0.651261",
"0.6507931",
"0.64382476",
"0.62664163",
"0.62421346",
"0.62397486",
"0.6229188",
"0.61240077",
"0.61128396",
"0.61069256",
"0.61002886",
"0.61002886",
"0.60622305",
"0.6059794",
"0.6059203",
"0.6037187",
"0.60058635",
"0.5987492",
"0.5984356",
"0.59465146",
"0.5942144",
"0.5939731",
"0.59326905",
"0.592389",
"0.5901561",
"0.5899145",
"0.5892686",
"0.5892686",
"0.5885967",
"0.58719045",
"0.5838845",
"0.5833863",
"0.5829806",
"0.5826062",
"0.5823763",
"0.58050126",
"0.57900524",
"0.5776831",
"0.5776831",
"0.5771731",
"0.5748983",
"0.57386345",
"0.5730118",
"0.57274914",
"0.57234776",
"0.5701078",
"0.56953084",
"0.5692304",
"0.5690893",
"0.5671213",
"0.5669442",
"0.5664715",
"0.5661032",
"0.56571484",
"0.5653543",
"0.56518596",
"0.56507975",
"0.5635184",
"0.5633764",
"0.5628051",
"0.56277496",
"0.5626264",
"0.5623926",
"0.56238294",
"0.5622415",
"0.56218135",
"0.5616639",
"0.561355",
"0.56114054",
"0.55815977",
"0.5580693",
"0.5578581",
"0.5574998",
"0.5574028",
"0.5569407",
"0.55637276",
"0.55514306",
"0.5547029",
"0.55296606",
"0.55286247",
"0.55206364",
"0.55160224",
"0.5515185",
"0.5499738",
"0.5491641",
"0.54767704",
"0.5472466",
"0.54714066",
"0.546093",
"0.5450357",
"0.5447857",
"0.5437251",
"0.5437251",
"0.5437251",
"0.5437221",
"0.5437221"
] |
0.6465549
|
6
|
format = '"Text with yyyy/mm/dd"yyyy[aa.bb][cc.dd.ee][ff]mmdd"Text with [aa.bb]"[]' format_parts(format) => [ '"Text with yyyy/mm/dd"', 'yyyy', '[aa.bb]', '[cc.dd.ee][ff]mmdd', '"Text with [aa.bb]"', '[', '', ']' ]
|
def format_parts(format)
# Separate format to array
formats = []
split_formats = format.split(/"/)
split_formats.each_with_index do |sf, i|
sf = %("#{sf}") if i % 2 == 1
formats << sf
end
formats.collect! do |f|
if f =~ /"/
f
else
f.gsub!(/(#+)/,'|\1|')
f.split('|')
end
end
# Remove array in formats
formats.flatten!
formats.collect! do |f|
if f =~ /"|#/
f
else
f.gsub!(/(\[[\w]+.[\w]+\])/,'|\1|')
f.split('|')
end
end
# Remove array in formats
formats.flatten!
# Remove empty formats
formats.delete('')
# Return
formats
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def parse_format(path)\n # format appears after the last period.\n remainder, dot, format = path.rpartition('.')\n return [path, ''] if dot.empty?\n return [remainder, format]\n end",
"def split(parts); end",
"def _process_format(format); end",
"def _process_format(format); end",
"def format_path(str)\n first_format = str[1..str.length - 2].split('|') # => [ \"['ATL', 'EWR'] \", \" ['SFO', 'ATL']\" ]\n second_format = first_format.map { |e| e[1..e.length - 2] } # => [\"'ATL', 'EWR'\", \"'SFO', 'ATL'\"]\n second_format.map { |e| e.strip.split(',') } # [[\"'ATL'\", \" 'EWR'\"], [\"'SFO'\", \" 'ATL'\"]]\n end",
"def parse_format(format)\n format = format.to_s\n format.chomp! # remove carriage return\n format.strip! # remove leading and trailing space\n format.gsub!(/[ \\t]+/, ' ') # replace tabulations or spaces with a space\n\n strip_quotes = proc { |string| string.gsub(/^\\\\\"/, '').gsub(/\\\\\"$/, '') }\n find_quotes = proc { |string| string =~ /^\\\\\"/ } \n find_percent = proc { |string| string =~ /^%.*t$/ }\n find_referrer_or_useragent = proc { |string| string =~ /Referer|User-Agent/ }\n \n pattern = format.split(' ').map do |element|\n has_quotes = !!find_quotes.call(element)\n element = strip_quotes.call(element) if has_quotes\n \n self.names << rename_this_name(element)\n\n case\n when has_quotes\n if element == '%r' or find_referrer_or_useragent.call(element)\n /\"([^\"\\\\]*(?:\\\\.[^\"\\\\]*)*)\"/\n else\n '\\\"([^\\\"]*)\\\"'\n end\n when find_percent.call(element)\n '(\\[[^\\]]+\\])'\n when element == '%U'\n '(.+?)'\n else\n '(\\S*)'\n end\n end.join(' ')\n\n @regexp = Regexp.new(\"^#{pattern}$\")\n format\n end",
"def format_date(str)\n# str.gsub(/^(\\d\\d\\d\\d)[-|\\/](\\d\\d)[-|\\/](\\d\\d)$/, '\\3.\\2.\\1')\n str.sub(/^(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)$/, '\\3.\\2.\\1')\n .sub(/^(\\d\\d\\d\\d)\\/(\\d\\d)\\/(\\d\\d)$/, '\\3.\\2.\\1')\nend",
"def structured_parts(line_86)\n line_86.split(/(>\\d{2})/)\n end",
"def extract_parts\n parts_regex = /\n (?: # non-capturing group\n \\A | # start of string OR\n \\r\\n # line break\n )\n (\n --#{Regexp.escape(boundary || \"\")} # boundary delimiter\n (?:--)? # with non-capturing optional closing\n )\n (?=\\s*$) # lookahead matching zero or more spaces followed by line-ending\n /x\n parts = raw_source.split(parts_regex).each_slice(2).to_a\n parts.each_with_index { |(part, _), index| parts.delete_at(index) if index > 0 && part.blank? }\n\n if parts.size > 1\n final_separator = parts[-2][1]\n parts << [\"\"] if final_separator != \"--#{boundary}--\"\n end\n parts.map(&:first)\n end",
"def parse_format(format)\n format = format.to_s\n format.chomp! # remove carriage return\n format.strip! # remove leading and trailing space\n format.gsub!(/[ \\t]+/, ' ') # replace tabulations or spaces with a space\n\n pattern = format.split(' ').map do |element|\n has_quotes = element =~ /^\\\\\"/\n element = element.gsub(/^\\\\\"/, '').gsub(/\\\\\"$/, '') if has_quotes\n\n self.names << rename_this_name(element)\n\n case\n when has_quotes\n if element == '%r' || element =~ /^%{Referer}/ || element =~ /^%{User-agent}/\n /\"([^\"\\\\]*(?:\\\\.[^\"\\\\]*)*)\"/\n else\n '\\\"([^\\\"]*)\\\"'\n end\n when element =~ /^%.*t$/\n '(\\[[^\\]]+\\])'\n when element == '%U'\n '(.+?)'\n else\n '(\\S*)'\n end\n end.join(' ')\n\n @regexp = Regexp.new(\"^#{pattern}$\")\n format\n end",
"def parts_to_fill\n parts = []\n sentence.scan(/(?:\\/)([^\\/]+)(?:\\/)/) { |group| parts << group[0] }\n parts\n end",
"def format_date(text)\n text.gsub(/(\\d\\d\\d\\d)([\\-\\/])(\\d\\d)\\2(\\d\\d)/, '\\4.\\3.\\1')\nend",
"def date_reformatting(date)\n #date.split('/')..join(',')\n Date.parse.(date).strftime'[%m, %d, %Y]'\nend",
"def path_parts(input) # :nodoc:\n case input\n when /((?:@{1,2}|\\$|)\\w+(?:\\[[^\\]]+\\])*)([\\[\\/])(['\"])([^\\3]*)$/\n $~.to_a.slice(1, 4).push($~.pre_match)\n when /((?:@{1,2}|\\$|)\\w+(?:\\[[^\\]]+\\])*)(\\.)(\\w*)$/\n $~.to_a.slice(1, 3).push($~.pre_match)\n when /((?:@{1,2}|\\$|)\\w+)$/\n $~.to_a.slice(1, 1).push(nil).push($~.pre_match)\n else\n [ nil, nil, nil ]\n end\n end",
"def parse(_string, _extension)\n [{}, {}]\n end",
"def test_String_008_format_dateString_mdyy\n \n # require 'date'\n \n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_String_008_format_dateString_mdyy\")\n puts2(\"#######################\")\n \n puts2(\"\\nTesting slash delimited dates expressed as STRINGS\")\n \n # Array of date strings to test\n aDateStrings = [\n \"12/31/2000\",\n \"1/1/01\",\n \"01/02/2002\",\n \"01/3/2003\",\n \"11/5/1900\",\n \"10/06/1901\"\n ]\n \n # Loop through the list, converting each date string\n aDateStrings.each do | sDateString |\n puts2(\"#{sDateString} formatted as \" + sDateString.format_dateString_mdyy(\"/\"))\n end\n \n puts2(\"\\nTesting period delimited dates expressed as STRINGS\")\n # Array of date strings to test\n aDateStrings = [\n \"12.31.2000\",\n \"1.1.01\",\n \"01.02.2002\",\n \"01.3.2003\",\n \"11.5.1900\",\n \"10.06.1901\"\n ]\n \n # Loop through the list, converting each date string\n aDateStrings.each do | sDateString |\n puts2(\"#{sDateString} formatted as \" + sDateString.format_dateString_mdyy(\".\"))\n end\n \n end",
"def test_String_009_format_dateString_mmddyyyy\n \n #require 'date'\n \n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_String_009_format_dateString_mmddyyyy\")\n puts2(\"#######################\")\n \n puts2(\"\\nTesting slash delimited dates expressed as STRINGS to the 1900's\")\n \n # Array of date strings to test\n aDateStrings = [\n \"1/1/01\",\n \"01/02/01\",\n \"11/1/01\",\n \"1/10/01\",\n \"12/31/2000\",\n ]\n \n # Loop through the list, converting each date string\n aDateStrings.each do | sDateString |\n puts2(\"#{sDateString} formatted as \" + sDateString.format_dateString_mmddyyyy(\"/\" ,\"19\"))\n end\n \n \n puts2(\"\\nTesting period delimited dates expressed as STRINGS to the 2300's\")\n \n # Array of date strings to test\n aDateStrings = [\n \"1.1.01\",\n \"01.02.01\",\n \"11.1.01\",\n \"1.10.01\",\n \"12.31.2000\",\n ]\n \n # Loop through the list, converting each date string\n aDateStrings.each do | sDateString |\n puts2(\"#{sDateString} formatted as \" + sDateString.format_dateString_mmddyyyy(\".\" ,\"23\"))\n end\n \n end",
"def split_sequence(sequence)\n pieces = sequence.split('.') \n case pieces.size\n when 3\n pieces\n when 2\n if pieces[0].size > 1 ## N termini\n ['-', pieces[0], pieces[1]]\n else ## C termini\n [pieces[0], pieces[1], '-']\n end\n when 1 ## this must be a parse error!\n [nil,nil,nil]\n when 0\n [nil,nil,nil]\n end\n end",
"def format_date(string)\n string.sub(/\\A(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)/, '\\3.\\2.\\1')\nend",
"def format_date(str)\n str.sub(/^(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)$/, '\\3.\\2.\\1')\nend",
"def unitdate_parts(unitdate_normal)\n unless unitdate_normal.blank? || /(\\d{4})\\/(\\d{4})/.match(unitdate_normal).nil?\n unitdate_normal.split(/\\//)\n else\n []\n end\n end",
"def date_array(user_string)\n user_string.scan(/\\d+(?=-)|(?<=-)\\d+|\\d+(?=\\/)|(?<=\\/)\\d+/)\n end",
"def create_ordered_output_from_format_string(f,u,c,i)\n found = Hash.new\n found[\"u\"] = f.index(/(%[\\-\\.0-9]*u[0-9]*)/)\n found[\"c\"] = f.index(/(%[\\-\\.0-9]*c[0-9]*)/)\n found[\"i\"] = f.index(/(%[\\-\\.0-9]*i[0-9]*)/)\n positions = Array.new\t\n positions[f.index(/(%[\\-\\.0-9]*u[0-9]*)/)] = u if !found[\"u\"].nil?\n positions[f.index(/(%[\\-\\.0-9]*c[0-9]*)/)] = c if !found[\"c\"].nil?\n positions[f.index(/(%[\\-\\.0-9]*i[0-9]*)/)] = i if !found[\"i\"].nil?\n positions.compact!\n positions\nend",
"def format_sins(string)\n\n match = string.scan(/(\\s|^)(\\d{3}[-.]{0,1}\\d{3}[-.]{0,1}*\\d{3})(\\D|$)/).transpose[1]\n reformatted = []\n unless match == nil\n match.each do |i|\n i.gsub! /[.-]/,\"\"\n threes = /(...)(...)(...)/.match(i).captures\n reformatted << \"#{threes[0]}-#{threes[1]}-#{threes[2]}\"\n end\n p reformatted\n return\n end\n return string\n end",
"def format_date(string)\n string.sub(/\\A(\\d{4})([\\-\\/])(\\d{2})\\2(\\d{2})\\z/, '\\4.\\3.\\1')\nend",
"def split_date(string)\n case string\n when /\\sat\\s/\n split = string.split(\" at \")\n { date: normalize_date_pair([split.first]), time: split.last.split(\" - \") }\n when /\\s-\\s/\n { date: normalize_date_pair(string.split(\" - \")), time: nil }\n when /^after /\n { date: normalize_date_pair([string.gsub(\"after\", \"\").strip]), time: nil }\n else\n { date: normalize_date_pair([string]), time: nil }\n end\n end",
"def split_in_parts (s, part_length)\n s.gsub(/(\\w{#{part_length}})/, '\\1 ').strip\nend",
"def reformat(string, format)\n case format\n when \"MM/YYYY\"\n val = string.to_i\n sprintf(\"%02d/%4d\", val % 12 + 1, val / 12)\n when /.*%.*f.*/\n sprintf(format, string.to_f).gsub(/(\\d)(?=\\d{3}+(\\.\\d*)?[^0-9]*$)/, '\\1,')\n when /.*%.*d.*/\n sprintf(format, string.to_i).gsub(/(\\d)(?=\\d{3}+(\\.\\d*)?[^0-9]*$)/, '\\1,')\n else\n string\n end\nend",
"def parse\n @parts = []\n\n sect = text.split(/^\\-\\-\\-/)\n\n if sect.size == 1\n @header = {}\n @parts << Part.new(sect[0]) #, *[@stencil, @default].compact.flatten)\n else\n sect.shift if sect.first.strip.empty?\n\n head = sect.shift\n head = YAML::load(head)\n parse_header(head)\n\n sect.each do |body|\n index = body.index(\"\\n\")\n formats = body[0...index].strip\n formats = formats.split(/\\s+/) if String===formats\n #formats = @default if formats.empty?\n #formats.unshift(@stencil) if @stencil\n text = body[index+1..-1]\n @parts << Part.new(text, *formats)\n end\n end\n end",
"def format_date(date_str)\n puts date_str.sub(/(\\d{4})([\\-\\/])(\\d{2})\\2(\\d{2})/, '\\4.\\3.\\1') \nend",
"def format_date2(date)\n date.gsub(/\\A(\\d{4})([\\-\\/])(\\d\\d)([\\-\\/])(\\d\\d)\\z/, '\\5.\\3.\\1')\nend",
"def format_date(string)\n string.sub(/\\A(\\d{4})-(\\d{2})-(\\d{2})\\z/, '\\3.\\2.\\1')\nend",
"def decompose_address(parts)\n addresses = parts || []\n address, city, zip, country_code = nil, nil, nil, nil\n\n if !addresses.empty?\n address = addresses[0] if addresses[0]\n zip, city = addresses[1].split(\" \", 2) if addresses[1]\n country_code = addresses[2] if addresses[2]\n end\n\n [address, city, zip, country_code]\n end",
"def split_birthday(birthday_str)\r\n birthday = birthday_str.split('/')\r\n return birthday\r\nend",
"def test_parts_without_duration(string)\n result = string.match(/\\A\\s*(test:\\s*)(.*?)(\\.\\s*:)(.*)([.EF])\\s*\\z/m)\n \n if result.nil?\n nil\n else\n [result[2], result[4], result[5], nil]\n end\nend",
"def parse_datetime_fmt(fmt, strict: true)\n # We parse the more complex formatting constructs first, and after each\n # parse, we remove the matched construct from fmt. At the end, any\n # remaining characters in fmt should be invalid.\n fmt_hash, fmt = parse_string_fmt(fmt)\n if fmt =~ /d\\[(?<bdy>[^\\]]*)\\]/\n fmt_hash[:date_fmt] = Regexp.last_match[:bdy]\n fmt = fmt.sub(Regexp.last_match[0], '')\n end\n if fmt =~ /D\\[(?<bdy>[^\\]]*)\\]/\n fmt_hash[:datetime_fmt] = Regexp.last_match[:bdy]\n fmt = fmt.sub(Regexp.last_match[0], '')\n end\n unless fmt.blank? || !strict\n msg = \"unrecognized datetime formatting instructions '#{fmt}'\"\n raise UserError, msg\n end\n [fmt_hash, fmt]\n end",
"def format_date(string)\n string.sub(/\\A(\\d\\d\\d\\d)(\\-|\\/)(\\d\\d)(\\-|\\/)(\\d\\d)/, '\\5.\\3.\\1')\nend",
"def format_date1(original_date)\n original_date.sub(/\\A(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)\\z/, '\\3.\\2.\\1')\nend",
"def supported_formats\n # WARNING: This shit won't be documented or even properly tested. It's almost 3 in the morning and I have no idea what I'm doing.\n header_index = output.index('format code')\n return nil if header_index.nil?\n\n formats = []\n output.slice(header_index..-1).split(\"\\n\").each do |line|\n format = {}\n format[:format_code], format[:extension], format[:resolution], format[:note] = line.scan(/\\A(\\d+)\\s+(\\w+)\\s+(\\S+)\\s(.*)/)[0]\n formats.push format\n end\n formats.shift # The first line is just headers\n return [] if formats.first.nil?\n formats.map do |format|\n format[:note].strip! # Get rid of any trailing whitespace on the note.\n format[:format_code] = format[:format_code].to_i # convert format code to integer\n format\n end\n end",
"def format_date(string)\n return string.split(/-/).reverse.join('.') if string.match(/-/)\n string\nend",
"def fields(input_fields)\n output = input_fields.gsub(/[\\s,]/ , \" \")\n output_array = output.split\n return output_array\nend",
"def test_parts_with_duration(string)\n result = string.match(/\\A\\s*(test:\\s*)(.*?)(\\.\\s*:)(.*)(([.EF]):)\\s*\\(([\\d.]+)\\)\\s*\\z/m)\n \n if result.nil?\n nil\n else\n [result[2], result[4].sub(/^\\s+/, ''), result[6], result[7]]\n end\nend",
"def my_split(string, divider)\n array = []\n current_element = ''\n\n formatted_string = string.clone\n formatted_string.strip!\n\n formatted_string.each_char do |char|\n if char == divider\n array << current_element\n current_element = ''\n else\n current_element << char\n end\n end\n\n array << current_element\n\n array\nend",
"def formatdate(date)\n p date.gsub(/^(\\d{4})([-\\/])(\\d{2})([-\\/])(\\d{2}$)/, '\\5.\\3.\\1') \nend",
"def split_into_start_and_end(string)\n super(string)\n string = string.split(\"-\")\n string = string[0].split(\"and\") if string.size == 1\n string = string[0].split(\"&\") if string.size == 1\n string = string[0].split(\"through\") if string.size == 1\n string = string[0].split(\"to\") if string.size == 1\n string\n end",
"def format(text); end",
"def normalize\n parts_arr = parse_parts_from_version_string\n if parts_arr.length != 1\n parts_arr.pop while parts_arr.last && parts_arr.last.value == 0\n parts_arr = [Part.new(0)] if parts_arr.empty?\n end\n parts_arr\n end",
"def components\n @components ||= @string.split('/').reject{|x| x == '' || x == nil} rescue []\n end",
"def convert(data_array, format)\n formated_text_and_coordinates=[]\n for i in 0 ... format.items.size\n formated_text_current = format.items[i][2].clone\n for j in 0 ... data_array.size\n if formated_text_current =~ /__#{j}__/\n if ! data_array[j] then data_array[j]=\"\" end\n eval \"formated_text_current.gsub!(/__#{j}__/,data_array[j])\"\n end\n end\n formated_text_and_coordinates.push([format.items[i][0], format.items[i][1], formated_text_current])\n end\n return formated_text_and_coordinates\nend",
"def convert(data_array, format)\n formated_text_and_coordinates=[]\n for i in 0 ... format.items.size\n formated_text_current = format.items[i][2].clone\n for j in 0 ... data_array.size\n if formated_text_current =~ /__#{j}__/\n if ! data_array[j] then data_array[j]=\"\" end\n eval \"formated_text_current.gsub!(/__#{j}__/,data_array[j])\"\n end\n end\n formated_text_and_coordinates.push([format.items[i][0], format.items[i][1], formated_text_current])\n end\n return formated_text_and_coordinates\nend",
"def parts(pathname)\n # [\"005010\", \"X221 HP835 Health Care Claim Payment Advice\"]\n parts = pathname.each_filename.to_a\n version, name, = parts\n\n case name\n when /^(X[^ ]+) ([^ ]+)/ # (X221) (HP835) Health Care Claim Payment Advice\n a, b = $1, $2\n gs01 = b[/^.{2}/]\n gs08 = [version, a]\n st01 = b[/.{3}$/]\n\n [versions.fetch(version, version), \"Implementations\", gs01, gs08, st01]\n\n when /^([A-Z]{2})(\\d{3})/ # (HP835) Health Care Claim Payment Advice\n gs01 = $1\n gs08 = [version]\n st01 = $2\n\n [versions.fetch(version, version), \"Standards\", gs01, gs08, st01]\n else\n raise name.inspect\n end\n end",
"def parts\n @parts ||= begin\n ary = string.split(/said/i, 2)\n if ary.size == 2 && ary[0].size > 31\n [string]\n else\n ary\n end\n end\n end",
"def remove_initial_and_format_change \n @reformated_array = []\n array_of_parse_files.each do |info|\n if !info[0].include?(\"|\") && !info[0].include?(\",\")\n info.map! {|element| element.split(\" \")}\n info.each {|element| element.slice!(-4)} \n @reformated_array << info\n elsif info[0].include?(\"|\")\n info.map! {|element| element.split(\" | \")}\n info.each {|element| element.slice!(-4)} \n @reformated_array << info\n else\n @reformated_array << info\n end\n end\nend",
"def address_form(address_parts)\n businessAddress = []\n address_parts.each do |part|\n part = part.text.strip\n if !part.blank?\n businessAddress << part\n end\n end\n\n businessAddress.join(\", \")\n end",
"def format_date(date)\n date.gsub(/^(\\d{4})-(\\d{2})-(\\d{2}$)/, '\\3.\\2.\\1') #capture groups make this way easier!\nend",
"def format_date(original_date_str)\n original_date_str.sub(%r{\\A(\\d{4})([-/])(\\d{2})\\2(\\d{2})\\z},'\\4.\\3.\\1')\nend",
"def normalize_date_strings(date_strings, separator = '/')\n return date_strings if RUBY_VERSION < '1.9'\n date_strings = [*date_strings] # ensure Array\n date_strings.map! do |ds|\n fragments = ds.split(separator)\n [fragments[1], fragments[0], fragments[2]].join(separator)\n end\n end",
"def extract_date(an_array)\n date_string_index = an_array.index{|s| s.start_with?(\"Date:\")}\n date_string = an_array[date_string_index]\n return DateTime.parse date_string.gsub('Date:','').strip\nend",
"def GetVersionParts(versionStr)\n version_vals = versionStr.split('-')\n major, minor, patch = version_vals[0].split('.')\n build = version_vals[1]\n return major, minor, patch, build\n end",
"def format_date(date)\n return date unless !!date.match(/[\\-]+/)\n date.split(/\\-/).reverse.join(\".\")\nend",
"def date_reformatting(date)\n month = [[\"January\", 1], [\"February\", 2], [\"March\", 3], [\"April\", 4], [\"May\", 5], [\"December\", 12], [\"Dec\", 12]]\n data = date.split(\" \")\n if data.length == 1\n data = data[0].split(\"-\")\n end\n if data.length == 1\n data = data[0].split(\".\")\n end\n if data.length == 1\n data = data[0].split(\"/\")\n end\n \n send_back = []\n\n month.each do |moth|\n if moth[0] = data[0]\n send_back[0] = moth[1].to_i\n end\n end\n\n send_back[1] = data[1].tr(\",\", \" \").to_i\n send_back[2] = data[2].to_i\n\n return send_back\nend",
"def format_description(text)\n # Look for signs of structure, otherwise just treat as unstructured.\n case text\n when /\"\";/ then double_quotes_to_sections(text)\n when /\\.--v\\. */ then double_dash_to_sections(text)\n when /; *PART */i then # Seen in some IA records.\n when /:;/ then # Observed in one unusual case.\n when /[[:punct:]] *--.* +-- +/ then # Blurbs/quotes with attribution.\n when / +-- +.* +-- +/ then # Table-of-contents title list.\n when /(;[^;]+){4,}/ then # Many sections indicated.\n else return format_multiline(text)\n end\n q_section = nil\n text.split(/ *; */).flat_map { |part|\n next if (part = part.strip).blank?\n case part\n when /^\"\"(.*)\"\"$/\n # === Rare type of table-of-contents listing entry\n line = $1.to_s\n if line.match(SECTION_TITLE_RE)\n gap = (\"\\n\" unless q_section)\n q_section = $1.to_s\n [gap, \"#{q_section} #{$2}\", \"\\n\"].compact\n else\n q_section = nil\n line.match?(/^\\d+ +/) ? line : \"#{BLACK_CIRCLE}#{EN_SPACE}#{line}\"\n end\n\n when / +-- +.* +-- +/\n # === Table-of-contents listing\n section = nil\n part.split(/ +-- +/).flat_map { |line|\n if line.match(SECTION_TITLE_RE)\n gap = (\"\\n\" unless section)\n section = $1.to_s.delete_suffix('.')\n [gap, \"#{section}. #{$2}\", \"\\n\"].compact\n else\n section = nil\n \"#{BLACK_CIRCLE}#{EN_SPACE}#{line}\"\n end\n }.tap { |toc| toc << \"\\n\" unless toc.last == \"\\n\" }\n\n when /[[:punct:]] *--/\n # === Blurbs/quotes with attribution\n part.scan(BLURB_RE).flat_map do |paragraph, attribution|\n attribution.remove!(/[.\\s]+$/)\n [\"#{paragraph} #{EM_DASH}#{attribution}.\", \"\\n\"]\n end\n\n when /^v[^.]*\\. *\\d/\n # === Apparent table-of-contents volume title\n [part]\n\n else\n # === Plain text section\n part = \"#{part}.\" unless part.match?(/[[:punct:]]$/)\n [part, \"\\n\"]\n end\n }.compact.map { |line|\n line.gsub(/---/, EM_DASH).gsub(/--/, EN_DASH)\n }\n end",
"def split(file)\n if m = file.match(/^(.*\\/)?([^\\.]+)\\.?(\\w+)?\\.?(\\w+)?\\.?(\\w+)?$/)\n if m[5] # Multipart formats\n [m[1], m[2], \"#{m[3]}.#{m[4]}\", m[5]]\n elsif m[4] # Single format\n [m[1], m[2], m[3], m[4]]\n else\n if valid_extension?(m[3]) # No format\n [m[1], m[2], nil, m[3]]\n else # No extension\n [m[1], m[2], m[3], nil]\n end\n end\n end\n end",
"def parse_field_format(fn)\n ctr = 0\n name = nil\n field_format = {}\n\n File.read(fn).each_line{|l|\n\n ctr += 1\n l.strip!\n\n next if (iscomment(l) || isblank(l))\n t = l.split\n\n if (t.size != 3)\n raise \"error: field format line #{ctr}\"\n end\n\n mne, args, needspc = t\n\n if (!['true', 'false'].include?(needspc))\n raise \"error: field format line #{ctr} column 3\"\n end\n\n field_format[mne] = [args, needspc == 'true']\n }\n\n return field_format\nend",
"def format_input(input)\n raise EmptyInput, 'No content in entry' if input.nil? || input.strip.empty?\n\n input_lines = input.split(/[\\n\\r]+/).delete_if(&:ignore?)\n title = input_lines[0]&.strip\n raise EmptyInput, 'No content in first line' if title.nil? || title.strip.empty?\n\n date = nil\n iso_rx = /\\d{4}-\\d\\d-\\d\\d \\d\\d:\\d\\d/\n date_rx = /^(?:\\s*- )?(?<date>.*?) \\| (?=\\S)/\n\n raise EmptyInput, 'No content' if title.sub(/^.*?\\| */, '').strip.empty?\n\n title.expand_date_tags(Doing.setting('date_tags'))\n\n if title =~ date_rx\n m = title.match(date_rx)\n d = m['date']\n date = if d =~ iso_rx\n Time.parse(d)\n else\n d.chronify(guess: :begin)\n end\n title.sub!(date_rx, '').strip!\n end\n\n note = Note.new\n note.add(input_lines[1..-1]) if input_lines.length > 1\n # If title line ends in a parenthetical, use that as the note\n if note.empty? && title =~ /\\s+\\(.*?\\)$/\n title.sub!(/\\s+\\((?<note>.*?)\\)$/) do\n m = Regexp.last_match\n note.add(m['note'])\n ''\n end\n end\n\n note.strip_lines!\n note.compress\n\n [date, title, note]\n end",
"def mail_to_parts(mail)\n mail.parts.empty? ? [mail.to_s] : mail.parts.map { |part| part.to_s } \n end",
"def format_date(date)\n date.sub(/(\\d\\d\\d\\d)([\\-\\/])(\\d\\d)\\2(\\d\\d)/, '\\4.\\3.\\1')\nend",
"def formatNameFromString( name )\n name.split(\",\")\n end",
"def formatNameFromString( name )\n name.split(\",\")\n end",
"def json_value\n result = []\n parts.each do |item|\n (start, ending) = item.split('/', 2)\n\n start = Tilia::VObject::DateTimeParser.parse_date_time(start)\n\n # This is a duration value.\n if ending[0] == 'P'\n result << [\n start.strftime('%Y-%m-%dT%H:%M:%S'),\n ending\n ]\n else\n ending = Tilia::VObject::DateTimeParser.parse_date_time(ending)\n result << [\n start.strftime('%Y-%m-%dT%H:%M:%S'),\n ending.strftime('%Y-%m-%dT%H:%M:%S')\n ]\n end\n end\n\n result\n end",
"def format_comb(arr)\n ret = []\n arr.each do |sub_arr|\n if sub_arr.size > 1\n # use dash to connect the multiple strings \n ret << sub_arr.inject('') {|acc, e| acc + e + '-' }[0..-2]\n elsif sub_arr.size == 1\n ret << sub_arr[0]\n else\n # do nothing...\n end\n end\n return ret\n end",
"def format_ssns(string)\n ssn_array = grab_all_ssns(string)\n ssn_array.map do |ssns|\n new_array = ssns.split('')\n new_array.delete_if { |str| str =~ /\\D/ }\n new_array.insert(3, \"-\")\n new_array.insert(6, \"-\")\n new_array = new_array.join\n ssn_array = new_array\n end\n ssn_array\n # binding.pry\nend",
"def formatConvertor(inputFormat)\n\n inputFormat.sub! 'DD', '%d'\n inputFormat.sub! 'YYYY', '%Y'\n inputFormat.sub! 'YY', '%Y'\n inputFormat.sub! 'MM', '%m'\n inputFormat.sub! 'hh', '%H'\n inputFormat.sub! 'mm', '%M'\n inputFormat.sub! 'ss', '%S'\n inputFormat.sub! 'HH', '%I' # HH - for hour of the clock (12 hour)\n inputFormat.sub! 'A/P', '%p'\n inputFormat.sub! 'MON', '%b' # Jan/Feb etc\n #inputFormat.sub! 'TZ', '%z' # TimeZone\n\n\nend",
"def parts_to_words(parts)\n word = \"\"\n \n parts.each_with_index do |part, i|\n if part.size > 0\n \n if i < 4\n word = word.concat(part + \"-\" + QUALIFIERS[i] + \"-\")\n else\n if word.size > 0\n word = word.concat(\"and-#{part}-\")\n else\n word = word.concat(\"#{part}-\")\n end\n end\n end\n end\n \n word.gsub(/-$/, '')\n end",
"def fields(string)\n string.split(/[,\\t ]+/)\nend",
"def make_sentence parts\n index = 1\n parts.delete('.')\n string = parts.join(' ') + '.'\n if string.include?(\" ,\")\n string.gsub!(\" ,\", \",\")\n end\n string\nend",
"def fields(text) \n p text.split(/[,\\s]+/)\nend",
"def fields(string)\n string.split(/\\W+/)\nend",
"def process_line(line_text)\n date_string,symbol = line_text.split(',')\n month,day,year = date_string.split('/')\n [Date.new(year.to_i, month.to_i, day.to_i), symbol.strip]\n end",
"def format_from_path\n\n return \"\" if path_info.nil? or path_info !~ /[.]/\n \n format = path_info.split(\".\").last\n \n if format =~ /[\\w+\\/]/\n format = format.split(\"/\")[0]\n end\n \n format\n end",
"def string_to_nested_array(str)\n arr1 = str.split(',')\n arr2 = []\n for i in 0..arr1.size - 1\n arr2[i] = arr1[i].split(':')\n end\n return arr2\nend",
"def parse_spec(file)\n file = File.open(file, 'r', :encoding => \"UTF-8\")\n lines = file.readlines\n line = lines.shift\n groups = {}\n count = 0\n cur = nil\n curgroup = nil\n while line do\n if line =~ /^Gegevensgroep(.*)$/ \n curgroup = $1.strip\n groups[curgroup] = []\n # don't parse explanation and condition yet\n line = lines.shift\n next\n end\n if line =~ /^Gegevensnaam(.*)$/\n cur = Datum.new\n groups[curgroup] << cur\n count += 1\n cur.name = $1.strip\n line = lines.shift\n while line !~ /^[Ii]dentificatie/\n cur.name << line\n line = lines.shift\n end\n next\n end\n if cur && line =~ /^[Ii]dentificatie(.*)$/\n cur.id = $1.strip\n line = lines.shift\n next\n end\n if cur && line =~ /^Omschrijving(.*)$/\n cur.description = $1.strip\n line = lines.shift\n while line !~ /^Condities/\n cur.description << line\n line = lines.shift\n end\n next \n end\n if cur && line =~ /^Condities(.*)$/ \n cur.conditions = $1.strip\n line = lines.shift\n while line !~ /^Toelichting/\n cur.conditions << line\n line = lines.shift\n end\n next\n end\n if cur && line =~ /^Toelichting(.*)$/ \n cur.explanation = $1.strip\n line = lines.shift\n while line !~ /^Formaat/\n cur.explanation << line\n line = lines.shift\n end\n next\n end\n if cur && line =~/^Formaat (.*)$/\n cur.format = $1\n line = lines.shift\n next\n end\n cur = nil\n line = lines.shift\n end\n return groups\nend",
"def components(host_string)\n host_string = host_string.strip\n\n # IPv6\n if host_string.start_with?('[')\n end_idx = host_string.index(']')\n raise ::Aerospike::Exceptions::Parse, 'Invalid IPv6 host' if end_idx.nil?\n\n # Slice away brackets and what's inside them, then split on : and\n # replace first entry with string inside brackets\n host_string.slice(end_idx+1..-1).split(':').tap do |result|\n result[0] = host_string[1...end_idx]\n end\n else\n host_string.split(?:)\n end\n end",
"def format_date(original_date)\n original_date.sub(/\\A(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)\\z/, '\\3.\\2.\\1')\nend",
"def format_date(original_date)\n original_date.sub(/\\A(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)\\z/, '\\3.\\2.\\1')\nend",
"def subtag2array(str)\n sep = \"\\001\"\n str.gsub(/\\n(\\s{1,#{@tagsize-1}}\\S)/, \"\\n#{sep}\\\\1\").split(sep)\n end",
"def clean_date(date)\n mo_day_year = date.split(\" \")[0]\n \n return mo_day_year.split(\"/\")\nend",
"def convert_log_file_time(string)\n\tarray=Array.new(2)\t\n\tarray=string.gsub(/:/,\".\").split(\"/\")\n\t#if (array[1]!=nil or array[1]==\"\") then array[1]=string.split(\"/\")[1].gsub(/:/,\".\") end\n\treturn array\nend",
"def deconstruct_version_string(version)\n match = version.match(/^(\\d+)\\.(\\d+)(?:\\.(\\d+))?$/)\n\n # Match should have 4 parts [0] = input string, [1] = major\n # [2] = minor, [3] = patch (possibly blank)\n if match && match.size == 4\n return [match[1].to_i, match[2].to_i, match[3].to_i || 0]\n else\n return nil\n end\n end",
"def c_build_format_string(mne, tokens, field_format)\n fmt_a = []\n\n tokens.each{|t|\n if (field_format.include?(t))\n fmt_a << field_format[t][0]\n else\n fmt_a << t\n end\n }\n\n fmt_s = mne\n\n if (!fmt_a.empty?)\n fmt_s += ' ' + fmt_a.join\n end\n\n return '\"' + fmt_s + '\"'\nend",
"def format\n # first of all, handle extended tags\n strs = reduce_nested_tag do |str, snip|\n start = str.index(snip)\n sub = str[start, snip.size]\n str[start, snip.size] = sub.gsub(extended_regex) do |variable|\n variable = variable[1, variable.size] # remove $\n dispatch(variable)\n end\n str\n end\n \n strs.gsub(variable_regex) do |variable|\n variable = variable[1, variable.size] # remove $\n dispatch(variable)\n end.gsub(shell_regex) do |variable|\n dispatch(variable)\n end\n end",
"def remove_initial_and_format_change(info) # removes middle initial for space_names and pipe_names AND puts comma_names into nested arrays\n if !info[0].include?(\"|\") && !info[0].include?(\",\")\n info.map! {|element| element.split(\" \")}\n info.each {|element| element.slice!(-4)} \n info\n elsif info[0].include?(\"|\")\n info.map! {|element| element.split(\" | \")}\n info.each {|element| element.slice!(-4)} \n info\n else\n info.map! {|element| element.split(\", \" )} \n end\nend",
"def date_formats\n [\n '%m/%d/%Y', #'mm/dd/yyyy',\n '%m-%d-%Y', #'mm-dd-yyyy',\n '%m-%d-%y', #'mm-dd-yy',\n '%d/%m/%Y', #'dd/mm/yyyy',\n '%d-%m-%Y', #'dd-mm-yyyy',\n '%d-%m-%y', #'dd-mm-yy',\n '%a, %d %b %Y' #strftime, e.g. 'Sat, 10 Nov 2007'\n ]\n end",
"def split_definition(raw_def)\r\n # TODO: your implementation here\r\n i = 0\r\n while (i < raw_def.size)\r\n raw_def[i].gsub! /\\s\\n/, \"\\n\"\r\n raw_def[i].gsub! /\\n+/, \"\\n\"\r\n raw_def[i].gsub! /\\t/, ''\r\n i += 1\r\n end\r\n x = 0\r\n newArr = []\r\n mod_def = []\r\n until x >= raw_def.size do\r\n if (raw_def[x][0] == \"\\n\")\r\n mod_def[x] = raw_def[x][1..-1]\r\n else\r\n mod_def[x] = raw_def[x]\r\n end\r\n newArr[x] = mod_def[x].split(/\\t?\\s?;\\s?\\n?/)\r\n x += 1\r\n end\r\n\r\n j = 0\r\n while (j < newArr.size)\r\n newArr[j].unshift(newArr[j][0][0..newArr[j][0].index(\">\")].gsub(/\\s*/, \"\"))\r\n if newArr[j][0] == \"<blank>\"\r\n newArr[j][1] = \"\";\r\n else\r\n newArr[j][1] = newArr[j][1][newArr[j][1].index(\">\") + 2..-1]\r\n end\r\n j += 1\r\n end\r\n\r\n k = 0\r\n while (k < newArr.size)\r\n l = 0\r\n while (l < newArr[k].size)\r\n newArr[k][l].gsub! /\\n+/, ' '\r\n l += 1\r\n end\r\n k += 1\r\n end\r\n\r\n return newArr\r\nend",
"def split_name_into_components(component)\n raise ArgumentError, \"Must pass a :row, :version AND :field\" if component.nil?\n component[:field] = [component[:field]] unless component[:field].is_a?(Array)\n \n component[:field].each do |field|\n NAME_BITS.zip(PEOPLE_BITS).each do |field_name, people_name|\n t.combine(:row => component[:row], :version => component[:version],\n :field => \"#{field}_#{field_name}\") do |row|\n \n # Grab the original, composite name\n name = row.send(\"#{field}_name\")\n \n unless name.nil?\n # Fix various name formatting errors\n name = self.class.fix_carrot_names(name) unless name.index(\"^\").nil?\n \n # Extract just the component you want\n (Fech::Translator::NAME_PARSER.parse(name)[people_name] || \"\").strip\n else\n nil\n end\n end\n end\n end\n end",
"def formatAnswerFromArray( answerString )\n answerRows = answerString.split(\"~\")\n answerArr = Array.new()\n answerRows.each { |ans|\n row = \"\"\n ansarr = ans.split(\",\")\n ansarr.each { |a|\n row += a unless a == \",\"\n }\n answerArr.push(row)\n } \n answerArr\n end",
"def format(string=\"[%{full_years} years >][%{months_after_years} months >][%{days_after_months} days >][%{hours_after_days}h>]%{minutes_after_hours}m>]%{seconds_after_minutes}s\")\n\t\t\t\n\t\tend",
"def format_name(str)\n parts = str.split(\" \")\n print parts\nend",
"def fields(string)\n string.split(/[\\t, ]+/) #split on all one or more instances of tabs, commas, or spaces\nend",
"def quote_name_part(part)\n part =~ /^\\[.*\\]$/ ? part : \"[#{part.gsub(']', ']]')}]\"\n end"
] |
[
"0.67150545",
"0.60502195",
"0.5724073",
"0.5724073",
"0.5637958",
"0.5620289",
"0.5610066",
"0.55777824",
"0.55194247",
"0.55191123",
"0.5513906",
"0.55050284",
"0.54896235",
"0.54811573",
"0.5458997",
"0.5433693",
"0.54069597",
"0.536396",
"0.53546613",
"0.5336816",
"0.5324163",
"0.53209484",
"0.5245328",
"0.52347517",
"0.5224767",
"0.5206955",
"0.52037674",
"0.5196498",
"0.519381",
"0.51725686",
"0.5163508",
"0.51362574",
"0.5109712",
"0.5099431",
"0.5057797",
"0.50514",
"0.5045491",
"0.5044498",
"0.5043356",
"0.5037138",
"0.50236523",
"0.50218743",
"0.5020223",
"0.5019095",
"0.50111574",
"0.5008584",
"0.5003527",
"0.4981154",
"0.49750993",
"0.49749184",
"0.497193",
"0.49638656",
"0.49595937",
"0.4947444",
"0.49470776",
"0.49349734",
"0.49253285",
"0.49176544",
"0.49172983",
"0.4900017",
"0.48920882",
"0.4880259",
"0.48745057",
"0.48738042",
"0.4858346",
"0.48569226",
"0.48541442",
"0.4852275",
"0.4852275",
"0.48205572",
"0.4817448",
"0.4813491",
"0.48016497",
"0.47994873",
"0.47921953",
"0.47883055",
"0.478499",
"0.47840363",
"0.4783256",
"0.47827795",
"0.4781055",
"0.47797522",
"0.47742757",
"0.4772114",
"0.4772114",
"0.47691843",
"0.4767598",
"0.4761078",
"0.47398347",
"0.4734943",
"0.47311908",
"0.47230116",
"0.4721821",
"0.4721799",
"0.47206363",
"0.4712444",
"0.47082213",
"0.470725",
"0.47044536",
"0.47038108"
] |
0.794051
|
0
|
CustomFields::AutoNumbering.increase(Integer) > String Get the next string CustomFields::AutoNumbering.increase(custom_field_id) => 10Text15120143
|
def increase(custom_field_id, cells)
ActiveRecord::Base.transaction do
custom_field = CustomFields::AutoNumbering.find(custom_field_id)
if self.unset_cells(custom_field, cells).empty?
value = format_value(custom_field, cells)
key_hash = AutoNumberRunning.key_hash(custom_field.format_key, value)
auto_number_running = custom_field.auto_number_runnings.find(:first,
:conditions => {
:auto_number_runnings => { :key_hash => key_hash }
}
)
auto_number_running ||= AutoNumberRunning.new(
:key_hash => key_hash,
:current => (custom_field.start_value - custom_field.increment)
)
custom_field.auto_number_runnings << auto_number_running if auto_number_running.new_record?
auto_number_running.current = auto_number_running.current + custom_field.increment
auto_number_running.save
format_value(auto_number_running, cells)
end
end.to_s
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def up_number\n unless number\n if Invoice.count == 0\n self.number = '001'\n else\n last_invoice = Invoice.order(:number).last\n self.number = last_invoice.number.succ\n end\n end\n end",
"def custom_attribute_field_id\n @ca_field_id ||= 0\n @ca_field_id += 1\n\n return \"custom_attribute_#{ @ca_field_id }\"\n end",
"def increments(field, options = {})\n incrementing_fields[field] = options.reverse_merge!(auto: true)\n attr_protected(field) if respond_to?(:attr_protected)\n end",
"def generate_number(isofferte)\n return id if isofferte.to_i == 1\n\n # TODO: scope per firm here!\n last_invoice = Invoice.order('number').last\n\n self.number = if last_invoice\n last_invoice.number + 1\n else\n # generate invoice nr based on year+month\n \"#{Time.new.strftime('%Y%m')}0001\".to_i\n end\n end",
"def set_invoice_number\n self.invoice_number = self.id + 777777\n self.save\n end",
"def increment_manuscript_rev_num\n if self.version && self.article\n num = self.manuscript_number \n rev = num.scan(/\\.R\\d+/)[0]\n if rev\n num.gsub!(/\\.R\\d+/,\"\")\n rev_num = rev.gsub(/\\.R/,\"\")\n rev_num = rev_num.to_i\n num+=\".R#{rev_num+1}\"\n else\n num = \"#{num}.R1\"\n end \n self.article.update_attribute(:manuscript_num,num)\n end\n end",
"def create_listing_number\n return unless self.listing_number.nil?\n\n number = Counter.get_next\n self.listing_number = self.account.country_short.upcase + number.to_s\n end",
"def increment_value str\n str.concat str.next.slice(-1)\nend",
"def update_invoice_number!\n return unless Spree::PrintInvoice::Config.use_sequential_number?\n return if invoice_number.present?\n\n update_columns(invoice_number: Spree::PrintInvoice::Config.increase_invoice_number)\n end",
"def number\n \"#{self.id}\".rjust(8, \"0\")\n end",
"def number\n \"#{self.id}\".rjust(8, \"0\")\n end",
"def number\n \"#{self.id}\".rjust(8, \"0\")\n end",
"def __to_inc__\n self\n end",
"def increment!(field, options)\n options = options.dup\n model_name = (options.delete(:model_name) || self.class.model_name).to_s\n options[:scope] = evaluate_scope(options[:scope]) if options[:scope]\n options[:step] = evaluate_step(options[:step]) if options[:step]\n write_attribute(\n field.to_sym,\n Mongoid::Autoinc::Incrementor.new(model_name, field, options).inc\n )\n end",
"def linkwizard_crm_num_field\n $tracer.trace(__method__)\n return ToolTag.new(input.className(\"/ats-enter_subscriber_number_field/\") ,__method__)\n end",
"def next_id\n (@curr_id +=1).to_s\n end",
"def nextCode(model,prefix,num)\n\t\t# naming= NamingSery.where('naming_type=\"Sale Invoice\"').first\n\t\tlastRecord=model.order(\"id desc\").first\n\t\t# name=''\n\t\t# if !naming.nil?\n\t\t# \tname=naming.series \n\t\t# end\n\n\t\tmaxNumber=''\n\t\t\tif !lastRecord.nil?\n\t\t\t\t\n\t\t\t\tnamingSeries=lastRecord[self]\n\t\t\t\tif !namingSeries.nil?\n\t\t\t\t\ti = 0\n\t\t\t\t\tlength = namingSeries.length\n\n\t\t\t\t\twhile i < length do\n\t\t\t\t\t\ti +=1\n\t\t\t\t\t \t chr=namingSeries[length-i].chr\n\t\t\t\t\t \tif (chr).is_number?\n\t\t\t\t\t \t\tmaxNumber.insert(0,chr)\t\t\t\t \t\t\n\t\t\t\t\t \telse\n\t\t\t\t\t \t\tbreak\n\t\t\t\t\t \tend\n\t\t\t\t\t \n\t\t\t\t\tend\t\n\t\t\t\t\t\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t\n\t\t\tend\n\t\treturn (maxNumber.to_i).generateCode(prefix,num)\n\tend",
"def number\n # TODO have this be our order id \n #CGI::Session.generate_unique_id\n mydate = Date.today().strftime('%Y%m%d')\n \"#{self.user.last_name}_#{mydate}_#{self.id}\"\n end",
"def inc_value(iIncrement = 1)\n super\n end",
"def increment_string(input)\n # snum = input.slice(/\\d+$/).to_s\n # num = (snum.to_i + 1)\n # \"#{input.split(/\\d+$/).first}#{num.to_s.rjust(snum.length, '0')}\"\n input.sub(/\\d*$/) {|d| d.empty? ? 1 : d.succ }\nend",
"def incr\n add(1)\n end",
"def next_id\n next_id = \"sdc:\" + (current_id.to_i + 1).to_s\n next_id\n end",
"def increment\n curr_value = counter\n self.counter = curr_value + 1\n save\n curr_value\n end",
"def increment!(name,amount=1)\n raise ArgumentError, \"Only integer fields can be incremented.\" unless self.class.fields.include?({:name => name.to_s, :type => :integer})\n redis.incr(field_key(name), amount)\n end",
"def teletext_add_digit _value\n send_cmd(\"teletext_add_digit #{_value}\")\n end",
"def increment(field, amount = 1)\n #value = (self[field] || 0) + amount\n #self[field] = value\n #if !@parse_object_id\n # # TODO - warn that the object must be stored first\n # return nil\n #end\n\n body = {field => Parse::Increment.new(amount)}.to_json\n data = Parse.client.request(self.uri, :put, body)\n parse data\n self\n end",
"def get_next_number\n if project && number.blank?\n last_invoice_number = Invoice.where(:project_id => project.id).max(:number)\n self.number = last_invoice_number ? ((last_invoice_number + 1).to_i) : 1\n end\n end",
"def update_auto_increments\n self.class.incrementing_fields.each do |field, options|\n increment!(field, options) if options[:auto]\n end && true\n end",
"def price_field\n \"#{field_name.parameterize.gsub('-', '_')}_value_as_integer\"\n end",
"def si_next_no(company, posted_at)\n code = ''\n year = posted_at.year\n company = company.to_s if company.is_a? Fixnum\n company = company.rjust(3, '0')\n year = year.to_s if year.is_a? Fixnum\n year = year.rjust(4, '0')\n last_no = SupplierInvoice.where(\"internal_no LIKE ?\", \"#{company}#{year}%\").order(:internal_no).maximum(:internal_no)\n if last_no.nil?\n code = company + year + '000001'\n else\n last_no = last_no[7..12].to_i + 1\n code = company + year + last_no.to_s.rjust(6, '0')\n end\n code\n end",
"def on_inc\n end",
"def get_integer_value(field_name)\n\t\tend",
"def cc_number_field\n #unit_test_no_generate: cc_number_field, input.className(create_ats_regex_string(\"ats-ccnumfield\"))\n $tracer.trace(__method__)\n return ToolTag.new(input.className(create_ats_regex_string(\"ats-ccnumfield\")), __method__)\n end",
"def display_number\n 'X' + id.to_s\n end",
"def order_number\n if (not self.id)\n return \"save to allocate number\"\n end\n base = Time.new().strftime(\"%Y\")\n return base + \"_\" + self.id.to_s\n end",
"def incr(x) x + 1 end",
"def increment_counter(counter_name, id)\n rec = collection.findOne({:_id => id})\n rec[counter_name] += 1\n collection.save(rec)\n end",
"def reference_it(value)\n reference_number = value[0,2].to_s.downcase\n reference_number += value.reverse[0,1].to_s.downcase\n reference_number += random_numeric(6)\n return reference_number\n end",
"def increment(name)\n update(name)\n end",
"def increment(format=nil, initial=1) \n regexp = format ? Regexp.new(Regexp.escape(format).gsub('%s', '\\d+')) : /\\d/\n parts = format ? split(/(#{regexp})|(\\D)/) : split(/(\\D)/)\n num = (format || \"%s\") % 0\n parts.push(num) unless parts[-1] =~ regexp\n parts[-1] = if format \n parts[-1].sub(/(\\d+)/) { |m| \n (Integer(m).zero? ? initial : Integer(m) + 1)\n }\n else\n Integer(parts[-1]).zero? ? initial : Integer(parts[-1]) + 1\n end\n parts.join\n end",
"def sequence_number; end",
"def plus_one(digits)\n digits[-1] += 1 \n digits \nend",
"def get_number(field)\n field['numberValue']\n end",
"def increment_id!\n self.id = (self.id + 1) % 0x10000\n end",
"def increment\n @value += 1\n end",
"def increment_sequence_number\n @sequence_number += 1\n @sequence_number = 0 if @sequence_number > 0xFFFFFFFF\n end",
"def increment_integer(user_id)\n user = User.find user_id\n user.integer_value += 1\n user.save\n\n user\n end",
"def increment_and_save!\n update_and_save { self.last_value = (last_value || 0) + 1 }\n end",
"def short_number\n self.new_record? ? self.number : \"#{self.id.to_s.rjust(6, \"0\")}#{I18n.l(self.created_at, :format => \"%m%Y\")}\"\n end",
"def hincrby(key, field, increment); end",
"def hincrby(key, field, increment); end",
"def increment!(name,amount=1)\n raise ArgumentError, \"Only integer fields can be incremented.\" unless self.class.fields.include?({:name => name.to_s, :type => :integer})\n store.update_count(field_key(name), amount)\n end",
"def next_unknown_field_name\n field_name = \"unknown\" + @unknown_inc.to_s\n @unknown_inc += 1\n field_name.to_sym\n end",
"def increment \n\t\t@counter = @counter + 1\n\tend",
"def mobile_or_pager_number\n FFaker.numerify('9### ####')\n end",
"def inc_seq_no!()\n @seq_no += 1\n return(nil)\n end",
"def increment_counter(counter_name, id)\n update_all \"#{counter_name} = #{counter_name} + 1\", \"#{primary_key} = #{id}\"\n end",
"def increase_rider\n @Num_rider.increase! :value\n end",
"def add_number\n return unless %w[techreport manual].include? @bib.type\n\n did = @bib.docidentifier.detect { |i| i.primary == true }\n did ||= @bib.docidentifier.first\n @item.number = did.id if did\n end",
"def document_counter(idx)\n idx + 1\n end",
"def increment\n self.class.increment(self)\n end",
"def number1\n self.number('number1','key1')\n end",
"def increment\n self.visits = self.visits.to_i.next\n self.save\n end",
"def unique_id\n $unique_id_increment = ($unique_id_increment || 0) + 1\n return (Time.new.to_f * 1000).to_i.to_s + $unique_id_increment.to_s\nend",
"def increment_counter(counter)\n\tcounter += 1\n\treturn counter\nend",
"def increment_num_comments\n\n end",
"def internationalized_phone_number(phone_number)\n \t\"+1#{phone_number}\"\n end",
"def number_field(object_name, method, options = T.unsafe(nil)); end",
"def get_next_serial_number(dt_wo)\n dt_wo.total_serial_nums += 1\n raise \"invalid serial number\" if dt_wo.total_serial_nums > 65525\n end_num = dt_wo.total_serial_nums.to_s\n serial_number = dt_wo.starting_serial_num\n serial_number = serial_number.ljust(10, \"0\")\n serial_number[serial_number.size - end_num.size, serial_number.size]= end_num\n dt_wo.current_serial_num = serial_number\n dt_wo.save!\n return serial_number\n end",
"def serialnumber\r\n\r\n @@serial +=1 ;\r\n \r\n id = request.object_id.to_i;\r\n if(id < 0 )\r\n \r\n id *= -1;\r\n end\r\n \r\n id %= 103; # mod by prime to keep the digits down.\r\n \r\n return(\"o\"+id.to_s+\"s\"+@@serial.to_s)\r\n \r\n end",
"def next_auto_increment\n if Visit.count > 0\n Visit.last.id + 1\n else\n tmp_visit = Visit.create(evid: \"00000000-0000-0000-0000-000000000000\")\n auto_increment = tmp_visit.id + 1\n tmp_visit.delete\n auto_increment\n end\n end",
"def string_increment(string)\n result = string.split(/[a-z]/i)\n new_str = ''\n if string[-1] =~ /[a-z]/i || string == \"\"\n new_str = string + \"1\"\n else\n digits_size = result.last.size\n if ((result.last.to_i + 1).to_s).size < digits_size # means 0 doestn't matter\n new_str = string[0, string.size-result.last.to_i.to_s.size]+(result.last.to_i + 1).to_s\n else\n new_str = string[0, string.size - digits_size] + (result.last.to_i + 1).to_s\n end\n end\n new_str\nend",
"def plus_one_short digits\n # int.next return the next int Ex: 2 -> 3\n # int.digits return an array of int digits\n # array.join return an string of array digits concatenation.\n # string.to_i return an int\n # array.reverse return an reversed array.\n digits.join.to_i.next.digits.reverse\nend",
"def make_next_seq_no\n if EdiHelper.current_out_is_cumulative || @return_a_string\n @out_seq = 1\n else\n @out_seq = MesControlFile.next_seq_edi(MesControlFile.const_get(\"EDI_#{@flow_type.upcase}\"))\n @seq_increased = true\n end\n @formatted_seq = sprintf('%03d', @out_seq)\n end",
"def increment_cell_value(str)\n letter = str[/[A-Za-z]+/]\n number = str[/\\d+/].to_i\n\n incremented_number = number + 1\n\n \"#{letter}#{incremented_number}\"\n end",
"def number\n HookNumber.new(number_record)\n end",
"def next_id\n @id ||= 0\n @id += 1\n end",
"def increment_string(input)\n return '1' if input.empty?\n \n arr = input.rpartition(/\\D/)\n\n if arr[-1].empty?\n arr[-1] = '1'\n else\n arr[-1] = arr[-1].succ\n end\n\n return arr.join\nend",
"def assign_control_doc_number\n\t\tself.control_doc_number = Time.now.strftime(\"%Y\") + \"/\" + Time.now.to_i.to_s\n\t\tself.control_doc_number\n\tend",
"def premium_service_number\n FFaker.numerify('1900 ### ####')\n end",
"def increment_string(s)\n s.sub(/\\d*$/) {|n| n.empty? ? 1 : n.succ}\nend",
"def next_number(number)\n return number += 1\nend",
"def inc(key)\n \n end",
"def increment_string(input)\nn = input.size\n i = n - 1\n numbers = '0'..'9'\n while i >= 0\n if !numbers.include?(input[i])\n break\n end\n i -= 1\n end\n numbers_size = input[i + 1..-1].size\n last_numbers = input[i + 1..-1].to_i + 1\n string = i == -1 ? '' : input[0..i]\n [string, \"%.#{numbers_size}d\" % last_numbers].join\nend",
"def increment_field_name(node)\n @node_offset += 1 # I really dislike this offset variable.\n @nodeset[\"#{node.name}_#{@node_offset}\".to_sym] = node.text unless node.blank?\n end",
"def increment(n = 1)\n @quantity += n\n end",
"def next_uid()\n\t\t\treturn @metadata.attributes[:next_uid].to_i\n\t\tend",
"def next_number(number)\n\n return number + 1\n\nend",
"def get_next_patid\n\t\tStudySubject.maximum(:patid).to_i + 1\n#\n#\tWhat happens if/when this goes over 4 digits? \n#\tThe database field is only 4 chars.\n#\n\tend",
"def next_note\n Note.new(self).succ.to_s\n end",
"def e_invoice_number_to\n (e_settings[:invoice_number_to] || 9999999999).to_s.to_i\n end",
"def increment\n @counter = @counter + 1\n end",
"def next_sequence_id\n last_sequence_id + 1\n end",
"def next_id\n self.latest_id += 1\n end",
"def active_scaffold_input_number(column, options)\n active_scaffold_number_input :number_field, column, options, :format\n end",
"def incrby(key, increment); end",
"def incrby(key, increment); end",
"def generate_order_number\n r = Random.new\n \"#{self.class.to_s.gsub(/[a-z]/, '')}#{Time.now.to_i}\"\n end",
"def next_number(number)\n number.to_i\n return number+=1\nend",
"def generate_order_no\n Time.now.to_f.to_s.tr('.', '')\n end"
] |
[
"0.6313153",
"0.626972",
"0.6189276",
"0.61273783",
"0.60978633",
"0.60512966",
"0.6033119",
"0.6012774",
"0.5972744",
"0.5963771",
"0.5963771",
"0.5963771",
"0.5956725",
"0.59532183",
"0.5952783",
"0.595243",
"0.59191203",
"0.5902649",
"0.5855905",
"0.58193666",
"0.5815659",
"0.57898253",
"0.5788209",
"0.57726157",
"0.57446223",
"0.57201886",
"0.5713808",
"0.5704661",
"0.5701585",
"0.56846064",
"0.5683697",
"0.5679766",
"0.5665269",
"0.56580377",
"0.5650708",
"0.5648592",
"0.5628852",
"0.5613651",
"0.56125754",
"0.56059945",
"0.5599268",
"0.5590308",
"0.5585889",
"0.55739427",
"0.55730385",
"0.5561051",
"0.5534021",
"0.5527486",
"0.5527023",
"0.5517148",
"0.5517148",
"0.5516978",
"0.5504426",
"0.5498683",
"0.5494997",
"0.54895765",
"0.54860175",
"0.5478411",
"0.5473188",
"0.547298",
"0.546862",
"0.54678684",
"0.5461028",
"0.5458847",
"0.5456173",
"0.54518235",
"0.5449746",
"0.5447524",
"0.54463524",
"0.54375017",
"0.54351217",
"0.5431515",
"0.54308105",
"0.5430706",
"0.5428815",
"0.5427642",
"0.5419932",
"0.5412362",
"0.5411014",
"0.5400983",
"0.5398882",
"0.5393385",
"0.53837496",
"0.53731465",
"0.53708994",
"0.5370387",
"0.5370076",
"0.53696525",
"0.5366076",
"0.53607225",
"0.5349131",
"0.53413105",
"0.53404146",
"0.5333219",
"0.53265476",
"0.5315991",
"0.5315991",
"0.5314678",
"0.53133565",
"0.53066367"
] |
0.73044413
|
0
|
custom_field = CustomFields::AutoNumbering.new custom_field.format = 'yyyy/mm/dd' custom_field.has_date? => true custom_field.format = '"Text with yyyy/mm/dd"' custom_field.has_date? => false custom_field.format = '[yy.mm]' custom_field.has_date? => false
|
def has_date?
format = self.format.gsub(/("[^"]*"|#|\[[\w.]+\])/,'')
!(format =~ /[ymdwhq]/).nil?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def template\n if self.style == 'mmyy'\n 'date_field_mmyy'\n else\n 'date_field'\n end\n end",
"def formatted_date(field)\n self.send(field).strftime('%b %d, %Y') if self.send(field).present?\n end",
"def date_field(field, options = {})\n append_class_option(options, \"date_field\")\n value = object.send(field)\n if value.is_a?(Date)\n value = I18n.l(value, :format => :default)\n end\n options[:value] = value\n text_field(field, options)\n end",
"def ptemplate\n if self.style == 'mmyy'\n 'fe/date_field_mmyy'\n else\n 'fe/date_field'\n end\n end",
"def validate_custom_field_values\n true\n end",
"def invoice_date_display\n\n end",
"def format_date_nicely(date)\nend",
"def mongoize\n \"#{format('%04d', year)}-#{format('%02d', month)}-#{format('%02d', day)}\"\n end",
"def acts_like_date?\n true\n end",
"def typus_date_format(attribute = :default)\n options = read_model_config['fields']['options']\n if options && options['date_formats'] && options['date_formats'][attribute.to_s]\n options['date_formats'][attribute.to_s].to_sym\n else\n :default\n end\n end",
"def html_for_date_field(object, field)\n \"<p>\n <label for = '#{field}' >\n Select your #{field}:\n </label>\n <input type = 'date' \n name = create_form[#{field}]\n placeholder = 'mm/dd/yy'\n value = '#{date_humanized(object.send(field))}'>\n </input>\n </p>\"\n end",
"def date_field(field, options={})\n options.reverse_merge!(:value => field_value(field), :id => field_id(field))\n options[:class] = 'date_field'\n options.merge!(:class => field_error(field, options))\n @template.date_field_tag field_name(field), options\n end",
"def create_date_field(form,\n value,\n name,\n label,\n field_id,\n required: false,\n validation: nil,\n html_class: nil,\n is_multiple: false,\n readonly: false,\n index: 0,\n ttip: nil,\n example: nil,\n default_value: nil)\n render partial: 'dynamic_form/fields/text_field',\n locals: {\n f: form,\n multiple: is_multiple,\n index:,\n field_value: value,\n field_name: name,\n field_label: label,\n field_class: html_class,\n field_id:,\n input_type: 'date',\n readonly:,\n required:,\n validation:,\n ttip:,\n example:,\n default_value:\n }\n end",
"def date_field_with_time(actual_date, object_name, method, options={})\n actual_date = Time.now if actual_date == nil\n if actual_date != nil\n hash = separate_date_time(actual_date)\n date_part = date_field(object_name, method+'_date', :size => 15, :value => hash[:date])\n time_part = text_field object_name, method+'_time', :size => 4,:value => hash[:time]\n else\n date_part= \"* SHOULD BE DATE STUFF HERE * \"\n time_part= \"* SHOULD BE TIME STUFF HERE * \"\n end\n return date_part+' ' + time_part\n end",
"def initialize_to_correct_date_type(field_info, field)\n initialize_integer(field_info, field)\n initialize_float(field_info, field)\n end",
"def dateify_dob\n self.dob ||= \"\"\n parts = self.dob.split(\"/\").map{|i| i.to_i}\n self.dob = \"#{parts[0].to_s.rjust(2, \"0\")}/#{parts[1].to_s.rjust(2, \"0\")}/#{parts[2]}\"\n end",
"def date_field_enter(date)\n my_date = Date.parse(date)\n year = my_date.year\n month = my_date.strftime('%b')\n day = my_date.strftime('%d')\n\n day_field = @field.all(:css, 'input[id$=\"DayValue\"]').first\n day_field.set \"#{day}\"\n\n month_drop_down = @field.all(:css, 'select[id$=\"MonthLongValue\"]').first[:id]\n select(month, :from => month_drop_down)\n\n year_field = @field.all(:css, 'input[id$=\"YearValue\"]').first\n year_field.set \"#{year}\"\n end",
"def date(input, format); end",
"def calc_date_mask(field_name)\n if params[:product][:\"#{field_name}(2i)\"] == '' and params[:product][:\"#{field_name}(3i)\"] != ''\n return\n elsif params[:product][:\"#{field_name}(2i)\"] == ''\n params[:product][:\"#{field_name}(2i)\"] = '1'\n params[:product][:\"#{field_name}(3i)\"] = '1'\n params[:product][:\"#{field_name}_mask\"] = :year\n elsif params[:product][:\"#{field_name}(3i)\"] == ''\n params[:product][:\"#{field_name}(3i)\"] = '1'\n params[:product][:\"#{field_name}_mask\"] = :year_month\n else\n params[:product][:\"#{field_name}_mask\"] = :year_month_day\n end\n end",
"def update_date_formats!\n Date::DATE_FORMATS.update(\n :db => '%Y-%m-%d %H:%M:%S',\n :ui => '%d.%m.%Y',\n :yaml => '%Y-%m-%d', # For Dates\n :default => '%d.%m.%Y'\n )\n end",
"def safe_value\n if self.value.nil?\n result = \"\"\n elsif self.format == :no_dash || self.format == :number\n result = self.value.strftime(\"%Y%m%d\")\n else\n result = self.value.strftime(\"%Y-%m-%d\")\n end\n\n if self.format == :number\n result.to_i.to_s\n else\n self.single_quoter_switch(result)\n end\n end",
"def number_field(field, options={})\n options.reverse_merge!(:value => field_value(field) ? field_value(field).to_i : nil, :id => field_id(field))\n options[:class] = 'number_field'\n options.merge!(:class => field_error(field, options))\n @template.number_field_tag field_name(field), options\n end",
"def date_format_readable(date)\n #date.strftime '%Y-%b-%d'\n date.strftime '%b %d %Y' if date.present?\n end",
"def create_format_method\n end",
"def processField033(field, index)\n field.find_all do |subfield|\n \n if subfield.code == \"a\"\n data = subfield.value.gsub(/[^0-9]/, \"\")\n \n if data.length == 4 # a simple 4-digit year\n date = data\n elsif data.length == 5 # this is a year and month, 19781\n date = \"#{data[0..3]}-0#{data[4]}\"\n elsif data.length == 6 # a year with a 2 digit date\n date = \"#{data[0..3]}-#{data[4..5]}\" # 4 digit year, two digit month, one digit day\n elsif data.length == 7\n \t\t date = \"#{data[0..3]}-#{data[4..5]}-0#{data[6]}\"\n \t\telsif data.length == 8 # 4 year, 2 month, 2 day\n \t\t date = \"#{data[0..3]}-#{data[4..5]}-#{data[6..7]}\"\n \t end\n\t \n \t if date\n \t return MARC::DataField.new('980', '', ' ', ['a', date], ['b', \"033\"], ['c', \"1\" ], [ \"d\", \"a\"], [ \"e\", index])\n else \n nil\n end\n end\n \n end\n end",
"def index_date_info(solr_doc)\n dates = temporal_or_created\n\n unless dates.empty?\n dates.each do |date|\n if date.length() == 4\n date += \"-01-01\"\n end\n\n valid_date = Chronic.parse(date)\n unless valid_date.nil?\n last_digit= valid_date.year.to_s[3,1]\n decade_lower = valid_date.year.to_i - last_digit.to_i\n decade_upper = valid_date.year.to_i + (10-last_digit.to_i)\n if decade_upper >= 2020\n decade_upper =\"Present\"\n end\n Solrizer.insert_field(solr_doc, 'year', \"#{decade_lower} to #{decade_upper}\", :facetable)\n end\n end\n end\n end",
"def typus_date_format(attribute = :default)\n Typus::Configuration.config[name]['fields']['options']['date_formats'][attribute.to_s].to_sym\n rescue\n :db\n end",
"def get_number(field)\n field['numberValue']\n end",
"def phone_number_field\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.find.input.id(\"/textPhoneNumberDaytime$/\"), format_method(__method__))\n end",
"def date_format t\n t.strftime \"%Y/%m/%d\"\nend",
"def date_format t\n t.strftime \"%Y/%m/%d\"\nend",
"def date_page_format\n '%B %d, %Y'\n end",
"def date_field_with_time_allowing_blank(date, object_name, method, options={})\n hash = { :date => '', :time => '' } \n \n\thash = separate_date_time(date) if date != nil\n\t\n date_part = date_field(object_name, method+'_date', :size => 15, :value => hash[:date])\n time_part = text_field object_name, method+'_time', :size => 4, :value => hash[:time]\n \n return date_part+' ' + time_part\n end",
"def billing_yearly?\n numbering_period == 'yearly'\n end",
"def has_date?\n !fields.select { |f| f.responsible_for?('Date') }.empty?\n end",
"def reformat(string, format)\n case format\n when \"MM/YYYY\"\n val = string.to_i\n sprintf(\"%02d/%4d\", val % 12 + 1, val / 12)\n when /.*%.*f.*/\n sprintf(format, string.to_f).gsub(/(\\d)(?=\\d{3}+(\\.\\d*)?[^0-9]*$)/, '\\1,')\n when /.*%.*d.*/\n sprintf(format, string.to_i).gsub(/(\\d)(?=\\d{3}+(\\.\\d*)?[^0-9]*$)/, '\\1,')\n else\n string\n end\nend",
"def short_number\n self.new_record? ? self.number : \"#{self.id.to_s.rjust(6, \"0\")}#{I18n.l(self.created_at, :format => \"%m%Y\")}\"\n end",
"def dates\n # only convert fields whose name is date* or *_date*\n # lots of other things might be 8 digits, and we have to exclude eg 'candidate'\n t.convert :field => /(^|_)date/ do |value|\n unless value.nil?\n Date.parse(value) rescue value\n end\n end\n end",
"def set_auto_date_field(field_name)\n method = \"#{field_name}=\"\n self.send(method, Time.now) if self.respond_to?(method)\n end",
"def price_field\n \"#{field_name.parameterize.gsub('-', '_')}_value_as_integer\"\n end",
"def active_scaffold_input_number(column, options)\n active_scaffold_number_input :number_field, column, options, :format\n end",
"def formatted_value\n value_as_date_hash = Date._parse(self.value.to_s)\n\n if Date.valid_date?(value_as_date_hash[:year].to_i,\n value_as_date_hash[:mon].to_i,\n value_as_date_hash[:mday].to_i)\n\n I18n.l Date.parse(self.value), format: :default\n else\n self.value\n end\n end",
"def custom_field_params\n params.require(:custom_field).permit(:name, :field_format)\n end",
"def datetime_format\n end",
"def build_support_field(feature)\n {\n :title => \"Total support worldwide\",\n :value => \"#{feature[\"usage_perc_y\"]}%\"\n }\nend",
"def date_view value, meta=nil\n return value.strftime \"%Y-%m-%d\" unless value.nil?\n ''\n end",
"def dateize(date)\n if not date.nil?\n date.strftime(\"%Y-%m-%d\")\n end\nend",
"def format_key\n formats = CustomFields::AutoNumbering.format_parts(self.format)\n\n formats.select{|f| (f =~ /(\"|#)/).nil? }.join('-')\n end",
"def number_with_formatting\n number_without_formatting\n end",
"def number_with_formatting\n number_without_formatting\n end",
"def date?\n false\n end",
"def cleanField(text = \"\")\n text.gsub!(\"Twentieth Century\", \"\") # date parser hates this...\n text.gsub!(\"-\",\" - \")\n \n text.scan(/(\\b\\d{4}s)/).each {|s| text.gsub!(s.first, convertDecades(s.first) )} #we need to convert decades with s'es (1930s) into ranges. \n text.scan(/(c\\d{4})/).each { |s| text.gsub!(s.first, s.first.delete(\"c\") )} #we need to remove c in copyright dates c1990 \n text.scan(/(\\d{4},)/).each {|s| text.gsub!(s.first, s.first.delete(\",\") )} #we need to remove commas after dates, like 1990,\n text.scan(/(\\d\\/)\\d{4}/).each { |p| text.gsub!( p.first, \"0#{p.first.gsub(\"/\", \"-\")}\" ) }\n \n \n text\n \n end",
"def expect_have_field_date(rendered_or_page, field_name, field_id, value, disabled, visible, pre_selector = '')\n expect(rendered_or_page).to have_field(field_name, disabled: disabled, visible: visible, count: 1)\n expect(rendered_or_page).to have_selector(\"#{pre_selector}input[type=date][id=#{field_id}][value='#{value}']\") if visible\n expect(rendered_or_page).to have_selector(\"#{pre_selector}input[type=date][id=#{field_id}]\") unless visible\n end",
"def premium_service_number\n FFaker.numerify('1900 ### ####')\n end",
"def date_field(object_name, method, options = T.unsafe(nil)); end",
"def rolls_date= date\n return super(date) unless date.is_a? String\n\n date = Date.strptime(date, \"%m%d%Y\") if date =~ /\\d{8}/\n date = Date.strptime(date, \"%m/%d/%Y\") if date =~ /\\d{1,2}\\/\\d{1,2}\\/\\d{4}/\n date = Date.parse(date) if date =~ /\\d{4}-\\d{1,2}-\\d{1,2}/\n\n super date\n end",
"def show_publication_year? _field_config, doc\n doc['journal_title_ts'].blank? && doc['conf_title_ts'].blank? && doc['publisher_ts'].blank?\n end",
"def field(issue, field)\n res = \"\"\n issue = issue[\"data\"] if issue.has_key?(\"data\")\n if %w{issuetype status assignee reporter project}.include?(field)\n res = issue[\"fields\"][field][\"name\"] unless issue[\"fields\"][field].nil?\n elsif %w{duedate created updated}.include?(field)\n res = format_date(issue[\"fields\"][field]).strftime(\"%m/%d/%Y\") unless issue[\"fields\"][field].nil?\n else\n res = issue[\"fields\"][field] unless issue[\"fields\"][field].nil?\n end\n res\n end",
"def assemble_collection_specific\n # TODO custom field text_type_k\n end",
"def human_date(date, optional_text= nil)\n if optional_text\n date.strftime(\"#{optional_text}\"+\" %d.%m.%Y\")\n else\n date.strftime(\"%d.%m.%Y\")\n end\n end",
"def format_date(date) \r\n (date == \"mm/dd/yy\" || date == \"MM/DD/YY\" || date.blank?)? nil : Date.strptime(date, '%m/%d/%y')\r\n end",
"def process_field_value(value)\r\n value\r\n end",
"def formatted_value_other(value, type)\n if type == :boolean || (type == :automatic && looks_like_boolean?(value))\n formatted_value_boolean(value)\n elsif type == :date || (type == :automatic && looks_like_date?(value))\n I18n.l(value)\n else # Number or String\n formatted_value_string(value)\n end\n end",
"def configure_field\n end",
"def is_valid_data_with_format?(date, reg_ex_date, obj_type)\n is_string?(date) ? (string_contains_reg_exp?(date, reg_ex_date) ? invalid_date_error_type(\"format\", obj_type) : true) : invalid_date_error_type(\"data type\", obj_type)\nend",
"def db_formatted_d( d )\n# d.try( :to_formatted_s, :db_date )\n d&.to_formatted_s( :db_date )\n end",
"def expand_value(code, value, lookup, format)\n return nil if value.blank?\n\n return lookup_ref_data_value(code, value) if lookup\n return value.to_date.strftime('%d %B %Y') if format == :date\n\n value\n end",
"def input_date_format(date)\n if date.split(\"-\").count > 2\n new_date = date.split(\"-\")\n return new_date[1] + \"-\" + new_date[0]\n else\n return date\n end\n end",
"def quoted_date(value)\n super.to_s\n end",
"def reformat_date_for_save(date_string)\n return if date_string.nil?\n month = \"1\"\n day = \"1\"\n year = \"1900\"\n #match = date_string.gsub(\"-\",\"/\").match(/(\\d+)\\/|\\-(\\d+)\\/|\\-(\\d+)/)\n match = date_string.gsub(\"-\", \"/\").split(\"/\")\n month_numbers = {\"Jan\" => \"1\", \"Feb\" => \"2\", \"Mar\" => \"3\", \"Apr\" => \"4\", \"May\" => \"5\", \"Jun\" => \"6\",\n \"Jul\" => \"7\", \"Aug\" => \"8\", \"Sep\" => \"9\", \"Oct\" => \"10\", \"Nov\" => \"11\", \"Dec\" => \"12\"}\n format_codes = GlobalSettings[:default_date_format].gsub(\"-\", \"/\").gsub(\" \", \"/\").split(\"/\")\n format_codes.each_with_index do |fmt, idx|\n case fmt.downcase\n when '%m'\n month = match[idx]\n when '%d'\n day = match[idx]\n when '%y'\n year = match[idx]\n when '%b'\n month = month_numbers[match[idx]]\n end\n end\n \"#{year}-#{month}-#{day}\"\n end",
"def is_date\n @is_date\n end",
"def hook_custom_field_value_tag(name, custom_value)\n custom_field = custom_value.custom_field\n field_name = \"#{name}[custom_field_values][#{custom_field.id}]\"\n field_name << '[]' if custom_field.multiple?\n field_id = \"#{name}_custom_field_values_#{custom_field.id}\"\n\n tag_options = { id: field_id, class: \"#{custom_field.field_format}_cf\" }\n\n field_format = custom_field.field_format\n case field_format.try(:edit_as)\n when 'date'\n text_field_tag(field_name, custom_value.value, tag_options.merge(size: 10)) +\n calendar_for(field_id)\n when 'text'\n text_area_tag(field_name, custom_value.value, tag_options.merge(rows: 3))\n when 'bool'\n hidden_field_tag(field_name, '0') + check_box_tag(field_name, '1', custom_value.true?, tag_options)\n when 'list'\n blank_option = ''.html_safe\n unless custom_field.multiple?\n blank_option = content_tag('option')\n end\n s = select_tag(field_name,\n blank_option + options_for_select(\n custom_field.possible_values_options(custom_value.customized),\n custom_value.value),\n tag_options.merge(multiple: custom_field.multiple?))\n if custom_field.multiple?\n s << hidden_field_tag(field_name, '')\n end\n s\n else\n text_field_tag(field_name, custom_value.value, tag_options)\n end\n end",
"def date_nested\n self[Solrizer.solr_name('date_nested', :displayable)]\n end",
"def publication_year\n super(:dc_date)\n end",
"def format_field(f, row)\n if respond_to?(\"format_#{f}\")\n send(\"format_#{f}\", row)\n else\n row[f].to_s\n end\n end",
"def input_date_month_year(name, date = Time.zone.today)\n field = field_content(name)\n id = field_id(name)\n {\n id: id,\n name: name,\n name_dd: \"#{id}_dd\",\n name_mm: \"#{id}_mm\",\n name_yy: \"#{id}_yy\",\n description: prop(field, 'description'),\n label: prop(field, 'label'),\n date: date,\n }\n end",
"def processField008(field)\n return nil if field.nil?\n field = field.value[6..15]\n if field[0] == \"p\" or field[0] == \"r\"\n \n first_date = field[1..4]\n second_date = field[5..9]\n start_date = first_date.gsub(\"u\", \"9\").to_i\n end_date = second_date.gsub(\"u\", \"9\").to_i\n \n if ( start_date > end_date && !second_date.include?(\"u\") )\n # if the secondDate is lower and there was not a \"u\" in the date field.\n return MARC::DataField.new('980', '', ' ', ['a', end_date], ['b', \"008\"], ['c', field[0] ])\n elsif ( start_date > end_date && second_date.include?(\"u\") ) \n # if the 2nd date is lower and there was a 'u', this means we need to add a date range.\n start_date = end_date - 9\n return MARC::DataField.new('980', '', ' ', ['a', \"#{start_date}-#{end_date}\"], ['b', \"008\"], ['c', field[0] ])\n elsif ( first_date.include?(\"u\") )\n # first date is larger, but there's a 'u' so, it needs a range. \n end_date = start_date - 9\n return MARC::DataField.new('980', '', ' ', ['a', \"#{start_date}-#{end_date}\"], ['b', \"008\"], ['c', field[0] ])\n else\n # at this point, we assume first date was larger and no 'u' so we just add the first date\n return MARC::DataField.new('980', '', ' ', ['a', start_date], ['b', \"008\"], ['c', field[0] ])\n end\n\n end\n end",
"def publication_date(field = nil)\n IsoDay.cast(find_record_items(field).first)&.to_s if field\n end",
"def date_field_tag(name, value = T.unsafe(nil), options = T.unsafe(nil)); end",
"def set_auto_date_field(field_name)\n self.send(\"#{field_name}=\", Time.now) if self.respond_to? field_name\n end",
"def get_numeric_field(value, id, field, *args)\n puts \"#{field} : #{value.class.to_s}\"\n opt = args.extract_options!\n if is_numeric?(value)\n if (value < 0)\n if (opt[:if_neg].eql?(:error)) # generate an error if value < 0\n invalid = \"#{field} doit etre > 0\"\n add_invalid(invalid, id)\n nil\n elsif opt[:if_neg].eql?(:warning) # generate a warning if value < 0\n warning = \"#{field} n'est pas > 0\"\n add_warning(warning, id)\n nil\n else\n #return value even if value<0\n end\n end\n value\n # branche elsif ci-dessous ajoutee car OpenOffice ne semble pas renvoyer de classe Integer pour les nombres\n elsif (value.class.eql?(String) || value.class.eql?(Fixnum))\n value = value.to_f\n if (value < 0)\n if (opt[:if_neg].eql?(:error)) # generate an error if value < 0\n invalid = \"#{field} doit etre > 0\"\n add_invalid(invalid, id)\n nil\n elsif opt[:if_neg].eql?(:warning) # generate a warning if value < 0\n warning = \"#{field} n'est pas > 0\"\n add_warning(warning, id)\n nil\n else\n #return value even if value<0\n end\n end\n value\n else\n if (opt[:invalid].eql?(:error)) # required => generate an error\n invalid = \"#{field} doit etre un nombre valide (class : #{field.class.to_s})\"\n add_invalid(invalid, id)\n elsif opt[:invalid].eql?(:warning) # not required => generate a warning\n warning = \"#{field} n'est pas un nombre valide\"\n add_warning(warning, id)\n end\n return nil\n end\n end",
"def expected_note_short_date_format(date)\n (Time.now.strftime('%Y') == date.strftime('%Y')) ? date.strftime('%b %-d') : date.strftime('%b %-d, %Y')\n end",
"def valid_mmddyyyy_date_format?(date)\n is_valid_data_with_format?(date, /^(0[1-9]|1[012])[- \\/.](0[1-9]|[12][0-9]|3[01])[- \\/.](19|20)\\d\\d$/, \"Date\")\nend",
"def mongoize\n ::Date.mongoize(self)\n end",
"def opportunity_date_ini_type_friendly(opportunity)\n if opportunity.date_ini_type == 0\n 'Indefinido'\n elsif opportunity.date_ini_type == 1\n 'Lo antes posible'\n else\n 'Fijar fecha'\n end\n end",
"def format_ap_date(date_obj)\n date_obj = DateTime.parse(date_obj) unless date_obj.is_a? DateTime\n\n if [*3..7].include? date_obj.month # months 3,4,5,6,7 are written as is in AP\n date_obj.strftime('%B %-d, %Y')\n elsif date_obj.month == 9 # Sept. is special\n date_obj.strftime('%bt. %-d, %Y')\n else # 3 letter abbr with .\n date_obj.strftime('%b. %-d, %Y')\n end\nend",
"def format_date_nicely(date)\n date.strftime '%d/%m/%Y'\nend",
"def format_date_nicely(date)\n date.strftime(\"%d/%m/%Y\")\nend",
"def format_date_nicely(date)\n date.strftime(\"%d/%m/%Y\")\nend",
"def decorate_field(field)\n field\n end",
"def format_date\n object.created_at.strftime(\"%b %d, %Y\")\n end",
"def publication_year(field = nil)\n IsoYear.cast(find_record_items(field).first)&.to_s if field\n end",
"def fiscal_year\n super(fy_year)\n end",
"def number_field_tag(name, value = T.unsafe(nil), options = T.unsafe(nil)); end",
"def format(value)\n case type\n when :date\n ::Date.parse(value)\n else\n value.to_s\n end\n end",
"def formal_publication_date\n publication_date.to_s(:formal_wo_ordinal)\n end",
"def phone_number_field\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.find.input.className(create_ats_regex_string(\"ats-phonefield\")), format_method(__method__))\n end",
"def custom_fields_version(name)\n send(:\"#{name}_custom_fields_version\") || 0\n end",
"def custom_fields_getters_for(name, type)\n case type.to_sym\n when :select then [name, \"#{name}_id\"]\n when :date, :date_time, :money then \"formatted_#{name}\"\n when :file then \"#{name}_url\"\n when :belongs_to then \"#{name}_id\"\n else\n name\n end\n end",
"def change_user_date(input_date)\n parsed_date = DateTime.parse(\"#{input_date}\")\n use_date = parsed_date.strftime('%a %d %b %Y')\n use_date\n end",
"def date_select(field, options={}, &block)\n format_with_label(field, options.merge(:field_type => \"date\"), super(field, purge_custom_tags(options)), &block)\n end"
] |
[
"0.63547283",
"0.62148106",
"0.60195345",
"0.5851265",
"0.56757474",
"0.567182",
"0.56124127",
"0.56004804",
"0.55629665",
"0.5489983",
"0.54718244",
"0.54544765",
"0.54295635",
"0.5412986",
"0.5408248",
"0.5404578",
"0.5386523",
"0.53690904",
"0.5363813",
"0.5362959",
"0.5344773",
"0.53435445",
"0.5321774",
"0.5318113",
"0.5312739",
"0.5309786",
"0.5307954",
"0.52970517",
"0.52592945",
"0.5242887",
"0.5242887",
"0.5232945",
"0.52182984",
"0.5215932",
"0.52150005",
"0.5214726",
"0.52137077",
"0.519528",
"0.5191905",
"0.51916426",
"0.51863",
"0.51858217",
"0.51847947",
"0.516631",
"0.5164236",
"0.51587427",
"0.51581377",
"0.5149229",
"0.5141893",
"0.5141893",
"0.5141458",
"0.5139232",
"0.5136534",
"0.51356566",
"0.5134027",
"0.5126421",
"0.5121251",
"0.5119138",
"0.51099867",
"0.51075923",
"0.5097949",
"0.5087707",
"0.5086602",
"0.50729895",
"0.50720465",
"0.50699115",
"0.50682396",
"0.50616574",
"0.5053057",
"0.5051367",
"0.5050828",
"0.5047537",
"0.50452733",
"0.50382805",
"0.5036115",
"0.5032213",
"0.50217754",
"0.50208116",
"0.5018927",
"0.5018533",
"0.50071996",
"0.5004329",
"0.5003303",
"0.5002328",
"0.49987245",
"0.499283",
"0.49858057",
"0.49805692",
"0.49805692",
"0.49794453",
"0.497558",
"0.49753252",
"0.4974501",
"0.49744105",
"0.4974126",
"0.49714315",
"0.49705344",
"0.49686754",
"0.4966533",
"0.4966423",
"0.49603036"
] |
0.0
|
-1
|
custom_field.format_key > string Get format key custom_field.format_key => "yymmdd"
|
def format_key
formats = CustomFields::AutoNumbering.format_parts(self.format)
formats.select{|f| (f =~ /("|#)/).nil? }.join('-')
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def key_format(field)\n @formatted_key[field] ||= JSONAPI.configuration\n .key_formatter\n .format(resource_key_for(field))\n .to_sym\n end",
"def format(value, key = nil, model = nil)\n if !key.nil?\n if key.to_s.ends_with?('_at')\n l(value.to_date)\n elsif !model.nil?\n t(\"#{model.to_s.downcase}.#{key}.#{value}\", :default => value.to_s)\n else\n value.to_s\n end\n else\n value.to_s\n end\n end",
"def format_field key\n key.downcase.gsub(%r{[^A-Z0-9]+}xoi,' ').strip.gsub(' ','_')\n end",
"def default_key_format(key)\n key\n end",
"def format_key(key)\n key.to_s.gsub(\"-\",\"_\")\n end",
"def template\n if self.style == 'mmyy'\n 'date_field_mmyy'\n else\n 'date_field'\n end\n end",
"def formatted_date(field)\n self.send(field).strftime('%b %d, %Y') if self.send(field).present?\n end",
"def typus_date_format(attribute = :default)\n options = read_model_config['fields']['options']\n if options && options['date_formats'] && options['date_formats'][attribute.to_s]\n options['date_formats'][attribute.to_s].to_sym\n else\n :default\n end\n end",
"def formatted_value\n formatter = @format.downcase.split(' ').map do |part|\n if (parsed_format = parse_date_or_time_format(part))\n parsed_format\n else\n warn 'Unable to parse custom format. Using \"YYYY-mm-dd HH:MM:SS\" format.'\n return @value.strftime('%F %T')\n end\n end.join(' ')\n\n @value.strftime(formatter)\n end",
"def date_param_value(params, key)\n k = clean_key(key.to_s)\n attrs = params.symbolize_keys\n if attrs.key?(:\"#{k}(1i)\")\n format_date = [\n attrs.fetch(:\"#{k}(1i)\"),\n attrs.fetch(:\"#{k}(2i)\"),\n attrs.fetch(:\"#{k}(3i)\"),\n ]\n format_date.delete_if(&:empty?)\n format_date.map { |d| zero_pad(d) }.join(\"-\")\n end\n end",
"def datetime_format\n end",
"def unique_format_name\n string_with_id(format_name)\n end",
"def typus_date_format(attribute = :default)\n Typus::Configuration.config[name]['fields']['options']['date_formats'][attribute.to_s].to_sym\n rescue\n :db\n end",
"def key_name(time, date_type=RailsRank::Types::Date::HOURLY)\n case date_type\n when RailsRank::Types::Date::YEARLY\n time.strftime('%Y')\n when RailsRank::Types::Date::MONTHLY\n time.strftime('%Y-%m')\n when RailsRank::Types::Date::DAILY\n time.strftime('%Y-%m-%d')\n else\n time.strftime('%Y-%m-%d-%H')\n end\n end",
"def key_by_date\n self.strftime('%Y-%m-%d')\n end",
"def formatted_value\n value_as_date_hash = Date._parse(self.value.to_s)\n\n if Date.valid_date?(value_as_date_hash[:year].to_i,\n value_as_date_hash[:mon].to_i,\n value_as_date_hash[:mday].to_i)\n\n I18n.l Date.parse(self.value), format: :default\n else\n self.value\n end\n end",
"def unique_format_name\n format_name + \" (#{id || \"?\"})\"\n end",
"def format=(value)\n super(value.to_s.underscore.gsub(/[\\s_]+/,'-'))\n end",
"def format_key(key)\n key.to_s.color(:yellow)\n end",
"def timekey_to_timeformat(timekey)\n case timekey\n when nil then ''\n when 0...60 then '%Y%m%d%H%M%S' # 60 exclusive\n when 60...3600 then '%Y%m%d%H%M'\n when 3600...86400 then '%Y%m%d%H'\n else '%Y%m%d'\n end\n end",
"def sub_string\n instance_variable_get(\"@#{config.format_key}\")\n end",
"def key(opts = {})\n time(opts).strftime(@format)\n end",
"def format_key\n :format_main_ssim\n end",
"def unique_partial_format_name\n string_with_id(partial_format_name)\n end",
"def typus_date_format(attribute = 'default')\n date_format = Typus::Configuration.config[self.name]['fields']['options']['date_formats'][attribute] rescue nil\n date_format = :db if date_format.nil?\n return date_format.to_sym\n end",
"def get_key_for(time)\n \"#{time.year}/#{time.month}/#{time.day}/#{time.hour}\"\n end",
"def format_name\n title\n end",
"def getdate(key, format)\r\n @value = getvalue(key)\r\n return SVUtils::getdate(@value, format)\r\n end",
"def input_date_format(date)\n if date.split(\"-\").count > 2\n new_date = date.split(\"-\")\n return new_date[1] + \"-\" + new_date[0]\n else\n return date\n end\n end",
"def field(issue, field)\n res = \"\"\n issue = issue[\"data\"] if issue.has_key?(\"data\")\n if %w{issuetype status assignee reporter project}.include?(field)\n res = issue[\"fields\"][field][\"name\"] unless issue[\"fields\"][field].nil?\n elsif %w{duedate created updated}.include?(field)\n res = format_date(issue[\"fields\"][field]).strftime(\"%m/%d/%Y\") unless issue[\"fields\"][field].nil?\n else\n res = issue[\"fields\"][field] unless issue[\"fields\"][field].nil?\n end\n res\n end",
"def test_format_strftime_record\n d = create_driver %[\n tag #{@tag}\n key #{@key}\n format %d/%b/%Y:%H:%M:%S %z\n source record\n standard localtime\n ]\n\n d.run do\n d.emit({\"a\"=>1}, Time.parse(\"1990-04-14 09:45:15 UTC\").to_i)\n end\n\n record = d.emits.first.last\n assert_equal \"14/Apr/1990:11:45:15 +0200\", record[@key]\n end",
"def putfield(format,key,value)\n format = 'a' if format.nil?\n field = \"#{key} : #{format =~ /^a.*$/ ? hexstring(value) : value}\"\n field = field[0..40] + '...'+ field[-40..-1] if field.size > 80 # centre-truncate long strings\n puts field\nend",
"def format(key, value)\n \"#{key}#{key_value_separator}#{format_value(value)}\"\n end",
"def default_key_format(key)\n snake(key)\n end",
"def get_batch_date(format)\r\n self.date.strftime(format)\r\n end",
"def ptemplate\n if self.style == 'mmyy'\n 'fe/date_field_mmyy'\n else\n 'fe/date_field'\n end\n end",
"def add_format(key, format)\n formats.merge!({key => format})\n end",
"def datetime_format\n /^\\d{4}-\\d{2}-\\d{2}\\w\\d{2}:\\d{2}:\\d{2}/\n end",
"def arrest_key(date, last, first)\n \"#{date}-#{last}-#{first}\".downcase\n end",
"def strftime_ordinalized(fmt, format=nil)\n strftime(fmt.gsub(/(^|[^-])%d/, '\\1_%d_')).gsub(/_(\\d+)_/) { |s| s.to_i.ordinalize }\n end",
"def formatted_date\n \tobject.created_at.strftime(\"%R - %B %e, %Y \")\n end",
"def date_time_attribute_get(instance, name)\n if value = instance.send(:\"formatted_#{name}\")\n { name => value, \"formatted_#{name}\" => value }\n else\n {}\n end\n end",
"def format_date\n object.created_at.strftime(\"%b %d, %Y\")\n end",
"def format_field(f, row)\n if respond_to?(\"format_#{f}\")\n send(\"format_#{f}\", row)\n else\n row[f].to_s\n end\n end",
"def key_formatter\n JSONAPI.configuration.key_formatter\n end",
"def key_formatter\n JSONAPI.configuration.key_formatter\n end",
"def format_key(key)\n key.tr(\"_\", \"-\")\n .gsub(\"enabled\", \"enable\")\n .gsub(\"user-name\", \"username\")\n .gsub(/^registry-jwt-expiration-time-value$/, \"jwt-expiration-time\")\n .gsub(/^registry-catalog-page-value$/, \"catalog-page\")\n .gsub(/^check-ssl-usage-enable$/, \"secure\")\n .gsub(/^user-permission-change-visibility-enable$/, \"change-visibility-enable\")\n .gsub(/^user-permission-manage-namespace-enable$/, \"manage-namespace-enable\")\n .gsub(/^user-permission-create-namespace-enable$/, \"create-namespace-enable\")\n .gsub(/^user-permission-manage-team-enable$/, \"manage-team-enable\")\n .gsub(/^user-permission-create-team-enable$/, \"create-team-enable\")\nend",
"def datetime_format\n @default_formatter.datetime_format\n end",
"def formatConvertor(inputFormat)\n\n inputFormat.sub! 'DD', '%d'\n inputFormat.sub! 'YYYY', '%Y'\n inputFormat.sub! 'YY', '%Y'\n inputFormat.sub! 'MM', '%m'\n inputFormat.sub! 'hh', '%H'\n inputFormat.sub! 'mm', '%M'\n inputFormat.sub! 'ss', '%S'\n inputFormat.sub! 'HH', '%I' # HH - for hour of the clock (12 hour)\n inputFormat.sub! 'A/P', '%p'\n inputFormat.sub! 'MON', '%b' # Jan/Feb etc\n #inputFormat.sub! 'TZ', '%z' # TimeZone\n\n\nend",
"def datetime_format\n @logger.first.datetime_format\n end",
"def pretty_date\n from_index[:modified].sub(/(\\d{4})(\\d{2})(\\d{2})\\d{6}/,'\\1-\\2-\\3')\n end",
"def format(value)\n case type\n when :date\n ::Date.parse(value)\n else\n value.to_s\n end\n end",
"def format_proper_date(key, value)\n return unless key == 'layer_modified_dt'\n\n metadata[key] = Time.parse(value).utc.iso8601\n end",
"def translate_formats(key, value)\n return unless key == 'dc_format_s' && formats.include?(value)\n\n metadata[key] = formats[value]\n end",
"def formatted_created_at\n self.created_at.strftime('%b %d') if self.created_at\n end",
"def custom_key\n object.title\n end",
"def literal_date(v)\n v.strftime(\"{d '%Y-%m-%d'}\")\n end",
"def localized_format(key, translation_table = nil, placeholder_value)\n format_str = localized(key, translation_table)\n puts format_str\n NSString.stringWithFormat(format_str, placeholder_value)\nend",
"def safe_value\n if self.value.nil?\n result = \"\"\n elsif self.format == :no_dash || self.format == :number\n result = self.value.strftime(\"%Y%m%d\")\n else\n result = self.value.strftime(\"%Y-%m-%d\")\n end\n\n if self.format == :number\n result.to_i.to_s\n else\n self.single_quoter_switch(result)\n end\n end",
"def i18n_key(content_type)\n simplify_matchdata(match(content_type), joiner: \".\") { |e|\n e.gsub!(I18N_RE, \"-\")\n }\n end",
"def formatted_created_at\n object.created_at.strftime('%b %-d, %Y')\n end",
"def expand_value(code, value, lookup, format)\n return nil if value.blank?\n\n return lookup_ref_data_value(code, value) if lookup\n return value.to_date.strftime('%d %B %Y') if format == :date\n\n value\n end",
"def formatted_creation_date\n self.created_at.strftime(\"%b %d '%y %H:%M\")\n end",
"def format_date(date, format)\n date = datetime(date)\n if format.nil? || format.empty? || format == \"ordinal\"\n date_formatted = ordinalize(date)\n else\n format.gsub!(/%a/, ABBR_DAYNAMES_DE[date.wday])\n format.gsub!(/%A/, DAYNAMES_DE[date.wday])\n format.gsub!(/%b/, ABBR_MONTHNAMES_DE[date.mon])\n format.gsub!(/%B/, MONTHNAMES_DE[date.mon])\n date_formatted = date.strftime(format)\n end\n date_formatted\n end",
"def new_key_format\n if GROUPS[:trivia].include?(self.key)\n if self.key.to_s =~ /(qs_)/\n \"old_question\"\n else\n \"trivia\"\n end\n else\n self.key.to_s\n end\n end",
"def mongoize\n \"#{format('%04d', year)}-#{format('%02d', month)}-#{format('%02d', day)}\"\n end",
"def date_format\n return @date_format\n end",
"def normalized_key(name, serializer)\n # serializer && serializer.localized? ? \"#{name}.#{::I18n.locale}\" : name\n serializer&.localized? ? \"#{name}.#{::Mongoid::Fields::I18n.locale}\" : name\n end",
"def format_date_nicely(date)\nend",
"def transform_field_name(key, name)\n hash = ::CUSTOM_FIELD_NAMES\n class_name = self.class.name.demodulize.underscore.to_sym\n return name if hash.nil? || hash[class_name].nil? || hash[class_name][key.to_sym].nil?\n hash[class_name][key.to_sym]\n end",
"def unique_format_name\n title + \" (#{id || \"?\"})\"\n end",
"def format(obj)\n case obj\n when Time\n obj.strftime(\"%Y-%m-%d\")\n when Date, Gem::Version, Gem::Requirement\n obj.to_s\n else\n obj\n end\n end",
"def the_field(field_key, default_val = '')\n h.do_shortcode(object.get_field(field_key, default_val).to_s.translate(@_deco_locale), object)\n end",
"def en_time_format(date)\n date.strftime(\"%m.%d.%y - %H:%M\")\n end",
"def formatted_created_at\n self.created_at.to_date.to_s(:long)\nend",
"def custom_field_params\n params.require(:custom_field).permit(:name, :field_format)\n end",
"def db_formatted_d( d )\n# d.try( :to_formatted_s, :db_date )\n d&.to_formatted_s( :db_date )\n end",
"def datetime_format=(format)\n end",
"def date_format_readable(date)\n #date.strftime '%Y-%b-%d'\n date.strftime '%b %d %Y' if date.present?\n end",
"def fix_format_string(fmt)\n\t\t\tfmt.gsub(\"__\",\"%s\").gsub(\"_\",\"%s\")\n\tend",
"def unique_format_name\n display_name + \" (#{id || \"?\"})\"\n end",
"def sf_field(key)\n self.attributes[translate_rails_key(key)] || self.attributes[translate_rails_key(key) + \"__c\"]\n end",
"def decorated_created_at\n created_at.to_date.to_s(:long)\n # created_at.strftime \"%d/%m/%Y %H:%M\"\n end",
"def price_field\n \"#{field_name.parameterize.gsub('-', '_')}_value_as_integer\"\n end",
"def get_field(key)\n @form_fields.getField key.to_s\n end",
"def format_key(key)\n @string_size = [@string_size.to_i, key.length + 2].max\n key.ljust(@string_size, \" \")\nend",
"def email_date; strftime(EMAIL_TIME_FORMAT); end",
"def formatted_date( date )\n date.strftime( \"%Y-%b-%d\" ) + \" \" + date.strftime( \"%A\" ).slice( 0..2 ) unless date == nil\n end",
"def create_format_method\n end",
"def format\n return @key if @params.empty?\n\n Kernel.format(@key, @params) if @params.any?\n end",
"def field_names\n internal_format.keys\n end",
"def get_fmt(key)\n case key\n when \"PNG\" , \"png\" then 0\n when \"BMP\" , \"bmp\" then 1\n when \"TIFF\" , \"tiff\" then 2\n when \"PBM\" , \"pbm\" then 3\n when \"SVG\" , \"svg\" then 4\n when \"JSON\" , \"json\" then 5\n when \"DIGIT\", \"digit\" then 6\n when \"ASCII\", \"ascii\" then 7\n end\n end",
"def to_param\n I18n.l(date, format: :ymd)\n end",
"def format_date(date)\n date.strftime(\"%b #{date.day.ordinalize}, %Y\")\n end",
"def cdr_from_fmt\n '%s'\n end",
"def date_format=(value)\n @date_format = value\n end",
"def format\n Hash[params.map {|k, v| [k.to_s.dasherize, v]}]\n end",
"def format=(name)\n @format = name.to_s\n end",
"def input_name_from_type(type)\n prefix = @options[:prefix] || ActionView::Helpers::DateTimeSelector::DEFAULT_PREFIX\n prefix += \"[#{@options[:index]}]\" if @options.has_key?(:index)\n\n field_name = @options[:field_name] || type.to_s\n if @options[:include_position]\n field_name += \"(#{ActionView::Helpers::DateTimeSelector::POSITION[type]}i)\"\n end\n\n @options[:discard_type] ? prefix : \"#{prefix}[#{field_name}]\"\n end",
"def date_format t\n t.strftime \"%Y/%m/%d\"\nend"
] |
[
"0.6988146",
"0.6979394",
"0.6971839",
"0.6855248",
"0.6465034",
"0.64554995",
"0.62444687",
"0.61550605",
"0.61434186",
"0.6141597",
"0.61248356",
"0.6122676",
"0.5986273",
"0.59589183",
"0.59386146",
"0.5897729",
"0.5897417",
"0.58601105",
"0.5854681",
"0.5850038",
"0.5843593",
"0.58370394",
"0.5835245",
"0.5834641",
"0.5802074",
"0.57899266",
"0.57866675",
"0.5770705",
"0.5755069",
"0.57215434",
"0.57185155",
"0.57182395",
"0.57170296",
"0.5693786",
"0.5677855",
"0.5677723",
"0.56680566",
"0.56528854",
"0.56287885",
"0.5609891",
"0.56004673",
"0.55908084",
"0.55653954",
"0.5564552",
"0.5559766",
"0.5559766",
"0.55556303",
"0.5535122",
"0.55315727",
"0.5531164",
"0.54967076",
"0.54933625",
"0.5461378",
"0.5459913",
"0.5445932",
"0.5434444",
"0.5433932",
"0.5420969",
"0.54152614",
"0.5412275",
"0.5411518",
"0.5404824",
"0.53942794",
"0.5392119",
"0.5391888",
"0.5388579",
"0.5385609",
"0.5385243",
"0.5370827",
"0.53559494",
"0.53535676",
"0.53527415",
"0.535197",
"0.53488266",
"0.5337216",
"0.5333785",
"0.533308",
"0.5319195",
"0.53150165",
"0.5313348",
"0.5296337",
"0.5289271",
"0.52863616",
"0.5284453",
"0.5278543",
"0.5270497",
"0.5270325",
"0.52700764",
"0.52626157",
"0.52621186",
"0.5260789",
"0.5253177",
"0.5252133",
"0.5249796",
"0.52464724",
"0.5233758",
"0.5231979",
"0.5215829",
"0.5215713",
"0.5212146"
] |
0.76499903
|
0
|
cutom_field.reference_custom_field_ids > an array Get reference custom field ids custom_field.reference_custom_field_ids => [10,11,12,13]
|
def reference_custom_field_ids
self[:value] ||= {}
self[:value][:custom_field_ids] ||= []
@custom_field_ids ||= self[:value][:custom_field_ids].collect{|cf_id| cf_id.to_i if CustomField.exists?(cf_id) }.compact
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def reference_custom_fields\n reference_custom_field_ids.collect{|cf_id| CustomFields::Reference.find(cf_id) }\n end",
"def custom_fields\n field_values = @client.account_details.custom_field_values\n\n fields = []\n\n 3.times do |i|\n n = i+1\n\n if send(:\"field#{n}_value_id\").nil?\n fields << nil\n else\n\n field_value = field_values.select { |fv| fv[\"id\"] == send(:\"field#{n}_value_id\") }\n fields << Unfuddled::CustomField.new(\n :number => n,\n :title => project.send(:\"ticket_field#{n}_title\"),\n :type => project.send(:\"ticket_field#{n}_disposition\"),\n :value => field_value\n )\n end\n end\n\n fields\n end",
"def field_ids\n @conditions['field_ids'] || cbobject.basis_fields\n end",
"def contact_ids\n (object.added_contacts + object.mutual_contacts).map{|ct| ct.slug }\n end",
"def id\n @customFieldId\n end",
"def field_ids\n @fields.keys\n end",
"def ffcrm_list_ids\n config.mailchimp_list_fields.map{ |f| f.settings['list_id'] }\n end",
"def add_custom_field_to_issue(issue_and_custom_fields)\n issue_and_custom_fields[0].custom_fields = issue_and_custom_fields[1].map do |template_values|\n {id: CustomField.where(name: template_values.values.first.keys.first).pluck(:id).first, value: template_values.keys.first}\n end\n issue_and_custom_fields[0]\n end",
"def _referenced_object_ids\n @data.each.select do |v|\n v&.respond_to?(:is_poxreference?)\n end.map(&:id)\n end",
"def custom_fields_request\n data[:properties].custom_field_property do\n key :type, \"array\"\n items do\n key :\"$ref\", \"CustomFieldValueApiRequest\"\n end\n end\n end",
"def many_to_many_custom_fields\n group_custom_fields('many_to_many') { |rule| [rule['name'], \"#{rule['name'].singularize}_ids\"] }\n end",
"def many_to_many_custom_fields\n group_custom_fields('many_to_many') { |rule| [rule['name'], \"#{rule['name'].singularize}_ids\"] }\n end",
"def delete_all_custom_fields\n puts \"Deleting custom fields for user #{@user_id}\"\n fieldlist = get_all_custom_fields\n\n fields = JSON.parse(fieldlist)\n # make an array of ids\n field_ids = fields['custom_fields'].map {|k,v| k['id']}\n puts field_ids.length\n field_ids.each do |i|\n res = delete_custom_field(i)\n end\n end",
"def get_custom_fields(issue)\n custom_items = {}\n issue.customFieldValues.each do |custom|\n if Jira_custom_fields.has_key?(custom.customfieldId)\n custom_items[Jira_custom_fields[custom.customfieldId]] = custom.values.join(\", \")\n end\n end\n custom_items\n end",
"def current_account_contact_ids\n current_account.added_contact_ids + current_account.mutual_contact_ids\n end",
"def account_ids()\n return [1, 2]\n end",
"def history_card_ids\n field_card_ids << id\nend",
"def references\n details.map { |detail| detail[:recurring_detail_reference] }\n end",
"def member_ids_field\n Solrizer.solr_name('member_ids', :symbol)\n end",
"def work_entry_other_ids(field)\n case field.tag\n when /(760|762|765|767|770|772|773|774|775|777|780|785|786|787)/\n field.subfields.select { |sf| work_entry_other_id_subfields(field).include?(sf.code) }\n .map { |sf| remove_parenthetical_id_prefix_from_sf_w(sf) }\n end\n end",
"def campaign_ids\n (params[:campaign_ids] || []).map(&:to_i)\n end",
"def custom_fields\n CustomField.all(self)\n end",
"def company_ids\n @cached_company_ids ||= @object.companies.legit.pluck(:id)\n end",
"def relationship_custom_fields\n custom_fields_recipe['rules'].find_all do |rule|\n %w[belongs_to has_many many_to_many].include?(rule['type'])\n end\n end",
"def libraries_id_array\n staff_member_library_ids = []\n self.library.each do |l|\n staff_member_library_ids << l.id\n end\n staff_member_library_ids\n end",
"def get_custom_fields(autopilot_contact)\n\t if autopilot_contact.has_key?(\"custom\")\n \t\tautopilot_contact[\"custom\"].each do |key,value|\n\t\t\t#if !cf[\"deleted\"]\n\t\t\t\t#Rails.logger.info \"cutom fieldsssssssssssss\"\n\t\t\t\t#Rails.logger.info \"#{key}\"\n\t\t\t\t#Rails.logger.debug \"#{value}\"\n\t\t\t\tcustom_field_value = value\n\t\t\t\tcustom_field_type, custom_field = key.split(\"--\")\n\t\t\t\t#Rails.logger.debug \"custom field-->#{custom_field}-#{custom_field_value}\"\n\t\t\t\tcase custom_field\n\t\t\t\twhen \"FDADDRESS\"\n\t\t\t\t\t@freshdesk_data[\"address\"] = custom_field_value\n\t\t\t\twhen \"FDACCOUNTID\"\n\t\t\t\t\t@freshdesk_account_id = custom_field_value\n\t\t\t\twhen \"FDCONTACTID\"\n\t\t\t\t\t@freshdesk_contact_id = custom_field_value\n\t\t\t\telse\n\t\t\t\t #@freshdesk_data[\"custom_fields\"][cf[\"kind\"]] = custom_field_value\n\t\t\t\tend\t\n\t\t\t#end\n\t\tend\n \t end\n\tend",
"def custom_fields_response\n data[:properties].custom_field_property do\n key :type, \"array\"\n key :xml, wrapped: true\n items do\n key :\"$ref\", \"CustomFieldValueApiResponse\"\n end\n end\n end",
"def custom_attribute_field_id\n @ca_field_id ||= 0\n @ca_field_id += 1\n\n return \"custom_attribute_#{ @ca_field_id }\"\n end",
"def custom_fields_for_issues(tracker)\n all_custom_fields.select {|c| tracker.custom_fields.include? c }\n end",
"def customer_ids; (customers.map(&:id) rescue []); end",
"def ordered_ids\n Array(solr_document[\"member_ids_ssim\"])\n end",
"def custom_fields_to_show\n begin\n custom_field_names = plugin_setting('custom_fields_shown').to_s\n custom_field_names.split(',').map {|custom_field_name|\n UserCustomField.find_by_name(custom_field_name.strip) \n }.flatten.compact\n rescue\n []\n end\n end",
"def collection_name\n 'resource_reference_fields'\n end",
"def set_custom_field\n @custom_field = CustomField.find(params[:id])\n end",
"def create_custom_field_values(contact)\n values = contact.custom_field_values\n existing_custom_fields = values.collect(&:custom_field)\n current_user.custom_fields.each do |custom_field|\n unless existing_custom_fields.include?(custom_field)\n new_value = values.new\n new_value.custom_field = custom_field\n end\n end\n end",
"def jira_ids\n options[:jira_ids] || []\n end",
"def telerivet_contact_ids\n @@SMS_NUMBER_FIELDS.keys\n .map { |attribute| split_sms_numbers(attribute) }\n .flatten\n .map { |sms_number| telerivet_id_cache[sms_number] }\n .reject(&:blank?)\n .uniq\n end",
"def duplicants_fieldlet_ids\n\t\t\tself.duplicant_field::FIELDLET_IDS\n\t\tend",
"def set_custom_field\n @custom_field = CustomField.find(params[:id])\n end",
"def field_name(relation)\n \"__#{relation}_ids\"\n end",
"def acc_ids\n\t self.accounts.pluck(:id)\n\tend",
"def editable_custom_field_values(user=nil)\n user_real = user || User.current\n custom_field_values.select do |value|\n value.custom_field.editable_by?(project, user_real)\n end\n end",
"def advised_companies\n Company.where(:id.in => advised_company_ids)\n end",
"def advised_companies\n Company.where(:id.in => advised_company_ids)\n end",
"def custom_field_values_from_keywords(customized)\n customized.custom_field_values.inject({}) do |h, v|\n if keyword = get_keyword(v.custom_field.name)\n h[v.custom_field.id.to_s] = v.custom_field.value_from_keyword(keyword, customized)\n end\n h\n end\n end",
"def initialize_custom_fields\n fields = service.get_custom_fields(contact_point_list)\n existing_fields = fields.map(&:FieldName)\n\n [\n { name: \"organization_id\", type: 'Number' },\n { name: \"organization_name\", type: 'Text' },\n { name: \"cop_status\", type: 'Text' },\n { name: \"cop_due_on\", type: 'Text' },\n ].each do |hash|\n create_custom_field(hash.fetch(:name), hash.fetch(:type))\n end\n end",
"def index\n @custom_field_values = CustomFieldValue.all\n end",
"def has_many_custom_fields\n group_custom_fields('has_many') { |rule| [rule['name'], rule['inverse_of']] }\n end",
"def has_many_custom_fields\n group_custom_fields('has_many') { |rule| [rule['name'], rule['inverse_of']] }\n end",
"def member_ids_field\n \"member_ids_ssim\"\n end",
"def to_ids\n @to_ids ||= [ reference.id ] + to_similarity_ids\n end",
"def references\n @references ||= Comment.find(:all, :conditions => [\"(comments.commentable_type = ? AND comments.commentable_id = ?) AND comments.position IN (?)\", self.commentable_type, self.commentable_id, self.reference_ids], :order => 'comments.position ASC')\n end",
"def doc_ids_only\n {'fl'=>'id', 'facet'=>'false'}\n end",
"def ids\n (1..get_item_count).map do |index|\n get_item_identifier index\n end\n end",
"def second_reference_id\n nil\n end",
"def other_claim_related_id\n end",
"def fetch_message_ids field\n self[field] ? self[field].message_ids || [self[field].message_id] : []\n end",
"def auto_reference(value)\n if value.is_a?(Array)\n return value.map { |v| auto_reference(v) }\n end\n\n if value.is_a?(Entity)\n # If it's from another crate, need to add it to this one.\n crate.add_contextual_entity(value)\n\n return value.reference\n end\n\n value\n end",
"def set_custom_field\n @custom_field = CustomField.find(params[:id])\n end",
"def dids_911\n dids_911_list ? dids_911_list.collection : []\n end",
"def ids\n options[:id][1..-2].split(\",\").map(&:to_i)\n end",
"def set_custom_field_value\n @custom_field_value = CustomFieldValue.find(params[:id])\n end",
"def need_calc_company\n company_ids = []\n company_ids = self[:company].split(\",\") unless self[:company].blank?\n company_ids\n end",
"def non_autocomplete_fields\n\t\t\t\t[\"ID\"]\n\t\t\tend",
"def fold_references_helper(entity, array_of_refs, organization)\n ref = array_of_refs.shift\n field = entity[ref]\n return if field.blank?\n\n # Follow embedment path, remplace if it's not an array or a hash\n case field\n when Array\n field.each do |f|\n fold_references_helper(f, array_of_refs.dup, organization)\n end\n when Hash\n fold_references_helper(entity[ref], array_of_refs, organization)\n else\n id = field\n entity[ref] = [id_hash(id, organization)]\n end\n end",
"def custom_field_value_by_id(field_id)\n @acl_cfv_hash = {} if @acl_cfv_hash.blank?\n return @acl_cfv_hash[field_id.to_s] if @acl_cfv_hash.has_key?(field_id.to_s)\n if self.acl_available_custom_fields.has_key?(field_id.to_i)\n x = CustomFieldValue.new\n x.custom_field = self.acl_available_custom_fields[field_id.to_i]\n x.customized = self\n @acl_cfv_hash[field_id.to_s] = x\n x\n else\n nil\n end\n end",
"def first_found_value_as_highlighted_array(document, list_of_fieldnames, default = [])\n list_of_fieldnames.map { |f| hl_field(document, f) }.reject { |x| x.empty? }.first || []\n end",
"def phone_numbers\n self[\"gd$phoneNumber\"] ? self[\"gd$phoneNumber\"].map { |e| e['$t'] } : []\n end",
"def index\n @custom_fields = CustomField.all\n end",
"def index\n @custom_fields = CustomField.all\n end",
"def get_user_ids\n @assigned_lawfirm_users.map(&:id)\n end",
"def attachment_reference_ids_removed\n attachment_reference_ids = []\n self.class.attachable_columns.each do |column|\n attachment_reference_ids += send(\"#{column}#{ATTACHMENT_REMOVED_SUFFIX}\")\n end\n\n attachment_reference_ids\n end",
"def listed_company_registration_number; end",
"def ocr_comparison_fields_array\n @ocr_comparison_fields_array = ClientKycPassSetting.get_bits_set_for_ocr_comparison_fields(ocr_comparison_fields)\n end",
"def customId=(value)\n\t\t\t@customId = value\n\t\tend",
"def get_field_reference(content)\n segments, fragments = get_field_schema(content[:ref])\n # fragments first\n results = get_fragments(fragments) unless fragments.nil?\n # segments second\n unless segments.nil? || results\n results = get_segments(segments) unless segments.empty?\n end\n results\n end",
"def collection_name\n 'form_reference_fields'\n end",
"def potential_subscriber_ids\n Subscriber.where(phone_number: from_phone).order(updated_at: :desc).map(&:id)\n end",
"def GetField id\n\n APICall(path: \"ticket_fields/#{id}.json\")\n\n end",
"def document_ids\n (Array.wrap(documents) + Array.wrap(additional_document)).uniq.delete_if(&:empty?)\n end",
"def referenced_by\n values = super\n values = Deepblue::MetadataHelper.ordered( ordered_values: referenced_by_ordered, values: values )\n return values\n end",
"def cursor_grpc doc_ids: [\"10\"], before: true\n converted_values = doc_ids.map do |doc_id|\n Google::Cloud::Firestore::V1::Value.new(\n reference_value: document_path(doc_id)\n )\n end\n Google::Cloud::Firestore::V1::Cursor.new(\n values: converted_values,\n before: before\n )\nend",
"def document_series_ref_id\n vbms_uploaded_documents\n .where(document_type: \"BVA Case Notifications\")\n .where.not(uploaded_to_vbms_at: nil)\n .order(uploaded_to_vbms_at: :desc)\n .first\n &.document_series_reference_id\n end",
"def references\n GameContent.where reference_id: self.id\n end",
"def visible_custom_fields(user=nil)\n user_real = user || User.current\n available_custom_fields.select do |custom_field|\n custom_field.visible_by?(project, user_real)\n end\n end",
"def visible_custom_fields(user=nil)\n user_real = user || User.current\n available_custom_fields.select do |custom_field|\n custom_field.visible_by?(project, user_real)\n end\n end",
"def fetch_reference_ids(table, row)\n attributes = {}\n table.reference_columns.each do |c|\n new_id = nil\n if row[c.name.to_s].is_a?(Array)\n new_id = []\n row[c.name.to_s].each do |old_id|\n new_id << no_sql_connection.get_id_using_pre_mongified_id(c.references.to_s, old_id)\n end\n else\n new_id = no_sql_connection.get_id_using_pre_mongified_id(c.references.to_s, row[c.name.to_s])\n end\n attributes.merge!(c.name => new_id) unless new_id.nil?\n end\n attributes\n end",
"def select_auto_reference_nbr(test_data)\n hide_notifications_bar\n ref_nbr = select_id_generator_option(reference_nbr_input, reference_nbr_options)\n test_data.merge!({ UseOfCollections::REFERENCE_NBR.name => ref_nbr})\n end",
"def references(collection)\n target.manager_refs_by_association&.dig(collection, :ems_ref)&.to_a&.compact || []\n end",
"def deviation_custom_field_id\n return @@deviation_custom_field_id if defined?(@@deviation_custom_field_id)\n\n @@deviation_custom_field_id = TimeEntryCustomField.find_by_name('Deviation')\n @@deviation_custom_field_id = @@deviation_custom_field_id.id if @@deviation_custom_field_id\n\n @@deviation_custom_field_id\n end",
"def references(collection)\n manager_refs_by_association.try(:[], collection).try(:[], :ems_ref)&.to_a || []\n end",
"def dids_911_list\n payload[:dids_911].nil? ? nil : payload[:dids_911]\n end",
"def my_questions\n self.questions.map(&:id)\n end",
"def get_list_referral_code(code)\n m = @redis.smembers list_referral_code_key(code)\n if m\n m.collect! do |id|\n id = id.to_i\n end\n end\n m\n end",
"def user_ids \n @user_ids ||= input[\"users\"].map{|user| user[\"id\"]}\nend",
"def resolve_json_reference(options, object, _field, reference_def)\n keys = nil\n reference_json = nil\n if reference_def[:metadata]\n key = reference_def[:metadata].key.to_sym\n if reference_def[:metadata].polymorphic?\n clazz = reference_def[:metadata].inverse_class_name.constantize\n else\n clazz = reference_def[:metadata].class_name.constantize\n end\n relation_class = if Mongoid::Compatibility::Version.mongoid7_or_newer?\n Mongoid::Association::Referenced::HasAndBelongsToMany::Proxy\n else\n Mongoid::Relations::Referenced::ManyToMany\n end\n\n if reference_def[:metadata].relation == relation_class\n object_ids = object.send(key)\n if object_ids\n reference_json = object_ids.map do |id|\n materialize_keys, json = materialize_json(options, clazz: clazz, id: id)\n keys = keys ? keys.merge_set(materialize_keys) : materialize_keys\n json\n end.compact\n else\n object_ids = []\n end\n end\n end\n # If we get to this point and reference_json is still nil, there's no chance we can\n # load the JSON from cache so we go ahead and call as_json on the object.\n unless reference_json\n reference_def_definition = reference_def[:definition]\n reference = reference_def_definition.is_a?(Symbol) ? object.send(reference_def_definition) : reference_def_definition.call(object)\n reference_json = nil\n if reference\n if reference.respond_to?(:as_json_partial)\n reference_keys, reference_json = reference.as_json_partial(options)\n keys = keys ? keys.merge_set(reference_keys) : reference_keys\n else\n reference_json = reference.as_json(options)\n end\n end\n end\n [keys, reference_json]\n end",
"def unfold_references_helper(entity, array_of_refs, organization)\n ref = array_of_refs.shift\n field = entity[ref]\n\n # Unfold the id\n if array_of_refs.empty? && field\n return entity.delete(ref) if field.is_a?(String) # ~retro-compatibility to ease transition aroud Connec! idmaps rework. Should be removed eventually.\n\n id_hash = field.find { |id| id[:provider] == organization.oauth_provider && id[:realm] == organization.oauth_uid }\n if id_hash\n entity[ref] = id_hash['id']\n elsif field.find { |id| id[:provider] == 'connec' } # Should always be true as ids will always contain a connec id\n # We may enqueue a fetch on the endpoint of the missing association, followed by a re-fetch on this one.\n # However it's expected to be an edge case, so for now we rely on the fact that the webhooks should be relativly in order.\n # Worst case it'll be done on following sync\n entity.delete(ref)\n return nil\n end\n true\n\n # Follow embedment path\n else\n return true if field.blank?\n\n case field\n when Array\n bool = true\n field.each do |f|\n bool &= unfold_references_helper(f, array_of_refs.dup, organization)\n end\n bool\n when Hash\n unfold_references_helper(entity[ref], array_of_refs, organization)\n end\n end\n end",
"def assignable_people_ids\n ([self.scrum_master_id.to_s] + self.team_member_ids).select {|u_id| !u_id.blank?}\n end",
"def relationship_relation company_id_field, referer_id\n Relationship.joins(\n \"join card_references cr on cr.referee_id = relationships.#{company_id_field}\"\n ).where(\n \"cr.referer_id = #{referer_id} \" \\\n \"and #{relationship_prefix}metric_id = #{metric_card.id}\"\n )\n end",
"def prepare_custom_fields(fields)\n fields.each_with_object({}) { |e, o| o[\"copyleaks-client-custom-#{e[0]}\"] = e[1] }\n end"
] |
[
"0.82706416",
"0.62558174",
"0.6199382",
"0.60171694",
"0.6004322",
"0.59667856",
"0.59193647",
"0.5727874",
"0.5708435",
"0.56372553",
"0.55993074",
"0.55993074",
"0.5564795",
"0.555203",
"0.5534277",
"0.55329764",
"0.552238",
"0.5492505",
"0.54437894",
"0.5438593",
"0.54049957",
"0.53850365",
"0.5374059",
"0.53475153",
"0.53361714",
"0.53259546",
"0.5322845",
"0.5290237",
"0.528295",
"0.5263528",
"0.5225122",
"0.5201197",
"0.520006",
"0.5191387",
"0.51526016",
"0.5143086",
"0.51167804",
"0.5103147",
"0.5099498",
"0.50921977",
"0.50859904",
"0.5084631",
"0.50689363",
"0.50689363",
"0.50662035",
"0.5062158",
"0.5054472",
"0.50531065",
"0.50531065",
"0.5048879",
"0.50475323",
"0.5035138",
"0.503135",
"0.5028695",
"0.50143206",
"0.501276",
"0.5012568",
"0.5009432",
"0.5008892",
"0.50077385",
"0.5006562",
"0.5002203",
"0.49847752",
"0.49825692",
"0.4976848",
"0.49652314",
"0.49576086",
"0.4951883",
"0.49440697",
"0.49440697",
"0.49193928",
"0.49134406",
"0.4903792",
"0.48990786",
"0.48858196",
"0.4883297",
"0.48758274",
"0.48680735",
"0.4857286",
"0.48549822",
"0.485399",
"0.4852886",
"0.48445576",
"0.4841688",
"0.48381385",
"0.48381385",
"0.4832544",
"0.4826263",
"0.48260808",
"0.48189554",
"0.48149115",
"0.4810975",
"0.48101145",
"0.48090032",
"0.48048425",
"0.4804425",
"0.47985086",
"0.4797663",
"0.47952008",
"0.47842363"
] |
0.8533863
|
0
|
cutom_field.reference_custom_fields > an array Get reference custom fields custom_field.reference_custom_fields => [CustomFields::Reference,CustomFields::Reference,CustomFields::Reference,CustomFields::Reference]
|
def reference_custom_fields
reference_custom_field_ids.collect{|cf_id| CustomFields::Reference.find(cf_id) }
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def reference_custom_field_ids\n self[:value] ||= {}\n self[:value][:custom_field_ids] ||= []\n \n @custom_field_ids ||= self[:value][:custom_field_ids].collect{|cf_id| cf_id.to_i if CustomField.exists?(cf_id) }.compact\n end",
"def custom_fields\n field_values = @client.account_details.custom_field_values\n\n fields = []\n\n 3.times do |i|\n n = i+1\n\n if send(:\"field#{n}_value_id\").nil?\n fields << nil\n else\n\n field_value = field_values.select { |fv| fv[\"id\"] == send(:\"field#{n}_value_id\") }\n fields << Unfuddled::CustomField.new(\n :number => n,\n :title => project.send(:\"ticket_field#{n}_title\"),\n :type => project.send(:\"ticket_field#{n}_disposition\"),\n :value => field_value\n )\n end\n end\n\n fields\n end",
"def custom_fields_request\n data[:properties].custom_field_property do\n key :type, \"array\"\n items do\n key :\"$ref\", \"CustomFieldValueApiRequest\"\n end\n end\n end",
"def custom_fields_response\n data[:properties].custom_field_property do\n key :type, \"array\"\n key :xml, wrapped: true\n items do\n key :\"$ref\", \"CustomFieldValueApiResponse\"\n end\n end\n end",
"def custom_fields\n CustomField.all(self)\n end",
"def relationship_custom_fields\n custom_fields_recipe['rules'].find_all do |rule|\n %w[belongs_to has_many many_to_many].include?(rule['type'])\n end\n end",
"def collection_name\n 'resource_reference_fields'\n end",
"def get_custom_fields(autopilot_contact)\n\t if autopilot_contact.has_key?(\"custom\")\n \t\tautopilot_contact[\"custom\"].each do |key,value|\n\t\t\t#if !cf[\"deleted\"]\n\t\t\t\t#Rails.logger.info \"cutom fieldsssssssssssss\"\n\t\t\t\t#Rails.logger.info \"#{key}\"\n\t\t\t\t#Rails.logger.debug \"#{value}\"\n\t\t\t\tcustom_field_value = value\n\t\t\t\tcustom_field_type, custom_field = key.split(\"--\")\n\t\t\t\t#Rails.logger.debug \"custom field-->#{custom_field}-#{custom_field_value}\"\n\t\t\t\tcase custom_field\n\t\t\t\twhen \"FDADDRESS\"\n\t\t\t\t\t@freshdesk_data[\"address\"] = custom_field_value\n\t\t\t\twhen \"FDACCOUNTID\"\n\t\t\t\t\t@freshdesk_account_id = custom_field_value\n\t\t\t\twhen \"FDCONTACTID\"\n\t\t\t\t\t@freshdesk_contact_id = custom_field_value\n\t\t\t\telse\n\t\t\t\t #@freshdesk_data[\"custom_fields\"][cf[\"kind\"]] = custom_field_value\n\t\t\t\tend\t\n\t\t\t#end\n\t\tend\n \t end\n\tend",
"def references\n details.map { |detail| detail[:recurring_detail_reference] }\n end",
"def get_custom_fields(issue)\n custom_items = {}\n issue.customFieldValues.each do |custom|\n if Jira_custom_fields.has_key?(custom.customfieldId)\n custom_items[Jira_custom_fields[custom.customfieldId]] = custom.values.join(\", \")\n end\n end\n custom_items\n end",
"def custom_fields_to_show\n begin\n custom_field_names = plugin_setting('custom_fields_shown').to_s\n custom_field_names.split(',').map {|custom_field_name|\n UserCustomField.find_by_name(custom_field_name.strip) \n }.flatten.compact\n rescue\n []\n end\n end",
"def add_custom_field_to_issue(issue_and_custom_fields)\n issue_and_custom_fields[0].custom_fields = issue_and_custom_fields[1].map do |template_values|\n {id: CustomField.where(name: template_values.values.first.keys.first).pluck(:id).first, value: template_values.keys.first}\n end\n issue_and_custom_fields[0]\n end",
"def collection_name\n 'form_reference_fields'\n end",
"def custom_fields_for_issues(tracker)\n all_custom_fields.select {|c| tracker.custom_fields.include? c }\n end",
"def initialize_custom_fields\n fields = service.get_custom_fields(contact_point_list)\n existing_fields = fields.map(&:FieldName)\n\n [\n { name: \"organization_id\", type: 'Number' },\n { name: \"organization_name\", type: 'Text' },\n { name: \"cop_status\", type: 'Text' },\n { name: \"cop_due_on\", type: 'Text' },\n ].each do |hash|\n create_custom_field(hash.fetch(:name), hash.fetch(:type))\n end\n end",
"def has_many_custom_fields\n group_custom_fields('has_many') { |rule| [rule['name'], rule['inverse_of']] }\n end",
"def has_many_custom_fields\n group_custom_fields('has_many') { |rule| [rule['name'], rule['inverse_of']] }\n end",
"def referenced_by\n values = super\n values = Deepblue::MetadataHelper.ordered( ordered_values: referenced_by_ordered, values: values )\n return values\n end",
"def prepare_custom_fields(fields)\n fields.each_with_object({}) { |e, o| o[\"copyleaks-client-custom-#{e[0]}\"] = e[1] }\n end",
"def fields\n [*lookup]\n end",
"def custom_fields_for(name)\n declare_embedded_in_definition_in_custom_field(name)\n\n # stores the relation name\n _custom_fields_for << name.to_s\n\n extend_for_custom_fields(name)\n end",
"def ocr_comparison_fields_array\n @ocr_comparison_fields_array = ClientKycPassSetting.get_bits_set_for_ocr_comparison_fields(ocr_comparison_fields)\n end",
"def index\n @custom_fields = CustomField.all\n end",
"def index\n @custom_fields = CustomField.all\n end",
"def reference_words\n @reference_array ||= @reference.split(' ')\n end",
"def reference\n value_for('reference')\n end",
"def first_found_value_as_highlighted_array(document, list_of_fieldnames, default = [])\n list_of_fieldnames.map { |f| hl_field(document, f) }.reject { |x| x.empty? }.first || []\n end",
"def create_custom_field_values(contact)\n values = contact.custom_field_values\n existing_custom_fields = values.collect(&:custom_field)\n current_user.custom_fields.each do |custom_field|\n unless existing_custom_fields.include?(custom_field)\n new_value = values.new\n new_value.custom_field = custom_field\n end\n end\n end",
"def the_fields(field_key)\n r = []\n object.get_fields(field_key).each do |text|\n r << h.do_shortcode(text.to_s.translate(@_deco_locale), object)\n end\n r\n end",
"def absorption_references\n @references.inject([]) do |array, ref|\n array << ref\n # puts \"Column #{name} spans #{ref}, #{ref.is_absorbing ? \"\" : \"not \"} absorbing (#{ref.to.name} absorbs via #{ref.to.absorbed_via.inspect})\"\n break array unless ref.is_absorbing\n array\n end\n end",
"def custom_field_values_from_keywords(customized)\n customized.custom_field_values.inject({}) do |h, v|\n if keyword = get_keyword(v.custom_field.name)\n h[v.custom_field.id.to_s] = v.custom_field.value_from_keyword(keyword, customized)\n end\n h\n end\n end",
"def auto_reference(value)\n if value.is_a?(Array)\n return value.map { |v| auto_reference(v) }\n end\n\n if value.is_a?(Entity)\n # If it's from another crate, need to add it to this one.\n crate.add_contextual_entity(value)\n\n return value.reference\n end\n\n value\n end",
"def visible_custom_fields(user=nil)\n user_real = user || User.current\n available_custom_fields.select do |custom_field|\n custom_field.visible_by?(project, user_real)\n end\n end",
"def visible_custom_fields(user=nil)\n user_real = user || User.current\n available_custom_fields.select do |custom_field|\n custom_field.visible_by?(project, user_real)\n end\n end",
"def getAllFieldsMap\n @customFieldMap = self.class.get(\"/rest/api/2/field\", :verify => false)\n end",
"def isReferencedBy\n values = super\n values = MetadataHelper.ordered( ordered_values: self.isReferencedBy_ordered, values: values )\n return values\n end",
"def isReferencedBy\n values = super\n values = MetadataHelper.ordered( ordered_values: self.isReferencedBy_ordered, values: values )\n return values\n end",
"def controlfields\n cf = []\n org_codes = %w(NNU-TL NNU-F NyNyUA NyNyUAD NyNyUCH NBPol NyBlHS NHi)\n org_code = get_repo_org_code\n cf << add_003_tag(org_code) if org_codes.include?(org_code)\n cf << add_005_tag\n @record.controlfields = cf\n end",
"def field_extras\r\n return @field_extras\r\n end",
"def reference\n @data['reference']\n end",
"def custom_fields_safe_attributes\n self.custom_fields_recipe['rules'].map do |rule|\n case rule['type'].to_sym\n when :date then \"formatted_#{rule['name']}\"\n when :file then [rule['name'], \"remove_#{rule['name']}\"]\n when :select, :belongs_to then [\"#{rule['name']}_id\", \"position_in_#{rule['name']}\"]\n when :has_many, :many_to_many then nil\n else\n rule['name']\n end\n end.compact.flatten\n end",
"def field_array_controls\n \"__controls__\"\n end",
"def custom_fields_object\n @custom_fields_object ||= Hashie::Mash.new custom_fields\n end",
"def custom_fields_safe_setters\n custom_fields_recipe['rules'].map do |rule|\n case rule['type'].to_sym\n when :date, :date_time, :money then \"formatted_#{rule['name']}\"\n when :file then [rule['name'], \"remove_#{rule['name']}\", \"remote_#{rule['name']}_url\"]\n when :select, :belongs_to then [\"#{rule['name']}_id\", \"position_in_#{rule['name']}\"]\n when :has_many, :many_to_many then nil\n else\n rule['name']\n end\n end.compact.flatten\n end",
"def get_field_reference(content)\n segments, fragments = get_field_schema(content[:ref])\n # fragments first\n results = get_fragments(fragments) unless fragments.nil?\n # segments second\n unless segments.nil? || results\n results = get_segments(segments) unless segments.empty?\n end\n results\n end",
"def the_json_fields(field_key)\n r = []\n object.get_fields(field_key).each do |text|\n _r = JSON.parse(text || '{}').with_indifferent_access\n _r.keys.each do |k|\n _r[k] = h.do_shortcode(_r[k].to_s.translate(@_deco_locale), object)\n end\n r << _r\n end\n r\n end",
"def resolve_json_reference(options, object, _field, reference_def)\n keys = nil\n reference_json = nil\n if reference_def[:metadata]\n key = reference_def[:metadata].key.to_sym\n if reference_def[:metadata].polymorphic?\n clazz = reference_def[:metadata].inverse_class_name.constantize\n else\n clazz = reference_def[:metadata].class_name.constantize\n end\n relation_class = if Mongoid::Compatibility::Version.mongoid7_or_newer?\n Mongoid::Association::Referenced::HasAndBelongsToMany::Proxy\n else\n Mongoid::Relations::Referenced::ManyToMany\n end\n\n if reference_def[:metadata].relation == relation_class\n object_ids = object.send(key)\n if object_ids\n reference_json = object_ids.map do |id|\n materialize_keys, json = materialize_json(options, clazz: clazz, id: id)\n keys = keys ? keys.merge_set(materialize_keys) : materialize_keys\n json\n end.compact\n else\n object_ids = []\n end\n end\n end\n # If we get to this point and reference_json is still nil, there's no chance we can\n # load the JSON from cache so we go ahead and call as_json on the object.\n unless reference_json\n reference_def_definition = reference_def[:definition]\n reference = reference_def_definition.is_a?(Symbol) ? object.send(reference_def_definition) : reference_def_definition.call(object)\n reference_json = nil\n if reference\n if reference.respond_to?(:as_json_partial)\n reference_keys, reference_json = reference.as_json_partial(options)\n keys = keys ? keys.merge_set(reference_keys) : reference_keys\n else\n reference_json = reference.as_json(options)\n end\n end\n end\n [keys, reference_json]\n end",
"def build_reference_types(inventory_collection)\n class_name = inventory_collection.model_class.to_s\n\n reference_types[class_name] ||= []\n reference_types[class_name] << \"#{inventory_collection.name.to_s.singularize.camelize}Reference\"\n inventory_collection.secondary_refs.each do |key, _value|\n reference_types[class_name] << \"#{inventory_collection.name.to_s.singularize.camelize}Reference#{key.to_s.camelize}\"\n end\n end",
"def ref_types\n response = request(:eve, :ref_types)\n result = {}\n response.ref_types.each do |row|\n result[row.ref_type_id] = row.ref_type_name\n end\n result\n end",
"def references\n (headers['References']||'').scan(/(<[^<]+?>)/).flatten\n end",
"def custom_fields_by_type(type)\n custom_fields.select { |field| field.type == \"platformCore:#{type}\" }\n end",
"def belongs_to_custom_fields\n group_custom_fields 'belongs_to'\n end",
"def index\n @custom_field_values = CustomFieldValue.all\n end",
"def refs(test_case)\n all_tags(test_case).select{|tag| tag.name =~/(?:jira|ref)_/}.map{|ticket| /(?:jira|ref)_(\\w+-\\d+)$/.match(ticket.name)[1]}.uniq.join(\",\")\n end",
"def referers type, field\n ::Card.search type: type, limit: 10, right_plus: [field, refer_to: object.card_id]\n end",
"def fields\n return @fields if defined?(@fields)\n\n @fields = array_of_items_for(Fields, :fields)\n end",
"def references\n @references\n end",
"def many_to_many_custom_fields\n group_custom_fields('many_to_many') { |rule| [rule['name'], \"#{rule['name'].singularize}_ids\"] }\n end",
"def many_to_many_custom_fields\n group_custom_fields('many_to_many') { |rule| [rule['name'], \"#{rule['name'].singularize}_ids\"] }\n end",
"def get_field_schema(reference)\n schema = get_url(reference, :reference) if reference.is_a? String\n return [\n schema['segments'] || nil,\n schema['fragments'] || nil\n ] - ['', nil] if schema.is_a? Hash\n end",
"def contact_field_options(contact_field)\n contact_field_definitions[contact_field]\n end",
"def custom_index_fields(blacklight_config)\n Hash[exhibit.custom_fields.reject(&:new_record?).map do |custom_field|\n original_config = blacklight_config.index_fields[custom_field.field] || {}\n field = Blacklight::Configuration::IndexField.new original_config.merge(\n custom_field.configuration.merge(\n key: custom_field.field, field: custom_field.solr_field, custom_field: true\n )\n )\n [custom_field.field, field]\n end]\n end",
"def references(collection)\n target.manager_refs_by_association&.dig(collection, :ems_ref)&.to_a&.compact || []\n end",
"def extract_custom_field_value(custom_field_value)\n if custom_field_value.present? && custom_field_value.is_a?(Hash) && custom_field_value.has_key?(:name)\n custom_field_value = custom_field_value[:name]\n end\n\n if custom_field_value.present? && custom_field_value.is_a?(NetSuite::Records::CustomRecordRef)\n custom_field_value = custom_field_value.attributes[:name]\n end\n\n custom_field_value\n end",
"def references(collection)\n manager_refs_by_association.try(:[], collection).try(:[], :ems_ref)&.to_a || []\n end",
"def resolve_array_refs(obj)\n items = obj[ITEMS_KEY]\n\n case items\n when Array\n return resolve_items_array(items)\n when Hash\n # handle a nested any of key\n any_of = items[ANY_OF_KEY]\n return resolve_items_array(any_of) if any_of.is_a?(Array)\n\n resolve_reference_string(items[REF_KEY])\n return [class_name_from_ref(items[REF_KEY])].compact\n else\n return []\n end\n end",
"def reference\n [ type, identifier ]\n end",
"def references\n @data[:refs].map { |ref|\n ref[:id] = nil\n ref[:doi] = nil if ref[:doi].nil?\n ref[:volume] = nil if ref[:volume].nil?\n ref[:journal_name] = nil if ref[:journal_name].nil?\n RefEm::Entity::Reference.new(ref)\n }\n end",
"def references\n return @references\n end",
"def references\n @references ||= []\n end",
"def field_ids\n @conditions['field_ids'] || cbobject.basis_fields\n end",
"def dynamic_fields\n self.dynamic_attributes.keys.map do |name|\n self.content_type.find_field(name)\n end\n end",
"def value\n #--- if field is a country field, convert the country_id into real name\n if custom_field_def.field_type == 'country'\n Country.find(field_data.to_i).english_name\n elsif field_data.is_a? Array\n # make into a comma delimited string. remove any blank/nil entries\n field_data.reject(&:blank?).join(', ')\n else\n field_data\n end\n end",
"def custom_fields_recipe_for(name)\n {\n 'name' => \"#{relations[name.to_s].class_name.demodulize}#{_id}\",\n 'rules' => ordered_custom_fields(name).map(&:to_recipe),\n 'version' => custom_fields_version(name),\n 'model_name' => relations[name.to_s].class_name.constantize.model_name.to_s\n }\n end",
"def contact_ids\n (object.added_contacts + object.mutual_contacts).map{|ct| ct.slug }\n end",
"def use_any_aliases(custom_fields)\n custom_fields.map { |column_name,column_type| [column_name.gsub(/.*AS\\s+/, ''), column_type] }.to_h\n end",
"def related_fields(method)\n \n end",
"def reference_string_by type\n\t\t\t\t\trstring = []\n\t\t\t\t\ttype.each do |ref|\n\t\t\t\t\t\trstring << ref.value\n\t\t\t\t\tend\n\n\t\t\t\t\trstring.join(\", \")\n\t\t\t\tend",
"def mailchimp_list_field_names\n config.mailchimp_list_fields.map(&:name)\n end",
"def fields()\n if !@custom_fields || @fields.length == 0 then\n @elements.each { |field|\n if field.respond_to?(:is_form_field) then\n @fields << field.name\n @element_map[field.name.to_s] = field\n elsif field.is_a?(Fieldset) then\n @fields << { field.name => field.fields }\n @element_map.update(field.element_map)\n end\n }\n end\n @fields.uniq!\n return @fields\n end",
"def references\n references_hash.to_json\n end",
"def jde_buyer_invoice_hashes_array\n jde_invoice_hashes_array('member')\n end",
"def fold_references_helper(entity, array_of_refs, organization)\n ref = array_of_refs.shift\n field = entity[ref]\n return if field.blank?\n\n # Follow embedment path, remplace if it's not an array or a hash\n case field\n when Array\n field.each do |f|\n fold_references_helper(f, array_of_refs.dup, organization)\n end\n when Hash\n fold_references_helper(entity[ref], array_of_refs, organization)\n else\n id = field\n entity[ref] = [id_hash(id, organization)]\n end\n end",
"def fields\n return @fields if fields_registered?\n all_fields = SugarCRM.connection.get_fields(@name)\n @fields = all_fields[\"module_fields\"].with_indifferent_access\n @link_fields= all_fields[\"link_fields\"]\n handle_empty_arrays\n @fields_registered = true\n @fields\n end",
"def field_ids\n @fields.keys\n end",
"def related_items\n related_items = { :coffee_pods => related_coffee_pods }\n related_items\n end",
"def reference_credit_note\n object.credit_note_ref.to_s\n end",
"def raw_marc_values r, doc\n vals = []\n @marcfieldspecs.each do |ts|\n vals.concat ts.marc_values(r)\n end\n return vals\n end",
"def delete_all_custom_fields\n puts \"Deleting custom fields for user #{@user_id}\"\n fieldlist = get_all_custom_fields\n\n fields = JSON.parse(fieldlist)\n # make an array of ids\n field_ids = fields['custom_fields'].map {|k,v| k['id']}\n puts field_ids.length\n field_ids.each do |i|\n res = delete_custom_field(i)\n end\n end",
"def ordered_custom_fields(name)\n send(:\"#{name}_custom_fields\").sort { |a, b| (a.position || 0) <=> (b.position || 0) }\n end",
"def non_relationship_custom_fields\n custom_fields_recipe['rules'].find_all do |rule|\n !%w[belongs_to has_many many_to_many].include?(rule['type'])\n end\n end",
"def id\n @customFieldId\n end",
"def transform_custom_fields(params)\n return params unless @has_custom_fields\n\n @@name_key_hash = Pipedrive.send(\"#{@resource_name}_fields\").name_key_hash\n @@name_key_hash.transform_keys!{|key|clear_key(key)}\n\n hash = ::CUSTOM_FIELD_NAMES\n if hash && hash[@resource_name.to_sym]\n @@name_key_hash = @@name_key_hash.merge(hash[@resource_name.to_sym].invert)\n end\n\n keys = @@name_key_hash.keys\n res = {}\n\n params.each do |name, value|\n if keys.include?(name.to_s) #Custom Field\n res[@@name_key_hash[name.to_s]] = value\n else\n res[name] = value\n end\n end\n res\n end",
"def fs_contact_addresses\n fs_contact_addresses_array.join(',')\n end",
"def init_custom_fields\n @item_types = [nil, '']\n @capacities_types = [nil, '']\n end",
"def location_contact_fields\n [:urls, :emails, :phones]\n end",
"def custom\n @data[\"custom\"]\n end",
"def snapshot_hidden_custom_fields; end",
"def extend_for_custom_fields(name)\n class_eval do\n field :\"#{name}_custom_fields_version\", type: ::Integer, default: 0\n\n embeds_many :\"#{name}_custom_fields\", class_name: dynamic_custom_field_class_name(name) # , cascade_callbacks: true # FIXME ?????\n\n accepts_nested_attributes_for :\"#{name}_custom_fields\", allow_destroy: true\n end\n\n class_eval <<-EOV, __FILE__, __LINE__ + 1\n after_initialize :refresh_#{name}_metadata\n before_update :bump_#{name}_custom_fields_version\n before_update :collect_#{name}_custom_fields_diff\n after_update :apply_#{name}_custom_fields_diff\n after_update :apply_#{name}_custom_fields_localize_diff\n\n def ordered_#{name}_custom_fields\n self.ordered_custom_fields('#{name}')\n end\n\n protected\n\n def refresh_#{name}_metadata\n self.refresh_metadata_with_custom_fields('#{name}')\n end\n\n def bump_#{name}_custom_fields_version\n self.bump_custom_fields_version('#{name}')\n end\n\n def collect_#{name}_custom_fields_diff\n self.collect_custom_fields_diff(:#{name}, self.#{name}_custom_fields)\n end\n\n def apply_#{name}_custom_fields_diff\n self.apply_custom_fields_diff(:#{name})\n end\n\n def apply_#{name}_custom_fields_localize_diff\n self.apply_custom_fields_localize_diff(:#{name})\n end\n\n EOV\n end",
"def collect_custom_fields_diff(name, fields)\n # puts \"==> collect_custom_fields_diff for #{name}, #{fields.size}\" # DEBUG\n\n memo = initialize_custom_fields_diff(name)\n\n fields.map do |field|\n field.collect_diff(memo)\n end\n\n # collect fields with a modified localized field\n fields.each do |field|\n if field.localized_changed? && field.persisted?\n self._custom_field_localize_diff[name] << { field: field.name, localized: field.localized? }\n end\n end\n end"
] |
[
"0.7628164",
"0.6554916",
"0.6377768",
"0.63773763",
"0.6209855",
"0.6170273",
"0.61499184",
"0.61368376",
"0.6105796",
"0.6061481",
"0.60173017",
"0.5999315",
"0.58081925",
"0.5783502",
"0.5762397",
"0.5715312",
"0.5715312",
"0.56559294",
"0.5623446",
"0.5610104",
"0.5526577",
"0.5510423",
"0.5493268",
"0.5493268",
"0.5490706",
"0.5469344",
"0.54632825",
"0.54605526",
"0.54366624",
"0.5422938",
"0.5420446",
"0.54017776",
"0.5377624",
"0.5377624",
"0.5364301",
"0.5361207",
"0.5361207",
"0.5355831",
"0.5352561",
"0.5342762",
"0.533977",
"0.5335875",
"0.53216624",
"0.531907",
"0.5306821",
"0.5299949",
"0.5285425",
"0.5274665",
"0.52622944",
"0.52583045",
"0.5257511",
"0.5242788",
"0.5235579",
"0.5232047",
"0.522127",
"0.52208847",
"0.5219477",
"0.52175146",
"0.52175146",
"0.52134913",
"0.5200933",
"0.51919127",
"0.51716316",
"0.5171356",
"0.51706576",
"0.5170469",
"0.51692224",
"0.51689357",
"0.51608026",
"0.5157342",
"0.5156659",
"0.5141088",
"0.51402533",
"0.5139445",
"0.5131186",
"0.5126698",
"0.5120835",
"0.5113422",
"0.5111404",
"0.51081365",
"0.51071376",
"0.51039374",
"0.5092793",
"0.50902534",
"0.5085048",
"0.5082516",
"0.5079861",
"0.50791216",
"0.5077488",
"0.5059282",
"0.5057802",
"0.5057783",
"0.50517637",
"0.5033793",
"0.5032615",
"0.50246364",
"0.50165707",
"0.50154805",
"0.5004516",
"0.5002664"
] |
0.8362868
|
0
|
metodo que por defecto presenta el string
|
def to_s
"#{nombres} #{paterno}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def string?; end",
"def string() end",
"def string; end",
"def string; end",
"def string; end",
"def string; end",
"def string; end",
"def string; end",
"def string; end",
"def string; end",
"def string; end",
"def string\n @string\n end",
"def string\n @string\n end",
"def string(*) end",
"def string\n end",
"def string\n end",
"def string\n end",
"def String(p0) end",
"def string()\n #This is a stub, used for indexing\n end",
"def str; end",
"def str; end",
"def string(str); end",
"def string=(p0) end",
"def string=(_arg0); end",
"def string= string\n #This is a stub, used for indexing\n end",
"def content=(string); end",
"def content=(string); end",
"def get_string_value\n\t\tend",
"def str(str); end",
"def str(str); end",
"def text(str); end",
"def input_string; end",
"def text(string); end",
"def text(string); end",
"def str1\n 'from string'\nend",
"def str1; end",
"def str1; end",
"def text\n \"STRAT\"\n end",
"def str2; end",
"def str2; end",
"def strings; end",
"def string=(arg0)\n end",
"def string_message(str = \"\")\n if str.empty?\n \"It's an empty string!\"\n else\n # explicit return option\n return \"The string is nonempty.\"\n end\n end",
"def read_string; end",
"def str3; end",
"def str3; end",
"def is_string()\n res = super(context,self)\n return res\n end",
"def get_string(attr); end",
"def string(value = '')\n return '' unless present?(value)\n\n send(value)\n rescue NoMethodError\n ''\n end",
"def string?(description)\n description.type == :str\n end",
"def gritar(texto = \"Ahhhh\")\n\t\ttexto\n\tend",
"def process\n @string\n end",
"def quoted_string; end",
"def add_string\n \"will be created.\"\n end",
"def can_show? str\n \treturn not(str.nil? || str === \"\")\n end",
"def sb(s)\r\n (s == '(none)' || s == '') ? '' : s\r\n end",
"def my_string\n'Hello World'\nend",
"def brand_string(str)\n @brand = str\n end",
"def string?\n !@arg[:textValue].nil?\n end",
"def string_value(value)\r\n value\r\n end",
"def on_tstring_content(string)\n string\n end",
"def set_str(x)\n @str = x\n end",
"def string_message(string)\n if string.empty?\n \"It's an empty string!\"\n else\n \"The string is nonempty.\"\n end\n end",
"def string(value = '')\n return '' if value.to_sym.empty?\n\n sequences.fetch(value.to_sym, proc { '' }).call\n end",
"def string(t)\n @@string_visitor.visit_this(self, t)\n end",
"def string=(code); end",
"def str(str)\n Atoms::Str.new(str)\n end",
"def string\n @string ||= input.to_str[offset, length]\n end",
"def parameter_string\n\t\tend",
"def string_message2(string)\n return \"It's an empty string!\" if string.empty?\n return \"The string is nonempty.\"\n end",
"def stringOutput\n\t\tend",
"def stringOutput\n\t\tend",
"def default(text)\n text.to_s\n end",
"def initialize string\n\t\t@string = string.strip\n\tend",
"def text=(_arg0); end",
"def string(text)\n common_string(text, text.event.unicode)\n end",
"def string(text)\n common_string(text, text.event.unicode)\n end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def value\n @string || to_s\n end",
"def defaults_str\n \"\"\n end",
"def return_string\n \"This is a test\"\nend",
"def string!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 15 )\n\n\n\n type = STRING\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 36:9: 'nombre'\n match( \"nombre\" )\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 15 )\n\n\n end",
"def string?\n @kind == :double_string_lit || @kind == :single_string_lit\n end",
"def text\n v=@real.text\n v == \"\" ? nil : v\n end",
"def text\n v=@real.text\n v == \"\" ? nil : v\n end",
"def è_una_stringa?\n @contenuto.start_with? \"\\\"\" or\n @contenuto.start_with? \"'\" or\n @contenuto.start_with? \"%{\"\n end",
"def string(string_id, skip_ampersand = true)\n string = driver.getString(string_id, skip_ampersand)\n end",
"def string(name, default='', format='%s')\n add(name, default, format) { |v,a| a }\n end"
] |
[
"0.74515164",
"0.73246247",
"0.7225491",
"0.7225491",
"0.7225491",
"0.7225491",
"0.7225491",
"0.7225491",
"0.7225491",
"0.7225491",
"0.7225491",
"0.7170139",
"0.7170139",
"0.6994524",
"0.69842976",
"0.69842976",
"0.69842976",
"0.69474274",
"0.6898626",
"0.6889612",
"0.6889612",
"0.68645245",
"0.6829292",
"0.6804572",
"0.6698411",
"0.6661888",
"0.6661888",
"0.66568464",
"0.66130275",
"0.66130275",
"0.6553118",
"0.65282404",
"0.64682937",
"0.64682937",
"0.6465988",
"0.638246",
"0.638246",
"0.6359526",
"0.63527375",
"0.63527375",
"0.6312929",
"0.62257034",
"0.6199807",
"0.61958635",
"0.6173003",
"0.6173003",
"0.61681986",
"0.61544484",
"0.61534274",
"0.6132315",
"0.60887426",
"0.6055356",
"0.60533273",
"0.6051019",
"0.6050606",
"0.60378104",
"0.603719",
"0.60253453",
"0.602487",
"0.5994338",
"0.5971368",
"0.5948164",
"0.5943483",
"0.5936846",
"0.59213114",
"0.5914858",
"0.5903825",
"0.5901077",
"0.5886551",
"0.5880259",
"0.5873598",
"0.5873598",
"0.58649457",
"0.585083",
"0.5849144",
"0.5848296",
"0.5848296",
"0.58451647",
"0.58451647",
"0.58451647",
"0.58451647",
"0.58451647",
"0.58451647",
"0.58451647",
"0.58451647",
"0.58451647",
"0.58451647",
"0.58451647",
"0.58451647",
"0.58451647",
"0.58451647",
"0.58290136",
"0.58207715",
"0.5815152",
"0.5813371",
"0.58117145",
"0.5803126",
"0.5803126",
"0.5800946",
"0.57875735",
"0.5781259"
] |
0.0
|
-1
|
Consultor del titulo, devuelve nil ya que solo las calles tienen titulo
|
def titulo
return nil
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def asignar_titulo_propiedad()\n \n end",
"def titulo_guia\n titulo = []\n\n t = Especie.find(params[:especie_id])\n a = t.adicional\n\n tipo_region = params[:tipo_region] == \"anp\" ? \"ANP \" : \"Municipio de \"\n \n if a.nombre_comun_principal.present?\n titulo[0] = \"Guía de #{a.nombre_comun_principal}\"\n else\n titulo[0] = \"Guía de #{t.nombre_cientifico}\"\n end\n\n titulo[1] = tipo_region + params[:nombre_region]\n titulo\n end",
"def estado\n if titular\n \"Vendido\"\n else\n \"Sin vender\"\n end\n end",
"def titulo_propiedad(ntp)\n @titulo = ntp\n end",
"def caly_tytul(page_title)\n\t\tpoczatek_tytulu = \"eMagazyn\"\n\t\tif(page_title.empty?)\n\t\t\treturn poczatek_tytulu\n\t\telse\n\t\t\treturn \"#{poczatek_tytulu} | #{page_title}\"\n\t\tend\n\tend",
"def validacion_titulo_Nota\n if titulo != nil && titulo== \"Nota\" then\n errors.add(:titulo,\"El título no puede ser 'Nota'\")\n end\n end",
"def retorna_nome_produto\n titulo_produto.greenify\n titulo_produto.text\n end",
"def get_titulo\n \"#{@titulo}\" \n end",
"def get_title(n)\n description = Nokogiri::HTML(@description_xpath[n].text).text\n if description.include?(\"IF YOU GO\")\n description = description.split(\"IF YOU GO\")[1]\n if description.include?(\"Where\")\n title = description.split(\"Where\")[0]\n # Title must fit on single line\n title.gsub!(\"\\n\", \" \").strip!\n title\n else\n super(n)\n end\n else\n super(n)\n end\n end",
"def titre\n \"Links Analysis du #{Time.now.strftime('%d %m %Y à %H:%M')}\"\n end",
"def fineline_accurate_title\n return nil\n end",
"def getTilte\r\n\t\t\t\t\treturn @title\r\n\t\t\t\tend",
"def set_titulo\n @titulo = Titulo.find(params[:id])\n end",
"def result_for_title\r\n result_for_txt.text\r\n end",
"def title\n title = \"No Title\"\n if (@language.present?)\n nt = NewsTitle.where(news_id: self.id).where(language: @language)\n if (nt != nil && nt.size > 0)\n title = nt.first.title\n end\n end\n\n title\n end",
"def titulares_serial\n Representante.find(self.titular_ids_serial).map(&:nombre)\n end",
"def page_title() nil end",
"def buscar_o_crear_titular(params)\n rep = Representante.where([\"LOWER(nombre) = ?\", params['NOMBRE DEL TITULAR'].downcase]).first\n pais = Pais.find_by_codigo(params['PAIS DEL TITULAR'])\n if rep\n if pais\n rep.pais_id = pais.id\n rep.pais_codigo = pais.codigo\n rep.pais_nombre = pais.nombre\n end\n rep.direccion = params['DIRECCION DEL TITULAR']\n rep.save(:validate => false)\n elsif !params['NOMBRE DEL TITULAR'].blank?\n rep = Representante.new(\n :nombre => params['NOMBRE DEL TITULAR'],\n :direccion => params['DIRECCION DEL TITULAR'],\n :cliente => false,\n :pais_id => pais.try(:id)\n )\n rep.save\n end\n rep.id\n end",
"def trouver( extrait_titre )\n Debug.log( \"Biblio#trouver( #{extrait_titre} )\" )\n\n les_emprunts.\n selectionner { |e| e.titre =~ /#{extrait_titre}/ }.\n map { |e| e.titre }.\n sort\n end",
"def comprar_titulo_propiedad\n comprado = false\n \n coste_compra = @casilla_actual.coste\n \n if coste_compra < @saldo\n \n @casilla_actual.titulo.propietario = self\n \n comprado = true\n @propiedades << @casilla_actual.titulo\n \n modificar_saldo (-coste_compra)\n \n end\n \n return comprado\n end",
"def obtener\narray = Tarea.all\n \n @@tareas = Array.new\n array.each{|x| @@tareas.push(x) if /#{@@usuario}/.match(x[\"title\"])}\n\n @@tareas.each do |x|\nstring = x[\"title\"].split\n string.pop\nx[\"title\"] = string.join(\" \")\n\n\n end\n #esto es para que no quede una tarea vacia al principio, la cual es la correspondiente login\n@@tareas.shift\n @@tareas\n\nend",
"def titre_in_code code\n if idpath == \"main/home\"\n \"Accueil du site\"\n elsif name == \"_tdm_.erb\"\n \"Table des matières (#{idpath})\"\n elsif code.match(/<h3>(.*?)<\\/h3>/)\n code.match(/<h3>(.*?)<\\/h3>/).to_a[1].to_s.strip\n elsif code.match(/<h2>(.*?)<\\/h2>/)\n code.match(/<h2>(.*?)<\\/h2>/).to_a[1].to_s.strip\n elsif code.index('article.body_content')\n code.match(/article\\.body_content(.*?)\"(.*?)\"/).to_a[1].to_s.strip\n else\n debug \"= Titre introuvable dans le fichier existant #{fullpath}\"\n \"\"\n end\n end",
"def accurate_title\n nil\n end",
"def display_name\n titre\n end",
"def title\n t = nil\n # default to long title\n long_titles = self.courses.map(&:long_title)\n return t if (t = long_titles.find(&:present?)).present?\n\n # then try specific title. then short title\n return self.specific_title if self.specific_title.present?\n\n short_titles = self.courses.map(&:short_title)\n return t if (t = short_titles.find(&:present?)).present?\n\n return '(Title Unavailable)'\n end",
"def status_da_divulgacao(topico)\n end",
"def nome_perfil\n \tself.descricao\n end",
"def set_fio_titulo\r\n @fio_titulo = FioTitulo.find(params[:id])\r\n end",
"def f_title\n self.title[0]\n end",
"def comisiones_asignadas\n asunto.comisiones if asunto\n end",
"def extract_default_title\n\t\treturn self.name unless self.readme&.table_of_contents&.first\n\t\ttitle = self.readme.table_of_contents.first.text\n\t\ttitle ||= self.name\n\tend",
"def set_pregoestitulosgrafico\n @pregoestitulosgrafico = Pregoestitulosgrafico.find(params[:id])\n end",
"def resultados_basica\n paginado_y_offset\n estatus\n solo_publicos\n solo_categoria\n\n return unless por_id_o_nombre\n\n conteo_por_categoria_taxonomica\n dame_totales\n resultados\n\n resultados_fuzzy_match if totales == 0 && pagina == 1 && params[:solo_categoria].blank?\n end",
"def formato_titulo\n titulo_for=@titulo.split(\".\")\n auxiliar=\"\"\n titulo_for.each do |i|\n \n aux=i.capitalize\n aux+=(\".\")\n auxiliar+=aux\n end\n @titulo=auxiliar\n end",
"def titre\n if error?\n error.class.name\n else\n to_sym.to_s.capitalize\n end\n end",
"def set_pregoestitulo\n @pregoestitulo = Pregoestitulo.find(params[:id])\n end",
"def sigla; @nome; end",
"def por_nombre\n return unless (params[:nombre].present? && params[:especie_id].blank?)\n self.taxones = taxones.caso_nombre_comun_y_cientifico(params[:nombre].strip).left_joins(:nombres_comunes)\n end",
"def contrato\n avaluo.try(:contrato)\n end",
"def initialize(titulo, preco, ano_lancamento, possui_reimpressao)\n @titulo = titulo\n @ano_lancamento = ano_lancamento\n @possui_reimpressao = possui_reimpressao\n @preco = calcula_preco(preco)\n end",
"def title(t=nil)\n return @title unless t\n @title = t\n end",
"def task_title\n return @task_title if @task_title\n task.nil? ? \"\" : task.title \n end",
"def busca\n\t\t@anuncios = Anuncio.where(\"descricao LIKE :filtro OR titulo LIKE :filtro OR categoria LIKE :filtro\", {:filtro => \"%#{params[:filtro]}%\"})\n\tend",
"def filmodico titre = nil, options = nil\n options ||= Hash.new\n titre ||= options.delete(:titre) || \"Filmodico\"\n case output_format\n when :latex\n \"#{titre} sur le site LA BOITE À OUTILS DE L'AUTEUR\"\n else\n options.merge!(href: \"filmodico/home\")\n options.merge!(target: \"_blank\") unless options.has_key?(:target)\n titre.in_a(options)\n end\n end",
"def get_nombre; @nombre; end",
"def set_m_titular\n @m_titular = MTitular.find(params[:id])\n end",
"def titre_in_file\n if File.exist? fullpath\n titre_in_code File.read(fullpath).force_encoding('utf-8')\n else\n debug \"= Fichier ID #{id} introuvable (#{fullpath}). Impossible de récupérer son titre\"\n \"\"\n end\n end",
"def scrap_adversarios(adversario)\n if adversario.key?('title') &&\n adversario['title'].match?(/^[a-záàâãéèêíïóôõöúç\\s]+ - [a-z]{2}$/i)\n\n # Extract team's name (e.g Santos - SP => Santos)\n return adversario['title'][/^[a-záàâãéèêíïóôõöúç\\s]{3,50}/i].strip\n end\n\n nil\n end",
"def title\n return nil\n end",
"def page_title\n nil\n end",
"def emp_destinatario_val\n if egreso?\n if emp_proveedor_id?\n emp_proveedor.title\n end\n elsif ingreso?\n if emp_cliente_id?\n emp_cliente.title\n end\n end\n end",
"def title\n if @title == nil\n \"Movie not found!\"\n else\n @title\n end\n end",
"def valida_titulo\n errors.add_to_base 'avisotitulo' if tituloes.blank? and titulofr.blank? \nend",
"def informe(actual,todos)\r\n if jugador_correcto(actual,todos)\r\n Diario.instance.ocurre_evento(\"Jugador: \" + todos.at(actual).nombre + \" recibe sorpresa \" + @texto)\r\n end\r\n end",
"def title\n\t\tbase_titre = \"Simple App du Tutoriel Ruby on Rails\"\n\t\t@title.nil? ? base_titre : \"#{base_titre} | #{@title}\"\n\tend",
"def title\n @title_pages.each { |tp| tp.title and return tp.title }\n nil\n end",
"def title\n super.first || \"\"\n end",
"def title\n super.first || \"\"\n end",
"def recolectar_una\n\t\test = \"\"\n\t\tif @estado == ESTADO::MUERTE\n\t\t\test = \"El árbol está muerto\"\n\t\telse\n\t\t\tif @contador == 0\n\t\t\t\test = \"No hay más naranjas\"\n\t\t\telse\n\t\t\t\test = \"La naranja estaba deliciosa\"\n\t\t\t\t@contador -= 1\n\t\t\tend\n\t\tend\n\t\test\n\tend",
"def first_title\n title.first\n end",
"def title\n super.first || ''\n end",
"def title\n super.first || ''\n end",
"def title\n super.first || ''\n end",
"def titulo_params\n params.permit(:diploma, :resolucion, :fecha_grado)\n end",
"def citation_title\n self.article_title || self.book_title || self.title\n end",
"def title\n _title = self[\"title\"]\n _title ? _title[\"$t\"] : nil\n end",
"def title?; end",
"def head_table(opcoes = {})\n font_size 8\n #Config do campo Datas e a Linha horizontal\n bounding_box([0, 470], :width => 2200, :font_style => :bold) do\n # vertical_line 0, -40, :at => 225\n # #horizontal_line 240, 640, :at => -31\n # rotate(90, :origin => [00, 00]) do\n # draw_text \"Datas\", :at => [-32,-235], :font_style => :bold\n # end\n #fim Config\n \n #Tabela de Cabecalho\n \n #Controle das datas das aulas\n qtd_aulas = @discipline.discipline_class_exams.count\n repeticoes = qtd_aulas.div 12\n ite = opcoes[:iteracao]\n \n #Iteracoes para o controle das datas de aulas\n if !@preenchido.blank?\n dates_classes = [] \n for i in (ite*12)..(12*(ite+1))-1\n !@discipline.discipline_class_exams[i].blank? ? dates_classes << I18n.l(@discipline.discipline_class_exams[i].applied_at, :format => \"%d/%b\") : dates_classes << \" \"\n end \n data_head = [[\"Nº\",\"Matrícula\",\"Aluno\"] + dates_classes + [\"Total de Presenças\",\"Total de Faltas\",\"% de Faltas\",\"Média\"]]\n else\n data_head = [[\"Nº\",\"Matrícula\",\"Aluno\"] + [\" \"]*12 + [\"Total de Presenças\",\"Total de Faltas\",\"% de Faltas\",\"Média\"]]\n end\n #Fim da Iteraca\n #Fim do controle das datas de aulas\n \n # Definição e Desenho da Tabela Cabecalho\n \n \n table(data_head, :header => true) do\n row(0).height = (40)\n row(0).align = :center\n row(0).font_style = :bold\n row(0).columns(0).padding = [15,0,0,0]\n row(0).columns(1).padding = [15,0,0,0]\n row(0).columns(2).padding = [15,0,0,0]\n row(0).columns(23).padding = [10,0,0,0]\n row(0).columns(24).padding = [10,0,0,0]\n row(0).columns(25).padding = [10,0,0,0]\n columns(3..34).width = 30\n columns(0).width = 25\n columns(1).width = 90\n columns(2).width = 125\n columns(15).width = 60\n columns(16).width = 35\n columns(17).width = 35\n columns(18).width = 35\n \n row(0).column(3..14).rotate = 90\n #influencia -> [esquerda, cima, direita, baixo]\n row(0).column(3..14).padding = [45,-35,-35,10]\n end\n \n \n end\n end",
"def info_conta\n # CAMPO TAMANHO\n # agencia 3\n # conta corrente 7\n \"#{agencia}#{conta_corrente}\"\n end",
"def departamento_nombre\n\t departamento.nombre if departamento\n\tend",
"def title\n dt = doc_text_by_current_language\n unless dt.nil?\n return dt.title \n else\n return ESTEAM_NO_LANGUAGE_TXT\n end\n end",
"def title\n @title ||= self.content.split(@@title_separator).first unless self.content.nil?\n end",
"def contenido_de_la_posicion(posicion)\n @tablero.contenido_de_la_posicion posicion\n end",
"def index\r\n if params[:title] and params[:empresa]\r\n @reclamacaos = Reclamacao.where(\"titulo like ?\",\"%#{params[:title]}%\").where(:nome_empresa => params[:empresa])\r\n else\r\n @reclamacaos = Reclamacao.all\r\n end\r\n end",
"def complete_title\n if self.title.present?\n self.title\n else\n I18n.translate(\"bento_search.missing_title\")\n end\n end",
"def get_title\n\t\t@fields_hash[FIELDS_MAP[:title]] || \"\"\n\tend",
"def busqueda\n @pago = Pago.new\n nombre = params[:laboratorio_id]\n id = session[:farmacia_id]\n @cant_lab = Farmacium.find_by_sql(\"select cant_lab from farmacia where id = #{id} \").first\n sql = \"Select * from laboratorios where not exists (select * from lab_fars where lab_fars.laboratorio_id = laboratorios.id and lab_fars.farmacium_id = #{id} ) and laboratorios.activo = true and LOWER(laboratorios.nombre) like LOWER('%#{nombre}%') order by nombre\"\n @laboratorios = Laboratorio.paginate_by_sql(sql, :page => params[:page], :per_page => 5)\n render :template => \"lab_fars/index\"\n end",
"def index\r\n @fio_titulos = FioTitulo.all\r\n end",
"def texto_plano\n\t\tusuario.texto_plano\t\n\tend",
"def extract_data(link)\n page = link.click.link_with(text: 'Comisiones').click\n subj_title = page.css('div.tab-panel')[0].css('span')\n print \"#{subj_title[0].text} - #{subj_title[1].text}\\n\"\n dt = DataExtractor.new(Subject.new(subj_title[0].text, subj_title[1].text))\n begin\n page.css('div.tab-panel')[0].xpath('//text()').each do |tag|\n txt = tag.text.strip\n dt.handle_event(:comision, txt) if /^[A-Z]+$/.match(txt)\n if /(Lunes|Martes|Miércoles|Jueves|Viernes|Sábado|Domingo)/.match(txt)\n dt.handle_event(:dia, txt)\n end\n dt.handle_event(:hora, txt) if /^[0-9]+:[0-9]+$/.match(txt)\n end\n return dt.subject\n rescue StandardError\n return Subject.new(subj_title[0].text, subj_title[1].text)\n end\nend",
"def title\n nil\n end",
"def emprestimo_atual\n self.emprestimos.where('data_devolucao IS NULL').first\n end",
"def text\n # if the title is not present, show the code\n get_translation(self.text_translations, self.dataset.current_locale, self.dataset.default_language)\n end",
"def retornoBusqueda()\nreturn @busqueda\nend",
"def searchtitle\n end",
"def titles_from_page(page)\n doc = Nokogiri::HTML(page)\n cells = doc.xpath('//table[@id=\"table5\"]/tr/td')\n if cells.empty?\n cells = doc.xpath('//table[@id=\"table4\"]/tr/td') # ridiculous, I know\n if cells.empty?\n cells = doc.xpath('//table[@id=\"table2\"]/tr/td') # ridiculouser, I know\n end\n end\n he, en = ['', '']\n begin\n he, en = [trim(cells[0].text()), trim(cells[-1].text())] # first and last <td> elements should be the Hebrew and English names. There may or may not be the \"in preparation\" notice in a middle <td>\n rescue Exception\n log(\"--> ERROR getting labels!\")\n end\n return [he, en]\nend",
"def set_c_titul\n @c_titul = CTitul.find(params[:id])\n end",
"def setNombre dato\n\t\t@nombre = dato\n\tend",
"def full_title(page_title = '')\n base_title = \"Colegio de Notarios\"\n if page_title.empty?\n base_title\n else\n page_title + \" | \" + base_title\n end\n end",
"def get_descripcion(num_plato)\n if (num_plato<0)&&(num_plato>@platos)\n raise \"El plato no existe\"\n else\n \"#{@descripcion[num_plato]}\"\n end\n end",
"def inn\n slice = Capybara.all(:xpath, '//table[@class=\"stripy\"]/tbody/tr/td[contains(text(),\"ИНН\")]/following::td').first\n slice ? slice.text : \"-\"\n end",
"def asunto\n @name = 'foro'\n @page = Page.find(params[:id])\n end",
"def generos\n (self.genero == 1) ? \"Masculino\" : \"Femenino\"\n end",
"def full_descripcion \n \"#{asunto.nombre} - \"+\"#{nombre}\" \n end",
"def title_comp=(_arg0); end",
"def texts; end",
"def categoria_nombre\n categoria.try(:categoria_nombre)\n end",
"def set_task_meta_info answer=''\n\n if answer==''\n answer = @task_text_field.stringValue\n end\n\n existing_entry = Entry.where(:title).eq(answer).sort_by('created_at').last\n\n if existing_entry\n @project_field.setStringValue existing_entry.project_id if existing_entry.project_id\n @customer_field.setStringValue existing_entry.customer_name\n @time_today_field.setStringValue existing_entry.time_today\n @total_time_field.setStringValue existing_entry.total_time\n else\n @project_field.setStringValue ''\n @customer_field.setStringValue ''\n @time_today_field.setStringValue ''\n @total_time_field.setStringValue ''\n end\n end",
"def title\n base_title = \"Reseau Social ESMT\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end"
] |
[
"0.6372878",
"0.6333957",
"0.6325835",
"0.6239822",
"0.60625803",
"0.6023917",
"0.60175425",
"0.5932207",
"0.5886024",
"0.585017",
"0.582606",
"0.5805335",
"0.57674766",
"0.5748658",
"0.5712684",
"0.56854683",
"0.5675048",
"0.5662179",
"0.56564146",
"0.5652772",
"0.56351566",
"0.56341946",
"0.5628368",
"0.5620793",
"0.56056213",
"0.56051177",
"0.5529171",
"0.5526851",
"0.55264515",
"0.5520383",
"0.5517866",
"0.5515893",
"0.5508394",
"0.55039006",
"0.54863393",
"0.5480268",
"0.54795974",
"0.54750896",
"0.5473003",
"0.54663724",
"0.5462752",
"0.54621094",
"0.5462022",
"0.54600674",
"0.5456287",
"0.5451344",
"0.5446315",
"0.5434472",
"0.5424009",
"0.5416649",
"0.5416101",
"0.54137003",
"0.5386927",
"0.5383089",
"0.5367191",
"0.536274",
"0.53614753",
"0.53614753",
"0.53601164",
"0.53584504",
"0.53408587",
"0.53408587",
"0.53408587",
"0.53385746",
"0.5329943",
"0.5327884",
"0.53254914",
"0.5321004",
"0.5314183",
"0.5311014",
"0.53107077",
"0.5304594",
"0.5298952",
"0.5298412",
"0.52933764",
"0.5288282",
"0.5277785",
"0.52728844",
"0.5271288",
"0.52637225",
"0.52604896",
"0.52560854",
"0.525536",
"0.52474254",
"0.52398324",
"0.52380586",
"0.5233996",
"0.52234447",
"0.52219385",
"0.5211722",
"0.52061564",
"0.5205897",
"0.52030164",
"0.5200602",
"0.5198604",
"0.5198207",
"0.51920277",
"0.51866484",
"0.5181827"
] |
0.7745368
|
1
|
Comprueba si la casilla es edificable, devuelve false porque solo las calles lo son
|
def soy_edificable
return false
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def edificar_casa (titulo)\n edificada = false\n \n if (puedo_edificar_casa(titulo))\n coste_edificar_casa = titulo.precio_edificar\n if (tengo_saldo(coste_edificar_casa))\n titulo.edificar_casa\n modificar_saldo (-coste_edificar_casa)\n edificada = true\n end\n end\n \n return edificada\n end",
"def edible?\n#true \n !expired\n \nend",
"def debe_ser_encarcelado\n if is_encarcelado\n return false\n else\n if !tiene_salvoconducto\n return true\n else\n perder_salvoconducto\n Diario.instance.ocurre_evento(\"El jugador se libra de la cárcel\")\n return false\n end\n end\n end",
"def jugador_actual_en_calle_libre\n casilla_actual = @jugador_actual.casilla_actual\n \n return casilla_actual.soy_edificable && !casilla_actual.titulo.tengo_propietario\n end",
"def atributos\n valid = false\n if self.interreps_vencidos.any?\n valid = true\n\n elsif presente_reunioes == true\n valid = true\n end\n\n # elsif Time.now.year - ano_de_fundacao <= 1 \n # valid = true\n # end\n\n valid\n end",
"def ha_accedido?\n\t\t!usuario_actual.nil?\n\tend",
"def puedo_edificar_casa (titulo)\n return @saldo >= titulo.precio_edificar && titulo.num_casas < 8\n end",
"def puedo_edificar_casa (titulo)\n return @saldo >= titulo.precio_edificar && titulo.num_casas < 4 && titulo.num_hoteles == 0\n end",
"def edificar_hotel (titulo)\n edificado = false\n \n if (puedo_edificar_hotel(titulo))\n coste_edificar_hotel = titulo.precio_edificar\n titulo.edificar_hotel\n modificar_saldo (-coste_edificar_hotel)\n edificado=true\n end\n \n return edificado\n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n if @total_servicos.nil?\n return false\n end\n\n \n \n \n \n \n if @total_parcelado_nacionais.nil?\n return false\n end\n\n \n \n \n \n \n if @total_parcelado_internacionais.nil?\n return false\n end\n\n \n \n \n \n end",
"def soy_edificable\n return true\n end",
"def faloAgora?\n\t\tif $testMode then return true end\n\t\t@targ = rand 100\n\t\treturn true if @targ < ($probabilidadeDePost.to_i)\n\t\tself.log( \"Teste: \" + @targ.to_s + \"/\" + $probabilidadeDePost.to_s + \" : sem reação\" ) if $logEntradasNegativas\n\t\treturn false\n\tend",
"def no_circula_cero?\n return false unless self.verificacion_last_approved?\n return false if self.verificacion_expired?\n return true if self.verificacion_last_approved['resultado'] =~ /cero/i\n false\n end",
"def energized?\n @cur_energy > 0\n end",
"def eoi?\n @eoi\n end",
"def eoi?\n @eoi\n end",
"def valide?\n !association_invalide\n end",
"def elv_kapoera\n atk == dfe\n end",
"def edible?\n type.edible?\n end",
"def mes_nao_efetivado(data)\n\t\tself.parts.each do |p|\n\t\t\tif((p.data.month <= data.month) && (p.data.year <= data.year) && (p.confirmacao == 0))\n\t\t\t\treturn true\n\t\t\tend\n\t\tend\n\t\treturn false\n\tend",
"def debo_ir_a_carcel\n if (super)\n return !pagar_fianza\n else\n return true \n # Lo hemos hecho así, porque pensamos que si tiene carta y llama a \n # pagar fianza y tiene el saldo suficiente, se restaría dinero\n # del saldo aún teniendo la carta libertad\n end\n end",
"def estValide?\n\t\t!self.statutVisible.isTente?\n\tend",
"def puedo_edificar_hotel (titulo)\n tengo_suficientes_casas = titulo.num_casas == 4\n return @saldo >= titulo.precio_edificar && titulo.num_hoteles < 8 && tengo_suficientes_casas\n end",
"def reiwa?\n Date.new(2019, 5, 1) <= self\n end",
"def analisados(analisados)\n analisados.each do |_n, value|\n return true if value == false\n end\n false\n end",
"def notadedebito_val?\n errors.add(:notadedebito, \"No puede modificar una Nota de Debito impresa.\") if self.notadedebito.impresa?\n end",
"def puedo_edificar_hotel (titulo)\n tengo_suficientes_casas = titulo.num_casas == 4\n return (@saldo >= titulo.precio_edificar) && ((titulo.num_hoteles == 0 && tengo_suficientes_casas) || (titulo.num_hoteles < 4 && titulo.num_hoteles > 0))\n end",
"def repealed?\n !!repealed_on\n end",
"def escala?\n valores = @mi_mano.sort_by {|k, v| v[:valor]}.to_h.map{|k, v| [v[:valor]] }.flatten\n valores.each_with_index do |val, index|\n return false unless val == (valores[index + 1] - 1)\n return true if index == (valores.size - 2)\n end\n end",
"def puede_reproducir?\r\n return (@reproducir_puede && @pez_vivo)\r\n end",
"def resivo?\n \n if pogodci < 17\n return false\n end\n \n kopiraj = self.dup\n kopiraj.solve!\n \n return kopiraj.reseno?\n end",
"def aye?\n true\n end",
"def soyEdificable\n false\n end",
"def monto_utilizado_devoluciones\n credito_restante = notas_creditos_debito.credito_restante\n credito_restante += monto_utilizado_was if persisted? # sumar el monto_utilizado anterior si se esta editando\n errors.add(:monto_utilizado, I18n.t('activerecord.errors.messages.credito_superior_a_disponible')) if credito_restante < monto_utilizado\n errors.add(:monto_utilizado, I18n.t('activerecord.errors.messages.monto_utilizado_cero')) if monto_utilizado <= 0\n false if errors.size > 0\n end",
"def esta_suspendida?\n\n if self.estatus_id == 10029\n return true\n else\n return false\n end\n # solicitud_causa_renuncia = SolicitudCausaRenuncia.find_by_solicitud_id self.id\n\n #if solicitud_causa_renuncia.nil?\n # return false\n #else\n # return true\n #end\n end",
"def expiry_on?\n :on == self.expiry_option\n end",
"def es_medidor_de_energia_reactiva\n \tmedidor_id = MedidorEstadoMedidor.where(estado_medidor_id: self.id).take.medidor_id\n medidor = Medidor.find(medidor_id)\n return medidor.tipo_medidor.codigo == 2\n end",
"def calls?\n ! callees.empty?\n end",
"def editing?\n if Time.now > self.select_event.ordering_window_end_time\n # Cutoff time has passed\n false\n elsif self.edit_mode\n # SnapPea user is editing this select order\n true\n else\n # Default => not editing since the edit_mode field isn't set\n false\n end\n end",
"def valid?\n return false if !@expmonth.nil? && @expmonth > 12\n return false if !@expmonth.nil? && @expmonth < 1\n return false if !@expyear.nil? && @expyear > 2100\n return false if !@expyear.nil? && @expyear < 2000\n true\n end",
"def calculated?\n @calculated == true\n end",
"def actif?\n @actif == true\n end",
"def can_expedite?\n seconds.count >= seconds_for_expedition\n end",
"def needs_intros?\n # time to generate new intros\n if self.has_current_intros?\n Time.now.utc.to_i >= self.intros_expire_at\n else\n # no current intros\n true\n end\n end",
"def can_edit_actuals?\n return false if order_detail.nil?\n complete?\n end",
"def verifica_anulacion_del_cierre\n if Cierre.where(\"fechaproceso > ? and activo = ? and empresa_id = ? \", self.fechaproceso.to_date + 1.day, true, 1).exists?\n errors.add(:fechaproceso, \"Existen fechas posteriores que estan cerradas.\")\n end\n end",
"def puede_avanzar_doble?(columna, fila)\n fila_inicial == @fila and fila_doble_avance == fila and @tablero[columna][fila_siguiente].nil? and @columna == columna\n end",
"def calculation?\n !(@calculate == false || @calculate.nil?)\n end",
"def red_pencil_promotion?\n\t\t if valid_date? && valid_discount_amount? && valid_promotion_length?\n\t\t \treturn true\n\t\t else\n\t\t \treturn false\t\t \t\n\t\t end \n\tend",
"def has_calendar?\n \t\t!calendar.nil?\n \tend",
"def elide?\n false\n end",
"def allow_entry?\n #current_financial_year.is_freezed?\n @financial_year.is_freezed?\n end",
"def still_valid?\n if Time.now - self.Date < 7 * 24 * 3600 #7 days\n return true\n else\n return false\n end\n end",
"def evaluable?\n true\n end",
"def need_scrapping?\n !@festival.instance_of?(Festival) || !@festival.valid? || @festival.should_be_updated?\n end",
"def made?\n result >= 0\n end",
"def update?\n return true if event_planner? || super_admin?\n\n my_record? && !registration_closed?\n end",
"def assertive?\n true\n end",
"def expired_and_uncompleted?\n self.expired? and !self.completed?\n end",
"def has_valid_date?\n self.time_event < Time.now.advance(days: 1)\n end",
"def debo_ir_a_carcel\n return !tengo_carta_libertad\n end",
"def usable?\n\n @trajectory.each do |a_point|\n if a_point.alt > 1000000.0\n return false\n end\n end\n\n return true\n\n end",
"def is_expired?\n\t\tself.event_date < DateTime.now\n\tend",
"def has_entered_warehouse?\n # return true if self.stored_at No se esta borrando al sacar por error\n return true if self.warehouse || self.dispatched_at\n false\n end",
"def hay_obra?\n @obra.try :persisted?\n end",
"def maint?\n ck_valid\n return true if @num.to_i == 0\n false\n end",
"def performed?\n pa = performed_at\n ! pa.nil?\n end",
"def puede_enrocar?(columna, fila)\n false\n end",
"def self_auditor_checked?\n self.designer_result != 'None'\n end",
"def is_encarcelado\n return @encarcelado\n end",
"def fixed?\n !moving? && day.present?\n end",
"def delicious?\n #its automattically true\n true\n end",
"def at_cmee(bool)\n\t\t\t\ttrue\n\t\t\tend",
"def editable_by_with_date_check?(usr)\n if TimeEntry.diary_threshold_enabled?\n return false if self.spent_on && (self.spent_on < TimeEntry.min_date_for_modifications)\n end\n editable_by_without_date_check?(usr)\n end",
"def valid?\n return false if @event_time.nil?\n return true\n end",
"def editable?\n (self.entry_ts.to_date == Date.today && self.billing_ref.blank?) || ![BILLED,PAID,CANCELLED].include?(self.status)\n end",
"def is_expired?\n \t\n\tresult = false\n \t\t\n\tsubscription_count_services_ids = SounzService.subscription_count_services.map{|ss| ss.sounz_service_id}\n\t\t\n\tif (!self.expiry_date.blank? && self.expiry_date < Time.now) || ((subscription_count_services_ids.include?self.sounz_service_id) && self.loan_count.to_i < 1)\n\t result = true\n\tend\n \n\treturn result\n end",
"def on_eucalyptus?\n eucalyptus != nil\n end",
"def on_eucalyptus?\n eucalyptus != nil\n end",
"def set_alarm(employed, vacation)\n if employed == true && vacation == false\n true\n else\n false\n end\nend",
"def is_expire(copoun_obj) \n if copoun_obj.expiration_type == \"time\" \n true if copoun_obj.expiration_time < Date.today\n else\n if copoun_obj.expiration_number < 1\n true\n else\n copoun_obj.update(expiration_number: copoun_obj.expiration_number-1)\n end\n end\n end",
"def logado?\n !admin_atual.nil?\n end",
"def has_money\n return true unless Capital.find(1).montante_real < self.valor\n end",
"def valid?\n return false if !@day.nil? && @day > 7\n return false if !@day.nil? && @day < 1\n true\n end",
"def embargo_active?\n embargo.blank? ? false : Time.zone.today < embargo\n end",
"def valid?\n false\n end",
"def control_sin_items_comprobantes\n if [detalles].any? {|detalle| detalle.any? }\n self.errors[:base] = \"error que queres hacer?\"\n return false\n end \n end",
"def expedientes\n can [:create, :update], Expediente do |expediente|\n !expediente.inicio_id or @@user.oficina_ids.include? expediente.inicio_id\n end\n end",
"def expired?\n not valid?\n end",
"def has_revendeur\n \tif(self.entite.droit.has_revendeur == 1)\n \t\treturn true\n \telse\n \t\treturn false\n \tend\n end",
"def valid?\n return false if @id.nil?\n return false if @exec_date.nil?\n return false if @register_date.nil?\n return false if @amount.nil?\n return false if @state.nil?\n return false if @beneficiary_type.nil?\n true\n end",
"def suction_cup?\n @suction_cup == 1\n end",
"def delicious?\n\t\treturn true\n\tend",
"def evaluate?\n false\n end",
"def evaluate?\n false\n end",
"def concursoInactivo\n conc = Concurso.find(params[:concurso_id])\n (conc.inicio<=DateTime.now && conc.fim>=DateTime.now) ? false : true\n end",
"def update_asignar(control_asignacion)\n if control_asignacion[:usuario_id].nil? || control_asignacion[:usuario_id].empty?\n self.errors.add(:solicitud, I18n.t('Sistema.Body.Modelos.Errores.analista_asignar_es_requerido'))\n unless self.estatus_id == 10002\n if control_asignacion[:observacion].nil? || control_asignacion[:observacion].empty?\n self.errors.add(:solicitud, I18n.t('Sistema.Body.Modelos.Errores.observacion_es_requerido'))\n end\n end\n return false\n end\n unless self.estatus_id == 10002\n if control_asignacion[:observacion].nil? || control_asignacion[:observacion].empty?\n self.errors.add(:solicitud, I18n.t('Sistema.Body.Modelos.Errores.observacion_es_requerido'))\n return false\n end\n end\n\n if self.estatus_id == 10002\n asignar = true\n else\n asignar = false\n end\n\n control = ControlAsignacion.new(control_asignacion)\n control.solicitud_id = self.id\n control.fecha = Time.now\n control.asignacion = asignar\n control.unidad = 'C'\n control.save\n usuario = Usuario.find(control.usuario_id)\n self.usuario_pre_evaluacion = usuario.nombre_usuario\n self.save\n return true\n\n end",
"def alto?\n @cr[0xb][7] == 1\n end",
"def suivi? ; self.abs_module.nombre_jours.nil? end"
] |
[
"0.7485318",
"0.6895932",
"0.6827735",
"0.6723027",
"0.6675051",
"0.6655748",
"0.6613349",
"0.65563655",
"0.65446043",
"0.65325665",
"0.6491451",
"0.641164",
"0.6387168",
"0.63699794",
"0.63634354",
"0.63634354",
"0.6314135",
"0.6292197",
"0.627821",
"0.6246649",
"0.6221682",
"0.6205674",
"0.6197543",
"0.61955976",
"0.6182703",
"0.6174591",
"0.61584765",
"0.6128556",
"0.6101067",
"0.60983276",
"0.6088849",
"0.60775006",
"0.6077335",
"0.6076881",
"0.60730773",
"0.6058621",
"0.6055736",
"0.60536885",
"0.6021253",
"0.6015063",
"0.60119337",
"0.60102355",
"0.599831",
"0.59940106",
"0.5993201",
"0.5984527",
"0.59656256",
"0.5937234",
"0.593183",
"0.592847",
"0.5923018",
"0.5922597",
"0.59207004",
"0.5910824",
"0.59001887",
"0.58997834",
"0.58974403",
"0.589463",
"0.5894435",
"0.58939296",
"0.5891568",
"0.5886423",
"0.5874581",
"0.5872058",
"0.58665186",
"0.585676",
"0.5854983",
"0.5854147",
"0.58532363",
"0.5850485",
"0.5847125",
"0.58470756",
"0.58404106",
"0.58302385",
"0.5818337",
"0.581699",
"0.5810434",
"0.58027595",
"0.5801292",
"0.57993007",
"0.57906353",
"0.57903564",
"0.57803226",
"0.57721496",
"0.5769207",
"0.5765088",
"0.57645196",
"0.5764448",
"0.5761886",
"0.57589483",
"0.57577455",
"0.5750419",
"0.57479894",
"0.57447904",
"0.57447904",
"0.5744447",
"0.57429075",
"0.57419443",
"0.5741357"
] |
0.6498832
|
11
|
GET /draft_investments/1 GET /draft_investments/1.xml
|
def show
@draft_investment = DraftInvestment.find(params[:id])
respond_to do |format|
format.xml { render :xml => @draft_investment }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @draft_investment = DraftInvestment.new\n\n respond_to do |format|\n\n format.xml { render :xml => @draft_investment }\n end\n end",
"def show\n @invest = Invest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @invest }\n end\n end",
"def destroy\n @draft_investment = DraftInvestment.find(params[:id])\n @draft_investment.destroy\n\n respond_to do |format|\n\n format.xml { head :ok }\n end\n end",
"def index\n @fixed_deposits = FixedDeposit.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @fixed_deposits }\n end\n end",
"def update\n @draft_investment = DraftInvestment.find(params[:id])\n\n respond_to do |format|\n if @draft_investment.update_attributes(params[:investment])\n\n format.xml \n else\n\n format.xml { render :xml => @draft_investment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n @investigator = Investigator.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @investigator }\n end\n end",
"def index\r\n @fixed_deposit_investments = FixedDepositInvestment.all\r\n end",
"def show\n @draft = Draft.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @draft }\n end\n end",
"def index\n @investments = Investment.all\n\n respond_to do |format|\n format.html\n format.json\n end\n end",
"def show\n @draft_partnership = DraftPartnership.find(params[:id])\n\n respond_to do |format|\n \n format.xml { render :xml => @draft_partnership }\n end\n end",
"def index\n @investment_funds = InvestmentFund.all\n end",
"def show\n @fixed_deposit = FixedDeposit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @fixed_deposit }\n end\n end",
"def show\n @investment = Investment.find(params[:id])\n end",
"def show\n @draft = SmsOnRails::Draft.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @draft }\n end\n end",
"def show\n @round_expense = RoundExpense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @round_expense }\n end\n end",
"def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @expense.to_xml }\n end\n end",
"def show\n @dbs_deposit = DbsDeposit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @dbs_deposit }\n end\n end",
"def show\n @deposit_threshold = DepositThreshold.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @deposit_threshold }\n end\n end",
"def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @expense }\n end\n end",
"def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @expense }\n end\n end",
"def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @expense }\n end\n end",
"def show\n render json: @investment, root: false\n end",
"def index\n @fixed_expenses = FixedExpense.for_user(current_user).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @fixed_expenses }\n end\n end",
"def index\n @wallet_id = params[:wallet_id]\n @investment_funds = InvestmentFund.where(\"wallet_id = ?\", @wallet_id)\n end",
"def index\n @investments = Investment.all\n\n render json: {investments: @investments}, root: false\n end",
"def show\n @draft_company = DraftCompany.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @draft_company }\n end\n end",
"def index\n @investables = Investable.all\n end",
"def index\n @drafts = SmsOnRails::Draft.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @drafts }\n end\n end",
"def show\n @operating_expense = OperatingExpense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @operating_expense }\n end\n end",
"def show\n @pledge = Pledge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pledge }\n end\n end",
"def show\n @pledge = Pledge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pledge }\n end\n end",
"def index\n @savings = @advance.savings\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @savings }\n end\n end",
"def show\n @withdrawal = Withdrawal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @withdrawal }\n end\n end",
"def show\n @pledge = Pledge.find(params[:id])\n\n respond_to do |format|\n format.html show.html.erb\n format.xml { render :xml => @pledge }\n end\n end",
"def index\n @investigations = Investigation.where(:visible => true)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @investigations }\n end\n end",
"def show\n @approval = Approval.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @approval }\n end\n end",
"def index\n @investigations = Investigation.all\n end",
"def show\n @warranty = Warranty.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @warranty }\n end\n end",
"def index\n @contracts = @project.contracts\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @contracts }\n end\n end",
"def index\n @expenses = Expense.limit(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @expenses }\n end\n end",
"def show\n @investigation = Investigation.find(params[:id])\n @names = @investigation.names\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @investigation }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @unapproved_project }\n end\n end",
"def draft\n @search= @company.purchase_orders.by_branch_id(@current_user.branch_id).by_deleted(false).by_date(@financial_year).search(params[:search])\n @purchase_orders = @search.order(:record_date).page(params[:page]).per(20)\n respond_to do |format|\n format.html # closed.html.erb\n format.xml { render :xml => @invoices }\n end\n end",
"def show\n @budget_src = BudgetSrc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @budget_src }\n end\n end",
"def show\n @fixed_expense = FixedExpense.for_user(current_user).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @fixed_expense }\n end\n end",
"def index\n @expense_items = ExpenseItem.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @expense_items }\n end\n end",
"def index\n @investments = Investment.all.paginate(:page => params[:page], :per_page => 30)\n end",
"def new\n @draft_list = DraftList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @draft_list }\n end\n end",
"def show\n @funding_source = FundingSource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @funding_source }\n end\n end",
"def show\n @investment_type = InvestmentType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @investment_type }\n end\n end",
"def show\n @debt = Debt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @debt }\n end\n end",
"def create\n @invest = Invest.new(params[:invest])\n\n respond_to do |format|\n if @invest.save\n format.html { redirect_to(@invest, :notice => 'Invest was successfully created.') }\n format.xml { render :xml => @invest, :status => :created, :location => @invest }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @invest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @fixed_deposit = FixedDeposit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @fixed_deposit }\n end\n end",
"def index\n @ptbudgets = Ptbudget.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ptbudgets }\n end\n end",
"def pending_list\n @design_changes = DesignChange.find_pending\n \n respond_to do |format|\n format.html # pending_list.html.erb\n format.xml { render :xml => @design_changes }\n end\n end",
"def show\n @investigation = Investigation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @investigation }\n end\n end",
"def show\n @ptbudget = Ptbudget.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ptbudget }\n end\n end",
"def show\n @ptbudget = Ptbudget.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ptbudget }\n end\n end",
"def index\n @fund_company_investments = FundCompanyInvestment.all\n end",
"def index\n @expensegroups = Expensegroup.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @expensegroups }\n end\n end",
"def show\n @depositocaucion = Depositocaucion.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @depositocaucion }\n end\n end",
"def new\n @invest = Invest.new\n @invest.seq = get_next_seq(Invest)\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invest }\n end\n end",
"def new\n @fixed_expense = FixedExpense.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @fixed_expense }\n end\n end",
"def show\n @stock_disposal = StockDisposal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @stock_disposal }\n end\n end",
"def show\n @draft = Draft.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @draft }\n end\n end",
"def index\n @involvements = Involvement.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @involvements }\n end\n end",
"def show\n @expensegroup = Expensegroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @expensegroup }\n end\n end",
"def show\n @spend = Spend.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @spend }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @fund_request }\n end\n end",
"def create\n @data = params[:investment]\n @investment= DraftInvestment.find(:all, :conditions => [\"company_id = ? AND funding_type = ?\",@data[:company_id], @data[:funding_type]])\n if @investment.to_s != \"\"\n @invest = DraftInvestment.find(@investment[0][:id])\n\t @invest.update_attributes({\"agency\" => @investment[0][\"agency\"] + \", \" + @data[:agency],\"funding_amount\" => (@data[\"funding_amount\"].to_i + @investment[0][\"funding_amount\"]).to_s})\n respond_to do |format|\n format.xml \n\t\tend \n\t \n else\n\n @investment = DraftInvestment.new(params[:investment])\n respond_to do |format|\n if @investment.save\n flash[:notice] = 'Investment was successfully created.'\n\n format.xml { render :xml => @investment, :status => :created, :location => @investment }\n else\n\n format.xml { render :xml => @investment.errors, :status => :unprocessable_entity }\n end\n end\n \n end\n\n end",
"def destroy\n @invest = Invest.find(params[:id])\n @invest.destroy\n\n respond_to do |format|\n format.html { redirect_to(invests_url) }\n format.xml { head :ok }\n end\n end",
"def new\n @draft = SmsOnRails::Draft.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @draft }\n end\n end",
"def show\n @bank_reconciliations = AccountingBankReconciliations.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bank_reconciliations }\n end\n end",
"def show\n @estacion = Estacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estacion }\n end\n end",
"def show\n @prd_etc = PrdEtc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @prd_etc }\n end\n end",
"def new\n @draft_partnership = DraftPartnership.new\n\n respond_to do |format|\n \n format.xml { render :xml => @draft_partnership }\n end\n end",
"def view\n\t\t\t@investor = Investor.find params[:id]\n\t\tend",
"def index\n @project_phase_deliverables = ProjectPhaseDeliverable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @project_phase_deliverables }\n end\n end",
"def index\n @commitments = Commitment.all\n @title = \"Commitments\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @commitments }\n end\n end",
"def show\n @estados_civil = EstadosCivil.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estados_civil }\n end\n end",
"def index\n @payments = Payment.top\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @payments }\n end\n end",
"def show\n @involvement = Involvement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @involvement }\n end\n end",
"def show\n @revendedor = Revendedor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @revendedor }\n end\n end",
"def show\r\n @withdrawal = @company.withdrawals.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @withdrawal }\r\n end\r\n end",
"def index\n @deposits = Deposit.all\n end",
"def show\n @estado_pedido = EstadoPedido.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estado_pedido }\n end\n end",
"def index\n @invitados = Invitado.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invitados }\n end\n end",
"def new\n @round_expense = RoundExpense.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @round_expense }\n end\n end",
"def show\n @budget_item = BudgetItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @budget_item }\n end\n end",
"def show\n @savings = Savings.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @savings }\n end\n end",
"def show\n @expense = current_user.expenses.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @expense }\n end\n end",
"def show\n @proposal = Proposal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @proposal }\n end\n end",
"def pending\n @ledger_entries = @organization.ledger_entries.uninvoiced.page(params[:page])\n respond_with @organization, @invoice\n end",
"def new\n @dbs_deposit = DbsDeposit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dbs_deposit }\n end\n end",
"def show\n @stock_adjustment = StockAdjustment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @stock_adjustment }\n end\n end",
"def show\n @contract = Contract.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @contract }\n end\n end",
"def show\n @contract = Contract.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @contract }\n end\n end",
"def show\n @fee_std = FeeStd.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @fee_std }\n end\n end",
"def show\n @balance = Balance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @balance }\n end\n end",
"def new\n @draft_company = DraftCompany.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @draft_company }\n end\n end"
] |
[
"0.7332301",
"0.7167561",
"0.6709937",
"0.6649071",
"0.6569686",
"0.65380096",
"0.6527645",
"0.6504869",
"0.6488592",
"0.64177066",
"0.6391856",
"0.6375843",
"0.6279832",
"0.62487864",
"0.62323475",
"0.6164607",
"0.6135705",
"0.61334616",
"0.6111598",
"0.6111598",
"0.6111598",
"0.6111463",
"0.6091038",
"0.608802",
"0.60778886",
"0.60651296",
"0.6045243",
"0.6044584",
"0.60237974",
"0.60172474",
"0.60172474",
"0.6006936",
"0.5995409",
"0.5993819",
"0.5978163",
"0.59633684",
"0.5958371",
"0.59493005",
"0.59387046",
"0.59318745",
"0.5922896",
"0.59182495",
"0.59105015",
"0.59045154",
"0.59033954",
"0.59011054",
"0.59007955",
"0.59004384",
"0.5883696",
"0.5883385",
"0.5873109",
"0.5856855",
"0.58507407",
"0.5834752",
"0.58177954",
"0.58147395",
"0.5805125",
"0.5805125",
"0.58046293",
"0.5789915",
"0.5784837",
"0.57795227",
"0.5777093",
"0.5764992",
"0.57627857",
"0.5751934",
"0.5746324",
"0.5743299",
"0.5739677",
"0.57393444",
"0.5737823",
"0.5735705",
"0.5731122",
"0.5712973",
"0.5712335",
"0.570501",
"0.57031894",
"0.57018816",
"0.5698299",
"0.5697964",
"0.5692678",
"0.5692574",
"0.56811684",
"0.5670984",
"0.56659",
"0.56655496",
"0.5662358",
"0.56593806",
"0.5658048",
"0.5645233",
"0.5642996",
"0.5633182",
"0.5632028",
"0.5628163",
"0.5618813",
"0.5618243",
"0.5618243",
"0.5617421",
"0.5615893",
"0.5613033"
] |
0.7968183
|
0
|
GET /draft_investments/new GET /draft_investments/new.xml
|
def new
@draft_investment = DraftInvestment.new
respond_to do |format|
format.xml { render :xml => @draft_investment }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @fixed_deposit = FixedDeposit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @fixed_deposit }\n end\n end",
"def new\n @invest = Invest.new\n @invest.seq = get_next_seq(Invest)\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invest }\n end\n end",
"def create\n @invest = Invest.new(params[:invest])\n\n respond_to do |format|\n if @invest.save\n format.html { redirect_to(@invest, :notice => 'Invest was successfully created.') }\n format.xml { render :xml => @invest, :status => :created, :location => @invest }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @invest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @draft_list = DraftList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @draft_list }\n end\n end",
"def new\n @draft = SmsOnRails::Draft.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @draft }\n end\n end",
"def new\n @fixed_expense = FixedExpense.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @fixed_expense }\n end\n end",
"def new\n @deposit_threshold = DepositThreshold.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @deposit_threshold }\n end\n end",
"def new\n @pledge = Pledge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pledge }\n end\n end",
"def new\n @pledge = Pledge.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pledge }\n end\n end",
"def new\n @round_expense = RoundExpense.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @round_expense }\n end\n end",
"def new\n @approval = Approval.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @approval }\n end\n end",
"def new\n @draft_company = DraftCompany.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @draft_company }\n end\n end",
"def new\n @lease = Lease.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lease }\n end\n end",
"def new\n @investment_type = InvestmentType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @investment_type }\n end\n end",
"def new\n @draft_partnership = DraftPartnership.new\n\n respond_to do |format|\n \n format.xml { render :xml => @draft_partnership }\n end\n end",
"def new\n @expense = Expense.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @expense }\n end\n end",
"def new\n @expense = Expense.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @expense }\n end\n end",
"def new\n @draft = @compare.drafts.build \n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @draft }\n end\n end",
"def new\n @dbs_deposit = DbsDeposit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dbs_deposit }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @fund_request }\n end\n end",
"def new\n @proposal = Proposal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @proposal }\n end\n end",
"def new\n @proposal = Proposal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @proposal }\n end\n end",
"def new\n @withdrawal = Withdrawal.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @withdrawal }\n end\n end",
"def show\n @draft_investment = DraftInvestment.find(params[:id])\n\n respond_to do |format|\n\n format.xml { render :xml => @draft_investment }\n end\n end",
"def new\n @draft = Draft.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @draft }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end",
"def new\n @new_project_phase_deliverable = ProjectPhaseDeliverable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @new_project_phase_deliverable }\n end\n end",
"def new\n @draft = Draft.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @draft }\n end\n end",
"def new\n @funding_source = FundingSource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @funding_source }\n end\n end",
"def new\n @ptbudget = Ptbudget.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ptbudget }\n end\n end",
"def new\n @involvement = Involvement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @involvement }\n end\n end",
"def new\n @commitment = Commitment.new\n @title = \"New Commitment\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @commitment }\n end\n end",
"def new\n @teamcommitment = Teamcommitment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @teamcommitment }\n end\n end",
"def new\n @inv_type = InvType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @inv_type }\n end\n end",
"def new\n @contract = Contract.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contract }\n end\n end",
"def new\n @contract = Contract.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contract }\n end\n end",
"def new\n @investigation = Investigation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @investigation }\n end\n end",
"def new\n @spend = Spend.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @spend }\n end\n end",
"def new\n @deposit = Deposit.new(:user => current_user)\n @deposit.init_all_deposit_funds\n\n default = current_user.family.default_deposit_template\n default.apply(@deposit) if default\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @deposit }\n end\n end",
"def new\n @depositocaucion = Depositocaucion.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @depositocaucion }\n end\n end",
"def new\n @fundation = Fundation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @fundation }\n end\n end",
"def new\n @balance = Balance.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @balance }\n end\n end",
"def new\n @savings = Savings.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @savings }\n end\n end",
"def new\n @prd_etc = PrdEtc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prd_etc }\n end\n end",
"def new\n @estacion = Estacion.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estacion }\n end\n end",
"def new\n @operating_expense = OperatingExpense.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @operating_expense }\n end\n end",
"def new\n @newtype = params[:newtype]\n @ptbudget = Ptbudget.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ptbudget }\n end\n end",
"def new\n @dependent_representative = DependentRepresentative.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dependent_representative }\n end\n end",
"def new\n @partytype = Partytype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @partytype }\n end\n end",
"def new\n @budget_src = BudgetSrc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @budget_src }\n end\n end",
"def create\n puts \"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\"\n @investment = Investment.new(amount:params[:amount])\n\n respond_to do |format|\n if @investment.save\n format.html { redirect_to @investment, notice: 'Investment was successfully created.' }\n format.json { render action: 'show', status: :created, location: @investment }\n else\n format.html { render action: 'new' }\n format.json { render json: @investment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @investigation = Investigation.new(params[:investigation])\n\n respond_to do |format|\n if @investigation.save\n format.html { redirect_to(@investigation, :notice => 'Investigation was successfully created.') }\n format.xml { render :xml => @investigation, :status => :created, :location => @investigation }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @investigation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @party_type = PartyType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @party_type }\n end\n end",
"def new\n @loan = Loan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @loan }\n end\n end",
"def new\n @project_status = ProjectStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project_status }\n end\n end",
"def new\n @defect = Defect.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @defect }\n end\n end",
"def new\n @period = Period.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @period }\n end\n end",
"def new\n @revendedor = Revendedor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @revendedor }\n end\n end",
"def new\n @estado_pedido = EstadoPedido.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estado_pedido }\n end\n end",
"def new\n @estados_civil = EstadosCivil.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estados_civil }\n end\n end",
"def new\n @production = Production.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @production }\n end\n end",
"def new\n @procurement = Procurement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @procurement }\n end\n end",
"def new\n @incentive = Incentive.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @incentive }\n end\n end",
"def new\n @election = Election.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @election }\n end\n end",
"def new\n @department = Department.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @department }\n end\n end",
"def new\n @department = Department.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @department }\n end\n end",
"def new\n @provision = Provision.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @provision }\n end\n end",
"def new\n @province = Province.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @province }\n end\n end",
"def new\n @shipment = Shipment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shipment }\n end\n end",
"def new\n @boss = Boss.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @boss }\n end\n end",
"def new\n \n @personnel = Personnel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @personnel }\n end\n end",
"def new\n @visarequest = Visarequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @visarequest }\n end\n end",
"def new\n @regiment = Regiment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @regiment }\n end\n end",
"def new\n @amount = Amount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @amount }\n end\n end",
"def new\n @po = Po.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @po }\n end\n end",
"def create\n @draft = Draft.new(params[:draft])\n\n respond_to do |format|\n if @draft.save\n format.html { redirect_to(compare_path(:id => @draft.compare_id), :flash => { :success => 'draft created.'}) }\n format.xml { render :xml => @draft, :status => :created, :location => @draft }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @draft.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @interest = Interest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @interest }\n end\n end",
"def new\n @renewal = Renewal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @renewal }\n end\n end",
"def new\n @prd_threshold = PrdThreshold.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prd_threshold }\n end\n end",
"def new\n @expensegroup = Expensegroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @expensegroup }\n end\n end",
"def new\n @lookup_eligibilityoutcome = LookupEligibilityoutcome.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_eligibilityoutcome }\n end\n end",
"def new\n @kennel = Kennel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @kennel }\n end\n end",
"def new\n @announcement = Announcement.new\n\n respond_to do |format|\n format.html # new.haml\n format.xml { render :xml => @announcement }\n end\n end",
"def new\n @pay_period = PayPeriod.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pay_period }\n end\n end",
"def new\n @state_province = StateProvince.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @state_province }\n end\n end",
"def new\n @thesis_proposal = ThesisProposal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thesis_proposal }\n end\n end",
"def new\n @rankings = Rankings.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rankings }\n end\n end",
"def new\n @deposit_template = DepositTemplate.new(:user => current_user)\n @deposit_template.init_all_fund_percentages\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @deposit_template }\n end\n end",
"def new\n @workflow = Workflow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @workflow }\n end\n end",
"def new\n @breakdown = Breakdown.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @breakdown }\n end\n end",
"def new\n @outline = Outline.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @outline }\n end\n end",
"def new\n @derivative = Derivative.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @derivative }\n end\n end",
"def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invoice }\n end\n end",
"def new\n @journal = Journal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @journal }\n end\n end",
"def new\n @presentation = Presentation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @presentation }\n end\n end",
"def new\n @invitado = Invitado.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invitado }\n end\n end",
"def new\n @bill = Bill.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bill }\n end\n end",
"def new\n @announcement = Announcement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @announcement }\n end\n end",
"def new\n @announcement = Announcement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @announcement }\n end\n end",
"def new\n @pr = Pr.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pr }\n end\n end"
] |
[
"0.72021484",
"0.7185856",
"0.71423906",
"0.70694804",
"0.7049854",
"0.70109576",
"0.69804657",
"0.6924873",
"0.6898461",
"0.68829817",
"0.68815154",
"0.68684196",
"0.6858502",
"0.6840151",
"0.6827573",
"0.6824441",
"0.6824441",
"0.6798169",
"0.67973655",
"0.6790792",
"0.67902416",
"0.67902416",
"0.6781953",
"0.67662764",
"0.6748314",
"0.67420495",
"0.67408544",
"0.6739511",
"0.67214763",
"0.6718761",
"0.66891056",
"0.66875875",
"0.66803753",
"0.6655564",
"0.66547066",
"0.66547066",
"0.6640585",
"0.6621527",
"0.6617638",
"0.6615715",
"0.6592539",
"0.65886104",
"0.6568801",
"0.6560011",
"0.6550886",
"0.65453774",
"0.65441966",
"0.6540729",
"0.6535715",
"0.65352935",
"0.6526964",
"0.6523437",
"0.65214914",
"0.65162176",
"0.6505882",
"0.6502248",
"0.64975476",
"0.6482177",
"0.647412",
"0.6472907",
"0.64714295",
"0.64611393",
"0.64569557",
"0.64534616",
"0.64457786",
"0.64457786",
"0.6444306",
"0.6435812",
"0.64298546",
"0.6425286",
"0.6424972",
"0.64240813",
"0.6422091",
"0.6416569",
"0.64136714",
"0.64129245",
"0.6410499",
"0.6407426",
"0.64014775",
"0.6397091",
"0.6393782",
"0.6393345",
"0.6387716",
"0.63868904",
"0.6381692",
"0.63816446",
"0.63807136",
"0.6380374",
"0.6378686",
"0.6376819",
"0.6374802",
"0.63728696",
"0.6369973",
"0.6369443",
"0.63675165",
"0.6363405",
"0.636233",
"0.6357352",
"0.6357352",
"0.6357199"
] |
0.81029046
|
0
|
POST /draft_investments POST /draft_investments.xml
|
def create
@data = params[:investment]
@investment= DraftInvestment.find(:all, :conditions => ["company_id = ? AND funding_type = ?",@data[:company_id], @data[:funding_type]])
if @investment.to_s != ""
@invest = DraftInvestment.find(@investment[0][:id])
@invest.update_attributes({"agency" => @investment[0]["agency"] + ", " + @data[:agency],"funding_amount" => (@data["funding_amount"].to_i + @investment[0]["funding_amount"]).to_s})
respond_to do |format|
format.xml
end
else
@investment = DraftInvestment.new(params[:investment])
respond_to do |format|
if @investment.save
flash[:notice] = 'Investment was successfully created.'
format.xml { render :xml => @investment, :status => :created, :location => @investment }
else
format.xml { render :xml => @investment.errors, :status => :unprocessable_entity }
end
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @draft_investment = DraftInvestment.new\n\n respond_to do |format|\n\n format.xml { render :xml => @draft_investment }\n end\n end",
"def update\n @draft_investment = DraftInvestment.find(params[:id])\n\n respond_to do |format|\n if @draft_investment.update_attributes(params[:investment])\n\n format.xml \n else\n\n format.xml { render :xml => @draft_investment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @invest = Invest.new(params[:invest])\n\n respond_to do |format|\n if @invest.save\n format.html { redirect_to(@invest, :notice => 'Invest was successfully created.') }\n format.xml { render :xml => @invest, :status => :created, :location => @invest }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @invest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_investments investment_type\n self.create_investment_type(:fix_income => investment_type[:fix_income], :equity=> investment_type[:equity], :gold=> investment_type[:gold], :land_and_estate=> investment_type[:land_and_estate])\n end",
"def create\r\n @fixed_deposit_investment = FixedDepositInvestment.new(fixed_deposit_investment_params)\r\n\r\n respond_to do |format|\r\n if @fixed_deposit_investment.save\r\n format.html { redirect_to @fixed_deposit_investment, notice: 'Fixed deposit investment was successfully created.' }\r\n format.json { render :show, status: :created, location: @fixed_deposit_investment }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @fixed_deposit_investment.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def investment_params\n params.require(:investment).permit(:feature_id, :team_id, :investment)\n end",
"def create\n @investment = Investment.new(investment_params)\n\n if @investment.save\n render json: @investment, status: :created\n else\n render json: @investment.errors, status: :unprocessable_entity\n end\n end",
"def destroy\n @draft_investment = DraftInvestment.find(params[:id])\n @draft_investment.destroy\n\n respond_to do |format|\n\n format.xml { head :ok }\n end\n end",
"def create\n @investment = Investment.new(investment_params)\n\n respond_to do |format|\n if @investment.save\n format.html { redirect_to @investment, notice: 'Investment was successfully created.' }\n format.json { render :show, status: :created, location: @investment }\n else\n format.html { render :new }\n format.json { render json: @investment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def investment_params\n params.require(:investment).permit!\n end",
"def create\n puts \"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\"\n @investment = Investment.new(amount:params[:amount])\n\n respond_to do |format|\n if @investment.save\n format.html { redirect_to @investment, notice: 'Investment was successfully created.' }\n format.json { render action: 'show', status: :created, location: @investment }\n else\n format.html { render action: 'new' }\n format.json { render json: @investment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @investigated = Investigated.new(investigated_params)\n\n respond_to do |format|\n if @investigated.save\n format.html { redirect_to @investigated, notice: 'Investigated was successfully created.' }\n format.json { render :show, status: :created, location: @investigated }\n else\n format.html { render :new }\n format.json { render json: @investigated.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @investigation = Investigation.new(params[:investigation])\n\n respond_to do |format|\n if @investigation.save\n format.html { redirect_to(@investigation, :notice => 'Investigation was successfully created.') }\n format.xml { render :xml => @investigation, :status => :created, :location => @investigation }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @investigation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def fixed_deposit_investment_params\r\n params.require(:fixed_deposit_investment).permit(:institution_id, :name, :period_in_days, :minimum_principal_pesewas, :risk_rating, :links, :email, :phone_number, :description)\r\n end",
"def create\n @investment_fund = InvestmentFund.new(investment_fund_params)\n\n respond_to do |format|\n if @investment_fund.save\n format.html { redirect_to @investment_fund, notice: 'Investment fund was successfully created.' }\n format.json { render :show, status: :created, location: @investment_fund }\n else\n format.html { render :new }\n format.json { render json: @investment_fund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @investment_fund = InvestmentFund.new(investment_fund_params)\n\n respond_to do |format|\n if @investment_fund.save\n format.html { redirect_to @investment_fund, notice: 'Investment fund was successfully created.' }\n format.json { render :show, status: :created, location: @investment_fund }\n else\n format.html { render :new }\n format.json { render json: @investment_fund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def investment_params\n params.require(:investment).permit(:month, :amount, :total_inv)\n end",
"def show\n @draft_investment = DraftInvestment.find(params[:id])\n\n respond_to do |format|\n\n format.xml { render :xml => @draft_investment }\n end\n end",
"def create\n @investment = Investment.new(investment_params)\n\n respond_to do |format|\n @investment.investor = current_user\n if @investment.save\n update_staffs\n format.html { redirect_to @investment, notice: 'Investment was successfully created.' }\n format.json { render :show, status: :created, location: @investment }\n else\n flash[:danger] = @investment.errors.full_messages.join(', ')\n format.html { render :new }\n format.json { render json: @investment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_investments investment_type\n if self.investment_type.nil?\n self.create_investments investment_type\n else\n self.investment_type.update!(:fix_income => investment_type[:fix_income], :equity=> investment_type[:equity], :gold=> investment_type[:gold], :land_and_estate=> investment_type[:land_and_estate])\n end\n end",
"def index\r\n @fixed_deposit_investments = FixedDepositInvestment.all\r\n end",
"def set_fixed_deposit_investment\r\n @fixed_deposit_investment = FixedDepositInvestment.find(params[:id])\r\n end",
"def create\n ActiveRecord::Base.transaction do\n @investigacion = Investigacion.new(investigacion_params)\n\n respond_to do |format|\n if @investigacion.save\n format.html { redirect_to @investigacion, notice: 'La Investigacion se creó exitosamente.' }\n format.json { render :show, status: :created, location: @investigacion }\n else\n format.html { render :new }\n format.json { render json: @investigacion.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def create\n @ico_etz_investment = EtzInvestment.new(ico_etz_investment_params)\n\n respond_to do |format|\n if @ico_etz_investment.save\n format.html { redirect_to ico_etz_investment_path(@ico_etz_investment), notice: 'Etz investment was successfully created.' }\n format.json { render :show, status: :created, location: @ico_etz_investment }\n else\n format.html { render :new }\n format.json { render json: @ico_etz_investment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def continue\n if params[:add_fund].present?\n session[:investment_attributes] = Investment.find(params[:add_fund]).attributes\n redirect_to amount_wizard_investment_path\n else\n session[:investment_attributes] = Investment.find(params[:draft]).attributes\n redirect_to plan_wizard_investment_path\n end\n end",
"def create\n @investable = Investable.new(investable_params)\n\n respond_to do |format|\n if @investable.save\n format.html { redirect_to @investable, notice: 'Investable was successfully created.' }\n format.json { render action: 'show', status: :created, location: @investable }\n else\n format.html { render action: 'new' }\n format.json { render json: @investable.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fixed_deposit = FixedDeposit.new(params[:fixed_deposit])\n\n respond_to do |format|\n if @fixed_deposit.save\n flash[:notice] = 'FixedDeposit was successfully created.'\n format.html { redirect_to(@fixed_deposit) }\n format.xml { render :xml => @fixed_deposit, :status => :created, :location => @fixed_deposit }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @fixed_deposit.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def investment_declaration_params\n params.require(:investment_declaration).permit(:date, :document, :investment_head_id, :amount, :actual_amt, :accepted_amt, :rejected_amt, :employee_id, :status, :comment, :total_amt)\n end",
"def investment_fund_params\n params.require(:investment_fund).permit(:category, :name, :redemption_period, :value)\n end",
"def update\n if @investment.update(investment_params)\n render json: @investment, status: :ok\n else\n render json: @investment.errors, status: :unprocessable_entity\n end\n end",
"def create\n @investigador = Investigador.new(investigador_params)\n\n respond_to do |format|\n if @investigador.save\n format.html { redirect_to investigadore_path(@investigador), notice: \"Investigador was successfully created.\" }\n format.json { render :show, status: :created, location: @investigador }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @investigador.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_investment_fund\n @investment_fund = InvestmentFund.find(params[:id])\n end",
"def set_investment_fund\n @investment_fund = InvestmentFund.find(params[:id])\n end",
"def create\n \n @investigation = Investigation.new(investigation_params)\n\n respond_to do |format|\n if @investigation.save\n format.html { redirect_to @investigation, notice: 'Investigation was successfully created.' }\n format.json { render :show, status: :created, location: @investigation }\n else\n format.html { render :new }\n format.json { render json: @investigation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @investment_type = InvestmentType.new(params[:investment_type])\n\n respond_to do |format|\n if @investment_type.save\n format.html { redirect_to investment_types_path, notice: 'Investment type was successfully created.' }\n format.json { render json: @investment_type, status: :created, location: @investment_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @investment_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_investment\n #@investment = Investment.find(params[:id])\n end",
"def set_investment\n @investment = Investment.find(params[:id])\n end",
"def set_investment\n @investment = Investment.find(params[:id])\n end",
"def set_investment\n @investment = Investment.find(params[:id])\n end",
"def set_investment\n @investment = Investment.find(params[:id])\n end",
"def set_investment\n @investment = Investment.find(params[:id])\n end",
"def index\n @investments = Investment.all\n\n respond_to do |format|\n format.html\n format.json\n end\n end",
"def investment_params\n params.require(:investment).permit(:title, :size, :description, :type, :revenue_share, :start_date, :logo,:end_date, :company_id, :industry, :stage, :staff_users, :location, :expected_return, :background_image, :background_image_crop_x, :background_image_crop_y, :background_image_crop_w, :background_image_crop_h, :highlights_1,:highlights_2, :highlights_3, :highlights_4, :highlights_5, :highlights_6, :highlights_7, :highlights_8, :highlights_9, :highlights_10, :overview_1, :overview_2, :overview_3, :problem_bullet_1, :problem_bullet_2, :problem_bullet_3, :problem_bullet_4, :problem_bullet_5,:solution_bullet_1, :solution_bullet_2, :solution_bullet_3, :solution_bullet_4, :solution_bullet_5,:updates_attributes => [:id, :title, :brief_description, :detailed_description, :_destroy], :user_ids => [], :investment_photos_attributes => [:id, :investment_image, :_destroy], :investment_documents_attributes => [:id, :document, :investment_id, :_destroy], :investment_videos_attributes => [:id, :title, :link, :description, :investment_id, :_destroy],:term_sheet_attributes => [:id, :investment_id, :description, :security, :automatic_conversion, :interest_rate, :interest_payments, :maturity_date, :conversion_discount, :conversion_cap, :optional_conversion, :redemption_option, :min_investment_for_vestedAngels, :min_Raise_through_vestedAngels, :max_raise_through_vestedAngels, :maximum_fund_investors, :management_fee, :carried_interest, :administrative_cost, :target_closing_date, :other])\n end",
"def investor_params\n params.require(:investor).permit(:name, :amount, :willing_to_reinvest, :negotiation_state)\n end",
"def create_draft_invoice(options={})\n options = options.merge!(@options)\n response = self.class.post(\"/api/sales/draftinvoices/v3?autonumber=true\", options)\n respond_with!(response)\n end",
"def new\n @invest = Invest.new\n @invest.seq = get_next_seq(Invest)\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invest }\n end\n end",
"def index\n @investment_funds = InvestmentFund.all\n end",
"def investigation_params\n params.require(:investigation).permit(:nombre, :descripcion, :fecha_inicio, :fecha_fin, :user_id)\n end",
"def update\r\n respond_to do |format|\r\n if @fixed_deposit_investment.update(fixed_deposit_investment_params)\r\n format.html { redirect_to @fixed_deposit_investment, notice: 'Fixed deposit investment was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @fixed_deposit_investment }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @fixed_deposit_investment.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def investment_fund_params\n params.require(:investment_fund).permit(:name, :buyDate, :admTax, :aditionalInfo, :exitTax, :fundBegin, :manager, :managerContact, :shareValue, :capital, :wallet_id)\n end",
"def ico_etz_investment_params\n params.require(:etz_investment).permit(:wallet, :time, :etz, :eth, :rdt)\n end",
"def create\n @individual_company_investment = IndividualCompanyInvestment.new(individual_company_investment_params)\n\n respond_to do |format|\n if @individual_company_investment.save\n format.html { redirect_to @individual_company_investment, notice: 'Individual company investment was successfully created.' }\n format.json { render action: 'show', status: :created, location: @individual_company_investment }\n else\n format.html { render action: 'new' }\n format.json { render json: @individual_company_investment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @draft_partnership = DraftPartnership.new(params[:partnership])\n\n respond_to do |format|\n if @draft_partnership.save\n\n format.xml { render :xml => @draft_partnership, :status => :created, :location => @draft_partnership }\n else\n \n format.xml { render :xml => @draft_partnership.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @draft = Draft.new(draft_params)\n\n respond_to do |format|\n if @draft.save\n format.html { redirect_to @draft, notice: 'Draft was successfully created.' }\n format.json { render :show, status: :created, location: @draft }\n else\n format.html { render :new }\n format.json { render json: @draft.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @draft = Draft.new(params[:draft])\n\n respond_to do |format|\n if @draft.save\n format.html { redirect_to @draft, :notice => 'Draft was successfully created.' }\n format.json { render :json => @draft, :status => :created, :location => @draft }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @draft.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def investment_params\n params.require(:investment).permit(:ticker, :name, :price, :yield, :mer, :risk_category, :objective, :distribution, :style, :typeof)\n end",
"def investigation_params\n params.require(:investigation).permit(:applicant_id, :client_id, :user_badge_number, :status, :renewal, :comments)\n end",
"def create\n @draft_ranking = DraftRanking.new(draft_ranking_params)\n\n respond_to do |format|\n if @draft_ranking.save\n format.html { redirect_to @draft_ranking, notice: 'Draft ranking was successfully created.' }\n format.json { render :show, status: :created, location: @draft_ranking }\n else\n format.html { render :new }\n format.json { render json: @draft_ranking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @draft = Draft.new(params[:draft])\n\n respond_to do |format|\n if @draft.save\n format.html { redirect_to(compare_path(:id => @draft.compare_id), :flash => { :success => 'draft created.'}) }\n format.xml { render :xml => @draft, :status => :created, :location => @draft }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @draft.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def save_draft\n @page.find(input_elements[:draft]).click\n end",
"def test05_DraftEmptyGN\n\t\t\tloginPost\n\t\t\t$browser.goto($patch_article)\n\t\t\tsleep 2\n\t\t\tif $post_now.exists?\n\t\t\t\tsleep 4\n\t\t\t\t$post_save_draft.fire_event(\"onclick\")\n\t\t\telse puts \"PDEVT05: FAILED! Unable to locate draft button.\"\n\t\t\tend\n\t\t\n\t\t\tbegin\n\t\t\tassert $post_draft_error.exists?\n\t\t\t\trescue => e\n\t\t\t\tputs (\"PDEVT05: FAILED! User able to save incomplete draft.\")\n\t\t\t\tputs e\n\t\t\tend\n\t\tend",
"def create\n @fund_company_investment = FundCompanyInvestment.new(fund_company_investment_params)\n\n respond_to do |format|\n if @fund_company_investment.save\n format.html { redirect_to @fund_company_investment, notice: 'Fund company investment was successfully created.' }\n format.json { render action: 'show', status: :created, location: @fund_company_investment }\n else\n format.html { render action: 'new' }\n format.json { render json: @fund_company_investment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test02_post_closed_news_publish_article_draft_TC_24309\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_news_post_closed_article_new)\n\t\t\n\t\tcreate_article_draft \"Article for Draft #{random}\"\n\t\tdelete_draft\n\tend",
"def create\n @player_investment = PlayerInvestment.new(params[:player_investment])\n\n respond_to do |format|\n if @player_investment.save\n format.html { redirect_to @player_investment, notice: 'Player investment was successfully created.' }\n format.json { render json: @player_investment, status: :created, location: @player_investment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @player_investment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @investment = Investment.new(investment_params)\n @feature = Feature.find(@investment.feature_id) #feature is needed for the redirection\n\n respond_to do |format|\n if @investment.save\n format.html { redirect_to @feature, notice: 'Investment was successfully created.' }\n format.json { render :show, status: :created, location: @investment }\n else\n errors = add_errors\n format.html { redirect_to new_investment_path(@feature, :errors => errors) }\n format.json { render json: @investment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @invest = Invest.find(params[:id])\n @invest.destroy\n\n respond_to do |format|\n format.html { redirect_to(invests_url) }\n format.xml { head :ok }\n end\n end",
"def save_draft\n frm.button(:name=>\"save\").click\n AssignmentsList.new(@browser)\n end",
"def test02_post_closed_board_publish_article_draft_TC_24309\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_boards_post_closed_article_new)\n\t\t\n\t\tcreate_article_draft \"Article for Draft #{random}\"\n\t\tdelete_draft\n\tend",
"def index\n @investments = Investment.all\n\n render json: {investments: @investments}, root: false\n end",
"def create_and_invitation_studant(params = {})\n run(:post, \"/invitations\", [201,422], JSON.dump(params))\n end",
"def update\n @invest = Invest.find(params[:id])\n\n respond_to do |format|\n if @invest.update_attributes(params[:invest])\n format.html { redirect_to(@invest, :notice => 'Invest was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @investigation = Investigation.new(params[:investigation])\n @investigation.visible = true\n if Investigation.last.blank?\n @investigation.id=1\n else\n @investigation.id = Investigation.last.id+1\n end\n\n respond_to do |format|\n if @investigation.save\n format.html { redirect_to @investigation, notice: 'Investigation was successfully created.' }\n format.json { render json: @investigation, status: :created, location: @investigation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @investigation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n hash = {}\n if @investment_wizard.investment.id.present?\n invs = Investment.find(@investment_wizard.investment.id)\n @investment_wizard.investment.attributes.each do |attr|\n hash.merge!(attr[0].to_sym => attr[1] ) unless attr[0].in? ['id','created_at','updated_at']\n end\n\n hash.merge!(:status => 3) # change sttus to wait for payment\n invs.update_attributes(hash)\n\n generate_payouts(@investment_wizard.investment)\n\n session[:investment_attributes] = nil\n redirect_to pay_wizard_investment_path(investment: invs.id), notice: \"Investment successfully updated\"\n else\n if @investment_wizard.investment.save\n\n generate_payouts(@investment_wizard.investment)\n\n # Queue job to wait untill finish and change status\n InvestmentStatusCheckJob.set(wait_until: @investment_wizard.investment.end_date + 5.minutes).perform_later(@investment_wizard.investment.id)\n\n session[:investment_attributes] = nil\n @investment_wizard.investment.update_attributes(:status => 3) # change sttus to wait for payment\n redirect_to pay_wizard_investment_path(investment: @investment_wizard.investment.id), notice: \"Investment successfully created\"\n else\n redirect_to({action: Wizard::Investment::STEPS.first}, alert: \"There were a problem when creating a investment.\")\n end\n end\n\n end",
"def create\n @fixed_expense = FixedExpense.new(params[:fixed_expense])\n @fixed_expense.user_id = current_user.id\n\n respond_to do |format|\n if @fixed_expense.save\n flash[:notice] = 'FixedExpense was successfully created.'\n format.html { redirect_to(fixed_expenses_path) }\n format.xml { render :xml => @fixed_expense, :status => :created, :location => @fixed_expense }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @fixed_expense.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def validated(investment)\n # @greeting = \"Hi\"\n\n @investment = investment\n\n # mail to: investment.user.email, subject: default_i18n_subject(user: @user.last_name))\n mail to: @investment.user.email, subject: 'Transaction Approved'\n end",
"def investigacion_params\n params.require(:investigacion).permit(:id_instituto, :id_microcuenca, :id_municipio, :id_documento, :autor, :titulo, :no_paginas, :fecha_realizacion, :fecha_publicacion, :resumen, :palabras_clave, :recurso_web, :id_status)\n end",
"def create\n @teamcommitment = Teamcommitment.new(params[:teamcommitment])\n\n respond_to do |format|\n @teamcommitment.status = Teamcommitment::StatusProposed \n if @teamcommitment.save\n flash[:notice] = 'Commitment was successfully created.'\n format.html { redirect_to(session[:original_uri]) }\n format.xml { render :xml => @teamcommitment, :status => :created, :location => @teamcommitment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @teamcommitment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\r\n @fixed_deposit_investment.destroy\r\n respond_to do |format|\r\n format.html { redirect_to fixed_deposit_investments_url, notice: 'Fixed deposit investment was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @investment.destroy\n end",
"def create\n @expense = Expense.new(params[:expense])\n\n respond_to do |format|\n if @expense.save\n flash[:notice] = 'Expense was successfully created.'\n format.html { redirect_to expense_url(@expense) }\n format.xml { head :created, :location => expense_url(@expense) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @expense.errors.to_xml }\n end\n end\n end",
"def create\n @articy_draft = ArticyDraft.new\n\n file = params[:articy_draft][:file]\n @articy_draft.xml = file\n @articy_draft.notes = params[:articy_draft][:notes]\n\n respond_to do |format|\n if @articy_draft.save\n format.html { redirect_to root_path, notice: 'Articy Draft XML was successfully created.' }\n format.json { render action: 'show', status: :created, location: @articy_draft }\n else\n format.html { render action: 'new' }\n format.json { render json: @articy_draft.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @investment_declaration = InvestmentDeclaration.new(investment_declaration_params)\n @investment_declarations = InvestmentDeclaration.all\n if @investment_declaration.save\n @investment_declaration = InvestmentDeclaration.new\n flash[:notice] = 'Investment Declaration is saved Successfully'\n end\n redirect_to new_investment_declaration_path \n end",
"def new\n @fixed_deposit = FixedDeposit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @fixed_deposit }\n end\n end",
"def rsvp_post(options = {})\n\n #add access token if it exists\n url = \"\"\n if options[:access_token]\n #url = \"https://api.meetup.com/2/rsvp?access_token=#{options[:access_token]}\"\n url = \"https://api.meetup.com/2/rsvp.json\"\n\n else\n url = \"https://api.meetup.com/2/rsvp\"\n end\n\n puts \"url posting is #{url}\"\n\n response = post_response(url,options)\n\n if response == \"OK\"\n puts \"rsvp ok\"\n else\n puts response.to_yaml\n end\n end",
"def draft_params\n params.require(:draft).permit(:round, :pick, :user_id, :team_id)\n end",
"def create\n @draft = current_user.drafts.build(params[:draft])\n\n respond_to do |format|\n if @draft.save\n format.html { redirect_to @draft, flash: { success: 'Черновик был успешно создан' } }\n format.json { render json: @draft, status: :created, location: @draft }\n else\n format.html { render action: \"new\" }\n format.json { render json: @draft.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n budget = Budget.find(contract_params[:budget_id])\n @contract = Contract.new_by_budget(contract_params, budget)\n respond_to do |format|\n if @contract.save\n contract = Contract.find(@contract.id)\n budget.update(state: Budget.states[:approved], contract: @contract)\n format.html { redirect_to contract, notice: 'El contrato se creó correctamente.' }\n format.json { render :show, status: :created, location: @contract }\n else\n format.html { render :new }\n format.json { render json: @contract.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @investment_type = InvestmentType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @investment_type }\n end\n end",
"def create\n @dbs_deposit = DbsDeposit.new(params[:dbs_deposit])\n\n respond_to do |format|\n if @dbs_deposit.save\n format.html { redirect_to(@dbs_deposit, :notice => 'DbsDeposit was successfully created.') }\n format.xml { render :xml => @dbs_deposit, :status => :created, :location => @dbs_deposit }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @dbs_deposit.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @expense = Expense.new(params[:expense])\n\n respond_to do |format|\n if @expense.save\n format.html { redirect_to(@expense, :notice => 'Expense was successfully created.') }\n format.xml { render :xml => @expense, :status => :created, :location => @expense }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @expense.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def draft_params\n params.require(:draft).permit(:title, :content, :category_id, :approval_status_id, :page_id, :user_id, :description, :comments)\n end",
"def new\n @draft = @compare.drafts.build \n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @draft }\n end\n end",
"def individual_company_investment_params\n params.require(:individual_company_investment).permit(:individual_id, :company_id, :amount, :buy_date, :sell_date)\n end",
"def create\n @estado_pedido = EstadoPedido.new(params[:estado_pedido])\n\n respond_to do |format|\n if @estado_pedido.save\n format.html { redirect_to(@estado_pedido, :notice => 'EstadoPedido was successfully created.') }\n format.xml { render :xml => @estado_pedido, :status => :created, :location => @estado_pedido }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @estado_pedido.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test04_post_closed_news_edit_article_draft\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_news_post_closed_article_new)\n\t\t\n\t\tcreate_article_draft \"Article for Draft #{random}\"s\n\t\tsleep 2\n\t\tedit_draft\n\t\t\n\t\tsleep 2\n\t\tassert $post_new_post.exists?\n\tend",
"def set_investigated\n @investigated = Investigated.find(params[:id])\n end",
"def depense_params\n params.require(:depense).permit(:title, :value, :date, :checked)\n end",
"def test_04_publish_event_draft\n\t\tloginPost\n\t\t$browser.goto($patch_event)\n\t\tsleep 2\n\t\tif $post_pick_group.exists?\n \t\t\tpostGroupPop\n \t\t\t$post_event_title.set(\"Event #{random}\")\n \t\t\t$post_event_calendar_start_text.set(\"2013-12-12\") \n \t\t\t$post_event_time_start_field.click\n \t\t\t$post_event_select_time.select(\"8:00 AM\")\n \t\t\t$post_event_location.set(\"Location #{random}\")\n \t\t\t$browser.execute_script(\"jQuery('iframe.wysihtml5-sandbox').contents().find('body').prepend('Automated Text')\")\n\t\t\t$post_save_draft.fire_event(\"onclick\")\n\t\t\tsleep 2\n\t\telse puts \"PD04T04: FAILED! User able to save draft.\"\n\t\tend\n\t\t\n\t\tif $post_draft_success.exists?\n\t\t\tcancel_delete\n\t\telse puts \"PD04T01: FAILED! Unable to delete draft.\"\n\t\tend\n\tend",
"def planned_expense_params\n params.require(:planned_expense).permit(:value, :expense_period_id, :expense_item_id)\n end",
"def investigador_params\n params.require(:investigador).permit(:cedula, :nombres, :apellidos)\n end"
] |
[
"0.67654425",
"0.66616166",
"0.6652693",
"0.6417311",
"0.6376922",
"0.6326423",
"0.63087755",
"0.6239985",
"0.6235383",
"0.6144707",
"0.6135099",
"0.613039",
"0.60580343",
"0.6007412",
"0.5957032",
"0.5957032",
"0.5955793",
"0.59285504",
"0.5925527",
"0.5859661",
"0.58588856",
"0.58454555",
"0.5837887",
"0.5832823",
"0.57906526",
"0.5766347",
"0.5741694",
"0.5728563",
"0.57269996",
"0.56755227",
"0.5666429",
"0.5640728",
"0.5640728",
"0.5635477",
"0.5622003",
"0.5617104",
"0.56168497",
"0.56168497",
"0.56168497",
"0.56168497",
"0.56168497",
"0.5586839",
"0.55809695",
"0.5569215",
"0.5539697",
"0.55275536",
"0.55253494",
"0.55089307",
"0.54941434",
"0.548862",
"0.5487126",
"0.54744965",
"0.54530776",
"0.5451863",
"0.54463404",
"0.5445717",
"0.54441476",
"0.5429747",
"0.5429412",
"0.54238945",
"0.5418455",
"0.54145646",
"0.5396663",
"0.53839755",
"0.537741",
"0.53726673",
"0.53532475",
"0.5344772",
"0.5344701",
"0.5338066",
"0.5335966",
"0.5325772",
"0.5325074",
"0.5318506",
"0.5313539",
"0.53108853",
"0.5310002",
"0.53097415",
"0.5297816",
"0.5288867",
"0.5281325",
"0.5278289",
"0.52775633",
"0.5275471",
"0.5267322",
"0.52662605",
"0.5265823",
"0.5264731",
"0.52537847",
"0.52501756",
"0.5243123",
"0.5239408",
"0.5236086",
"0.5234042",
"0.5226498",
"0.52202",
"0.5213997",
"0.52132684",
"0.5211464",
"0.52011305"
] |
0.6572378
|
3
|
PUT /draft_investments/1 PUT /draft_investments/1.xml
|
def update
@draft_investment = DraftInvestment.find(params[:id])
respond_to do |format|
if @draft_investment.update_attributes(params[:investment])
format.xml
else
format.xml { render :xml => @draft_investment.errors, :status => :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @invest = Invest.find(params[:id])\n\n respond_to do |format|\n if @invest.update_attributes(params[:invest])\n format.html { redirect_to(@invest, :notice => 'Invest was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @draft_investment = DraftInvestment.find(params[:id])\n @draft_investment.destroy\n\n respond_to do |format|\n\n format.xml { head :ok }\n end\n end",
"def update\n if @investment.update(investment_params)\n render json: @investment, status: :ok\n else\n render json: @investment.errors, status: :unprocessable_entity\n end\n end",
"def update\r\n respond_to do |format|\r\n if @fixed_deposit_investment.update(fixed_deposit_investment_params)\r\n format.html { redirect_to @fixed_deposit_investment, notice: 'Fixed deposit investment was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @fixed_deposit_investment }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @fixed_deposit_investment.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @investigation = Investigation.find(params[:id])\n\n respond_to do |format|\n if @investigation.update_attributes(params[:investigation])\n format.html { redirect_to(@investigation, :notice => 'Investigation was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @investigation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @investigated.update(investigated_params)\n format.html { redirect_to @investigated, notice: 'Investigated was successfully updated.' }\n format.json { render :show, status: :ok, location: @investigated }\n else\n format.html { render :edit }\n format.json { render json: @investigated.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @investment.update(investment_params)\n format.html { redirect_to @investment, notice: 'Investment was successfully updated.' }\n format.json { render :show, status: :ok, location: @investment }\n else\n format.html { render :edit }\n format.json { render json: @investment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @investment.update(investment_params)\n format.html { redirect_to @investment, notice: 'Investment was successfully updated.' }\n format.json { render :show, status: :ok, location: @investment }\n else\n format.html { render :edit }\n format.json { render json: @investment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_investments investment_type\n if self.investment_type.nil?\n self.create_investments investment_type\n else\n self.investment_type.update!(:fix_income => investment_type[:fix_income], :equity=> investment_type[:equity], :gold=> investment_type[:gold], :land_and_estate=> investment_type[:land_and_estate])\n end\n end",
"def update\n respond_to do |format|\n if @investment.update(investment_params)\n format.html { redirect_to @investment, notice: 'Investment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @investment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @draft_investment = DraftInvestment.find(params[:id])\n\n respond_to do |format|\n\n format.xml { render :xml => @draft_investment }\n end\n end",
"def update\n respond_to do |format|\n if @investable.update(investable_params)\n format.html { redirect_to @investable, notice: 'Investable was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @investable.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @investigation = Investigation.find(params[:id])\n\n respond_to do |format|\n if @investigation.update_attributes(params[:investigation])\n format.html { redirect_to @investigation, notice: 'Investigation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @investigation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @draft_investment = DraftInvestment.new\n\n respond_to do |format|\n\n format.xml { render :xml => @draft_investment }\n end\n end",
"def set_investment_fund\n @investment_fund = InvestmentFund.find(params[:id])\n end",
"def set_investment_fund\n @investment_fund = InvestmentFund.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @individual_company_investment.update(individual_company_investment_params)\n format.html { redirect_to @individual_company_investment, notice: 'Individual company investment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @individual_company_investment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @draft = Draft.find(params[:id])\n\n respond_to do |format|\n if @draft.update_attributes(params[:draft])\n format.html { redirect_to(@draft, :notice => 'Draft was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @draft.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @investigador.update(investigador_params)\n format.html { redirect_to investigadore_path(@investigador), notice: \"Investigador was successfully updated.\" }\n format.json { render :show, status: :ok, location: @investigador }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @investigador.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_fixed_deposit_investment\r\n @fixed_deposit_investment = FixedDepositInvestment.find(params[:id])\r\n end",
"def set_investment\n @investment = Investment.find(params[:id])\n end",
"def set_investment\n @investment = Investment.find(params[:id])\n end",
"def set_investment\n @investment = Investment.find(params[:id])\n end",
"def set_investment\n @investment = Investment.find(params[:id])\n end",
"def set_investment\n @investment = Investment.find(params[:id])\n end",
"def set_investment\n #@investment = Investment.find(params[:id])\n end",
"def create\n @data = params[:investment]\n @investment= DraftInvestment.find(:all, :conditions => [\"company_id = ? AND funding_type = ?\",@data[:company_id], @data[:funding_type]])\n if @investment.to_s != \"\"\n @invest = DraftInvestment.find(@investment[0][:id])\n\t @invest.update_attributes({\"agency\" => @investment[0][\"agency\"] + \", \" + @data[:agency],\"funding_amount\" => (@data[\"funding_amount\"].to_i + @investment[0][\"funding_amount\"]).to_s})\n respond_to do |format|\n format.xml \n\t\tend \n\t \n else\n\n @investment = DraftInvestment.new(params[:investment])\n respond_to do |format|\n if @investment.save\n flash[:notice] = 'Investment was successfully created.'\n\n format.xml { render :xml => @investment, :status => :created, :location => @investment }\n else\n\n format.xml { render :xml => @investment.errors, :status => :unprocessable_entity }\n end\n end\n \n end\n\n end",
"def update\n @draft_partnership = DraftPartnership.find(params[:id])\n\n respond_to do |format|\n if @draft_partnership.update_attributes(params[:partnership])\n\n format.xml \n else\n \n format.xml { render :xml => @draft_partnership.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @investigation.update(investigation_params)\n format.html { redirect_to @investigation, notice: 'Investigation was successfully updated.' }\n format.json { render :show, status: :ok, location: @investigation }\n else\n format.html { render :edit }\n format.json { render json: @investigation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @investor.update investor_params\n redirect_to @investor\n else\n render 'edit'\n end\n end",
"def update\n @investment_type = InvestmentType.find(params[:id])\n\n respond_to do |format|\n if @investment_type.update_attributes(params[:investment_type])\n format.html { redirect_to investment_types_path, notice: 'Investment type was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @investment_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n resource.update(deposit_contract_params)\n respond_with client, resource\n end",
"def update\n respond_to do |format|\n if @ico_etz_investment.update(ico_etz_investment_params)\n format.html { redirect_to ico_etz_investment_path(@ico_etz_investment), notice: 'Etz investment was successfully updated.' }\n format.json { render :show, status: :ok, location: @ico_etz_investment }\n else\n format.html { render :edit }\n format.json { render json: @ico_etz_investment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n ActiveRecord::Base.transaction do\n respond_to do |format|\n if @investigacion.update(investigacion_params)\n format.html { redirect_to @investigacion, notice: 'La Investigacion se actualizo correctamente.' }\n format.json { render :show, status: :ok, location: @investigacion }\n else\n format.html { render :edit }\n format.json { render json: @investigacion.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def update\n respond_to do |format|\n if @investment_fund.update(investment_fund_params)\n format.html { redirect_to @investment_fund, notice: 'Investment fund was successfully updated.' }\n format.json { render :show, status: :ok, location: @investment_fund }\n else\n format.html { render :edit }\n format.json { render json: @investment_fund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @investment_fund.update(investment_fund_params)\n format.html { redirect_to @investment_fund, notice: 'Investment fund was successfully updated.' }\n format.json { render :show, status: :ok, location: @investment_fund }\n else\n format.html { render :edit }\n format.json { render json: @investment_fund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @draft = Draft.find(params[:id])\n\n respond_to do |format|\n if @draft.update_attributes(params[:draft])\n format.html { redirect_to @draft, :notice => 'Draft was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @draft.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fund_company_investment.update(fund_company_investment_params)\n format.html { redirect_to @fund_company_investment, notice: 'Fund company investment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @fund_company_investment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @draft = Draft.find(params[:id])\n\n respond_to do |format|\n if @draft.update_attributes(params[:draft])\n format.html { redirect_to @draft, flash: { success: 'Черновик был успешно обновлён'} }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @draft.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fixed_deposit = FixedDeposit.find(params[:id])\n\n respond_to do |format|\n if @fixed_deposit.update_attributes(params[:fixed_deposit])\n flash[:notice] = 'FixedDeposit was successfully updated.'\n format.html { redirect_to(@fixed_deposit) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @fixed_deposit.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_put_expenses_1_xml\n @parameters = {:expense => {:description => 'NewDescription'}}\n if ActiveRecord::VERSION::MAJOR < 4\n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/expenses/1.xml',\n {:expense => {:description => 'NewDescription'}},\n {:success_code => :ok})\n end\n\n assert_no_difference('Expense.count') do\n put '/expenses/1.xml', @parameters, credentials('admin')\n end\n\n expense = Expense.find(1)\n assert_equal \"NewDescription\", expense.description\n end",
"def update\n respond_with Expense.update(params[:id], expense_params), status: 204\n end",
"def create\n @invest = Invest.new(params[:invest])\n\n respond_to do |format|\n if @invest.save\n format.html { redirect_to(@invest, :notice => 'Invest was successfully created.') }\n format.xml { render :xml => @invest, :status => :created, :location => @invest }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @invest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_investigated\n @investigated = Investigated.find(params[:id])\n end",
"def destroy\n @invest = Invest.find(params[:id])\n @invest.destroy\n\n respond_to do |format|\n format.html { redirect_to(invests_url) }\n format.xml { head :ok }\n end\n end",
"def update\n @round_expense = RoundExpense.find(params[:id])\n\n respond_to do |format|\n if @round_expense.update_attributes(params[:round_expense])\n format.html { redirect_to(@round_expense, :notice => 'Round expense was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @round_expense.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @draft.update(draft_params)\n format.html { redirect_to @draft, notice: 'Draft was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @draft.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @player_investment = PlayerInvestment.find(params[:id])\n\n respond_to do |format|\n if @player_investment.update_attributes(params[:player_investment])\n format.html { redirect_to @player_investment, notice: 'Player investment was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @player_investment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @draft.update(draft_params)\n format.html { redirect_to @draft, notice: 'Draft was successfully updated.' }\n format.json { render :show, status: :ok, location: @draft }\n else\n format.html { render :edit }\n format.json { render json: @draft.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @carrera_investigacion.update(carrera_investigacion_params)\n format.html { redirect_to @carrera_investigacion, notice: 'Carrera investigacion was successfully updated.' }\n format.json { render :show, status: :ok, location: @carrera_investigacion }\n else\n format.html { render :edit }\n format.json { render json: @carrera_investigacion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_invested\n self.invested_amount = self.investments.map(&:amount).sum\n self.goal_investment = 0 unless self.goal_investment\n self.equity_offered = 0 unless self.equity_offered\n self.save\n end",
"def update\n respond_to do |format|\n if @company_investor.update(company_investor_params)\n format.html { redirect_to @company_investor, notice: 'Company investor was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @company_investor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @draft = SmsOnRails::Draft.find(params[:id])\n\n respond_to do |format|\n if @draft.update_attributes(params[:draft])\n flash[:notice] = 'Draft was successfully updated.'\n format.html { redirect_to(sms_draft_url(:id => @draft)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @draft.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def investment_params\n params.require(:investment).permit(:feature_id, :team_id, :investment)\n end",
"def set_investable\n @investable = Investable.find(params[:id])\n end",
"def update\n respond_to do |format|\n @feature = Feature.find(@investment.feature_id) #feature is needed for the redirect\n if @investment.update(investment_params)\n format.html { redirect_to @feature, notice: 'Investment was successfully updated.' }\n format.json { render @investment, status: :ok, location: @investment }\n else\n errors = add_errors\n format.html { redirect_to edit_investment_path(@investment, :errors => errors) }\n format.json { render json: @investment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @investigationcause.update(investigationcause_params)\n format.html { redirect_to @investigationcause.investigation, notice: 'Investigationcause was successfully updated.' }\n format.json { render :show, status: :ok, location: @investigationcause }\n else\n format.html { render :edit }\n format.json { render json: @investigationcause.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @invest = Invest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @invest }\n end\n end",
"def update\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n if @expense.update_attributes(params[:expense])\n format.html { redirect_to(@expense, :notice => 'Expense was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @expense.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n if @expense.update_attributes(params[:expense])\n format.html { redirect_to(@expense, :notice => 'Expense was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @expense.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_investigador\n @investigador = Investigador.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @articy_draft.update(articy_draft_params)\n format.html { redirect_to @articy_draft, notice: 'Articy draft was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @articy_draft.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fixed_expense = FixedExpense.for_user(current_user).find(params[:id])\n\n respond_to do |format|\n if @fixed_expense.update_attributes(params[:fixed_expense])\n flash[:notice] = 'FixedExpense was successfully updated.'\n format.html { redirect_to(fixed_expenses_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @fixed_expense.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @expense = Expense.find(params[:id])\n @expense.reset\n respond_to do |format|\n if @expense.update_attributes(params[:expense])\n\n flash[:notice] = 'Expense was successfully updated.'\n format.html { redirect_to expense_url(@expense) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @expense.errors.to_xml }\n end\n end\n end",
"def update\n @operating_expense = OperatingExpense.find(params[:id])\n\n respond_to do |format|\n if @operating_expense.update_attributes(params[:operating_expense])\n format.html { redirect_to(@operating_expense, :notice => 'Operating expense was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @operating_expense.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @deposit = current_user.family.transactions.find(params[:id], :readonly => false)\n @deposit.user = current_user\n\n respond_to do |format|\n if @deposit.update_attributes(params[:deposit])\n flash[:notice] = 'Deposit was successfully updated.'\n format.html { redirect_to(@deposit) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @deposit.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_investigacion\n @investigacion = Investigacion.find(params[:id])\n end",
"def update\n # Si no existen éstos campos no se guarda y crea un mensaje.\n if (!@investigation.nombre.present? or !@investigation.descripcion.present?)\n redirect_to request.referrer, notice: 'Complete todos los campos.!'\n else\n respond_to do |format|\n if @investigation.update(investigation_params)\n format.html { redirect_to @investigation, notice: 'Trabajo de investigación´actualizado.' }\n format.json { render :show, status: :ok, location: @investigation }\n else\n format.html { render :edit }\n format.json { render json: @investigation.errors, status: :unprocessable_entity }\n end\n end\n end \n end",
"def update\n @inv_x_ref = InvXRef.find(params[:id])\n\n respond_to do |format|\n if @inv_x_ref.update_attributes(params[:inv_x_ref])\n format.html { redirect_to @inv_x_ref, notice: 'Inv x ref was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @inv_x_ref.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_fund_company_investment\n @fund_company_investment = FundCompanyInvestment.find(params[:id])\n end",
"def update\n @contract = Contract.find(params[:id])\n\n respond_to do |format|\n if @contract.update_attributes(params[:contract])\n flash[:notice] = 'Contract was successfully updated.'\n format.html { redirect_to(@contract) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @contract.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_expense.update(api_v1_expense_params)\n format.html { redirect_to @api_v1_expense, notice: 'Expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_expense }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @deposit.update(deposit_params)\r\n format.html { redirect_to @deposit, notice: 'Deposit was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @deposit }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @deposit.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @deposit.update(deposit_params)\n format.html { redirect_to @deposit, notice: 'Deposit was successfully updated.' }\n format.json { render :show, status: :ok, location: @deposit }\n else\n format.html { render :edit }\n format.json { render json: @deposit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @depense.update(depense_params)\n format.html { redirect_to @depense, notice: 'Depense was successfully updated.' }\n format.json { render :show, status: :ok, location: @depense }\n else\n format.html { render :edit }\n format.json { render json: @depense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @deposit.update(deposit_params)\n format.html { redirect_to @deposit, notice: \"Deposit was successfully updated.\" }\n format.json { render :show, status: :ok, location: @deposit }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @deposit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @stock_disposal = StockDisposal.find(params[:id])\n\n respond_to do |format|\n if @stock_disposal.update_attributes(params[:stock_disposal])\n format.html { redirect_to(@stock_disposal, :notice => 'Stock disposal was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @stock_disposal.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @investigation = Investigation.find(params[:id])\n @investigation.visible = false\n @investigation.save\n\n respond_to do |format|\n format.html { redirect_to investigations_url }\n format.json { head :no_content }\n end\n end",
"def update\n @contract = Contract.find(params[:id])\n\n respond_to do |format|\n if @contract.update_attributes(params[:contract])\n format.html { redirect_to(\"/contractview\", :notice => 'Contract was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @contract.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @dbs_deposit = DbsDeposit.find(params[:id])\n\n respond_to do |format|\n if @dbs_deposit.update_attributes(params[:dbs_deposit])\n format.html { redirect_to(@dbs_deposit, :notice => 'DbsDeposit was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @dbs_deposit.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @involvement = Involvement.find(params[:id])\n\n respond_to do |format|\n if @involvement.update_attributes(params[:involvement])\n flash[:notice] = 'Involvement was successfully updated.'\n format.html { redirect_to(@involvement) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @involvement.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @office.update(office_params)\n head :no_content\n end",
"def index\r\n @fixed_deposit_investments = FixedDepositInvestment.all\r\n end",
"def update\n @proposal = Proposal.find(params[:id])\n\n respond_to do |format|\n if @proposal.update_attributes(params[:proposal])\n format.html { redirect_to(@proposal, :notice => 'Proposal was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @proposal.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @outline = Outline.find(params[:id])\n\n respond_to do |format|\n if @outline.update_attributes(params[:outline])\n flash[:notice] = 'Outline was successfully updated.'\n format.html { redirect_to(@outline) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @outline.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @etat_depense.update(etat_depense_params)\n format.html { redirect_to etat_depenses_path, notice: 'Etat depense was successfully updated.' }\n format.json { render :show, status: :ok, location: @etat_depense }\n else\n format.html { render :edit }\n format.json { render json: @etat_depense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_draft\n @draft = Draft.find(params[:id])\n end",
"def set_draft\n @draft = Draft.find(params[:id])\n end",
"def set_draft\n @draft = Draft.find(params[:id])\n end",
"def set_draft\n @draft = Draft.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @investment.update(investment_params)\n update_staffs\n if investment_params[:background_image].present?\n redirect_to investment_crop_url(@investment) and return\n else\n format.html { redirect_to @investment, notice: 'Investment was successfully updated.' }\n format.json { render :show, status: :ok, location: @investment }\n end\n else\n flash[:danger] = @investment.errors.full_messages.join(', ')\n format.html { render :edit }\n format.json { render json: @investment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n handle_member_name(false) # converts params[:id] to params[:investigator_id] and sets @investigator\n before_update(@investigator)\n handle_investigator_delete(@investigator, params[:delete])\n respond_to do |format|\n params[:investigator].delete(:id) #id causes an error - can't mass assign id\n params[:investigator][\"era_comons_name\"] = nil if params[:investigator][\"era_comons_name\"].blank?\n# @investigator.investigator_appointments_form = params[:investigator][\"investigator_appointments_form\"] unless params[:investigator][\"investigator_appointments_form\"].blank?\n if @investigator.update_attributes(params[:investigator])\n #nparams = handle_investigator_investigator_apppointments_update(params, get_member_type(@investigator))\n clear_directory(\"investigators/#{@investigator.username}\")\n clear_file(\"profiles/#{@investigator.username}.html\")\n flash[:errors] = nil\n flash[:notice] = \"Investigator <i>'#{@investigator.name}'</i> was successfully updated\"\n unless @investigator.errors.blank?\n flash[:errors] = \"Investigator was saved but: \" + @investigator.errors.full_messages.join(\"; \")\n end\n format.html { redirect_to( investigator_url(@investigator.username)) }\n format.xml { head :ok }\n else\n flash[:errors] = \"Investigator was saved but: \" + @investigator.errors.full_messages.join(\"; \")\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @investigator.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @draft_ranking.update(draft_ranking_params)\n format.html { redirect_to @draft_ranking, notice: 'Draft ranking was successfully updated.' }\n format.json { render :show, status: :ok, location: @draft_ranking }\n else\n format.html { render :edit }\n format.json { render json: @draft_ranking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @invoice = Invoice.find(params[:id])\n\n respond_to do |format|\n if @invoice.update_attributes(params[:invoice])\n flash[:notice] = 'Nota fiscal atualizada.'\n format.html { redirect_to(@invoice) }\n format.xml { head :ok }\n else\n default_data\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invoice.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if election.update_attributes(params[:election] ? election_attributes : {})\n format.html { redirect_to(election, flash: { success: 'Election updated.' }) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => election.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @expense = Expense.for_user(current_user).find(params[:id])\n\n respond_to do |format|\n if @expense.update_attributes(params[:expense])\n flash[:notice] = 'Expense was successfully updated.'\n format.html { redirect_to(expenses_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @expense.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n if @expense.update_attributes(params[:expense])\n format.html { redirect_to expenses_url, notice: 'Expense was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @invitado = Invitado.find(params[:id])\n\n respond_to do |format|\n if @invitado.update_attributes(params[:invitado])\n format.html { redirect_to(@invitado, :notice => 'Invitado was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invitado.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @invoice = Invoice.find(params[:id])\n @invoice.update_attributes(params[:invoice])\n @invoice.remaining_sum=@invoice.total_sum\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to(@invoice, :notice => 'Facture modifiée avec succes.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invoice.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_ico_etz_investment\n @ico_etz_investment = EtzInvestment.find(params[:id])\n end"
] |
[
"0.7177903",
"0.68185717",
"0.67332476",
"0.6634273",
"0.6590446",
"0.6556295",
"0.65534264",
"0.65534264",
"0.65513444",
"0.6547284",
"0.6453545",
"0.6422345",
"0.63840234",
"0.6367753",
"0.6352475",
"0.6352475",
"0.634028",
"0.633478",
"0.6331328",
"0.6317676",
"0.63150215",
"0.63150215",
"0.63150215",
"0.63150215",
"0.63150215",
"0.6257121",
"0.62525624",
"0.62482554",
"0.6246912",
"0.62228644",
"0.62170935",
"0.61957484",
"0.61573625",
"0.6148456",
"0.61474144",
"0.61474144",
"0.6139753",
"0.6135008",
"0.6128129",
"0.6104358",
"0.6103859",
"0.60694706",
"0.6066551",
"0.60203284",
"0.601899",
"0.5991608",
"0.59793925",
"0.59718746",
"0.5960155",
"0.59456563",
"0.59163517",
"0.58948547",
"0.5894764",
"0.5890713",
"0.5886513",
"0.5868033",
"0.5829656",
"0.5797253",
"0.5791571",
"0.5791571",
"0.577562",
"0.57738155",
"0.5760562",
"0.57388",
"0.57380706",
"0.573636",
"0.57362795",
"0.5735276",
"0.57171905",
"0.5666801",
"0.5663227",
"0.56541675",
"0.5636668",
"0.562074",
"0.5619067",
"0.56143135",
"0.5589759",
"0.55821776",
"0.558178",
"0.55772823",
"0.55698454",
"0.5569565",
"0.55695224",
"0.5561479",
"0.5557404",
"0.5553436",
"0.55475986",
"0.55475986",
"0.55475986",
"0.55475986",
"0.553834",
"0.5536927",
"0.5531927",
"0.5530917",
"0.55301315",
"0.5527787",
"0.55273503",
"0.55250883",
"0.55240875",
"0.55188674"
] |
0.7863944
|
0
|
DELETE /draft_investments/1 DELETE /draft_investments/1.xml
|
def destroy
@draft_investment = DraftInvestment.find(params[:id])
@draft_investment.destroy
respond_to do |format|
format.xml { head :ok }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @invest = Invest.find(params[:id])\n @invest.destroy\n\n respond_to do |format|\n format.html { redirect_to(invests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @investigation = Investigation.find(params[:id])\n @investigation.destroy\n\n respond_to do |format|\n format.html { redirect_to(investigations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @fixed_deposit = FixedDeposit.find(params[:id])\n @fixed_deposit.destroy\n\n respond_to do |format|\n format.html { redirect_to(fixed_deposits_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @dbs_deposit = DbsDeposit.find(params[:id])\n @dbs_deposit.destroy\n\n respond_to do |format|\n format.html { redirect_to(dbs_deposits_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @deposit_threshold = DepositThreshold.find(params[:id])\n @deposit_threshold.destroy\n\n respond_to do |format|\n format.html { redirect_to(deposit_thresholds_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @round_expense = RoundExpense.find(params[:id])\n @round_expense.destroy\n\n respond_to do |format|\n format.html { redirect_to(round_expenses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @prd_etc = PrdEtc.find(params[:id])\n @prd_etc.destroy\n\n respond_to do |format|\n format.html { redirect_to(prd_etcs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @expense = Expense.find(params[:id])\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to(expenses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @expense = Expense.find(params[:id])\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to(expenses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\r\n @fixed_deposit_investment.destroy\r\n respond_to do |format|\r\n format.html { redirect_to fixed_deposit_investments_url, notice: 'Fixed deposit investment was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @investment.destroy\n end",
"def destroy\n @estacion = Estacion.find(params[:id])\n @estacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(estaciones_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @operating_expense = OperatingExpense.find(params[:id])\n @operating_expense.destroy\n\n respond_to do |format|\n format.html { redirect_to(operating_expenses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @investment.destroy\n respond_to do |format|\n format.html { redirect_to investments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @investable.destroy\n respond_to do |format|\n format.html { redirect_to investables_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @withdrawal = Withdrawal.find(params[:id])\n @withdrawal.destroy\n\n respond_to do |format|\n format.html { redirect_to(withdrawals_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @economic = Economic.find(params[:id])\n @economic.destroy\n\n respond_to do |format|\n format.html { redirect_to(economics_url) }\n format.xml { head :ok }\n end\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n ActiveRecord::Base.transaction do\n @investigacion.status = Status.find(Status::VALUES[:deleted])\n @investigacion.save validate: false\n respond_to do |format|\n format.html { redirect_to investigaciones_url, notice: 'La Investigacion se marco como borrada.' }\n format.json { head :no_content }\n end\n end\n end",
"def destroy\n @investigated.destroy\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @investigation.destroy\n respond_to do |format|\n # Redirige al index de investigations.\n format.html { redirect_to investigations_url, notice: 'Investigation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy1\n @draft = Draft.find(params[:id])\n @draft.destroy\n\n respond_to do |format|\n format.html { redirect_to(\n # @draft.compare_id , \n compare_path(:id => @draft.compare_id ),\n :notice => 'Draft was successfully deleted.'\n )\n }\n\n format.xml { head :ok }\n end\n end",
"def destroy\n @draft = SmsOnRails::Draft.find(params[:id])\n @draft.destroy\n\n respond_to do |format|\n format.html { redirect_to(sms_drafts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @fixed_expense = FixedExpense.for_user(current_user).find(params[:id])\n @fixed_expense.destroy\n\n respond_to do |format|\n format.html { redirect_to(fixed_expenses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @draft_company = DraftCompany.find(params[:id])\n @draft_company.destroy\n\n respond_to do |format|\n format.html { redirect_to(draft_companies_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @estados_civil = EstadosCivil.find(params[:id])\n @estados_civil.destroy\n\n respond_to do |format|\n format.html { redirect_to(estados_civiles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @individual_company_investment.destroy\n respond_to do |format|\n format.html { redirect_to individual_company_investments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @warranty = Warranty.find(params[:id])\n @warranty.destroy\n\n respond_to do |format|\n format.html { redirect_to(warranties_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @fund_company_investment.destroy\n respond_to do |format|\n format.html { redirect_to fund_company_investments_url }\n format.json { head :no_content }\n end\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n @ico_etz_investment.destroy\n respond_to do |format|\n format.html { redirect_to ico_etz_investments_url, notice: 'Etz investment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @investment_type = InvestmentType.find(params[:id])\n @investment_type.destroy\n\n respond_to do |format|\n format.html { redirect_to investment_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @approval = Approval.find(params[:id])\n @approval.destroy\n\n respond_to do |format|\n format.html { redirect_to(approvals_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @investor.destroy\n redirect_to investors_url\n end",
"def destroy\n @expensegroup = Expensegroup.find(params[:id])\n @expensegroup.destroy\n\n respond_to do |format|\n format.html { redirect_to(expensegroups_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @investment.destroy\n respond_to do |format|\n format.html { redirect_to investments_url, notice: 'Investment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @investment.destroy\n respond_to do |format|\n format.html { redirect_to investments_url, notice: 'Investment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @inv_x_ref = InvXRef.find(params[:id])\n @inv_x_ref.destroy\n\n respond_to do |format|\n format.html { redirect_to inv_x_refs_url }\n format.json { head :no_content }\n end\n end",
"def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end",
"def destroy\n @visarequest = Visarequest.find(params[:id])\n @visarequest.destroy\n\n respond_to do |format|\n format.html { redirect_to(visarequests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @estimate_line_item = EstimateLineItem.find(params[:id])\n @estimate_line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(estimate_line_items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @draft = Draft.find(params[:id])\n @draft.destroy\n\n respond_to do |format|\n format.html { redirect_to drafts_url, notice: 'Черновик был успешно удалён' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @budget_src = BudgetSrc.find(params[:id])\n @budget_src.destroy\n\n respond_to do |format|\n format.html { redirect_to(budget_srcs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @draft = Draft.find(params[:id])\n @draft.destroy\n\n respond_to do |format|\n format.html { redirect_to drafts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contract = Contract.find(params[:id])\n @contract.destroy\n\n respond_to do |format|\n format.html { redirect_to(contracts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @estate = Estate.find(params[:id])\n @estate.destroy\n \n respond_to do |format|\n format.html { redirect_to(estates_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @bank_reconciliations = AccountingBankReconciliations.find(params[:id])\n @bank_reconciliations.destroy\n\n respond_to do |format|\n format.html { redirect_to(accounting_bank_reconciliations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @draft_partnership = DraftPartnership.find(params[:id])\n @draft_partnership.destroy\n\n respond_to do |format|\n format.html { redirect_to(draft_partnerships_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @estudiante = Estudiante.find(params[:id])\n @estudiante.destroy\n\n respond_to do |format|\n format.html { redirect_to(estudiantes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @estudiante = Estudiante.find(params[:id])\n @estudiante.destroy\n\n respond_to do |format|\n format.html { redirect_to(estudiantes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_xmls_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoices_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoices_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoices_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoices_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoices_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @draft.destroy\n respond_to do |format|\n format.html { redirect_to drafts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @estagio = Estagio.find(params[:id])\n @estagio.destroy\n\n respond_to do |format|\n format.html { redirect_to(estagios_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @convenio = Convenio.find(params[:id])\n @convenio.destroy\n\n respond_to do |format|\n format.html { redirect_to(convenios_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @income_and_deduction = IncomeAndDeduction.find(params[:id])\n @income_and_deduction.destroy\n\n respond_to do |format|\n format.html { redirect_to(income_and_deductions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @accident_vehicle_expense = AccidentVehicleExpense.find(params[:id])\n @accident_vehicle_expense.destroy\n\n respond_to do |format|\n format.html { redirect_to(accident_vehicle_expenses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @investigation = Investigation.find(params[:id])\n @investigation.visible = false\n @investigation.save\n\n respond_to do |format|\n format.html { redirect_to investigations_url }\n format.json { head :no_content }\n end\n end",
"def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end",
"def destroy\n @benefit = Benefit.find(params[:id])\n @benefit.destroy\n\n respond_to do |format|\n format.html { redirect_to(benefits_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @expense = current_user.expenses.find(params[:id])\n @expense.destroy\n\n respond_to do |format|\n flash[:success] = t('activerecord.flash.deleted')\n format.html { redirect_to :back }\n format.xml { head :ok }\n end\n end",
"def destroy\n @expense = Expense.find params.fetch(:id)\n @expense.destroy\n head :no_content\n end",
"def destroy\n @pledge = Pledge.find(params[:id])\n @pledge.destroy\n\n respond_to do |format|\n format.html { redirect_to(pledges_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @pledge = Pledge.find(params[:id])\n @pledge.destroy\n\n respond_to do |format|\n format.html { redirect_to(pledges_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @pledge = Pledge.find(params[:id])\n @pledge.destroy\n\n respond_to do |format|\n format.html { redirect_to(pledges_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n pedigree = @person.pedigree\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(pedigree_url(pedigree)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @articy_draft.destroy\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @testament = Testament.find(params[:id])\n @testament.destroy\n\n respond_to do |format|\n format.html { redirect_to(testaments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @investment.destroy\n respond_to do |format|\n format.html { redirect_to feature_path(@investment.feature_id), notice: 'Investment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def maintenance_delete(statuspage_id, maintenance_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['maintenance_id'] = maintenance_id\n\n request :method => :post,\n :url => @url + 'maintenance/delete',\n :payload => data\n end",
"def destroy\n @pfs_consultation = PfsConsultation.find(params[:id])\n @pfs_consultation.destroy\n\n respond_to do |format|\n format.html { redirect_to(pfs_consultations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @envelope = Envelope.find(params[:id])\n @envelope.destroy\n\n respond_to do |format|\n format.html { redirect_to(envelopes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @invier_acceso = InvierAcceso.find(params[:id])\n @invier_acceso.destroy\n\n respond_to do |format|\n format.html { redirect_to(invier_accesos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @investment_declaration.destroy\n @investment_declaration = InvestmentDeclaration.new\n @investment_declarations = InvestmentDeclaration.all\n #redirect_to investment_declaration_self_services_path\n end",
"def destroy\n @investment_fund.destroy\n respond_to do |format|\n format.html { redirect_to wallets_path, notice: 'Investment fund was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @lease = Lease.find(params[:id])\n @lease.destroy\n\n respond_to do |format|\n format.html { redirect_to(leases_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @investigador.destroy\n respond_to do |format|\n format.html { redirect_to investigadores_url, notice: \"Investigador was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @redeem = Redeem.find(params[:id])\n @redeem.destroy\n\n respond_to do |format|\n format.html { redirect_to(redeems_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @incentive = Incentive.find(params[:id])\n @incentive.destroy\n\n respond_to do |format|\n format.html { redirect_to(incentives_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @balance = Balance.find(params[:id])\n @balance.destroy\n\n respond_to do |format|\n format.html { redirect_to(balances_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @invitado = Invitado.find(params[:id])\n @invitado.destroy\n\n respond_to do |format|\n format.html { redirect_to(invitados_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @advance_payment = AdvancePayment.find(params[:id])\n @advance_payment.destroy\n\n respond_to do |format|\n format.html { redirect_to(advance_payments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @deposit.destroy\n respond_to do |format|\n format.html { redirect_to deposits_url, notice: 'Deposit was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @deposit.destroy\n respond_to do |format|\n format.html { redirect_to deposits_url, notice: \"Deposit was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @debt = Debt.find(params[:id])\n @debt.destroy\n\n respond_to do |format|\n format.html { redirect_to(debts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @gstr_advance_receipts = GstrAdvanceReceipt.find_by_id_and_company_id(params[:id], @company.id)\n @gstr_advance_receipts.delete_gstr_one_entry \n @gstr_advance_receipts.delete\n respond_to do |format|\n @gstr_advance_receipts.register_delete_action(request.remote_ip, @current_user, 'deleted')\n format.html { redirect_to(gstr_advance_receipts_url, :notice =>\"Gstr Advance Receipt has been succesfully deleted\") }\n format.xml {head :ok}\n \n end\n end",
"def destroy\n @ptbudget = Ptbudget.find(params[:id])\n @ptbudget.destroy\n\n respond_to do |format|\n format.html { redirect_to(ptbudgets_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ptbudget = Ptbudget.find(params[:id])\n @ptbudget.destroy\n\n respond_to do |format|\n format.html { redirect_to(ptbudgets_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\r\n @deposit.destroy\r\n respond_to do |format|\r\n format.html { redirect_to deposits_url, notice: 'Deposit was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @dependent_representative = DependentRepresentative.find(params[:id])\n @dependent_representative.destroy\n\n respond_to do |format|\n format.html { redirect_to(dependent_representatives_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @exp = Exp.find(params[:id])\n @exp.destroy\n\n respond_to do |format|\n format.html { redirect_to(exps_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @investigation.destroy\n respond_to do |format|\n format.html { redirect_to investigations_url, notice: 'Investigation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @az_invoice = AzInvoice.find(params[:id])\n @az_invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to(az_invoices_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @estado_pedido = EstadoPedido.find(params[:id])\n @estado_pedido.destroy\n\n respond_to do |format|\n format.html { redirect_to(estado_pedidos_url) }\n format.xml { head :ok }\n end\n end"
] |
[
"0.7325162",
"0.6885616",
"0.68521565",
"0.68063796",
"0.6720497",
"0.66675067",
"0.6581549",
"0.657877",
"0.657877",
"0.6574228",
"0.655173",
"0.6549124",
"0.6544644",
"0.6521697",
"0.6502779",
"0.6489537",
"0.6445264",
"0.6442577",
"0.643813",
"0.64325726",
"0.6432013",
"0.64182913",
"0.63803184",
"0.6367865",
"0.6367455",
"0.63631886",
"0.6362455",
"0.63610375",
"0.6359822",
"0.6339445",
"0.63376784",
"0.6326233",
"0.6296028",
"0.6295738",
"0.62899745",
"0.62889147",
"0.6284202",
"0.6284202",
"0.62808126",
"0.62697434",
"0.62690294",
"0.6268228",
"0.62279767",
"0.6226635",
"0.6218996",
"0.6210178",
"0.6203803",
"0.62002176",
"0.6199337",
"0.6193202",
"0.61918086",
"0.6190555",
"0.61712706",
"0.61712706",
"0.61712706",
"0.61712706",
"0.61712706",
"0.6166418",
"0.61638576",
"0.61582834",
"0.61567307",
"0.61554086",
"0.61539",
"0.615244",
"0.61516035",
"0.6149476",
"0.6143585",
"0.61428404",
"0.61428404",
"0.61428404",
"0.61301553",
"0.61281514",
"0.6117069",
"0.6115277",
"0.61151624",
"0.6113386",
"0.6110192",
"0.61065805",
"0.6106193",
"0.61029446",
"0.61026824",
"0.610261",
"0.60987043",
"0.60986274",
"0.60960567",
"0.6093991",
"0.608957",
"0.6087593",
"0.6085552",
"0.60841167",
"0.6083261",
"0.6082806",
"0.6081656",
"0.6081656",
"0.60780805",
"0.6071782",
"0.6070256",
"0.6069504",
"0.60675836",
"0.6065255"
] |
0.79728395
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_booking
@booking = Booking.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
GET /relatives GET /relatives.json
|
def index
@relatives = Relative.includes(:organizations, :representative)
.group_by { |relative| relative.representative }
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def path(*args)\n return call_ancestry_method(:path) if use_ancestry?\n\n Relationship.resources(path_rels(*args)) # TODO: Prevent preload of self which is in the list\n end",
"def add_relatives(relatives,min_distance,max_distance,relationship)\n min_distance.upto(max_distance) do |distance|\n next if relatives.include?(distance)\n relatives[distance-1].each do |relative|\n regular = relative.public_send(relationship).to_a\n remote = @remote_context.relatives(relative, relationship, Cyclopedio::Wiki::Category)\n auxiliary = []\n auxiliary = yield(relative) if block_given?\n relatives[distance].concat((regular + remote + auxiliary).select { |c| c.regular? && c.plural? })\n end\n end\n end",
"def set_relatory\n @relatory = Relatory.find(params[:id])\n end",
"def show\n @law = Law.find(params[:id])\n @law.ancestors.each do |law|\n add_breadcrumb law.title,law_path(law)\n end\n add_breadcrumb @law.title\n @laws = @law.ordered_children\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @law }\n end\n end",
"def absolute_url\n @page = Page.find(params[:id])\n render :json => { :absolute_url => @page.absolute_url }\n end",
"def as_json(request)\n {\n :links => [\n *models.map { |k,v| {:rel => k, :href => request.add_path(k).full_path } },\n {:rel => 'self', :href => request.full_path}\n ]\n }\n end",
"def roots\n @objects = Node.roots\n respond_to do |format|\n format.html\n format.json {render json: @objects}\n end\n end",
"def get_relations(service)\n\t\treturn @transport.get_path(\"relations\",service)\n\tend",
"def index\n @relationships = @relationships.order(created_at: :desc).page(params[:page])\n\n respond_to do |format|\n format.html { @relationships = @relationships.includes(:follower, :followed) }\n format.json {}\n end\n end",
"def relatives(args)\n Word.relatives(args.map { |w| @games.dict[w] }.compact)\n @dict_adjustments.puts(\"!r #{args}\")\n @dict_adjustments.flush\n end",
"def / aRelativePath\n access_child(aRelativePath)\n end",
"def rels\n @rels ||= root.data._rels\n end",
"def path_rels(*args)\n options = args.extract_options!\n rel = relationship(:raise_on_multiple => true) # TODO: Handle multiple nodes with a way to detect which node you want\n rels = rel.nil? ? [relationship_for_isolated_root] : rel.path\n Relationship.filter_by_resource_type(rels, options)\n end",
"def paths\n\t\tresponse = self.server.run_with_json_template( :paths )\n\t\treturn response.each_with_object({}) do |entry, hash|\n\t\t\thash[ entry[:name].to_sym ] = URI( entry[:url] )\n\t\tend\n\tend",
"def index\n @parents = Parent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @parents }\n end\n end",
"def index\n @fdn_org_hierarchies = Fdn::OrgHierarchy.paginate(:page => params[:page]).order(\"created_by DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fdn_org_hierarchies }\n end\n end",
"def url\n\t\t\"/\" + parents.reverse.map(&:slug).join(\"/\")\n\tend",
"def index(**params)\n params.stringify_keys!\n path = nest_path_within_parent(plural_resource_path, params)\n api_request(:get, path, params: params)\n end",
"def locations\n get('locations')\n end",
"def parentsByLocation\n @parents = Parent.all\n @parents = Parent.find_all_by_location_id(params[:location_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @parents }\n end\n end",
"def ancestors(*args)\n return call_ancestry_method(:ancestors) if use_ancestry?\n\n Relationship.resources(ancestor_rels(*args))\n end",
"def logical_relatives(options = {}) # :yields: {OntologyClass => implied_redundant_relationships ? true : false}\n return [] if !ObjectRelationship.find_by_interaction_and_proj_id('is_a', self.proj_id) || !ObjectRelationship.find_by_interaction_and_proj_id('part_of', self.proj_id)\n\n rel1 = Proj.find(self.proj_id).object_relationships.by_interaction('is_a').first.id\n rel2 = Proj.find(self.proj_id).object_relationships.by_interaction('part_of').first.id\n return [] if !rel1 || !rel2\n\n opt = {\n :direction => :children, # [:parents | :children]\n :rel1 => rel1,\n :rel2 => rel2\n }.merge!(options.symbolize_keys)\n\n return nil if ![:parents, :children].include?(opt[:direction])\n\n first_result = [] # all the part_of\n second_result = [] # part_of through is_a\n\n result = {}\n\n # Find/recurse the isa/part_of tree, this gets us a unique array of pertinent OntologyRelationships\n # that reflect OntologyClass relationships that are related by one of rel1 or rel2 at each inspection.\n rels = self.related_ontology_relationships(opt.merge(:relationship_type => [opt[:rel1], opt[:rel2]]))\n\n return {} if rels == nil\n\n # get all the part_of resuls, anything below and with a part_of, is part_of (since all others are is_a)\n to_nuke = [] # index of rels to delete before next itteration\n rels.each do |r|\n nuke = false # boolean check for delete\n if r.object_relationship_id == opt[:rel2]\n nuke = true\n if opt[:direction] == :parents\n first_result.push(r.ontology_class2)\n else\n first_result.push(r.ontology_class1)\n end\n end\n to_nuke.push(r) if nuke\n end\n\n # !! don't do uniq on first result\n\n # try to invoke some loop speedup by deleting values we don't need to loop through\n rels.delete_if{|r| to_nuke.include?(r)}\n rels.delete_if{|r| !r.object_relationship_id == opt[:rel1]} # we only need to deal with isas of rel1 now\n\n # for all of the part_of results also get the is_a children (or whatever rel2 -> rel1 relationship is)\n\n rels.each do |rel|\n first_result.uniq.each_with_index do |r,i|\n if opt[:direction] == :parents\n second_result.insert(-1, rel.ontology_class2) if (rel.ontology_class1 == r)\n else\n second_result.insert(-1, rel.ontology_class1) if (rel.ontology_class2 == r)\n end\n end\n end\n\n second_result.uniq! # don't imply redundancies from hitting an is_a twice (is this right?! - gives \"correct\" result AFAIKT)\n\n (first_result + second_result).each do |r|\n result.merge!(r => (!result.keys.include?(r) ? false : true))\n end\n\n result\n end",
"def index\n @pages = Page.paginate(page: params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: Page.roots.map{|r| r.node}}\n end\n end",
"def relative\n return self if relative?\n @relativized ||= relative_path_from root\n end",
"def ingest_path_info\n respond_to do |format|\n format.json {render json: ingest_directory_info(params[:path])}\n end\n end",
"def fulltree(*args)\n Relationship.resources(fulltree_rels(*args)) # TODO: Prevent preload of self which is in the list\n end",
"def get_relationship_by_id id\n headers = {\n 'Accept' => 'application/json; charset=UTF-8',\n }\n get_request 'relationship/' + id, headers\n end",
"def view\n res = @client.get(path)\n @attributes = res.json if res.success?\n end",
"def paths\n root.paths\n end",
"def find_relatives\n Email.where(\"conversation_id = ?\", self.conversation_id)\n end",
"def relative_url\n path = nil\n note = self\n while true\n path = \"/#{note.slug}#{path}\"\n return path if !note.parent\n note = Note.first(:id=>note.parent)\n return path if !note\n end\n return nil\n end",
"def index\n respond_with Relationships.all\n end",
"def get_relations_referring_to_object(type, id)\n api_call_with_type(type, id, \"#{type}/#{id}/relations\")\n end",
"def code_rels\n @arc = Arc.find_by_code(params[:code])\n @arc_rels = @arc.relationships\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @arc_rels.to_xml(:root => 'relationships', :except => [ :created_at, :updated_at ]) }\n end\n end",
"def get_rels\n @rels = []\n @heads.each_with_index do |h1, i|\n @heads[i+1..-1].each do |h2|\n path = @graph.shortest_path(h1, h2)\n s = path.shift\n o = path.pop\n @rels << [s, path, o] if (path & @heads).empty?\n end\n end\n end",
"def get_user_relationships_info\n id = params[\"id\"]\n error_list = []\n status = 1\n json_response = {}\n user = User.find_by(id: id)\n\n if user.nil?\n error_list.append(\"Error: The specified user doesn't exist.\")\n status = -1\n else\n json_response[\"relationships\"] = user.get_relationship_json_data\n end\n\n if status == -1\n json_response[\"errors\"] = error_list\n end\n\n json_response[\"status\"] = status\n\n # Format the json_response into proper JSON and respond with it\n json_response = json_response.to_json\n\n respond_to do |format|\n format.json { render json: json_response }\n end\n end",
"def parents(*args)\n Relationship.resources(parent_rels(*args))\n end",
"def fulltree_arranged(*args)\n Relationship.arranged_rels_to_resources(fulltree_rels_arranged(*args))\n end",
"def common_variable_relationships_get(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: CommonVariableRelationshipApi#common_variable_relationships_get ...\"\n end\n \n # resource path\n path = \"/commonVariableRelationships\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n query_params[:'id'] = opts[:'id'] if opts[:'id']\n query_params[:'confidence_level'] = opts[:'confidence_level'] if opts[:'confidence_level']\n query_params[:'confidence_score'] = opts[:'confidence_score'] if opts[:'confidence_score']\n query_params[:'direction'] = opts[:'direction'] if opts[:'direction']\n query_params[:'duration_of_action'] = opts[:'duration_of_action'] if opts[:'duration_of_action']\n query_params[:'error_message'] = opts[:'error_message'] if opts[:'error_message']\n query_params[:'onset_delay'] = opts[:'onset_delay'] if opts[:'onset_delay']\n query_params[:'outcome_variable_id'] = opts[:'outcome_variable_id'] if opts[:'outcome_variable_id']\n query_params[:'predictor_variable_id'] = opts[:'predictor_variable_id'] if opts[:'predictor_variable_id']\n query_params[:'predictor_unit_id'] = opts[:'predictor_unit_id'] if opts[:'predictor_unit_id']\n query_params[:'sinn_rank'] = opts[:'sinn_rank'] if opts[:'sinn_rank']\n query_params[:'strength_score'] = opts[:'strength_score'] if opts[:'strength_score']\n query_params[:'strength_level'] = opts[:'strength_level'] if opts[:'strength_level']\n query_params[:'up_votes'] = opts[:'up_votes'] if opts[:'up_votes']\n query_params[:'down_votes'] = opts[:'down_votes'] if opts[:'down_votes']\n query_params[:'value_predicting_high_outcome'] = opts[:'value_predicting_high_outcome'] if opts[:'value_predicting_high_outcome']\n query_params[:'value_predicting_low_outcome'] = opts[:'value_predicting_low_outcome'] if opts[:'value_predicting_low_outcome']\n query_params[:'number_of_users'] = opts[:'number_of_users'] if opts[:'number_of_users']\n query_params[:'data_source'] = opts[:'data_source'] if opts[:'data_source']\n query_params[:'limit'] = opts[:'limit'] if opts[:'limit']\n query_params[:'offset'] = opts[:'offset'] if opts[:'offset']\n query_params[:'sort'] = opts[:'sort'] if opts[:'sort']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'inline_response_200_3')\n if Configuration.debugging\n Configuration.logger.debug \"API called: CommonVariableRelationshipApi#common_variable_relationships_get. Result: #{result.inspect}\"\n end\n return result\n end",
"def calculate_relatives!(root_id)\n @relatives = {root_id => 0}\n queue = Set[root_id]\n until queue.empty?\n new_queue = Set[]\n queue.each do |id|\n character = Character[id]\n [character.mother, character.father].compact.each do |c|\n next if @relatives[c.id]\n @relatives[c.id] = @relatives[id] + 1\n new_queue << c.id\n end\n end\n queue = new_queue\n end\n queue = Set[*@relatives.keys]\n until queue.empty?\n new_queue = Set[]\n queue.each do |id|\n character = Character[id]\n character.children.each do |c|\n next if @relatives[c.id]\n @relatives[c.id] = @relatives[id] + 1\n new_queue << c.id\n end\n end\n queue = new_queue\n end\n end",
"def paths\n {\n :homepage => '/',\n :people => '/people',\n :work => '/work',\n :labs => '/labs',\n :\"find-us\" => '/find-us',\n :\"pebbles-good-code\" => '/pebbles-good-code'\n }\nend",
"def index\n @relationships = Relationship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @relationships }\n end\n end",
"def show\n @quest_tree = QuestTree.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quest_tree }\n end\n end",
"def get_all_require_relatives(code = @code)\n if code.is_a?(Array) then\n require_relatives = (code.select { |sub| is_require_relative?(sub) }).map! do |sub|\n get_require_relative(sub)\n end\n code.each do |sub|\n require_relatives += get_all_require_relatives(sub)\n end\n return require_relatives\n else\n return []\n end\n end",
"def index\n @reforganism = Reforganism.find(params[:id])\n @referents = @reforganism.referents\n end",
"def update\n respond_to do |format|\n if @relatory.update(relatory_params)\n format.html { redirect_to @relatory, notice: 'Relatório atualizado.' }\n format.json { render :show, status: :ok, location: @relatory }\n else\n format.html { render :edit }\n format.json { render json: @relatory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @gpath = Gpath.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gpath }\n end\n end",
"def list_relationships\n end",
"def view relpath\n (folder_pages+relpath).deserb(self)\n end",
"def index\n @meant_it_rels = MeantItRel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @meant_it_rels }\n end\n end",
"def show\n @dependent_relationship = DependentRelationship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dependent_relationship }\n end\n end",
"def show\n @animal = Animal.find(params[:id])\n \n @zoo = Zoo.find(params[:zoo_id])\n @father = @animal.father\n @mother = @animal.mother\n @children = @animal.children\n @siblings = @animal.siblings\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @animal }\n end\n end",
"def index\n @laws = Law.ordered_roots\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @laws }\n end\n end",
"def relative; end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @leaf }\n end\n end",
"def get(path, params={})\n params = merge_set_up_params(params)\n @token = \"b3688c52-9235-45ca-b01f-c5b2b83a4f4f\"\n @result = Typhoeus::Request.get(API_URL + path, :params => params,\n :headers => {\"Authorization\" => \"Basic#{@token}\"})\n puts @result.body\n # check if the url looks correct in the log\n puts @result.effective_url\n # parse the result to json\n return JSON.parse(@result.body)\n end",
"def get_resource_tree\n {\n method: \"Page.getResourceTree\"\n }\n end",
"def show\n @parent = Parent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @parent }\n end\n end",
"def show\n @parent = Parent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @parent }\n end\n end",
"def root(*args)\n return call_ancestry_method(:root) if use_ancestry?\n\n Relationship.resource(root_rel(*args))\n end",
"def get_relation(args)\n\tapi_url = \"#{@base_url}/#{args[:collection]}/#{args[:key]}/relations/#{args[:relation]}\"\n\tdo_the_get_call( url: api_url, user: @user )\nend",
"def relatively\n @mode = :relative\n return self\n end",
"def json_get(path, params={})\n json_request(:get, path, params)\n end",
"def index\n @representante_athletes = current_user.organization.athletes\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @representante_athletes }\n end\n end",
"def show\n #Find the employee with id supplied from the front-end and return direct subtree of that node including the parent node\n begin @employees = Employee.find(params[:id]).subtree.arrange_serializable(:order => :id)\n render json: @employees\n rescue => err \n render json: {error: err}\n end\n end",
"def path\n # TODO: is this trip really necessary?!\n data.fetch(\"path\") { relative_path }\n end",
"def rel relative_path\r\n return File.dirname(__FILE__) + \"/../\" + relative_path\r\nend",
"def show\n @data_set = DataSet.find(params[:id])\n recur = params.include?(:recur) ? params[:recur] == 'true' : false\n respond_to do |format|\n format.html { redirect_to project_path(@data_set.project) + data_set_path(@data_set) }\n format.json { render json: @data_set.to_hash(recur) }\n end\n end",
"def json_url\n \"#{REDDIT_URL_PREFIX}#{permalink}.json\"\n end",
"def show\n @relationship = Relationship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @relationship }\n end\n end",
"def show\n @father = Father.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @father }\n end\n end",
"def show\n @trail = Trail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trail }\n end\n end",
"def show\n @trail = Trail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trail }\n end\n end",
"def children\n\t@child = Child.find(params[:id])\n\t@parents = @child.parents.all\n\trespond_to do |format|\n\t\tformat.js { }\n\tend\n end",
"def fulltree_rels(*args)\n options = args.extract_options!\n root_id = relationship.try(:root_id)\n rels = root_id ? Relationship.subtree_of(root_id).uniq : [relationship_for_isolated_root]\n Relationship.filter_by_resource_type(rels, options)\n end",
"def show\n\t\trespond_to do |format|\n\t\t\tformat.html { }\n\t\t\tformat.json { render :json => {:fallacyfolder => @fallacyfolder}.to_json }\n\t\tend\n\tend",
"def index\n @depts = Dept.roots.includes(:children)\n render json: @depts, each_serializer: V1::DeptSerializer, root: false\n end",
"def update\n respond_to do |format|\n if @relative.update(relative_params)\n format.html { redirect_to [:admin, @relative], notice: 'Relative was successfully updated.' }\n format.json { render :show, status: :ok, location: @relative }\n else\n format.html { render :edit }\n format.json { render json: @relative.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n #These are nested resources that are only displayed in the context of their parent patient\n redirect_to(root_url)\n end",
"def list_tenants_for_circles(args = {}) \n get(\"/tenants.json/circles\", args)\nend",
"def show\n @title = t('view.firefighters.show_title')\n @firefighter = Firefighter.find(params[:id])\n @relatives = @firefighter.relatives\n @dockets = @firefighter.dockets.order(:id).page(params[:page])\n end",
"def index\n @new_resource = Referential::Resource.new(referential: @referential)\n breadcrumb\n end",
"def get_org_unit_parents(org_unit_id, ou_type_id = 0)\n path = \"/d2l/api/lp/#{$lp_ver}/orgstructure/#{org_unit_id}/parents/\"\n path += \"?ouTypeId=#{ou_type_id}\" if ou_type_id != 0\n _get(path)\n # return json of org_unit parents\nend",
"def index\n @accounts = current_user.person.linked_in_accounts\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @accounts }\n end\n end",
"def index\n #Nested resources only displayed in the context of its parent patient\n redirect_to(root_url)\n end",
"def rels\n @traversal_result = :rels\n self\n end",
"def show\n @recurso = Recurso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recurso }\n end\n end",
"def get_vendor_relationships()\n build_header_auth('/vendor_relationships', API_VERSION_1, 'GET')\n build_request()\n request = Net::HTTP::Get.new(@uri.request_uri)\n @header.each do |name, value|\n request[name] = value\n end\n response = @http.request(request)\n # response.body = JSON.parse(response.body)\n return response\n end",
"def top_paths(repo, options = {})\n opts = ensure_api_media_type(:traffic, options)\n get \"#{Repository.path repo}/traffic/popular/paths\", opts\n end",
"def base_href\n '/api/v1'\n end",
"def path\n '%s/%s/' % [root, (@node.http.route if @node)]\n end",
"def get_children_folders(folder_id)\n url = URI(\"#{$base_url}/api/projects/#{$project_id}/folders/#{folder_id}/children\")\n\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n request = Net::HTTP::Get.new(url)\n request[\"accept\"] = 'application/vnd.api+json; version=1'\n request[\"access-token\"] = $access_token\n request[\"uid\"] = $uid\n request[\"client\"] = $client\n response = http.request(request)\n\n folders_json = ''\n\n if response.code == 200.to_s\n folders_json = JSON.parse(response.read_body)['data']\n else\n puts \"Problem with getting folders. Status: #{response.code}\"\n puts response.body\n end\n folders_json\nend",
"def json_url\n # \"#{REDDIT_URL_PREFIX}#{permalink}#{@self_id}.json\"\n end",
"def show\n @resources_and_link = ResourcesAndLink.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resources_and_link }\n end\n end",
"def show\n @tree = Tree.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tree }\n\n end\n\n end",
"def index\n @maps = current_user.owned_maps\n respond_with @maps, :include => :waypoints\n end",
"def get(relative_path, options = {})\n url = self.scoped_path(relative_path)\n response = self.class.get(url, default_options.merge(options))\n\n save_request_response(:get, url, nil, response) if @debug\n\n response\n end",
"def show\n @ordinario = Ordinario.find(params[:id])\n @alumnos = @ordinario.alumnos\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ordinario }\n end\n end",
"def update_relatives_dates\n return if new_record?\n return unless force_relatives_dates\n return unless starts_at_changed? || ends_at_changed?\n return unless recurrence.present?\n return unless future_relatives.any?\n\n future_relatives.each do |outing|\n outing.assign_attributes(metadata: outing.metadata.merge({\n starts_at: outing.metadata[:starts_at] + (self.metadata[:starts_at] - starts_at_was),\n ends_at: outing.metadata[:ends_at] + (self.metadata[:ends_at] - ends_at_was)\n }))\n end\n end",
"def show\n @ministry_child = MinistryChild.find(params[:id])\n @ministry = Ministry.find(@ministry_child.ministry.id)\n if request.path != ministry_children_path(@ministry_child)\n redirect_to @ministry_child, status: :moved_permanently\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ministry_child }\n end\n end"
] |
[
"0.59531796",
"0.5941671",
"0.57423955",
"0.56898934",
"0.5578644",
"0.55052364",
"0.5496592",
"0.5490209",
"0.5455474",
"0.54151464",
"0.5390504",
"0.53170204",
"0.5308653",
"0.52572894",
"0.52275693",
"0.52261436",
"0.52238655",
"0.51975673",
"0.51880985",
"0.5168235",
"0.51596487",
"0.5157494",
"0.5147069",
"0.5113745",
"0.5109925",
"0.5097481",
"0.5095804",
"0.50926983",
"0.50824314",
"0.50781363",
"0.5073327",
"0.5066053",
"0.5054068",
"0.5043228",
"0.50432044",
"0.5042615",
"0.5028817",
"0.5025739",
"0.5021739",
"0.5015839",
"0.5014002",
"0.5012727",
"0.49828637",
"0.49746317",
"0.49734282",
"0.49684048",
"0.4959974",
"0.49449667",
"0.49397907",
"0.49378803",
"0.49369067",
"0.49346325",
"0.49340147",
"0.4927835",
"0.4923918",
"0.49238613",
"0.492071",
"0.49158692",
"0.49158692",
"0.4911334",
"0.49016616",
"0.48978028",
"0.48888624",
"0.4883809",
"0.488222",
"0.4876636",
"0.48746318",
"0.48707452",
"0.48635906",
"0.48603973",
"0.48543164",
"0.48512945",
"0.48512945",
"0.48512843",
"0.48507085",
"0.48505557",
"0.48474243",
"0.4846212",
"0.48444682",
"0.4841283",
"0.4841104",
"0.48399314",
"0.48380515",
"0.4836056",
"0.48277435",
"0.48228502",
"0.48202288",
"0.4811017",
"0.48103315",
"0.48094404",
"0.48046586",
"0.4803087",
"0.4802726",
"0.47997585",
"0.47978055",
"0.47976676",
"0.47920144",
"0.47917718",
"0.47892192",
"0.4787978"
] |
0.6495635
|
0
|
GET /relatives/1 GET /relatives/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @relatives = Relative.includes(:organizations, :representative)\n .group_by { |relative| relative.representative }\n end",
"def path(*args)\n return call_ancestry_method(:path) if use_ancestry?\n\n Relationship.resources(path_rels(*args)) # TODO: Prevent preload of self which is in the list\n end",
"def set_relatory\n @relatory = Relatory.find(params[:id])\n end",
"def show\n @law = Law.find(params[:id])\n @law.ancestors.each do |law|\n add_breadcrumb law.title,law_path(law)\n end\n add_breadcrumb @law.title\n @laws = @law.ordered_children\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @law }\n end\n end",
"def absolute_url\n @page = Page.find(params[:id])\n render :json => { :absolute_url => @page.absolute_url }\n end",
"def / aRelativePath\n access_child(aRelativePath)\n end",
"def add_relatives(relatives,min_distance,max_distance,relationship)\n min_distance.upto(max_distance) do |distance|\n next if relatives.include?(distance)\n relatives[distance-1].each do |relative|\n regular = relative.public_send(relationship).to_a\n remote = @remote_context.relatives(relative, relationship, Cyclopedio::Wiki::Category)\n auxiliary = []\n auxiliary = yield(relative) if block_given?\n relatives[distance].concat((regular + remote + auxiliary).select { |c| c.regular? && c.plural? })\n end\n end\n end",
"def index(**params)\n params.stringify_keys!\n path = nest_path_within_parent(plural_resource_path, params)\n api_request(:get, path, params: params)\n end",
"def roots\n @objects = Node.roots\n respond_to do |format|\n format.html\n format.json {render json: @objects}\n end\n end",
"def show\n @quest_tree = QuestTree.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quest_tree }\n end\n end",
"def view\n res = @client.get(path)\n @attributes = res.json if res.success?\n end",
"def index\n @parents = Parent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @parents }\n end\n end",
"def show\n @gpath = Gpath.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gpath }\n end\n end",
"def show\n @trail = Trail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trail }\n end\n end",
"def show\n @trail = Trail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trail }\n end\n end",
"def index\n @pages = Page.paginate(page: params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: Page.roots.map{|r| r.node}}\n end\n end",
"def show\n @parent = Parent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @parent }\n end\n end",
"def show\n @parent = Parent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @parent }\n end\n end",
"def index\n @relationships = @relationships.order(created_at: :desc).page(params[:page])\n\n respond_to do |format|\n format.html { @relationships = @relationships.includes(:follower, :followed) }\n format.json {}\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @leaf }\n end\n end",
"def get_relations(service)\n\t\treturn @transport.get_path(\"relations\",service)\n\tend",
"def get_relationship_by_id id\n headers = {\n 'Accept' => 'application/json; charset=UTF-8',\n }\n get_request 'relationship/' + id, headers\n end",
"def show\n @animal = Animal.find(params[:id])\n \n @zoo = Zoo.find(params[:zoo_id])\n @father = @animal.father\n @mother = @animal.mother\n @children = @animal.children\n @siblings = @animal.siblings\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @animal }\n end\n end",
"def show\n @recurso = Recurso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recurso }\n end\n end",
"def index\n @fdn_org_hierarchies = Fdn::OrgHierarchy.paginate(:page => params[:page]).order(\"created_by DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fdn_org_hierarchies }\n end\n end",
"def ingest_path_info\n respond_to do |format|\n format.json {render json: ingest_directory_info(params[:path])}\n end\n end",
"def show\n @tree = Tree.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tree }\n\n end\n\n end",
"def show\n @father = Father.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @father }\n end\n end",
"def json_get(path, params={})\n json_request(:get, path, params)\n end",
"def parentsByLocation\n @parents = Parent.all\n @parents = Parent.find_all_by_location_id(params[:location_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @parents }\n end\n end",
"def show\n @relationship = Relationship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @relationship }\n end\n end",
"def path_rels(*args)\n options = args.extract_options!\n rel = relationship(:raise_on_multiple => true) # TODO: Handle multiple nodes with a way to detect which node you want\n rels = rel.nil? ? [relationship_for_isolated_root] : rel.path\n Relationship.filter_by_resource_type(rels, options)\n end",
"def show\n @ministry_child = MinistryChild.find(params[:id])\n @ministry = Ministry.find(@ministry_child.ministry.id)\n if request.path != ministry_children_path(@ministry_child)\n redirect_to @ministry_child, status: :moved_permanently\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ministry_child }\n end\n end",
"def index\n @relationships = Relationship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @relationships }\n end\n end",
"def show\n @dependent_relationship = DependentRelationship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dependent_relationship }\n end\n end",
"def as_json(request)\n {\n :links => [\n *models.map { |k,v| {:rel => k, :href => request.add_path(k).full_path } },\n {:rel => 'self', :href => request.full_path}\n ]\n }\n end",
"def get(path, params={})\n params = merge_set_up_params(params)\n @token = \"b3688c52-9235-45ca-b01f-c5b2b83a4f4f\"\n @result = Typhoeus::Request.get(API_URL + path, :params => params,\n :headers => {\"Authorization\" => \"Basic#{@token}\"})\n puts @result.body\n # check if the url looks correct in the log\n puts @result.effective_url\n # parse the result to json\n return JSON.parse(@result.body)\n end",
"def fulltree(*args)\n Relationship.resources(fulltree_rels(*args)) # TODO: Prevent preload of self which is in the list\n end",
"def index\n @new_resource = Referential::Resource.new(referential: @referential)\n breadcrumb\n end",
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n puts JSON.pretty_generate(result)\n result\nend",
"def show\n @data_set = DataSet.find(params[:id])\n recur = params.include?(:recur) ? params[:recur] == 'true' : false\n respond_to do |format|\n format.html { redirect_to project_path(@data_set.project) + data_set_path(@data_set) }\n format.json { render json: @data_set.to_hash(recur) }\n end\n end",
"def index\n @laws = Law.ordered_roots\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @laws }\n end\n end",
"def view relpath\n (folder_pages+relpath).deserb(self)\n end",
"def relatives(args)\n Word.relatives(args.map { |w| @games.dict[w] }.compact)\n @dict_adjustments.puts(\"!r #{args}\")\n @dict_adjustments.flush\n end",
"def show\n @relation = Relation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @relation }\n end\n end",
"def show\n @relation = Relation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @relation }\n end\n end",
"def show\n @fhir_base_url = FhirBaseUrl.find(params[:id])\n\n respond_to do |format|\n format.html { redirect_to :action => :edit }\n format.json { render json: @fhir_base_url }\n end\n end",
"def path\n '%s/%s/' % [root, (@node.http.route if @node)]\n end",
"def show\n add_breadcrumb @recipe.name, @recipe\n respond_to do |format|\n format.html\n format.json { render json: @recipe }\n end\n end",
"def json_url\n # \"#{REDDIT_URL_PREFIX}#{permalink}#{@self_id}.json\"\n end",
"def url\n\t\t\"/\" + parents.reverse.map(&:slug).join(\"/\")\n\tend",
"def common_variable_relationships_get(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: CommonVariableRelationshipApi#common_variable_relationships_get ...\"\n end\n \n # resource path\n path = \"/commonVariableRelationships\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n query_params[:'id'] = opts[:'id'] if opts[:'id']\n query_params[:'confidence_level'] = opts[:'confidence_level'] if opts[:'confidence_level']\n query_params[:'confidence_score'] = opts[:'confidence_score'] if opts[:'confidence_score']\n query_params[:'direction'] = opts[:'direction'] if opts[:'direction']\n query_params[:'duration_of_action'] = opts[:'duration_of_action'] if opts[:'duration_of_action']\n query_params[:'error_message'] = opts[:'error_message'] if opts[:'error_message']\n query_params[:'onset_delay'] = opts[:'onset_delay'] if opts[:'onset_delay']\n query_params[:'outcome_variable_id'] = opts[:'outcome_variable_id'] if opts[:'outcome_variable_id']\n query_params[:'predictor_variable_id'] = opts[:'predictor_variable_id'] if opts[:'predictor_variable_id']\n query_params[:'predictor_unit_id'] = opts[:'predictor_unit_id'] if opts[:'predictor_unit_id']\n query_params[:'sinn_rank'] = opts[:'sinn_rank'] if opts[:'sinn_rank']\n query_params[:'strength_score'] = opts[:'strength_score'] if opts[:'strength_score']\n query_params[:'strength_level'] = opts[:'strength_level'] if opts[:'strength_level']\n query_params[:'up_votes'] = opts[:'up_votes'] if opts[:'up_votes']\n query_params[:'down_votes'] = opts[:'down_votes'] if opts[:'down_votes']\n query_params[:'value_predicting_high_outcome'] = opts[:'value_predicting_high_outcome'] if opts[:'value_predicting_high_outcome']\n query_params[:'value_predicting_low_outcome'] = opts[:'value_predicting_low_outcome'] if opts[:'value_predicting_low_outcome']\n query_params[:'number_of_users'] = opts[:'number_of_users'] if opts[:'number_of_users']\n query_params[:'data_source'] = opts[:'data_source'] if opts[:'data_source']\n query_params[:'limit'] = opts[:'limit'] if opts[:'limit']\n query_params[:'offset'] = opts[:'offset'] if opts[:'offset']\n query_params[:'sort'] = opts[:'sort'] if opts[:'sort']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'inline_response_200_3')\n if Configuration.debugging\n Configuration.logger.debug \"API called: CommonVariableRelationshipApi#common_variable_relationships_get. Result: #{result.inspect}\"\n end\n return result\n end",
"def update\n respond_to do |format|\n if @relatory.update(relatory_params)\n format.html { redirect_to @relatory, notice: 'Relatório atualizado.' }\n format.json { render :show, status: :ok, location: @relatory }\n else\n format.html { render :edit }\n format.json { render json: @relatory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def relative_url\n path = nil\n note = self\n while true\n path = \"/#{note.slug}#{path}\"\n return path if !note.parent\n note = Note.first(:id=>note.parent)\n return path if !note\n end\n return nil\n end",
"def show\n @directory = Directory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @directory }\n end\n end",
"def show\n @prioridade = Prioridade.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prioridade }\n end\n end",
"def get_json(path)\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n #puts \"🤖 GET #{path}\"\n #puts \"HTTP #{response.code}\"\n #puts JSON.pretty_generate(result)\n result\nend",
"def endpoint_for(path)\n File.join(MemoTomato::ROOT_URL, \"#{path}.json\")\n end",
"def index\n @stories = Story.all#.each{|story| story.parentId = \"1\"}\n stories_with_parent_id = @stories.map {|story| story.add_parent_id_info}\n puts stories_with_parent_id\n render json: stories_with_parent_id\n end",
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend",
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend",
"def base_href\n '/api/v1'\n end",
"def get_relations_referring_to_object(type, id)\n api_call_with_type(type, id, \"#{type}/#{id}/relations\")\n end",
"def show\n @person = User.friendly.find(params[:id])\n add_breadcrumb @person.nickname, cooperative.person_path(@person)\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render :json => @person }\n end\n end",
"def index\n @reforganism = Reforganism.find(params[:id])\n @referents = @reforganism.referents\n end",
"def show\n @recipe_direction = @recipe.directions.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @recipe_direction }\n format.json { render :json => @recipe_direction }\n end\n end",
"def index\n @meant_it_rels = MeantItRel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @meant_it_rels }\n end\n end",
"def show\n #Find the employee with id supplied from the front-end and return direct subtree of that node including the parent node\n begin @employees = Employee.find(params[:id]).subtree.arrange_serializable(:order => :id)\n render json: @employees\n rescue => err \n render json: {error: err}\n end\n end",
"def show\n @child_guardian_relationship = ChildGuardianRelationship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @child_guardian_relationship }\n end\n end",
"def show\n begin\n @resource = get_relation(params[:id], params[:entity_id])\n render :response => :GET\n rescue Exception => e\n @error = process_exception(e)\n render :response => @error\n end\n \n \n\n end",
"def show\n @level_goal = LevelGoal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @level_goal }\n end\n end",
"def show\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal }\n end\n end",
"def show\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal }\n end\n end",
"def show\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal }\n end\n end",
"def show\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal }\n end\n end",
"def index\n @node = Fedora.rest('rest/')\n end",
"def json_url\n \"#{REDDIT_URL_PREFIX}#{permalink}.json\"\n end",
"def show\n @goal = Goal.find(params[:id])\n render json: @goal\n end",
"def show\n @hdfs_path = HdfsPath.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hdfs_path }\n end\n end",
"def show\n @goal = Goal.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal }\n end\n end",
"def show\n\tadd_breadcrumb \"Datos de la librería\", :librerias_path\n @libreria = Libreria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @libreria }\n end\n end",
"def show\n @node = Node.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @node }\n end\n end",
"def show\n @node = Node.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @node }\n end\n end",
"def show\n @node = Node.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @node }\n end\n end",
"def show\n @node = Node.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @node }\n end\n end",
"def show\n @node = Node.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @node }\n end\n end",
"def logical_relatives(options = {}) # :yields: {OntologyClass => implied_redundant_relationships ? true : false}\n return [] if !ObjectRelationship.find_by_interaction_and_proj_id('is_a', self.proj_id) || !ObjectRelationship.find_by_interaction_and_proj_id('part_of', self.proj_id)\n\n rel1 = Proj.find(self.proj_id).object_relationships.by_interaction('is_a').first.id\n rel2 = Proj.find(self.proj_id).object_relationships.by_interaction('part_of').first.id\n return [] if !rel1 || !rel2\n\n opt = {\n :direction => :children, # [:parents | :children]\n :rel1 => rel1,\n :rel2 => rel2\n }.merge!(options.symbolize_keys)\n\n return nil if ![:parents, :children].include?(opt[:direction])\n\n first_result = [] # all the part_of\n second_result = [] # part_of through is_a\n\n result = {}\n\n # Find/recurse the isa/part_of tree, this gets us a unique array of pertinent OntologyRelationships\n # that reflect OntologyClass relationships that are related by one of rel1 or rel2 at each inspection.\n rels = self.related_ontology_relationships(opt.merge(:relationship_type => [opt[:rel1], opt[:rel2]]))\n\n return {} if rels == nil\n\n # get all the part_of resuls, anything below and with a part_of, is part_of (since all others are is_a)\n to_nuke = [] # index of rels to delete before next itteration\n rels.each do |r|\n nuke = false # boolean check for delete\n if r.object_relationship_id == opt[:rel2]\n nuke = true\n if opt[:direction] == :parents\n first_result.push(r.ontology_class2)\n else\n first_result.push(r.ontology_class1)\n end\n end\n to_nuke.push(r) if nuke\n end\n\n # !! don't do uniq on first result\n\n # try to invoke some loop speedup by deleting values we don't need to loop through\n rels.delete_if{|r| to_nuke.include?(r)}\n rels.delete_if{|r| !r.object_relationship_id == opt[:rel1]} # we only need to deal with isas of rel1 now\n\n # for all of the part_of results also get the is_a children (or whatever rel2 -> rel1 relationship is)\n\n rels.each do |rel|\n first_result.uniq.each_with_index do |r,i|\n if opt[:direction] == :parents\n second_result.insert(-1, rel.ontology_class2) if (rel.ontology_class1 == r)\n else\n second_result.insert(-1, rel.ontology_class1) if (rel.ontology_class2 == r)\n end\n end\n end\n\n second_result.uniq! # don't imply redundancies from hitting an is_a twice (is this right?! - gives \"correct\" result AFAIKT)\n\n (first_result + second_result).each do |r|\n result.merge!(r => (!result.keys.include?(r) ? false : true))\n end\n\n result\n end",
"def show\n @ordinario = Ordinario.find(params[:id])\n @alumnos = @ordinario.alumnos\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ordinario }\n end\n end",
"def get_relation(args)\n\tapi_url = \"#{@base_url}/#{args[:collection]}/#{args[:key]}/relations/#{args[:relation]}\"\n\tdo_the_get_call( url: api_url, user: @user )\nend",
"def list_tenants_for_circles(args = {}) \n get(\"/tenants.json/circles\", args)\nend",
"def code_rels\n @arc = Arc.find_by_code(params[:code])\n @arc_rels = @arc.relationships\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @arc_rels.to_xml(:root => 'relationships', :except => [ :created_at, :updated_at ]) }\n end\n end",
"def paths\n\t\tresponse = self.server.run_with_json_template( :paths )\n\t\treturn response.each_with_object({}) do |entry, hash|\n\t\t\thash[ entry[:name].to_sym ] = URI( entry[:url] )\n\t\tend\n\tend",
"def show\n\t\trespond_to do |format|\n\t\t\tformat.html { }\n\t\t\tformat.json { render :json => {:fallacyfolder => @fallacyfolder}.to_json }\n\t\tend\n\tend",
"def root(*args)\n return call_ancestry_method(:root) if use_ancestry?\n\n Relationship.resource(root_rel(*args))\n end",
"def show\n @title = t('view.firefighters.show_title')\n @firefighter = Firefighter.find(params[:id])\n @relatives = @firefighter.relatives\n @dockets = @firefighter.dockets.order(:id).page(params[:page])\n end",
"def show\n @concept_group = ConceptGroup.find(params[:id])\n @concepts = @concept_group.concepts\n @concept_groups = @concept_group.concept_groups\n @parent = @concept_group.parent\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @concept_group }\n end\n end",
"def rels\n @rels ||= root.data._rels\n end",
"def show\n @meal = Meal.find(params[:meal_id]) if params[:meal_id]\n @recipe = @meal.recipes.find(params[:id]) if @meal\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipe }\n end\n end",
"def index\n @concept_groups = ConceptGroup.find_all_by_parent_id(nil)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @concept_groups }\n end\n end",
"def index\n @leaves = Leaf.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @leaves }\n end\n end",
"def view\n \t@parent = params[:parent]\n\n @pages = Page.where(\"digital_edition_id = ?\", @parent).order(\"page_page ASC\").page( params[:page]).per(20)\n\n respond_to do |format|\n format.html # view.html.erb\n format.json { render json: @page }\n end\n end"
] |
[
"0.6307115",
"0.60586995",
"0.5969806",
"0.5698729",
"0.56570244",
"0.56097126",
"0.5608365",
"0.55217624",
"0.5472127",
"0.53498554",
"0.5349347",
"0.5341495",
"0.5327132",
"0.5284667",
"0.5284667",
"0.52558774",
"0.5255536",
"0.5255536",
"0.5245706",
"0.52353317",
"0.52211475",
"0.5219851",
"0.5209819",
"0.5194589",
"0.51902497",
"0.51856863",
"0.5184734",
"0.5176413",
"0.5171952",
"0.51496994",
"0.51463825",
"0.5133895",
"0.5125634",
"0.51253146",
"0.51249427",
"0.5122114",
"0.51207304",
"0.51174176",
"0.51145464",
"0.5111516",
"0.5104974",
"0.5094539",
"0.5084455",
"0.5078291",
"0.50692886",
"0.50692886",
"0.5061139",
"0.5060947",
"0.5044897",
"0.5043501",
"0.5041531",
"0.5034761",
"0.50240093",
"0.5019882",
"0.50145227",
"0.5011793",
"0.5004807",
"0.5004295",
"0.5003994",
"0.49925902",
"0.49925902",
"0.49878106",
"0.4987571",
"0.49853882",
"0.4980652",
"0.49800813",
"0.49773747",
"0.4977098",
"0.49722075",
"0.49716055",
"0.49638483",
"0.49614313",
"0.49614313",
"0.49614313",
"0.49614313",
"0.49558988",
"0.49532428",
"0.49526593",
"0.4948808",
"0.49473593",
"0.49389017",
"0.4937095",
"0.4937095",
"0.4937095",
"0.4937095",
"0.4937095",
"0.4936676",
"0.49331024",
"0.4930703",
"0.49304044",
"0.49251163",
"0.49235064",
"0.49215063",
"0.49205738",
"0.4920364",
"0.4917728",
"0.49122506",
"0.49106675",
"0.49053377",
"0.49004817",
"0.4896228"
] |
0.0
|
-1
|
POST /relatives POST /relatives.json
|
def create
@relative = Relative.new(relative_params)
respond_to do |format|
if @relative.save
format.html { redirect_to [:admin, @relative], notice: 'Relative was successfully created.' }
format.json { render :show, status: :created, location: @relative }
else
format.html { render :new }
format.json { render json: @relative.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @relatory = Relatory.new(relatory_params)\n\n respond_to do |format|\n if @relatory.save\n format.html { redirect_to @relatory, notice: 'Relatório Salvo.' }\n format.json { render :show, status: :created, location: @relatory }\n else\n format.html { render :new }\n format.json { render json: @relatory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_relatory\n @relatory = Relatory.find(params[:id])\n end",
"def add_relatives(relatives,min_distance,max_distance,relationship)\n min_distance.upto(max_distance) do |distance|\n next if relatives.include?(distance)\n relatives[distance-1].each do |relative|\n regular = relative.public_send(relationship).to_a\n remote = @remote_context.relatives(relative, relationship, Cyclopedio::Wiki::Category)\n auxiliary = []\n auxiliary = yield(relative) if block_given?\n relatives[distance].concat((regular + remote + auxiliary).select { |c| c.regular? && c.plural? })\n end\n end\n end",
"def update\n respond_to do |format|\n if @relatory.update(relatory_params)\n format.html { redirect_to @relatory, notice: 'Relatório atualizado.' }\n format.json { render :show, status: :ok, location: @relatory }\n else\n format.html { render :edit }\n format.json { render json: @relatory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_relatives_dates\n return if new_record?\n return unless force_relatives_dates\n return unless starts_at_changed? || ends_at_changed?\n return unless recurrence.present?\n return unless future_relatives.any?\n\n future_relatives.each do |outing|\n outing.assign_attributes(metadata: outing.metadata.merge({\n starts_at: outing.metadata[:starts_at] + (self.metadata[:starts_at] - starts_at_was),\n ends_at: outing.metadata[:ends_at] + (self.metadata[:ends_at] - ends_at_was)\n }))\n end\n end",
"def follow_up\r\n @node = Node.new(node_params)\r\n @parent = Node.find(params[:id])\r\n @story = @parent.story \r\n @node.story = @story\r\n @node.parent = @parent\r\n @node.level = @parent.level + 1\r\n @node.path = \"#{@parent.path}, #{@parent.id}\"\r\n if current_user != nil\r\n \t@node.user_id = current_user.id\r\n\t\telse\r\n\t\t\t@node.user_id =0\r\n\t\tend\r\n\t\t\r\n respond_to do |format|\r\n if @node.save\r\n \r\n format.html { redirect_to story_path(@story), notice: \"You just follow up.\" }\r\n # format.json { render \"success\"}\r\n format.json { render json: @parent, status: :ok}\r\n \r\n else\r\n \r\n format.html { render action: 'new_follow'}\r\n format.json { render json: @node.errors, status: :unprocessable_entity}\r\n end\r\n end\r\n end",
"def json_post\n @content_type = 'text/plain'\n @render_nothing = true\n @rendered_template = true\n @current_layout = nil\n puts \"json_post: submitting #{params[:path]}\" if @@debug\n path = params[:path]\n if path\n puts \"json_post: path is #{path} l=#{path.length}\" if @@debug\n path = path.split('/').compact()\n path.delete('')\n # you cannot make rooted nodes via json atm... fix? xxx\n if path.length > 1\n name = path.pop\n nodes = Note.make_path @user,path\n puts \"json_post: making at path #{path.join('/')}\" if @@debug\n if nodes\n note = nodes.last.make_child @user,params,name\n puts \"json_post: made child #{note} from #{name} l=#{name.length}\"\n params[:path] = path.join('/') # for call to json_query\n # it is important to do a query rather than returning the note; to get freshest order\n json_query\n return\n #write_json note if note\n end\n end\n end\n render :nothing => true\n end",
"def create\n @tarifa = Tarifa.new(tarifa_params)\n @parent_path = set_parent_path\n respond_to do |format|\n if @tarifa.save\n format.html { redirect_to @parent_path , notice: 'Tarifa creada exitosamente.' }\n format.json { render :show, status: :created, location: @tarifa }\n else\n format.html { render :new }\n format.json { render json: @tarifa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_relationship_within\n authorize! :read, form_params[:child_id]\n\n if form.save\n notice = I18n.t('create_within', scope: 'hyrax.dashboard.nest_collections_form', child_title: form.child.title.first, parent_title: form.parent.title.first)\n redirect_to redirect_path(item: form.child), notice: notice\n else\n redirect_to redirect_path(item: form.child), flash: { error: form.errors.full_messages }\n end\n end",
"def add_parent_to_org_unit(parent_ou_id, child_ou_id)\n # Must follow structure of data\n # (course <-- semester <== org -->custom dept--> dept -->templates--> courses)\n # Refer to valence documentation for further structural understanding..\n path = \"/d2l/api/lp/#{$lp_ver}/orgstructure/#{child_ou_id}/parents/\"\n _post(path, parent_ou_id)\nend",
"def index\n @relatives = Relative.includes(:organizations, :representative)\n .group_by { |relative| relative.representative }\n end",
"def update\n\t\t @tree = current_user.trees.find(params[:tree_id])\n\n\t if @tree.nil?\n\t \trender json: { errors: [\"No such tree found\"], success: false }, status: :bad_request\n\t end\n\n\t @person = @tree.people.find(params[:id])\n\n \tif @person.nil?\n \t\trender json: { errors: [\"No such person found\"], success: false }, status: :bad_request\n \tend\n\n \tparams.delete :_id\n\n\t relations = {}\n\t\t \tmodified_people = []\n\n\t\t \tif params[:person][:spouses]\n\t\t \t\trelations[:spouses] = params[:person][:spouses]\n\t\t \t\tparams[:person].delete :spouses\n\t\t \tend\n\n\t\t \tif params[:person][:children]\n\t\t \t\trelations[:children] = params[:person][:children]\n\t\t \t\tparams[:person].delete :children\n\t\t \tend\n\n\t\t \tif params[:person][:parents]\n\t\t \t\trelations[:parents] = params[:person][:parents]\n\t\t \t\tparams[:person].delete :parents\n\t\t \tend\n\n \tif @person.update_attributes(params[:person])\n \t\tmodified_people << @person\n\n \t\trelations.each do |k,v|\n\t\t \t\tv.each do |p|\n\t\t \t\t\tputs \"RELATIONS\", relations\n\t\t \t\t\tputs \"HERE\", k, v, p\n\t\t \t\t\trelative = @tree.people.find(p)\n\t\t \t\t\tputs \"THERE\", relative[k], relative.to_json\n\t\t \t\t\trelative.send(k) << @person\n\t\t \t\t\trelative.save\n\t\t \t\t\tmodified_people << relative\n\t\t \t\tend\n\t\t \tend\n\n \trender json: { person: @person, people: modified_people }, status: :accepted\n \telse\n \trender json: { errors: @person.errors, success: false }, status: :unprocessable_entity\n \tend\n\t\t end",
"def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend",
"def repair_children\n @obj = Node.find(params[:id])\n @obj.repair_children\n respond_to do |format|\n format.html {redirect_to nodes_url}\n format.json {render json: @obj}\n end\n end",
"def create\n @goal = Goal.new(goal_params)\n set_owner\n\n respond_to do |format|\n if @goal.save\n format.html { redirect_to @goal.parent.nil? ? @goal : @goal.parent, notice: 'Goal was successfully created.' }\n format.json { render :show, status: :created, location: @goal }\n else\n format.html { render :new }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_or_create_relationship(conn, node_start, node_end, type)\n data = <<\"EOS\"\n{\n \"to\" : \"#{node_end}\",\n \"max_depth\" : 1,\n \"relationships\" : {\n \"type\" : \"#{type}\",\n \"direction\" : \"out\"\n },\n \"algorithm\" : \"shortestPath\"\n}\nEOS\n r = conn.post(\"#{node_start}/paths\", data, HEADER)\n length = (JSON.parse(r.body).first || {})['length'] if r.status == 200\n if length != 1\n conn.post(\"#{node_start}/relationships\", JSON.unparse({ :to => node_end, :type => type }), HEADER)\n $load_r += 1\n else\n $skip_r += 1\n end\nend",
"def create_relationship_under\n authorize! :read, form_params[:parent_id]\n\n if form.save\n notice = I18n.t('create_under', scope: 'hyrax.dashboard.nest_collections_form', child_title: form.child.title.first, parent_title: form.parent.title.first)\n redirect_to redirect_path(item: form.parent), notice: notice\n else\n redirect_to redirect_path(item: form.parent), flash: { error: form.errors.full_messages }\n end\n end",
"def create\n respond_to do |format|\n if @resource.save\n format.html { redirect_to referential_resource_path(@referential, @resource), notice: 'Resource was successfully created.' }\n format.json { render :show, status: :created, location: @resource }\n else\n format.html { render :new }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @story = Story.find(params[:story_id])\n @page = @story.pages.build(page_params)\n\n @parent = Page.find(params[:parent_id]);\n\n if @page.save!\n if(params[:parent_id] && params[:choice_text])\n @parent = Page.find(params[:parent_id]);\n @branch = @parent.branches.build(destination_id: @page.id, choice_text: params[:choice_text], story_id: @story.id)\n\n if !@branch.save\n render json: { error: \"Error saving page\", status: 400 }, status: 400\n end\n\n if !@parent.save\n render json: { error: \"Error saving page\", status: 400 }, status: 400\n end\n end\n\n render json: @parent, status: 201\n end\n end",
"def update\n respond_to do |format|\n if @relative.update(relative_params)\n format.html { redirect_to [:admin, @relative], notice: 'Relative was successfully updated.' }\n format.json { render :show, status: :ok, location: @relative }\n else\n format.html { render :edit }\n format.json { render json: @relative.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_relation\n #add relation\n @word.word_roots.create(@word_root)\n respond_to do |format|\n format.js\n end\n end",
"def create\n @direcciont = Direcciont.new(direcciont_params)\n\n respond_to do |format|\n if @direcciont.save\n format.html { redirect_to @direcciont, notice: 'Direcciont was successfully created.' }\n format.json { render :show, status: :created, location: @direcciont }\n else\n format.html { render :new }\n format.json { render json: @direcciont.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_post!(params)\n @children.create! params\n end",
"def destroy\n @relatory.destroy\n respond_to do |format|\n format.html { redirect_to relatories_url, notice: 'Relatório deletado.' }\n format.json { head :no_content }\n end\n end",
"def create\n #debugger\n @resto = Restaurant.find(params[:relationship][:restaurant_id])\n current_user.follow!(@resto)\n #debugger\n #respond_with @resto\n redirect_to @resto\n end",
"def create\n @descendant = Descendant.new(descendant_params)\n\n respond_to do |format|\n if @descendant.save\n format.html { redirect_to @descendant, notice: 'Descendant was successfully created.' }\n format.json { render :show, status: :created, location: @descendant }\n else\n format.html { render :new }\n format.json { render json: @descendant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @page = Page.new\n @page.parent_id = params[:parent_id]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def create\n @quest_tree = QuestTree.new(params[:quest_tree])\n\n respond_to do |format|\n if @quest_tree.save\n format.html { redirect_to @quest_tree, notice: 'Quest tree was successfully created.' }\n format.json { render json: @quest_tree, status: :created, location: @quest_tree }\n else\n format.html { render action: \"new\" }\n format.json { render json: @quest_tree.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n child = Assembly.find(params[:child_id])\n @relationship = @assembly.relationships.build(child: child)\n child = @relationship.child\n child.used = true\n child.save\n\n respond_to do |format|\n if @relationship.save\n format.html { redirect_to [@plan, @assembly], notice: 'Relationship was successfully created.' }\n format.json { render json: @relationship, status: :created, location: @relationship }\n else\n format.html { render action: \"new\" }\n format.json { render json: @relationship.errors, status: :unprocessable_entity }\n end\n end\n end",
"def relatory_params\n params.require(:relatory).permit(:buyer, :description, :price,:quantity, :address, :owner)\n end",
"def calculate_relatives!(root_id)\n @relatives = {root_id => 0}\n queue = Set[root_id]\n until queue.empty?\n new_queue = Set[]\n queue.each do |id|\n character = Character[id]\n [character.mother, character.father].compact.each do |c|\n next if @relatives[c.id]\n @relatives[c.id] = @relatives[id] + 1\n new_queue << c.id\n end\n end\n queue = new_queue\n end\n queue = Set[*@relatives.keys]\n until queue.empty?\n new_queue = Set[]\n queue.each do |id|\n character = Character[id]\n character.children.each do |c|\n next if @relatives[c.id]\n @relatives[c.id] = @relatives[id] + 1\n new_queue << c.id\n end\n end\n queue = new_queue\n end\n end",
"def create\n @tree = Tree.new(params[:tree])\n @tree.synclatlon\n respond_to do |format|\n if @tree.save\n format.html { redirect_to @tree, notice: 'Tree was successfully created.' }\n format.json { render json: @tree, status: :created, location: @tree }\n else\n format.html { render 'new' }\n format.json { render json: @tree.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create \n get_system\n @nav_entry = NavEntry.new(params[:nav_entry])\n get_parents\n\n respond_to do |format|\n if @nav_entry.save\n format.html { redirect_to(system_path(@system), :notice => 'Nav entry was successfully created.') }\n format.xml { render :xml => @nav_entry, :status => :created, :location => @nav_entry }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @nav_entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @referent = Referent.new(referent_params)\n if params[:referent][:organisme_id] == \"\"\n #@referent.organisme = Organisme.first\n else\n @referent.organisme = Organisme.find(params[:referent][:organisme_id])\n end\n respond_to do |format|\n if @referent.save\n format.html { redirect_to @referent, notice: 'Referent was successfully created.' }\n format.json { render :show, status: :created, location: @referent }\n else\n format.html { render :new }\n format.json { render json: @referent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pastry = Pastry.new(pastry_params)\n\n respond_to do |format|\n if @pastry.save\n format.html { redirect_to @pastry, notice: 'Pastry was successfully created.' }\n format.json { render :show, status: :created, location: @pastry }\n else\n format.html { render :new }\n format.json { render json: @pastry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @taxon_name_relationship = TaxonNameRelationship.new(taxon_name_relationship_params)\n\n respond_to do |format|\n if @taxon_name_relationship.save\n format.html { redirect_to @taxon_name_relationship.metamorphosize, notice: 'Taxon name relationship was successfully created.' }\n format.json { render action: 'show', status: :created, location: @taxon_name_relationship.metamorphosize }\n else\n format.html { render action: 'new' }\n format.json { render json: @taxon_name_relationship.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @relationship = @character.relationships.build(relative_id: params[:relative_id], relation_type: params[:relation_type])\n if @relationship.save\n redirect_to @character, notice: 'Relationship was successfully created.'\n else\n render action: 'new'\n end\n end",
"def post(resource, params)\n case resource\n when \"pedidos\", \"place_order\", \"new_order\" then url = \"/pedidos\"\n when \"envios\", \"shipping\" then url = \"/envios\"\n else url = \"/#{resource}\"\n end\n\n post_request(url, params)\n end",
"def create\n respond_to do |format|\n if @relationship.save\n format.html { redirect_to @relationship.followed, notice: \"Now following #{@relationship.followed.name}.\" }\n format.json { render :index, status: :created, location: @relationship }\n format.js\n else\n format.html { render :index }\n format.json { render json: @relationship.errors, status: :unprocessable_entity }\n end\n end\n end",
"def tree_params\n params.require(:tree).permit(:title, :content, :special_date)\n end",
"def create\n @athletes_parent = AthletesParent.new(params[:athletes_parent])\n\n respond_to do |format|\n if @athletes_parent.save\n format.html { redirect_to(@athletes_parent, :notice => 'Athletes parent was successfully created.') }\n format.xml { render :xml => @athletes_parent, :status => :created, :location => @athletes_parent }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @athletes_parent.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @leaf = Leaf.new(leaf_params)\n\n respond_to do |format|\n if @leaf.save\n format.html { redirect_to @leaf, notice: t('common.message.created_success')}\n format.json { render :show, status: :created, location: @leaf }\n else\n format.html { render :new }\n format.json { render json: @leaf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @direccion = Direccion.new(direccion_params)\n\n respond_to do |format|\n if @direccion.save\n format.html { redirect_to @direccion, notice: 'Direccion was successfully created.' }\n format.json { render :show, status: :created, location: @direccion }\n else\n format.html { render :new }\n format.json { render json: @direccion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @direccion = Direccion.new(direccion_params)\n\n respond_to do |format|\n if @direccion.save\n format.html { redirect_to @direccion, notice: 'Direccion was successfully created.' }\n format.json { render :show, status: :created, location: @direccion }\n else\n format.html { render :new }\n format.json { render json: @direccion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_children\n parent = Event.find(params[:parent_id])\n parent.missing_children.each do |child|\n child.parent = parent\n child.save!\n end\n redirect_to(edit_admin_event_path(parent))\n end",
"def post(request_opts = {})\n store_result(http(request_opts).post(resolved_path, @attrs))\n end",
"def create\n @relationships = Relationship.paginate(:page => params[:page], :per_page => 30).order('updated_at DESC')\n @relationship = Relationship.create(params[:relationship])\n end",
"def thema_params\n params.require(:thema).permit(:node, :term, :category, :parent_id, :new_parent_id)\n end",
"def tree_params\n params.require(:tree).permit(:name, :data, :root_uri)\n end",
"def create\n @direccion = Direccion.new(direccion_params)\n\n respond_to do |format|\n if @direccion.save\n format.html { redirect_to @direccion, notice: \"Direccion was successfully created.\" }\n format.json { render :show, status: :created, location: @direccion }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @direccion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(object, path = nil)\n to_ostruct(post(sanitize!(path), object.to_json))\nend",
"def create\n @student_relation = StudentRelation.new(params[:student_relation])\n\n respond_to do |format|\n if @student_relation.save\n flash[:notice] = 'Relative was successfully created.'\n format.html { redirect_to(@student_relation) }\n format.xml { render :xml => @student_relation, :status => :created, :location => @student_relation }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student_relation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post(path, params={})\n RestClient.post request_base+path, params\n end",
"def update\n if @thema.try(:new_parent_id)\n @thema.parent = Thema.find(@thema.new_parent_id)\n end\n\n respond_to do |format|\n if @thema.update(thema_params)\n format.html { redirect_to @thema, notice: 'Thema was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @thema.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_relativity(relativity, expected)\n raise RuntimeError,\n \"A relativity (#{@relativity}) was already set; you cannot \" \\\n \"set another\" if @relativity_set\n\n @relativity, @expected, @relativity_set = relativity, expected, true\n self\n end",
"def create\n # Code refactoring that use the relationship between person and Entry Sets\n @entry_set = @current_user.person.entry_sets.build(params[:entry_set])\n\n respond_to do |format|\n if @entry_set.save\n format.json { render json: @entry_set, status: :created, location: @entry_set }\n else\n format.json { render json: @entry_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #@parent_page = Page.find(params[:page][:parent_id])\n \n @page = Page.new(params[:page])\n #@page.move_to_child_of(@parent_page)\n \n respond_to do |wants|\n if @page.save\n flash[:notice] = 'Страница успешно создана.'\n wants.html { redirect_to(admin_pages_url) }\n wants.xml { render :xml => @page, :status => :created, :location => @page }\n else\n wants.html { render :action => \"new\" }\n wants.xml { render :xml => @page.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @relative.destroy\n respond_to do |format|\n format.html { redirect_to [:admin, :relatives], notice: 'Relative was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def / aRelativePath\n access_child(aRelativePath)\n end",
"def plant_tree\n @category = Category.new\n subject = @category.subjects.build\n subject.resources.build\n @categories = Category.all\n @subjects = Subject.all\n render 'new'\n end",
"def create\n @page_hierarchy = PageHierarchy.new(page_hierarchy_params)\n\n respond_to do |format|\n if @page_hierarchy.save\n format.html { redirect_to @page_hierarchy, notice: 'Page hierarchy was successfully created.' }\n format.json { render :show, status: :created, location: @page_hierarchy }\n else\n format.html { render :new }\n format.json { render json: @page_hierarchy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @leaf = Leaf.new(leaf_params)\n\n respond_to do |format|\n if @leaf.save\n format.html { redirect_to leaf_path(@leaf), notice: CREATE_SUCCESS }\n format.json { render :show, status: :created, location: @leaf }\n else\n format.html { render :new }\n format.json { render json: @leaf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_field_rel(params)\n post('fieldRels', fieldRel: params)\n end",
"def child\n @folder = Folder.new\n @folder.parent = Folder.find(params[:id])\n @folder.user = @current_user\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @folder }\n end\n end",
"def create\n # Draft or Publish buttons support\n\n params[:resource][:status] = 'PUBLISHED' if params[:publish_button]\n params[:resource][:status] = 'DRAFT' if params[:draft_button]\n params[:resource][:status] = 'ARCHIVED' if params[:archive_button]\n\n @resource = Resource.new(params[:resource])\n\n # ******************\n # Check permissions!\n # parent_tree_node = TreeNode.find(params[:resource][:tree_node][:parent_id])\n # if not (parent_tree_node && parent_tree_node.can_create_child?)\n # flash[:notice] = \"Access denied. User can't create tree node\"\n # redirect_to session[:referer]\n # end\n # ******************\n \n tree_node = params[:resource][:tree_nodes_attributes]['0']\n parent_id = tree_node[:parent_id]\n unless parent_id == '0' && AuthenticationModel.current_user_is_admin?\n parent_tree_node = TreeNode.find(parent_id)\n if not (parent_tree_node && parent_tree_node.can_create_child?)\n flash[:notice] = \"Access denied. User can't create tree node\"\n redirect_to session[:referer]\n end\n end\n\n @tree_node = @resource.tree_nodes[0]\n @tree_node.is_main = true\n @tree_node.ac_type = parent_tree_node ? parent_tree_node.ac_type : 4\n @resource.tree_nodes[0] = @tree_node\n Website.associate_website(@resource, session[:website]) # TODO OLD CODE - Check to remove (Rami only)\n\n respond_to do |format|\n if @resource.save && @tree_node.save\n flash[:notice] = 'Resource was successfully created.'\n format.html { redirect_to session[:referer] || :back}\n format.xml { head :created, :location => admin_resource_url(@resource) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @resource.errors.to_xml }\n end\n end\n end",
"def location_params\n params.require(:location).permit(:name, :parent_id)\n end",
"def create\n @nodo = Nodo.new(nodo_params)\n\n respond_to do |format|\n if @nodo.save\n #format.html { redirect_to @nodo, notice: 'Nodo was successfully created.' }\n #format.json { render action: 'show', status: :created, location: @nodo }\n format.html { redirect_to nodos_url }\n format.json { head :no_content }\n else\n format.html { render action: 'new' }\n format.json { render json: @nodo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(relative_url, params)\n url = URI::join(ENV[\"testhost\"], relative_url)\n @res = Net::HTTP.post_form(url, params).body\n end",
"def index\n @stories = Story.all#.each{|story| story.parentId = \"1\"}\n stories_with_parent_id = @stories.map {|story| story.add_parent_id_info}\n puts stories_with_parent_id\n render json: stories_with_parent_id\n end",
"def create\n @relationship = current_user.relationships.build(relationship_params)\n\n respond_to do |format|\n if @relationship.save\n format.html { redirect_to @relationship, notice: 'Relationship was successfully created.' }\n format.json { render :show, status: :created, location: @relationship }\n else\n format.html { render :new }\n format.json { render json: @relationship.errors, status: :unprocessable_entity }\n end\n end\n end",
"def requisito_params\n params.require(:requisito).permit(:parent_id, :child_id)\n end",
"def sync_child_pages\n children.each{ |p| p.save! } if full_path_changed?\n end",
"def post_and_give_me_a_json(additional_path, entity = nil)\n if self.service_base_path != nil\n \n additional = \"\"\n if additional_path != nil\n additional = \"/#{additional_path}\"\n end\n \n if entity != nil\n message = self.http_client.post \"#{self.base_url}#{self.service_base_path}#{additional}.json?api_key=#{self.access_token}\", entity.to_hash\n else\n message = self.http_client.post \"#{self.base_url}#{self.service_base_path}#{additional}.json?api_key=#{self.access_token}\"\n end\n trata_erro(message.content)\n end\n end",
"def recurso_params\n params.require(:recurso).permit(:name)\n end",
"def create\n @dependent_relationship = DependentRelationship.new(params[:dependent_relationship])\n\n respond_to do |format|\n if @dependent_relationship.save\n format.html { redirect_to @dependent_relationship, notice: 'Dependent relationship was successfully created.' }\n format.json { render json: @dependent_relationship, status: :created, location: @dependent_relationship }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dependent_relationship.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n if @parent.save\n format.html { redirect_to @parent, notice: 'Parent was successfully created.' }\n format.json { render :show, status: :created, location: @parent }\n else\n format.html { render :new }\n format.json { render json: @parent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.find(params[:relationship][:followed_id])\n current_user.follow!(@user)\n respond_to do |format|\n format.html { redirect_to @user }\n format.js\n end\n end",
"def create\n @user = User.find(params[:relationship][:followed_id])\n current_user.follow!(@user)\n respond_to do |format|\n format.html { redirect_to @user }\n format.js\n end\n end",
"def index\n @new_resource = Referential::Resource.new(referential: @referential)\n breadcrumb\n end",
"def create\n @tree = Tree.new(tree_params)\n\n respond_to do |format|\n if @tree.save\n format.html { redirect_to @tree, notice: 'Tree was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tree }\n else\n format.html { render action: 'new' }\n format.json { render json: @tree.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tree = Tree.new(tree_params)\n\n respond_to do |format|\n if @tree.save\n format.html { redirect_to @tree, notice: 'Tree was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tree }\n else\n format.html { render action: 'new' }\n format.json { render json: @tree.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @node = Node.new\n @node.addresses.build\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @node }\n end\n end",
"def create\n @person.save\n respond_with(@person, :location => people_path)\n end",
"def add_page_to_tree(page)\n if !page.root?\n #puts \"page: #{page}\"\n #puts \"page.fullpath: #{page.fullpath}\"\n #puts \"page.parent_id: #{page.parent_id}\"\n page.parent = @remote_pages_by_id[page.parent_id]\n #puts \"page.parent: #{page.parent}\"\n #puts \"page.parent.class: #{page.parent.class}\"\n #puts \"page.parent.children: #{page.parent.children}\"\n page.parent.children << page\n end\n end",
"def create\n @recurso = Recurso.new(params[:recurso])\n\n respond_to do |format|\n if @recurso.save\n format.html { redirect_to @recurso, notice: 'O recurso de auto de infração foi criado com sucesso.' }\n format.json { render json: @recurso, status: :created, location: @recurso }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recurso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @administracao_relatorios_diario = Administracao::RelatoriosDiario.new(administracao_relatorios_diario_params)\n\n respond_to do |format|\n if @administracao_relatorios_diario.save\n format.html { redirect_to @administracao_relatorios_diario, notice: 'Relatorios diario was successfully created.' }\n format.json { render :show, status: :created, location: @administracao_relatorios_diario }\n else\n format.html { render :new }\n format.json { render json: @administracao_relatorios_diario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @relatorio = Relatorio.new(relatorio_params)\r\n\r\n respond_to do |format|\r\n if @relatorio.save\r\n format.html { redirect_to @relatorio, notice: 'Relatório criado com sucesso.' }\r\n format.json { render :show, status: :created, location: @relatorio }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @relatorio.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n #params[:area] == {\"parent_id\"=>\"21\",\"name\"=>\"test4\"} parent id from hidden field, name from field\n @area = Area.new(params[:area])\n\n respond_to do |format|\n if @area.save\n #format.html { redirect_to(@area, :notice => 'Area was successfully created.') }\n format.html { redirect_to(locations_url, :notice => \"#{@area.to_s} was successfully created.\") }\n format.xml { render :xml => @area, :status => :created, :location => @area }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @area.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def tree_params\n params.require(:tree).permit(:name, :pruning, :wiring, :repotting, :propagation, :disease, :placement, :fertilizing)\n end",
"def create\n @tangent = Tangent.new(tangent_params)\n\n respond_to do |format|\n if @tangent.save\n format.html { redirect_to @tangent, notice: 'Tangent was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tangent }\n else\n format.html { render action: 'new' }\n format.json { render json: @tangent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @child_guardian_relationship = ChildGuardianRelationship.new(params[:child_guardian_relationship])\n\n respond_to do |format|\n if @child_guardian_relationship.save\n format.html { redirect_to @child_guardian_relationship, notice: 'Child guardian relationship was successfully created.' }\n format.json { render json: @child_guardian_relationship, status: :created, location: @child_guardian_relationship }\n else\n format.html { render action: \"new\" }\n format.json { render json: @child_guardian_relationship.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tree = Tree.new(tree_params)\n\n respond_to do |format|\n if @tree.save\n format.html { redirect_to @tree, notice: 'Tree was successfully created.' }\n format.json { render :show, status: :created, location: @tree }\n else\n format.html { render :new }\n format.json { render json: @tree.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @representative = Representative.new(representative_params)\n\n respond_to do |format|\n if @representative.save\n #format.html { redirect_to admin_organization_path(@representative.organization,:locale => I18n.locale), notice: 'Representative was successfully created.' } \n format.js { render :js => \"window.location = ('#{admin_organization_path(@representative.organization,:locale => I18n.locale)}');\"}\n #format.json { render action: 'show', status: :created, location: @representative }\n else\n\t #format.html { render template: 'admin/organizations/show', flash: { newreperror: @representative.errors.full_messages} }\n #format.html { redirect_to admin_organization_path(@representative.organization,:locale => I18n.locale), flash: { newreperror: @representative.errors.full_messages} }\n format.json { render json: @representative.errors.full_messages, status: :unprocessable_entity }\n end\n end\n end",
"def relativize_points points, rel_points\n m_begin \"relativize_points\"\n raise \"invalid argument\" unless points.class == Array && rel_points.class == Array\n lastx, lasty = 0, 0\n points.each do\n |x, y|\n rel_points << [x-lastx, y-lasty]\n lastx = x\n lasty = y\n end\n m_end \"relativize_points\"\n end",
"def create\n @goal = @todo.goals.create(goal_params)\n render json: @goal\n end",
"def program_relationship_params\n params.require(:program_relationship).permit(:parent_id, :child_id)\n end",
"def fallacyfolder_params\n\t\tparams.permit(\n\t\t\t:name,\n\t\t\t:parent)\n\tend",
"def create\n @page = Page.new(page_params)\n respond_to do |format|\n if @page.save\n self.build_pages_tree\n format.html { redirect_to @pages_tree[@page.id], notice: 'Page was successfully created.' }\n format.json { render :show, status: :created, location: @page }\n else\n format.html { render :new }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def leaf_params\n params.require(:leaf).permit(:name, :period, :desc, :status, :group1, :group2, :group3)\n end",
"def fulltree_arranged(*args)\n Relationship.arranged_rels_to_resources(fulltree_rels_arranged(*args))\n end"
] |
[
"0.64449376",
"0.61134684",
"0.6084945",
"0.5859393",
"0.58260524",
"0.54997855",
"0.5465198",
"0.54432344",
"0.5345139",
"0.5303838",
"0.52967906",
"0.525849",
"0.5246864",
"0.5206786",
"0.5200933",
"0.5194986",
"0.5124349",
"0.5117807",
"0.51080775",
"0.510206",
"0.5101751",
"0.50424004",
"0.5033458",
"0.5026837",
"0.50258267",
"0.5021281",
"0.5011097",
"0.5010274",
"0.49973613",
"0.49815655",
"0.4974455",
"0.49706423",
"0.4970358",
"0.49663445",
"0.4941712",
"0.49260503",
"0.4925571",
"0.49224588",
"0.48838913",
"0.488013",
"0.487647",
"0.48689684",
"0.4867202",
"0.4867202",
"0.4865399",
"0.48617065",
"0.48486066",
"0.48404774",
"0.4838143",
"0.4835351",
"0.4832717",
"0.48317182",
"0.4830963",
"0.48239535",
"0.48232335",
"0.48119882",
"0.4811228",
"0.48092175",
"0.47958234",
"0.4794447",
"0.47936842",
"0.47914472",
"0.47910246",
"0.47907567",
"0.47906557",
"0.478248",
"0.47802147",
"0.4773729",
"0.47663876",
"0.475872",
"0.4753868",
"0.47523993",
"0.47492436",
"0.47452927",
"0.473552",
"0.47337428",
"0.47284162",
"0.47284162",
"0.47247186",
"0.47224295",
"0.47224295",
"0.47203842",
"0.47180265",
"0.4716855",
"0.4716502",
"0.4714854",
"0.47123542",
"0.47063813",
"0.47045922",
"0.4703539",
"0.47011906",
"0.47002703",
"0.46934143",
"0.46918324",
"0.46917978",
"0.46903563",
"0.4687632",
"0.46850392",
"0.46838292",
"0.46825615"
] |
0.60831225
|
3
|
PATCH/PUT /relatives/1 PATCH/PUT /relatives/1.json
|
def update
respond_to do |format|
if @relative.update(relative_params)
format.html { redirect_to [:admin, @relative], notice: 'Relative was successfully updated.' }
format.json { render :show, status: :ok, location: @relative }
else
format.html { render :edit }
format.json { render json: @relative.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n respond_to do |format|\n if @relatory.update(relatory_params)\n format.html { redirect_to @relatory, notice: 'Relatório atualizado.' }\n format.json { render :show, status: :ok, location: @relatory }\n else\n format.html { render :edit }\n format.json { render json: @relatory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def patch(path, **args); end",
"def patch!\n request! :patch\n end",
"def update\n\t\t @tree = current_user.trees.find(params[:tree_id])\n\n\t if @tree.nil?\n\t \trender json: { errors: [\"No such tree found\"], success: false }, status: :bad_request\n\t end\n\n\t @person = @tree.people.find(params[:id])\n\n \tif @person.nil?\n \t\trender json: { errors: [\"No such person found\"], success: false }, status: :bad_request\n \tend\n\n \tparams.delete :_id\n\n\t relations = {}\n\t\t \tmodified_people = []\n\n\t\t \tif params[:person][:spouses]\n\t\t \t\trelations[:spouses] = params[:person][:spouses]\n\t\t \t\tparams[:person].delete :spouses\n\t\t \tend\n\n\t\t \tif params[:person][:children]\n\t\t \t\trelations[:children] = params[:person][:children]\n\t\t \t\tparams[:person].delete :children\n\t\t \tend\n\n\t\t \tif params[:person][:parents]\n\t\t \t\trelations[:parents] = params[:person][:parents]\n\t\t \t\tparams[:person].delete :parents\n\t\t \tend\n\n \tif @person.update_attributes(params[:person])\n \t\tmodified_people << @person\n\n \t\trelations.each do |k,v|\n\t\t \t\tv.each do |p|\n\t\t \t\t\tputs \"RELATIONS\", relations\n\t\t \t\t\tputs \"HERE\", k, v, p\n\t\t \t\t\trelative = @tree.people.find(p)\n\t\t \t\t\tputs \"THERE\", relative[k], relative.to_json\n\t\t \t\t\trelative.send(k) << @person\n\t\t \t\t\trelative.save\n\t\t \t\t\tmodified_people << relative\n\t\t \t\tend\n\t\t \tend\n\n \trender json: { person: @person, people: modified_people }, status: :accepted\n \telse\n \trender json: { errors: @person.errors, success: false }, status: :unprocessable_entity\n \tend\n\t\t end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def update(attrs, path=nil)\n resp = api_client.put(path || url, JSON.dump(attrs))\n refresh(JSON.load(resp.body))\n end",
"def update\n if @thema.try(:new_parent_id)\n @thema.parent = Thema.find(@thema.new_parent_id)\n end\n\n respond_to do |format|\n if @thema.update(thema_params)\n format.html { redirect_to @thema, notice: 'Thema was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @thema.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def patch(path, data, params = {}, request_options = {})\n request(:patch, path, data, params)\n end",
"def patch(path, opts = {})\n request(:patch, path, opts).body\n end",
"def update\n respond_to do |format|\n if @leaf.update(leaf_params)\n format.html { redirect_to leaf_path(@leaf), notice: EDIT_SUCCESS }\n format.json { render :show, status: :ok, location: @leaf }\n else\n format.html { render :edit }\n format.json { render json: @leaf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def patch options\n rest_request({ method: :patch }.merge(options))\n end",
"def patch options\n rest_request({ method: :patch }.merge(options))\n end",
"def update\n respond_to do |format|\n if @leaf.update(leaf_params)\n format.html { redirect_to @leaf, notice: 'Leaf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @leaf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @parent = Parent.find(params[:id])\n\n respond_to do |format|\n if @parent.update_attributes(params[:parent])\n format.html { redirect_to parents_url, notice: 'Parent was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @parent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @parent_of.update(parent_of_params)\n format.html { redirect_to @parent_of, notice: 'Parent of was successfully updated.' }\n format.json { render :show, status: :ok, location: @parent_of }\n else\n format.html { render :edit }\n format.json { render json: @parent_of.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n end",
"def update\n respond_to do |format|\n if @resource.update(resource_params)\n format.html { redirect_to referential_resource_path(@referential, @resource), notice: 'Resource was successfully updated.' }\n format.json { render :show, status: :ok, location: @resource }\n else\n format.html { render :edit }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n @parent_path = set_parent_path + \"/tarifas/\" + @tarifa.id.to_s\n if @tarifa.update(tarifa_params)\n format.html { redirect_to @parent_path, notice: 'Tarifa actualizada exitosamente.' }\n format.json { render :show, status: :ok, location: @tarifa }\n else\n format.html { render :edit }\n format.json { render json: @tarifa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update \n pastry = Pastry.find(params[:id])\n pastry.update(pastry_params)\n render json: pastry\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n @obj = Node.find(params[:id])\n\n respond_to do |format|\n if @obj.update_attributes(params[:node])\n format.html { redirect_to @obj, notice: 'Node was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @obj.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end",
"def update\n respond_to do |format|\n if @leaf.update(leaf_params)\n format.html { redirect_to @leaf, notice: t('common.message.updated_success')}\n format.json { render :show, status: :ok, location: @leaf }\n else\n format.html { render :edit }\n format.json { render json: @leaf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tree.update(tree_params)\n format.html { redirect_to @tree, notice: 'Tree was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tree.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tree.update(tree_params)\n format.html { redirect_to @tree, notice: 'Tree was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tree.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_principal(path, prop_patch)\n end",
"def update\n @recurso = Recurso.find(params[:id])\n\n respond_to do |format|\n if @recurso.update_attributes(params[:recurso])\n format.html { redirect_to @recurso, notice: 'O recurso de auto de infração foi atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recurso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end",
"def update(path)\n output { patch(path, params) }\n end",
"def update\n respond_to do |format|\n if @foster_parent.update(foster_parent_params)\n format.html { redirect_to @foster_parent, notice: 'Foster parent was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @foster_parent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, opts = {}, &block)\n request(:patch, path, opts, &block)\n end",
"def patch(path, opts = {}, &block)\n request(:patch, path, opts, &block)\n end",
"def update!(**args)\n @child_link = args[:child_link] if args.key?(:child_link)\n @created = args[:created] if args.key?(:created)\n @id = args[:id] if args.key?(:id)\n @kind = args[:kind] if args.key?(:kind)\n @name = args[:name] if args.key?(:name)\n @permissions = args[:permissions] if args.key?(:permissions)\n @self_link = args[:self_link] if args.key?(:self_link)\n @starred = args[:starred] if args.key?(:starred)\n @updated = args[:updated] if args.key?(:updated)\n end",
"def http_prop_patch(request, response)\n path = request.path\n\n begin\n prop_patch = @server.xml.expect('{DAV:}propertyupdate', request.body)\n rescue Tilia::Xml::ParseException => e\n raise Exception::BadRequest, e.message, nil, e\n end\n\n new_properties = prop_patch.properties\n\n result = @server.update_properties(path, new_properties)\n\n prefer = @server.http_prefer\n response.update_header('Vary', 'Brief,Prefer')\n\n if prefer['return'] == 'minimal'\n # If return-minimal is specified, we only have to check if the\n # request was succesful, and don't need to return the\n # multi-status.\n ok = true\n result.each do |_prop, code|\n ok = false if code.to_i > 299\n end\n\n if ok\n response.status = 204\n return false\n end\n end\n\n response.status = 207\n response.update_header('Content-Type', 'application/xml; charset=utf-8')\n\n # Reorganizing the result for generateMultiStatus\n multi_status = {}\n result.each do |property_name, code|\n if multi_status.key?(code)\n multi_status[code][property_name] = nil\n else\n multi_status[code] = { property_name => nil }\n end\n end\n multi_status['href'] = path\n\n response.body = @server.generate_multi_status([multi_status])\n\n # Sending back false will interupt the event chain and tell the server\n # we've handled this method.\n false\n end",
"def update\n @tree = Tree.find(params[:id])\n\n respond_to do |format|\n if @tree.update_attributes(params[:tree])\n format.html { redirect_to @tree, notice: 'Tree was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render \"edit\" }\n format.json { render json: @tree.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch_via_redirect(path, parameters = nil, headers = nil)\n request_via_redirect(:patch, path, parameters, headers)\n end",
"def patch(path, to: nil, as: nil, **constraints, &blk)\n add_route(::Rack::PATCH, path, to, as, constraints, &blk)\n end",
"def update\n relationship = Relationships.find(params[:id])\n if relationship.update(relationship_params)\n render json: relationship, status: 200\n else\n render json: { errors: relationship.errors }, status: 422\n end\n end",
"def update\n @athletes_parent = AthletesParent.find(params[:id])\n\n respond_to do |format|\n if @athletes_parent.update_attributes(params[:athletes_parent])\n format.html { redirect_to(@athletes_parent, :notice => 'Athletes parent was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @athletes_parent.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @parent.update(parent_params)\n format.html { redirect_to @parent, notice: 'Parent was successfully updated.' }\n format.json { render :show, status: :ok, location: @parent }\n else\n format.html { render :edit }\n format.json { render json: @parent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @parent.update(parent_params)\n format.html { redirect_to @parent, notice: 'Parent was successfully updated.' }\n format.json { render :show, status: :ok, location: @parent }\n else\n format.html { render :edit }\n format.json { render json: @parent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @parent.update(parent_params)\n format.html { redirect_to @parent, notice: 'Parent was successfully updated.' }\n format.json { render :show, status: :ok, location: @parent }\n else\n format.html { render :edit }\n format.json { render json: @parent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @parent.update(parent_params)\n format.html { redirect_to @parent, notice: 'Parent was successfully updated.' }\n format.json { render :show, status: :ok, location: @parent }\n else\n format.html { render :edit }\n format.json { render json: @parent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @parent.update(parent_params)\n format.html { redirect_to @parent, notice: 'Parent was successfully updated.' }\n format.json { render :show, status: :ok, location: @parent }\n else\n format.html { render :edit }\n format.json { render json: @parent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_relatives_dates\n return if new_record?\n return unless force_relatives_dates\n return unless starts_at_changed? || ends_at_changed?\n return unless recurrence.present?\n return unless future_relatives.any?\n\n future_relatives.each do |outing|\n outing.assign_attributes(metadata: outing.metadata.merge({\n starts_at: outing.metadata[:starts_at] + (self.metadata[:starts_at] - starts_at_was),\n ends_at: outing.metadata[:ends_at] + (self.metadata[:ends_at] - ends_at_was)\n }))\n end\n end",
"def update!(**args)\n @subpath = args[:subpath] if args.key?(:subpath)\n end",
"def update\n @path = Path.find(params[:id])\n\n respond_to do |format|\n if @path.update_attributes(params[:path])\n format.html { redirect_to([@layer, @path], :notice => 'Path was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @path.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @child_resource = ChildResource.find(params[:id])\n # require modify permissions for this object\n require_privilege(Alberich::Privilege::MODIFY, @child_resource)\n\n respond_to do |format|\n if @child_resource.update_attributes(params[:child_resource])\n format.html { redirect_to @child_resource, notice: 'Child resource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @child_resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :manage, @node\n\n respond_to do |format|\n if @node.update_attributes(params[:node])\n format.html { redirect_to @node, notice: 'Node was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def prop_patch(path, prop_patch)\n node = @server.tree.node_for_path(path)\n return nil unless node.is_a?(IShareableCalendar)\n\n prop_patch.handle(\n '{DAV:}resourcetype',\n lambda do |value|\n return false if value.is(\"{#{Plugin::NS_CALENDARSERVER}}shared-owner\")\n\n shares = node.shares\n remove = []\n shares.each do |share|\n remove << share['href']\n end\n node.update_shares([], remove)\n\n true\n end\n )\n end",
"def patch(path, params)\n time(\"PATCH #{path}\") { Cloudflarer.new.patch(path, params) }\n end",
"def update\n @father = Father.find(params[:id])\n\n respond_to do |format|\n if @father.update_attributes(params[:father])\n format.html { redirect_to @father, notice: 'Father was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @father.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance/{tenantId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def partial_update(klass, id, patchset, options = {}, format = nil)\n headers = {}\n headers[:accept] = \"#{format}\" if format\n format ||= @default_format\n options = { resource: klass, id: id, format: format}.merge options\n if [FHIR::Formats::ResourceFormat::RESOURCE_XML, FHIR::Formats::ResourceFormat::RESOURCE_XML_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_XML\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_XML}\"\n elsif [FHIR::Formats::ResourceFormat::RESOURCE_JSON, FHIR::Formats::ResourceFormat::RESOURCE_JSON_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_JSON\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_JSON}\"\n end\n headers[:prefer] = @return_preference if @use_return_preference\n reply = patch resource_url(options), patchset, fhir_headers(headers)\n reply.resource = parse_reply(klass, format, reply)\n reply.resource_class = klass\n reply\n end",
"def update\n respond_to do |format|\n if @taxon_name_relationship.update(taxon_name_relationship_params)\n format.html { redirect_to @taxon_name_relationship.metamorphosize, notice: 'Taxon name relationship was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @taxon_name_relationship.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \trespond_to do |format|\n \t\tif @tree.update(tree_params)\n \t\t\tformat.html { redirect_to @tree, notice: 'Nome da arvore atualizado com sucesso.' }\n \t\t\tformat.json { render :show, status: :ok, location: @tree }\n \t\telse\n \t\t\tformat.html { render :edit }\n \t\t\tformat.json { render json: @tree.errors, status: :unprocessable_entity }\n \t\tend\n \tend\n end",
"def patch(operation, path, value = nil)\n ensure_client && ensure_uri\n body = {\n 'op' => operation,\n 'path' => path,\n 'value' => value\n }\n response = @client.rest_patch(@data['uri'], { 'Content-Type' => 'application/json-patch+json', 'body' => [body] }, @api_version)\n @client.response_handler(response)\n end",
"def prop_patch_node_update(path, prop_patch)\n # This should trigger a 404 if the node doesn't exist.\n node = @server.tree.node_for_path(path)\n\n node.prop_patch(prop_patch) if node.is_a?(IProperties)\n end",
"def rest_patch(base_uri,json_payload,params)\n begin\n @response = RestClient.patch(base_uri,json_payload,params)\n rescue => e\n puts @response.code\n end\n return @response\n end",
"def update\n respond_to do |format|\n if @trip.update(trip_params)\n last_clip(@trip, trip_params[:clips_attributes].present?)\n format.html { redirect_to @trip.parent || @trip, notice: 'Trip was successfully updated.', change: \"list\" }\n format.json { head :no_content }\n else\n format.html { redirect_to @trip.parent || @trip }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(attrs = nil)\n attrs ||= attributes.changed_attributes\n\n execute_request('PATCH') do |uri, headers|\n HTTP.http_client.patch(\n uri,\n body: adapter.serialize(attrs),\n header: headers.merge(CONTENT_TYPE_HEADERS)\n )\n end\n end",
"def jsonapi_update!(attributes)\n assign_jsonapi_attributes(attributes)\n save!\n end",
"def update\n @quest_tree = QuestTree.find(params[:id])\n\n respond_to do |format|\n if @quest_tree.update_attributes(params[:quest_tree])\n format.html { redirect_to @quest_tree, notice: 'Quest tree was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quest_tree.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(payload)\n post_like payload, Net::HTTP::Patch.new(@uri.path)\n end",
"def update\n respond_to do |format|\n if @tangent.update(tangent_params)\n format.html { redirect_to @tangent, notice: 'Tangent was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tangent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_current_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update\n @request.assign_json_attributes(params) if @request.resume?\n respond_to do |format|\n if @request.update(request_params)\n format.html { redirect_to @request, notice: 'Request was successfully updated.' }\n format.json { render :show, status: :ok, location: @request }\n else\n format.html { render :edit }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @node = Node.find(params[:id])\n\n respond_to do |format|\n if @node.update_attributes(params[:node])\n format.html { redirect_to @node, notice: 'Node was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @node = Node.find(params[:id])\n\n respond_to do |format|\n if @node.update_attributes(params[:node])\n format.html { redirect_to @node, notice: 'Node was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @node = Node.find(params[:id])\n\n respond_to do |format|\n if @node.update_attributes(params[:node])\n format.html { redirect_to @node, notice: 'Node was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n save_relations\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @relationship = Relationship.find(params[:id])\n\n respond_to do |format|\n if @relationship.update_attributes(params[:relationship])\n format.html { redirect_to @relationship, notice: 'Relationship was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @relationship.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(url, payload, headers={})\n RestClient.patch url, payload, headers\n end",
"def set_relatory\n @relatory = Relatory.find(params[:id])\n end",
"def update\n\t\t@parent = Parent.find(params[:id])\n respond_to do |format|\n if @parent.update(parent_params)\n format.html { redirect_to @parent, notice: 'Parent was successfully updated.' }\n format.json { render :show, status: :ok, location: @parent }\n else\n format.html { render :edit }\n format.json { render json: @parent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @shape_type = ShapeType.find(params[:id])\n\n\t\t# get the parent shape type\n\t\tparent = ShapeType.find(params[:parent_shape])\n\n respond_to do |format|\n\t\t\tif parent.nil?\n\t format.html { render action: \"edit\" }\n\t format.json { render json: @shape_type.errors, status: :unprocessable_entity }\n\t\t\telse\n\t\t\t\t# see if the parent shape changed\n\t\t\t\tanc_ary = @shape_type.ancestry.split(\"/\")\n\t\t\t\tif (anc_ary.length == 1 && parent.id.to_s == anc_ary[0]) || parent.id.to_s == anc_ary[anc_ary.length-1]\n\t\t\t\t\t# parent shape did not change, do nothing\n\t\t\t\telse\n\t\t\t\t\t# parent shape did change. update the ancestry value\n\t\t\t\t\tnew_anc = parent.ancestor_ids.join(\"/\")\n\t\t\t\t\tnew_anc += \"/\" + parent.id.to_s\n\t\t\t\t\tparams[:shape_type][:ancestry] = new_anc\n\t\t\t\tend\n\n\t\t if @shape_type.update_attributes(params[:shape_type])\n\t\t\t\t\tmsg = I18n.t('app.msgs.success_updated', :obj => I18n.t('app.common.shape_type'))\n\t\t\t\t\tsend_status_update(I18n.t('app.msgs.cache_cleared', :action => msg))\n\t\t format.html { redirect_to admin_shape_type_path(@shape_type), notice: msg }\n\t\t format.json { head :ok }\n\t\t else\n\t\t format.html { render action: \"edit\" }\n\t\t format.json { render json: @shape_type.errors, status: :unprocessable_entity }\n\t\t end\n\t end\n end\n end",
"def update!(**args)\n @children_locations = args[:children_locations] if args.key?(:children_locations)\n @parent_chain = args[:parent_chain] if args.key?(:parent_chain)\n @parent_location = args[:parent_location] if args.key?(:parent_location)\n end",
"def update\n @patch = Patch.find(params[:id])\n\n respond_to do |format|\n if @patch.update_attributes(params[:patch])\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @hdfs_path = HdfsPath.find(params[:id])\n\n respond_to do |format|\n if @hdfs_path.update_attributes(params[:hdfs_path])\n format.html { redirect_to @hdfs_path, notice: 'Hdfs path was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hdfs_path.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @node = Node.find(params[:id])\n\n respond_to do |format|\n if @node.update_attributes(params[:node])\n format.html { redirect_to @node, notice: 'Node was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n begin\n @resource = Relation.find params[:id]\n @resource.update_attributes!(params[:relation])\n render :response => :PUT\n rescue Exception => e\n @error = process_exception(e)\n render :response => :error\n end\n end",
"def update!(**args)\n @parent = args[:parent] if args.key?(:parent)\n @permission = args[:permission] if args.key?(:permission)\n end",
"def update_in_tree\n\t\tfname = \"#{self.class.name}.#{__method__}\"\n\t\t#LOG.info(fname) { \"params: #{params}\" }\n\t\t@link = Link.find(params[:id])\n\t\t##########@link.update_accessor(current_user)\n\t\t@object_in_explorer = PlmServices.get_object(params[:object_model], params[:object_id])\n\t\t@root = PlmServices.get_object(params[:root_model], params[:root_id])\n\t\terr = false\n\t\trespond_to do |format|\n\t\t\t#values = OpenWFE::Json::from_json(params[:link][:values])\n\t\t\t#LOG.info(fname) { \"values: #{values}\" }\n\t\t\t#########update_att=@link.update_attributes(params[:link])\n\t\t\tupdate_att = @link.update_link(current_user,params[:link])\n\t\t\t#LOG.info(fname) { \"update_att: #{update_att} @link.errors=#{@link.errors.inspect}\" }\n\t\t\t@link.errors.clear if update_att\n\t\t\tupdate_eff = update_effectivities(@link, params[:effectivities])\n\t\t\t#LOG.info(fname) { \"update_eff: #{update_eff} @link.errors=#{@link.errors.inspect}\" }\n\t\t\tif update_att && update_eff\n\t\t\t\tLOG.info(fname) { \"ok:effectivities: #{params[:effectivities]}\" }\n\t\t\t\tflash[:notice] = t(:ctrl_object_updated, :typeobj => t(:ctrl_link), :ident => @link.ident)\n\t\t\t\tformat.html { render action: \"edit_in_tree\" }\n\t\t\t\tformat.xml { head :ok }\n\t\t\telse\n\t\t\t\tstrerr=\"ko:update_att=#{update_att} update_eff=#{update_eff} effectivities: #{params[:effectivities]}\"\n\t\t\t\tLOG.info(fname) { strerr}\n\t\t\t\t# lien non modifie\n\t\t\t\tflash[:error] = t(:ctrl_object_not_updated,:typeobj =>t(:ctrl_link),:ident=>@link.ident, :error=>strerr)\n\t\t\t\tformat.html { render action: \"edit_in_tree\" }\n\t\t\t\tformat.xml { render xml: @link.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tree.update(tree_params)\n format.html { redirect_to @tree, notice: 'Tree was successfully updated.' }\n format.json { render :show, status: :ok, location: @tree }\n else\n format.html { render :edit }\n format.json { render json: @tree.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n @student.parent.update(parent_params.merge(address: params[:student][\"address\"].as_json))\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @child.update(child_params)\n format.html { redirect_to @child, notice: 'Child was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @child.errors, status: :unprocessable_entity }\n end\n end\n \n end",
"def update\n respond_to do |format|\n if @parent_info.update(parent_info_params)\n format.html { redirect_to @parent_info, notice: 'Parent info was successfully updated.' }\n format.json { render :show, status: :ok, location: @parent_info }\n else\n format.html { render :edit }\n format.json { render json: @parent_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @added_parents = args[:added_parents] if args.key?(:added_parents)\n @removed_parents = args[:removed_parents] if args.key?(:removed_parents)\n end",
"def update\n @person = Person.find(params[:id])\n @provider = Provider.find(params[:provider_id]) unless params[:provider_id].blank?\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n\n path = people_path\n msg = 'Person was successfully updated.'\n if @participant\n path = participant_path(@participant, :anchor => \"relationships_tab\")\n msg = 'Person was successfully updated.'\n end\n if @provider\n path = provider_path(@provider)\n msg = \"Person was successfully updated for #{@provider}.\"\n end\n\n format.html { redirect_to(path, :notice => msg) }\n format.json { render :json => @person }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @person.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n run_callbacks :update do\n method = self.class.method_for(:update)\n path = request_path(:_owner_path => @owner_path)\n self.class.request(to_params.merge(:_method => method, :_path => path)) do |response|\n load_attributes_from_response(response)\n end\n end\n end",
"def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end"
] |
[
"0.63427764",
"0.63061845",
"0.61638796",
"0.6162443",
"0.6121891",
"0.5970408",
"0.5970408",
"0.5935698",
"0.5860946",
"0.585707",
"0.5831847",
"0.5793702",
"0.5767282",
"0.576302",
"0.5761221",
"0.57491714",
"0.5692404",
"0.5692404",
"0.5691393",
"0.5691393",
"0.568664",
"0.56505084",
"0.5616267",
"0.5606019",
"0.55920416",
"0.55863154",
"0.55834323",
"0.55797774",
"0.5564702",
"0.5555933",
"0.5551839",
"0.55481994",
"0.55481994",
"0.55434686",
"0.5534373",
"0.5525796",
"0.5522367",
"0.55206066",
"0.5520181",
"0.5520181",
"0.5518236",
"0.5516815",
"0.5512012",
"0.55041176",
"0.5498061",
"0.54885155",
"0.5485902",
"0.54642814",
"0.54642814",
"0.54642814",
"0.54642814",
"0.54642814",
"0.54593045",
"0.54589444",
"0.5456514",
"0.54485923",
"0.544852",
"0.5439709",
"0.5439373",
"0.54382294",
"0.54321784",
"0.5423267",
"0.54153216",
"0.54150504",
"0.54114217",
"0.54087585",
"0.5394697",
"0.53927654",
"0.53878933",
"0.5384322",
"0.53792965",
"0.5375671",
"0.5373502",
"0.537302",
"0.5371248",
"0.5364348",
"0.5364348",
"0.5364348",
"0.53632575",
"0.5359419",
"0.5358079",
"0.5356344",
"0.53536385",
"0.5353421",
"0.535175",
"0.5348585",
"0.5348566",
"0.53461397",
"0.5342796",
"0.5341948",
"0.5337144",
"0.53300446",
"0.5320246",
"0.531966",
"0.53195626",
"0.5311552",
"0.5306106",
"0.5305023",
"0.53022027",
"0.5299439"
] |
0.6024745
|
5
|
DELETE /relatives/1 DELETE /relatives/1.json
|
def destroy
@relative.destroy
respond_to do |format|
format.html { redirect_to [:admin, :relatives], notice: 'Relative was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @relatory.destroy\n respond_to do |format|\n format.html { redirect_to relatories_url, notice: 'Relatório deletado.' }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @path = Path.find(params[:id])\n @path.destroy\n\n head :no_content\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def delete; rest_delete(link('self')); end",
"def delete; rest_delete(link('self')); end",
"def delete(path)\n repository = path.split(/\\//)[2]\n objectid = path.split(/\\//)[3]\n if storage_fetch(repository, objectid) && storage_delete(repository, objectid)\n ['200', {}, []]\n else\n ['404', {}, [\"Repository #{repository} or ObjectID #{objectid} not found: #{path}\"]]\n end\n end",
"def destroy\n @hdfs_path = HdfsPath.find(params[:id])\n @hdfs_path.destroy\n\n respond_to do |format|\n format.html { redirect_to hdfs_paths_url }\n format.json { head :ok }\n end\n end",
"def destroy\n relationship = Relationships.find(params[:id])\n relationship.destroy\n head 204\n end",
"def delete(path)\n root.delete(path)\n end",
"def destroy\n @parent_of.destroy\n respond_to do |format|\n format.html { redirect_to parent_ofs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recurso = Recurso.find(params[:id])\n @recurso.destroy\n\n respond_to do |format|\n format.html { redirect_to recursos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gpath = Gpath.find(params[:id])\n @gpath.destroy\n\n respond_to do |format|\n format.html { redirect_to gpaths_url }\n format.json { head :no_content }\n end\n end",
"def deletes_to(path,opts={},&block) #:nodoc: \n crud_to(:delete,path,opts[:params] || {},opts,&block)\n end",
"def destroy\n @orphan.destroy\n respond_to do |format|\n format.html { redirect_to orphans_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @leaf.destroy\n respond_to do |format|\n format.html { redirect_to leafs_url, notice: DELETE_SUCCESS }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n request(:delete, path)\n end",
"def destroy\n \n @parent_path = set_parent_path\n \n @tarifa.destroy\n respond_to do |format|\n format.html { redirect_to @parent_path, notice: 'Tarifa eliminada exitosamente.' }\n format.json { head :no_content }\n end\n \n end",
"def destroy\n @direcciont.destroy\n respond_to do |format|\n format.html { redirect_to direccionts_url, notice: 'Direcciont was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @node = Node.find_key(params[:id] || params[:name])\n @node.destroy\n respond_to do |format|\n format.html { redirect_to deployment_path(@node.deployment_id) }\n format.json { render api_delete @node }\n end\n end",
"def destroy\n @path = Path.find(params[:id])\n @path.destroy\n\n respond_to do |format|\n format.html { redirect_to(layer_url) }\n format.xml { head :ok }\n end\n end",
"def delete(path, params)\n headers = {:Authorization => \"token #{token}\", :content_type => :json, :accept => :json}\n res = RestClient.delete(\"#{github_api_uri}/#{path}\", params.to_json, headers)\n Yajl.load(res)\n end",
"def destroy\n @descendant.destroy\n respond_to do |format|\n format.html { redirect_to descendants_url, notice: 'Descendant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tree.destroy\n respond_to do |format|\n format.html { redirect_to trees_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tree.destroy\n respond_to do |format|\n format.html { redirect_to trees_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @direccion.destroy\n respond_to do |format|\n format.html { redirect_to direcciones_url, notice: 'Direccion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @child.destroy\n respond_to do |format|\n format.html { redirect_to children_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @obj = Node.find(params[:id])\n @obj.destroy\n\n respond_to do |format|\n format.html { redirect_to :back}\n format.json { head :no_content }\n end\n end",
"def destroy\n @tangent.destroy\n respond_to do |format|\n format.html { redirect_to tangents_url }\n format.json { head :no_content }\n end\n end",
"def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end",
"def destroy\n @athletes_parent = AthletesParent.find(params[:id])\n @athletes_parent.destroy\n\n respond_to do |format|\n format.html { redirect_to(athletes_parents_url) }\n format.xml { head :ok }\n end\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def destroy\n @direccion.destroy\n respond_to do |format|\n format.html { redirect_to direccions_url, notice: 'Direccion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @branch = Branch.find(params[:id])\n @parentTitle = Branch.find(params[:id]).uid\n Branch.where(parent: @parentTitle).delete_all\n @branch.destroy\n render :json => @branch.to_json\n end",
"def destroy\n @direccion.destroy\n respond_to do |format|\n format.html { redirect_to direccions_url, notice: \"Direccion was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nodo.destroy\n respond_to do |format|\n format.html { redirect_to nodos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @leaf.destroy\n respond_to do |format|\n format.html { redirect_to leaves_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @relationship = @assembly.relationships.find(params[:id])\n child = @relationship.child\n child.used = false\n child.save\n @relationship.destroy\n\n respond_to do |format|\n format.html { redirect_to [@plan, @assembly], notice: 'Relationship was deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @quest_tree = QuestTree.find(params[:id])\n @quest_tree.destroy\n\n respond_to do |format|\n format.html { redirect_to quest_trees_url }\n format.json { head :ok }\n end\n end",
"def delete(path)\n request 'DELETE', path\n end",
"def delete(path, params)\n request(:delete, path, {})\n end",
"def delete(options={})\n connection.delete(\"/\", @name)\n end",
"def destroy\n @trnodo = Trnodo.find(params[:id])\n @trnodo.destroy\n\n respond_to do |format|\n format.html { redirect_to trnodos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category = Category.by_alias params[:alias]\n raise ActionController::RoutingError, 'Not found' if @category.nil?\n\n parent_url = @category.parent_url\n @category.destroy_tree\n\n respond_to do |format|\n format.html { redirect_to parent_url }\n format.json { head :ok }\n end\n end",
"def delete(path)\n\t\trequest(path, :delete)\n\tend",
"def delete_pathway\n pathway = Pathway.find(params[:pathway_par])\n current_user.pathways.delete(pathway)\n if current_user.pathways.size < 1\n respond_to do |format|\n format.html { redirect_to '/saved#pathways' }\n format.json { head :no_content }\n end\n end\n end",
"def destroy\n @taxon_name_relationship.destroy\n respond_to do |format|\n format.html { redirect_to taxon_name_relationships_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @parent = Parent.find(params[:id])\n @parent.destroy\n\n respond_to do |format|\n format.html { redirect_to parents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @child = Child.find(params[:id])\n @child.destroy\n\n respond_to do |format|\n format.html { redirect_to children_url }\n format.json { head :ok }\n end\n end",
"def delete(path, params = {})\n request(:delete, path, params)\n end",
"def delete(path, params = {})\n request(:delete, path, params)\n end",
"def delete(path, params = {})\n request(:delete, path, params)\n end",
"def delete(path)\n request(:delete, path)\n end",
"def destroy\n @taxonomy = Taxonomy.find(params[:id])\n taxonomy_type = @taxonomy.taxonomy_type \n @taxonomy.delete_node_keep_sub_nodes\n @taxonomy.reload\n @taxonomy.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_taxonomies_url(:taxonomy_type => taxonomy_type) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tree = Tree.find(params[:id])\n @tree.destroy\n\n respond_to do |format|\n format.html { redirect_to trees_url }\n format.json { head :no_content }\n end\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def destroy\n record = TaxRule.find(params[:id])\n record.trash\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete(type, id)\n http_delete @target, \"#{type_info(type, :path)}/#{Addressable::URI.encode(id)}\", @auth_header, @zone\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def destroy\n @leaf.destroy\n respond_to do |format|\n format.html { redirect_to leafs_url, notice: t('common.message.destroyed_success')}\n format.json { head :no_content }\n end\n end",
"def delete(splat)\n bad_request if splat.empty?\n _delete resolve_uri(splat[0])\n end",
"def destroy\n @folder.destroy\n respond_to do |format|\n format.html { redirect_to folder_url(@folder.parent) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flat.destroy\n\n respond_to do |format|\n format.html { redirect_to flats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @direccion = Direccion.find(params[:id])\n @direccion.destroy\n\n respond_to do |format|\n format.html { redirect_to(direccions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n \t@tree.destroy\n \trespond_to do |format|\n \t\tformat.html { redirect_to trees_url, notice: 'Arvore deletado com sucesso.' }\n \t\tformat.json { head :no_content }\n \tend\n end",
"def delete(href, additional_parameters = {})\n rest_connect do |base_uri, headers|\n href = \"#{base_uri}/#{href}\" unless begins_with_slash(href)\n new_path = URI.escape(href)\n req = Net::HTTP::Delete.new(href, headers)\n req.set_content_type('application/json')\n req.body = additional_parameters.to_json\n req\n end\n end",
"def http_delete(path, data = nil, content_type = 'application/json')\n http_methods(path, :delete, data, content_type)\n end",
"def delete(path, params)\n parse_response @client[path].delete(:params => params)\n end",
"def destroy\n @relation = Relation.find(params[:id])\n @relation.destroy\n\n respond_to do |format|\n format.html { redirect_to relations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @child_guardian_relationship = ChildGuardianRelationship.find(params[:id])\n @child_guardian_relationship.destroy\n\n respond_to do |format|\n format.html { redirect_to child_guardian_relationships_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recur.destroy\n respond_to do |format|\n format.html { redirect_to recurs_url, notice: 'Recur was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_and_give_me_a_json(additional_path, params = nil)\n if self.service_base_path != nil\n if params == nil\n params = Hash.new\n end\n params[:api_key] = self.access_token\n message = self.http_client.delete \"#{self.base_url}#{self.service_base_path}/#{additional_path}.json\", params\n trata_erro(message.content)\n end\n end",
"def destroy\r\n @node.destroy\r\n respond_to do |format|\r\n format.html { redirect_to nodes_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def delete(path, params = {})\n request(:delete, path, params)\n end",
"def delete(path, params = {})\n request(:delete, path, params)\n end",
"def rm(*path)\n super; on_success{ nil }\n end",
"def destroy\n @taxirequest = Taxirequest.find(params[:id])\n @taxirequest.destroy\n\n respond_to do |format|\n format.html { redirect_to taxirequests_url }\n format.json { head :no_content }\n end\n end",
"def delete(*rest) end",
"def destroy\n n = Node.find_key(params[:id] || params[:name])\n render api_delete Node\n end",
"def destroy\n @jido_guardian_rel = JidoGuardianRel.find(params[:id])\n @jido_guardian_rel.destroy\n\n respond_to do |format|\n format.html { redirect_to(jido_guardian_rels_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to nodes_path }\n format.json { head :ok }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to nodes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to nodes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to nodes_url }\n format.json { head :no_content }\n end\n end",
"def delete(object)\n full_name = extract_full_name object\n post 'api/del', :id => full_name\n end",
"def destroy\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to @trip.parent || trips_url, change: 'trip' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to nodes_url }\n format.json { head :ok }\n end\n end"
] |
[
"0.6867178",
"0.6731767",
"0.6679621",
"0.66419244",
"0.6641555",
"0.6560886",
"0.6531206",
"0.65192753",
"0.65192753",
"0.64699703",
"0.64286506",
"0.6426314",
"0.64173937",
"0.64156896",
"0.64134645",
"0.64024055",
"0.63852704",
"0.63792837",
"0.6366503",
"0.6362228",
"0.6359949",
"0.6343782",
"0.63342434",
"0.63324666",
"0.6311576",
"0.6278583",
"0.6264245",
"0.6264245",
"0.625883",
"0.62556225",
"0.6249505",
"0.62441206",
"0.6241735",
"0.6223447",
"0.6222972",
"0.62168634",
"0.62168634",
"0.62168634",
"0.62168634",
"0.62168634",
"0.62168634",
"0.62168634",
"0.6216787",
"0.6212999",
"0.6209746",
"0.62075853",
"0.6205066",
"0.61986196",
"0.6194806",
"0.61933786",
"0.6193295",
"0.6189529",
"0.6188805",
"0.61814827",
"0.6179515",
"0.61785316",
"0.61771613",
"0.617201",
"0.6160295",
"0.61550117",
"0.61550117",
"0.61550117",
"0.6142449",
"0.6138539",
"0.61368257",
"0.6130953",
"0.61252296",
"0.611763",
"0.61144584",
"0.61144584",
"0.61144584",
"0.61144584",
"0.61126477",
"0.6111493",
"0.6110132",
"0.6108233",
"0.6103017",
"0.61014724",
"0.6094137",
"0.60879874",
"0.60852265",
"0.6076081",
"0.60758114",
"0.6074599",
"0.6074095",
"0.60712606",
"0.606731",
"0.606731",
"0.60613424",
"0.60578",
"0.60557854",
"0.60551286",
"0.6053106",
"0.605159",
"0.6051119",
"0.6051119",
"0.6051119",
"0.6041457",
"0.6036967",
"0.6026858"
] |
0.7204016
|
0
|
Generates a Ruby Hash containing a configuration compatible with ExtJS Buttonwidget definition, to be used inside an items list of a panel container. Works similarly to ApplicationHelper::create_extjs_button_config, but instead of returning a parsable Javascript string, the result is a plain Ruby Hash. == Params: action_title_i19n_sym => Symbol for the I18n title for the button. The method assumes also that a tooltip symbol is defined with a "_tooltip" appended on the title symbol action_title_i19n_scope_sym => Symbol for the I18n scope of the localization; it can be nil for using the default global scope image_name => file name for the image to be used in the button, searched under "/images/icons"
|
def create_button_config( action_title_i19n_sym, action_title_i19n_scope_sym, image_name = "cog.png" )
action_text = I18n.t( action_title_i19n_sym.to_sym, {:scope => [action_title_i19n_scope_sym ? action_title_i19n_scope_sym.to_sym : nil]} )
tooltip_text = I18n.t( "#{action_title_i19n_sym}_tooltip".to_sym, {:scope => [action_title_i19n_scope_sym ? action_title_i19n_scope_sym.to_sym : nil]} )
{
:xtype => 'button',
:id => action_title_i19n_sym.to_s,
:name => action_title_i19n_sym.to_s,
:icon => "/images/icons/#{ image_name }",
:text => "#{ action_text }",
:tooltip => "#{ tooltip_text }",
:margin => '0 3 3 3'
}
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def integrated_slat_action_button_component_options\n { theme: (theme || :secondary),\n traits: traits,\n as: :a,\n confirm: confirm,\n disable_with: disable_with,\n href: href,\n method: send(:method),\n remote: remote,\n outlined: outlined,\n left_icon: icon }\n end",
"def toolbar_button(options = {})\n options.symbolize_keys!\n defaults = {\n :overlay => true,\n :skip_permission_check => false,\n :active => false,\n :link_options => {},\n :overlay_options => {},\n :loading_indicator => true\n }\n options = defaults.merge(options)\n button = content_tag('div', :class => 'button_with_label' + (options[:active] ? ' active' : '')) do\n link = if options[:overlay]\n link_to_overlay_window(\n render_icon(options[:icon]),\n options[:url],\n options[:overlay_options],\n {\n :class => 'icon_button',\n :title => options[:title],\n 'data-alchemy-hotkey' => options[:hotkey]\n }.merge(options[:link_options])\n )\n else\n link_to options[:url], {:class => (\"icon_button#{options[:loading_indicator] ? ' please_wait' : nil}\"), :title => options[:title], 'data-alchemy-hotkey' => options[:hotkey]}.merge(options[:link_options]) do\n render_icon(options[:icon])\n end\n end\n link += content_tag('label', options[:label])\n end\n if options[:skip_permission_check]\n return button\n else\n if options[:if_permitted_to].blank?\n action_controller = options[:url].gsub(/^\\//, '').split('/')\n options[:if_permitted_to] = [action_controller.last.to_sym, action_controller[0..action_controller.length-2].join('_').to_sym]\n end\n if permitted_to?(*options[:if_permitted_to])\n return button\n else\n return \"\"\n end\n end\n end",
"def generate_buttons(buttons:)\n fb_buttons = buttons.collect do |button|\n case button['type']\n when 'url'\n _button = {\n \"type\" => \"web_url\",\n \"url\" => button[\"url\"],\n \"title\" => button[\"text\"]\n }\n\n if button[\"webview_height\"].present?\n _button[\"webview_height_ratio\"] = button[\"webview_height\"]\n end\n\n if button['messenger_extensions'].present?\n _button['messenger_extensions'] = true\n end\n\n _button\n\n when 'payload'\n _button = {\n \"type\" => \"postback\",\n \"payload\" => button[\"payload\"],\n \"title\" => button[\"text\"]\n }\n\n when 'call'\n _button = {\n \"type\" => \"phone_number\",\n \"payload\" => button[\"phone_number\"],\n \"title\" => button[\"text\"]\n }\n\n when 'login'\n _button = {\n \"type\" => \"account_link\",\n \"url\" => button[\"url\"]\n }\n\n when 'logout'\n _button = {\n \"type\" => \"account_unlink\"\n }\n\n when 'nested'\n _button = {\n \"type\" => \"nested\",\n \"title\" => button[\"text\"],\n \"call_to_actions\" => generate_buttons(buttons: button[\"buttons\"])\n }\n\n else\n raise(Stealth::Errors::ServiceImpaired, \"Sorry, we don't yet support #{button[\"type\"]} buttons yet!\")\n end\n\n _button\n end\n\n fb_buttons\n end",
"def attach_symname_button(name, ivar_name, tooltip_text = nil)\n\t\tself.attach_label('Name', tooltip_text)\n\t\tw = Gtk::Button.new #(:label => 'OpAmp.sym')\n\t\tw.tooltip_text = tooltip_text\n\t\tw.hexpand = true\n\t\t@grid.attach(w, 1, @row, 1, 1)\n\t\t@row += 1\n\t\treturn w\n\tend",
"def build_toolbar_button(url_hash)\n url_hash[:empty_selection] ||= url_hash[:single]\n url_hash[:build_callback] ||= :selection unless url_hash[:empty_selection]\n classes = ['grid_toolbar_item', 'button', 'ui-state-default', 'ui-corner-all']\n s = <<-EOS\njQuery('<div class=\"#{(classes + Array(url_hash[:class])).compact.join(' ')}\" />')\n .text('#{escape_javascript(url_hash[:name])}')\n .button()\n .click(\n #{hash_to_callback(url_hash)}\n ).appendTo('#t_' + #{format_type_to_js(@table_id)});\nEOS\n end",
"def apphelp_protected_buttons_to( *button_data )\n buttons = ''\n\n button_data.each do | data |\n next if ( data.nil? )\n\n action = data[ 0 ] # NB: This is the action the button will represent, not the current, user-requested action for the enclosing page.\n options_for_link = data[ 1 ] || {}\n options_for_url = data[ 2 ]\n\n case action_name.to_sym # NB: This is the current, user-requested action for the enclosing page, not the action the button will represent.\n when :new, :create, :edit, :update\n mapping_hash = @@apphelp_button_mappings[ :for_read_write_pages ]\n when :show, :index\n mapping_hash = @@apphelp_button_mappings[ :for_read_only_pages ]\n else\n mapping_hash = @@apphelp_button_mappings[ :for_general_use ]\n end\n\n mapping = mapping_hash[ action ] || @@apphelp_button_mappings[ :for_general_use ][ :default ]\n ctrl = options_for_link[ :controller ] || controller.class\n variant = options_for_link.delete( :variant ) || mapping[ :variant ]\n icon = options_for_link.delete( :icon ) || mapping[ :icon ]\n text = options_for_link.delete( :text ) || apphelp_heading( ctrl, action )\n\n options_for_link[ :class ] ||= \"#{ variant } round\"\n\n buttons += ' ' unless ( buttons.empty? )\n buttons += apphelp_protected_link_to(\n action,\n options_for_link,\n options_for_url\n ) do\n image_tag(\n \"icons/#{ icon }.png\",\n :alt => '' # Explicit empty ALT text => icon not important for screen reading\n ) << text\n end\n end\n\n return buttons\n end",
"def button_defaults\n {\n name: \"NAME PLACEHOLDER\",\n type: 'donation',\n style: 'none',\n text: 'tip!',\n price_currency_iso: \"USD\",\n description: \"Tip\",\n price_string: '1',\n custom: \"CUSTOM PLACEHOLDER\",\n callback_url: 'http://guarded-journey-5941.herokuapp.com/callback',\n variable_price: true,\n choose_price: true,\n price1: '0.5',\n price2: '1',\n price3: '2',\n price4: '5',\n price5: '10'\n }\n end",
"def to_message_with_buttons\n {\n attachment: {\n type: 'template',\n payload: {\n template_type: 'button',\n text: self.message,\n buttons: self.get_buttons\n }\n }\n }\n end",
"def set_fab_button_options\n opt = { items: {}}\n case params[:action]\n when 'nothing'; opt = opt\n # when 'new'; #opt[:items].merge! print: { ajax: 'get', icon: 'print', class: 'blue lighten-2', url: '/stock_items/print?print_list=true', browser: 'new' }\n # when 'edit'; #opt[:items].merge! print: { ajax: 'get', icon: 'print', class: 'blue lighten-2', url: '/stock_items/print?print_list=true', browser: 'new' }\n # when 'show'; opt[:items].merge! print: { ajax: 'get', icon: 'print', class: 'blue lighten-2', url: '/stock_items/print', browser: 'new' }\n # when 'index'; opt[:items].merge! print: { ajax: 'get', icon: 'print', class: 'blue lighten-2', url: '/stock_items/print?print_list=true', browser: 'new' }\n end\n\n # = build_print_link(f.object, list: false, print_options: \"print_cmd=print_label\", button: 'icon-tag', text: 'Udskriv dæk label')\n @fab_button_options = opt\n end",
"def action(sym, ops = {})\n\t \tops[:icon] ||= sym\n\t \tops[:title] ||= sym.to_s.humanize\n\t \tif ops[:icon].is_a?(String)\n\t \t\tadd_icon sym => ops[:icon]\n\t \t\tops[:icon] = sym\n\t \tend\n @actions[sym] = ops\n\t end",
"def integrated_slat_action_html_options\n { href: href,\n class: integrated_slat_action_link_css_classes,\n method: send(:method),\n remote: remote,\n data: integrated_slat_action_html_data_attributes }\n end",
"def collectible_buttons_all\n h = {}\n collectible_buttons_available.each { |name| h[name.to_sym] = true }\n h\n end",
"def create_buttons buttons, parent = nil\n\n buttons.each do |label, options|\n button = create_button(label)\n\n modifiers = options[:modifiers] || @accelerator_mods\n parent = options[:parent] || parent\n\n options[:keys].each do |key|\n\n key = Gdk::Keyval.from_name(key) if key.is_a? String\n\n button.add_accelerator(\n \"activate\", # event to call\n @accelerator_group, # accelerator group\n key, # Value of the key that will call this event\n modifiers, # any key modifiers (shift, ctrl, etc)\n @accelerator_flags # accelerator flags\n )\n end\n\n # if the parent exists, add this button to the parent\n parent.pack_start(button, true, true) unless !parent\n\n @buttons[label] = button\n end\n\n end",
"def button # :nodoc:\n @properties['button'].dup\n end",
"def initialize_intern_components\n super\n @title_label = Label.new(\n name: 'button_title',\n parent: self,\n value: @style[:title],\n font: @style[:font]\n )\n Interactive.objects.delete(@title_label)\n end",
"def related_button_mapping\n @@related_button_mapping ||= Hash[Danbooru.config.full_tag_config_info.map { |k, v| [k, v[\"relatedbutton\"]] }]\n end",
"def create_action_buttons *labels\n @action_buttons = []\n _row = @height-3\n _col = (@width-(labels.count*8))/2\n _col = 5 if _col < 1\n\n labels.each_with_index do |l, ix|\n b = Button.new text: l, row: _row, col: _col\n _col += l.length+5\n @action_buttons << b\n @form.add_widget b\n b.command do\n @selected_index = ix\n throw(:close, ix)\n end\n end\n ## 2018-05-17 - associate RETURN ENTER key with first button (FIXME) should be Ok or Okay or user \n ## should have some say in this. Same for associating ESC with Cancel or Quit.\n @form.bind_key(10, \"Fire Ok button\") { @action_buttons.first.fire }\n end",
"def how_to_create_buttons args\n # Define a button style\n args.state.button_style = { w: 82, h: 10, }\n\n # Render instructions\n args.state.button_message ||= \"Press a Button!\"\n args.nokia.labels << args.nokia\n .default_label\n .merge(x: 42,\n y: 82,\n text: args.state.button_message,\n alignment_enum: 1)\n\n\n # Creates button one using a border and a label\n args.state.button_one_border = args.state.button_style.merge( x: 1, y: 32)\n args.nokia.borders << args.state.button_one_border\n args.nokia.labels << args.nokia\n .default_label\n .merge(x: args.state.button_one_border.x + 2,\n y: args.state.button_one_border.y + NOKIA_FONT_SM_HEIGHT + 2,\n text: \"Button One\")\n\n # Creates button two using a border and a label\n args.state.button_two_border = args.state.button_style.merge( x: 1, y: 20)\n\n args.nokia.borders << args.state.button_two_border\n args.nokia.labels << args.nokia\n .default_label\n .merge(x: args.state.button_two_border.x + 2,\n y: args.state.button_two_border.y + NOKIA_FONT_SM_HEIGHT + 2,\n text: \"Button Two\")\n\n # Initialize the state variable that tracks which button was clicked to \"\" (empty stringI\n args.state.last_button_clicked ||= \"--\"\n\n # If a click occurs, check to see if either button one, or button two was clicked\n # using the inside_rect? method of the mouse\n # set args.state.last_button_clicked accordingly\n if args.nokia.mouse_click\n if args.nokia.mouse_click.inside_rect? args.state.button_one_border\n args.state.last_button_clicked = \"One Clicked!\"\n elsif args.nokia.mouse_click.inside_rect? args.state.button_two_border\n args.state.last_button_clicked = \"Two Clicked!\"\n else\n args.state.last_button_clicked = \"--\"\n end\n end\n\n # Render the current value of args.state.last_button_clicked\n args.nokia.labels << args.nokia\n .default_label\n .merge(x: 42,\n y: 5,\n text: args.state.last_button_clicked,\n alignment_enum: 1)\nend",
"def calculate_toolbars\n toolbars = {}\n if display_back_button? # taskbar branch\n toolbars['summary_center_tb'] = controller.restful? ? \"summary_center_restful_tb\" : \"summary_center_tb\"\n end\n\n # FIXME: singular vs plural for controller.class.toolbar_singular\n toolbars['center_tb'] = if controller.class.toolbar_plural.present? && params[:action] == 'show_list'\n \"#{controller.class.toolbar_plural}_center_tb\"\n elsif controller.class.toolbar_singular.present?\n \"#{controller.class.toolbar_singular}_center_tb\"\n elsif controller.try(:toolbar)\n controller.toolbar.to_s\n else\n center_toolbar_filename\n end\n toolbars['custom_tb'] = controller.custom_toolbar\n\n toolbars['view_tb'] = inner_layout_present? ? x_view_toolbar_filename : view_toolbar_filename\n toolbars\n end",
"def icon_button(icon: nil, text: nil, url: nil, **opt)\n icon ||= BLACK_STAR\n text ||= opt[:title] || 'Action' # TODO: I18n\n opt[:title] ||= text\n\n sr_only = html_span(text, class: 'text sr-only')\n symbol = html_span(icon, class: 'symbol', 'aria-hidden': true)\n label = sr_only << symbol\n\n if url\n # noinspection RubyMismatchedArgumentType\n make_link(label, url, **opt)\n else\n if opt[:tabindex].to_i == -1\n opt.except!(:tabindex, :role)\n else\n opt[:tabindex] ||= 0\n opt[:role] ||= 'button'\n end\n html_span(label, opt)\n end\n end",
"def action_configuration\n configuration[action] || {}\n end",
"def load_keys\n @@keys = Hash[buttons.map{|button| [button.text, button]}]\n end",
"def createNewHypothesisButton()\n\t\treturn ButtonCreator.new(\n\t\t\t:assetName => 'plus.png', \n\t\t\t:assetSize => 40, \n\t\t\t:parent => self,\n\t\t\t:clicked => :btn_new_clicked\n\t\t)\n\tend",
"def render_button\n NfgUi::Components::Elements::Button.new({ **integrated_slat_action_button_component_options, body: (block_given? ? yield : body) }, view_context).render\n end",
"def custom_button(entity, action, path, label)\n\t\temployee_icons = {\"show\" => 'icons/icons_01.gif',\n\t\t\t\t\t\t\"new\" => 'icons/icons_02.gif',\n\t\t\t\t\t \"del\" => 'icons/icons_03.gif',\n\t\t\t\t\t\t\"edit\" => 'icons/icons_04.gif'\n\t\t}\n\t\tassign_icons = { \"show\" => 'icons/icons_05.gif',\n\t\t\t\t\"new\" => 'icons/icons_06.gif',\n\t\t\t \"del\" => 'icons/icons_07.gif',\n\t\t\t\t\"edit\" => 'icons/icons_08.gif'\n\t\t}\n\t\tstore_icons = { \"show\" => 'icons/icons_09.gif',\n\t\t\t\t\"new\" => 'icons/icons_10.gif',\n\t\t\t \"del\" => 'icons/icons_11.gif',\n\t\t\t\t\"edit\" => 'icons/icons_12.gif'\n\t\t}\n\t\tjob_icons = { \"show\" => 'icons/icons_13.gif',\n\t\t\t\t\"new\" => 'icons/icons_14.gif',\n\t\t\t\t\"del\" => 'icons/icons_15.gif',\n\t\t\t \"edit\" => 'icons/icons_16.gif'\n\t\t}\t\n\t\tshift_icons = { \"show\" => 'icons/icons_17.gif',\n\t\t\t\t\"new\" => 'icons/icons_18.gif',\n\t\t\t\t\"del\" => 'icons/icons_19.gif',\n\t\t\t\t\"edit\" => 'icons/icons_20.gif'\n\t\t}\t\t\t\t\t\t\t \n\t\ticons = { \"employee\" => employee_icons, \n\t\t\t \"assignment\" => assign_icons, \n\t\t\t \"store\" => store_icons, \n\t\t\t \"job\" => job_icons, \n\t\t\t \"shift\" => shift_icons\n\t\t}\n\t\timg_tag = image_tag(icons[entity][action], :alt => label)\n\t\treturn '<a href=\"' + path + '\" class=\"btn btn-large ' + action + '\">' + label + \" \" + img_tag + '</a>'\n\tend",
"def submit_hash\n hash=Hash.new\n\n hash[:id]=\"test\"+self.id.to_s\n\n # this should add classes to be used by Javascript to the submit buttons\n # e.g. <input type=\"button\" ...=submit ... geoLocation=\"true\">\n self.dynamic_params.each do |param|\n hash[param.value]=\"true\"\n end\n return hash\n end",
"def create_dynamic_text_card(btn_caption, webhook, method, text, body = {})\n buttons = []\n buttons.push(create_dynamic_button_hash(btn_caption, webhook, method, body))\n message_array = []\n message_hash = {}\n message_hash[:type] = \"text\"\n message_hash[:text] = text\n message_hash[:buttons] = buttons\n message_array.push(message_hash)\n return message_array\n end",
"def create_buttons\n @buttons = Array.new(@image_indexes.size) do |i|\n UI::PSDKMenuButton.new(@viewport, @image_indexes[i], i)\n end\n end",
"def tab_options(action, scope = nil)\n {\n 'id' => \"#{action}-tab\",\n 'class' => @tab == action && 'active',\n 'data-title' => translate_in_controller_scope(\"#{scope || action}.title\"),\n }\n end",
"def headbutt_options(opts={})\n self.headbutt_options_hash = get_headbutt_options.merge(opts.stringify_keys)\n end",
"def backend_menu\n config = AccountAccess.maps_for(current_account).collect(&:project_modules).flatten.uniq.collect(&:config)\n config << { :text => I18n.t(\"backend.menus.help\", :default => \"Help\"), :handler => \"function() { Backend.app.openHelp() }\".to_l }\n return config.to_json\n end",
"def shipping_add_addconfm_button\n # unit_test_no_generate: shipping_add_addconfm_button, button.className(create_ats_regex_string(\"ats-wis-shipaddrconfcontinuebtn\"))\n\t\t$tracer.trace(__method__)\n\t return ToolTag.new(button.className(create_ats_regex_string(\"ats-wis-shipaddrconfcontinuebtn\")), __method__)\n\tend",
"def button_with_icon(text , icon, options = { })\n return \"<button id='foo_submit' class = '#{options[:class]} ui-corner-all fg-button ui-state-default fg-button-icon-left' type='submit' name='commit'><span class='ui-icon ui-icon-#{icon}'></span>#{text}</button>\"\n end",
"def render\n write_item = toolbar_item(:label => \"Write\", :image => image(icon_path(\"187-pencil\")))\n \n read_item = toolbar_item(:label => \"Read\", :image => image(icon_path(\"57-download\")))\n read_item.on_action { connect_serial }\n \n reset_item = toolbar_item(:label => \"Reset\", :image => image(icon_path(\"01-refresh\")))\n \n expert_view_item = toolbar_item(:label => \"Expert view\") do |ev|\n ev.view = button(:title => \"Expert\", :bezel => :textured_rounded, :type => :push_on_push_off )\n end\n \n debug_item = toolbar_item(:label => \"Debug console\", :image => image(:named => \"NSActionTemplate\"))\n debug_item.on_action { connect_serial }\n \n # search_item = toolbar_item(:identifier => \"Search\") do |si|\n # search = search_field(:frame => [0, 0, 150, 30], :layout => {:align => :right, :start => false})\n # search.on_action { |sender| filter_instances(search) }\n # si.view = search\n # end\n \n tbar = toolbar(:default => [read_item, write_item, reset_item, debug_item, :flexible_space, expert_view_item]) \n \n # TODO: someone please tell me how where I go wrong:\n HotCocoaApplication.instance.controllers[:application_controller].application_window.toolbar = tbar\n end",
"def button_attributes(transaction_type='sale', hash_method='sha1')\n attributes = {\n api_login_id: api_login_id,\n method: transaction_type,\n version_number: API_VERSION,\n total_amount: orderable.total_amount,\n utc_time: DotNetTime.now.ticks,\n order_number: orderable.order_number,\n #\n # `customer_token` is optional if `paymethod_token` exist, and vice versa.\n #\n customer_token: nil,\n #paymethod_token: nil,\n signature: nil\n }\n\n hmac_signature = Hmac.signature(\n secure_transaction_key,\n attributes.values.join('|'),\n hash_method\n )\n\n attributes.update(\n hash_method: hash_method,\n signature: hmac_signature\n )\n end",
"def sf_tooltip_hash(placement: 'right', text: nil, i18n: nil)\n tooltip_text =\n if i18n\n I18n.t(\"simple_form.hints.#{i18n}\")\n else\n text\n end\n\n {\n hint: false,\n label_html: {\n data: {\n toggle: 'tooltip',\n placement: placement,\n },\n title: tooltip_text,\n },\n }\n end",
"def call_to_action_params\n params.permit(:description, :button_text, :button_link, :position, :bg_color, :bg_border_size, :bg_border_type, :bg_border_color, :bg_border_radius, :btn_color, :btn_border_size, :btn_border_type, :btn_border_color, :btn_border_radius, :user_id, :brand_id)\n end",
"def button_texts\n return [nil, nil, nil, ext_text(9000, 115)]\n end",
"def generate\n return {} if config.empty?\n assets = {}\n config.each do |key, value|\n next if key == \"widgets\" # Widgets are handled separately.\n assets[key] = Array(value).map { |v|\n {\n \"url\" => url(v),\n \"id\" => File.join(@ruhoh.paths.theme, \"javascripts\", v)\n }\n }\n end\n \n assets\n end",
"def button_texts\n return [nil, nil, nil, ext_text(9000, 115)]\n end",
"def any_button_text(btn_text)\n btns = { 'Client' => @client.nick ,\n 'Project' => \"#{@client.projects.last.name} (#{@client.projects.last.id})\" ,\n 'Destroy Project' => \"Destroy \" + @client.projects.first.name } # TODO: less than ideal - i wanted all named \"Destroy Project\" - but these are hard to nail down\n btns[btn_text] || btn_text\nend",
"def __init_title_dic\n {\n upd: ['Update', 10, __sid(:site)],\n system: ['System', 13, __sid(:val)],\n mcr: ['MACRO', 3, __sid(:args, :async)],\n exec: ['EXEC', 13, __sid(:site, :args)],\n cfg: ['Config', 14, __sid(:site, :args)],\n sleep: ['Sleeping(sec)', 6, __sid(:val)],\n select: ['SELECT', 3, __sid(:site, :var)],\n wait: ['Waiting', 6, __sid(:retry)]\n }.update(Title_Dic)\n end",
"def to_jaxb_json_hash\n _h = {}\n _h['showFindArtifacts'] = showFindArtifacts.to_jaxb_json_hash unless showFindArtifacts.nil?\n _h['appletFindEnabled'] = appletFindEnabled.to_jaxb_json_hash unless appletFindEnabled.nil?\n _h['disableEasterEggs'] = disableEasterEggs.to_jaxb_json_hash unless disableEasterEggs.nil?\n _h['applicationUrl'] = applicationUrl.to_jaxb_json_hash unless applicationUrl.nil?\n _h['disableRegistration'] = disableRegistration.to_jaxb_json_hash unless disableRegistration.nil?\n return _h\n end",
"def button_actions\n return @button_actions if @button_actions\n\n @button_actions = [proc {}]\n\n @button_actions << proc do\n @units = swap_units(@units || 'imperial')\n end\n\n @button_actions << proc do\n @disp = @disp == :temp ? :desc : :temp\n end\n\n @button_actions << proc do\n raise IndexError, 'Cancel button was pressed'\n end\n end",
"def hash\n [is_disabled, action_type, external_url, target_slide_index, target_frame, tooltip, history, highlight_click, stop_sound_on_click, color_source, sound_base64].hash\n end",
"def to_param_string_hash\n res = {}\n \n # insert all the string properties\n %w[title description category_id poster_contact url\n source expiration_date for_sale price region_id address1 \n address2 city state country zip lat long].each do |att|\n res[att] = (self.send att).send \"to_s\" if self.respond_to? att\n end\n\n # need to make sure that Net::HTTP.post_form will pass this correctly\n res[\"image_urls[]\"] = self.image_urls\n res\n end",
"def create_header_gallery_element(title, subtitle, image_url, buttons_array = [])\n title = title\n subtitle = subtitle\n image_url = image_url\n # action_url = action_url\n create_message_element_hash(title, subtitle, image_url, buttons_array)\n end",
"def filter_options(action, scope = nil)\n {\n id: \"#{action}-tab\",\n class: @tab == action ? \"radio_button filter active\" : \"radio_button filter inactive\",\n \"data-title\" => translate_in_controller_scope(\"#{scope || action}.title\"),\n }\n end",
"def default_bbar\n [\n :show_details.action, # The custom action defined below via JS\n :search.action,\n \"-\", # Adds a separator\n :del.action,\n \"-\",\n {\n :menu => [:add_in_form.action, :edit_in_form.action],\n :text => I18n.t(:edit_in_form),\n :icon => \"/images/icons/application_form.png\"\n },\n \"-\",\n :row_counter.action\n ]\n end",
"def control_icon_button(action, index: nil, unique: nil, css: '.icon', **opt)\n prop = opt.extract!(*ICON_PROPERTIES)\n case (active = prop[:active])\n when nil then # Enabled if not specified otherwise.\n when true, false then return unless active\n when Proc then return unless active.call(object)\n else return unless true?(active)\n end\n case (path = prop[:path])\n when Symbol then # deferred\n when Proc then path = path.call(object)\n else path ||= path_for(object, action: action)\n end\n return if path.blank?\n\n uniq_opt = { index: index, unique: unique }.compact\n opt[:id] = unique_id(*opt[:id], **uniq_opt) if uniq_opt.present?\n\n if opt[:title].blank? && (tip = prop[:tooltip]).present?\n tip = tip.include?('%') ? (tip % { item: model_type }) : tip.dup\n tip = \"#{tip} #{index.next}\" if index && tip.sub!(' this ', ' ')\n opt[:title] = tip\n end\n\n opt[ACTION_ATTR] ||= action\n\n return yield(path, opt) if block_given?\n\n icon = prop[:icon] || BLACK_STAR\n icon = symbol_icon(icon)\n\n prepend_css!(opt, css, action)\n if path == :button\n html_button(icon, **opt)\n else\n # noinspection RubyMismatchedArgumentType\n make_link(icon, path, **opt)\n end\n end",
"def to_js\n \"var #{@name}\t\t= new GIcon();\n #{@name}.image\t\t= \\\"#{@image_url}\\\";\n #{@name}.shadow\t\t= \\\"#{@shadow_url}\\\";\n #{@name}.iconSize = new GSize(#{@width}, #{@height});\n #{@name}.shadowSize = new GSize(#{@shadow_width}, #{@shadow_height});\n #{@name}.iconAnchor = new GPoint(#{@anchor_x}, #{@anchor_y});\n #{@name}.infoWindowAnchor = new GPoint(#{@info_anchor_x}, #{@info_anchor_y});\n \"\n end",
"def command_btn(title:, key:, display:, help: nil, color: \"default\")\n button_tag(title,\n class: \"btn btn-#{color} btn-block\",\n title: help,\n id: \"#{key.to_s.downcase}_btn\",\n data: {\n toggle: \"cli\",\n target: cli_product_path(key, name: @product.name, type: @type),\n title: title,\n cmd: \"<code>#{display}</code>\"\n })\n end",
"def createHypothesisButtons(hypothesis)\n\t\tcss = self.btnCSS(hypothesis)\n\t\taccept = ButtonCreator.new(:assetName => 'check.png', :assetSize => 40, :css => css)\n\t\treject = ButtonCreator.new(:assetName => 'close.png', :assetSize => 40, :css => css)\n\n\t\taccept.signal_connect('clicked') { self.btn_accept_clicked(hypothesis) }\n\t\treject.signal_connect('clicked') { self.btn_reject_clicked(hypothesis) }\n\n\t\treturn GridCreator.fromArray([accept, reject], :vertical => true)\n\tend",
"def render_additional_action_buttons(obj)\n template = self.additional_action_buttons\n if !template.nil?\n result = render_to_string :partial => template, :locals => {obj: obj}\n result.html_safe\n else\n \"\"\n end\n end",
"def mgs_buy_as_new_account_btn\n\t\t$tracer.trace(__method__)\n\t\treturn ToolTag.new(button.className(create_ats_regex_string(\"ats-buyasnew\")), __method__)\n\tend",
"def __val2ruby_optkeys # { key=>proc, ... }\n super().update('labelwidget'=>proc{|v| window(v)})\n end",
"def submit_button_template(l = {})\n <<-END\n <div class=\"button\">#{l[:element]}</div>\n\t END\n end",
"def button(value=nil, options={})\n value, options = nil, value if value.is_a?(Hash)\n\n value ||= I18n.t(\"manageable.save\")\n options[:class] = [options[:class], \"button\"].compact.join(\" \")\n image = @template.image_tag(options.delete(:image) || \"/assets/manageable/icons/tick.png\", :alt => value)\n\n @template.button_tag(options) do\n [image, value].compact.join(\" \").html_safe\n end\n end",
"def attributes_for_api(action)\n ret = {}\n\n return ret if action.input_layout != :object\n\n action.input_params.each do |name, param|\n case param[:type]\n when 'Resource'\n ret[name] = @params[name][ param[:value_id].to_sym ]\n\n else\n ret[name] = @params[name]\n end\n end\n\n ret\n end",
"def js_extend_properties\n {\n :init_component => js_init_component.l\n }\n end",
"def create_texts\n self.title = I18n.t(:tictactoe)\n @new_btn.label = I18n.t(:new_game)\n @quit_btn.label = I18n.t(:quit)\n @default_size_btn.label = I18n.t(:default_size)\n end",
"def html_button(*args, &block)\n label = args.first.presence\n symbols = only_symbols?(label)\n accessible_name?(*args) if Log.debug? && (symbols || label.blank?)\n args[0] = symbol_icon(label) if symbols\n html_tag(:button, *args, &block)\n end",
"def promotion_code_apply_button\n $tracer.trace(__method__)\n #unit_test_no_generate: promotion_code_apply_button, button.className(create_ats_regex_string(\"ats-promoapplybtn\"))\n return ToolTag.new(button.className(create_ats_regex_string(\"ats-promoapplybtn\")), __method__, self)\n end",
"def call\n {\n name: app.name,\n html: {\n name: 'html',\n code: app.html.code,\n show: app.html.show,\n },\n css: {\n name: 'css',\n code: app.css.code,\n show: app.css.show,\n },\n ruby: {\n name: 'ruby',\n code: app.ruby.code,\n show: app.ruby.show,\n },\n show_js: app.show_js,\n }\n end",
"def button_link(title, url, icon = nil, html_options = {}) # TODO: use this more\n html_options[:class] = '' unless html_options[:class]\n html_options[:class] += ' btn ' unless html_options[:class].include?('btn ')\n html_options[:class] += ' btn-default ' unless html_options[:class].include?('btn-')\n if icon\n link = link_to(url, html_options) do\n if icon.include?('psap-entity-icon')\n raw(icon.gsub('psap-entity-icon', '')) + ' ' + title\n elsif icon.include?('glyphicon')\n content_tag(:span, '', class: 'glyphicon ' + icon) + ' ' + title\n else\n content_tag(:i, '', class: 'fa ' + icon) + ' ' + title\n end\n end\n return raw(link)\n end\n raw(link_to(title, url, html_options))\n end",
"def linkbutton\n config[\"linkbutton\"]\n end",
"def build\n @buttons = Hash.new\n create_palettes\n end",
"def default_bbar\n [\n :add.action, :edit.action, :apply.action, :del.action,\n \"-\", # Adds a separator\n {\n :menu => [:add_in_form.action, :edit_in_form.action],\n :text => I18n.t(:edit_in_form),\n :icon => \"/images/icons/application_form.png\"\n },\n \"-\", # Adds a separator\n :row_counter.action\n ]\n end",
"def default_bbar\n [\n :add.action, :edit.action, :apply.action, :del.action,\n \"-\", # Adds a separator\n :search.action,\n \"-\", # Adds a separator\n {\n :menu => [:add_in_form.action, :edit_in_form.action],\n :text => I18n.t(:edit_in_form),\n :icon => \"/images/icons/application_form.png\"\n },\n \"-\", # Adds a separator\n :row_counter.action\n ]\n end",
"def human_button_name(button_name, options = {})\n defaults = lookup_ancestors.map do |klass|\n :\"#{self.i18n_scope}.buttons.#{klass.model_name.i18n_key}.#{button_name}\"\n end\n \n defaults << :\"buttons.#{button_name}\"\n defaults << options.delete(:default) if options[:default]\n defaults << button_name.to_s.humanize\n \n options.reverse_merge! :default => defaults\n I18n.translate(defaults.shift, options)\n end",
"def _init_action(action_hash)\n obj = _load_asset(ASSET_TYPE_ACTION, action_hash[:name])\n obj.parameters = action_hash[:parameters]\n obj\n end",
"def gen_offer_params(action, publisher_app)\n raise \"publisher_app is required to generate offer parameters because an offer must be clicked and converted in the context of a publishing app showing the offer\" unless publisher_app\n params = params_for(offer_params_group, action)\n params.merge!(TestChamber.current_device.params_for(offer_params_group, action))\n params.merge!(publisher_app.params_for(offer_params_group, action))\n end",
"def config\n if @url.blank? && @items.empty?\n options = human_name\n else\n options = @options.merge(:text => human_name)\n options.merge!(:menu => @items.collect(&:config)) if @items.size > 0\n options.merge!(:handler => \"function(){ Backend.app.load('#{url}') }\".to_l) if !@url.blank?\n end\n options\n end",
"def init_jaxb_json_hash(_o)\n @showFindArtifacts = Boolean.from_json(_o['showFindArtifacts']) unless _o['showFindArtifacts'].nil?\n @appletFindEnabled = Boolean.from_json(_o['appletFindEnabled']) unless _o['appletFindEnabled'].nil?\n @disableEasterEggs = Boolean.from_json(_o['disableEasterEggs']) unless _o['disableEasterEggs'].nil?\n @applicationUrl = String.from_json(_o['applicationUrl']) unless _o['applicationUrl'].nil?\n @disableRegistration = Boolean.from_json(_o['disableRegistration']) unless _o['disableRegistration'].nil?\n end",
"def graph_params(title: \"\", subtitle: \"\", caption: \"\", x_label: \"\", y_label: \"\")\n R.labs(\n title: title, \n subtitle: subtitle, \n caption: caption,\n y_label: y_label, \n x_label: x_label, \n )\n end",
"def extras_codes\n code = []\n\n codes = {}\n if table.global_action_columns.any?\n\n actions = ''\n actions << \"<span class=\\\"list-actions\\\" data-list-ref=\\\"#{uid}\\\">'\"\n for column in table.global_action_columns\n actions << \" + link_to(content_tag(:i) + h(' ' + :#{column.name}.t(scope: 'rest.actions')), #{column.default_url.inspect}, class: 'btn btn-#{column.name}'#{', style: \"display: none\"' unless column.use_none?}#{', method: \"' + column.options[:method].to_s + '\"' if column.options[:method]}, data: {list_actioner: :#{column.use_none? ? 'none' : 'many'}#{', confirm: :' + column.options[:confirm].to_s + '.t(scope: \"labels\")' if column.options[:confirm]}})\"\n end\n actions << \" + '</span>\"\n code << \"'#{actions}'\"\n\n codes[:actions] = \"'#{actions}'\"\n end\n\n code << \"'#{menu_code}'\"\n codes[:settings] = \"'#{menu_code}'\"\n\n if table.paginate?\n pagination = ''\n current_page = var_name(:page).to_s\n last_page = var_name(:last).to_s\n\n pagination << \"<span class=\\\"list-pagination\\\" data-list-ref=\\\"#{uid}\\\">\"\n pagination << \"<span class=\\\"status\\\">' + 'list.pagination.x_to_y_of_total'.t(x: (#{var_name(:offset)} + (#{var_name(:count)} > 0 ? 1 : 0)), y: ((#{var_name(:last)} == #{var_name(:page)}) ? #{var_name(:count)} : #{var_name(:offset)} + #{var_name(:limit)}), total: #{var_name(:count)}) + '</span>\"\n\n pagination << '<span class=\"paginator\">'\n pagination << \"<a href=\\\"#\\\" data-list-move-to-page=\\\"' + (#{current_page} - 1).to_s + '\\\" class=\\\"btn previous-page\\\"' + (#{current_page} != 1 ? '' : ' disabled=\\\"true\\\"') + '><i></i>' + ::I18n.translate('list.pagination.previous') + '</a>\"\n\n pagination << \"<a href=\\\"#\\\" data-list-move-to-page=\\\"' + (#{current_page} + 1).to_s + '\\\" class=\\\"btn next-page\\\"' + (#{current_page} != #{last_page} ? '' : ' disabled=\\\"true\\\"') + '><i></i>' + ::I18n.translate('list.pagination.next')+'</a>\"\n pagination << '</span>'\n\n pagination << '</span>'\n\n code << \"'#{pagination}'\"\n codes[:pagination] = \"'#{pagination}'\"\n\n if table.options[:footer_pagination]\n pagination = ''\n current_page = var_name(:page).to_s\n last_page = var_name(:last).to_s\n\n pagination << \"<span class=\\\"list-footer-pagination\\\" data-list-ref=\\\"#{uid}\\\">\"\n pagination << \"<span class=\\\"status\\\">' + 'list.pagination.x_to_y_of_total'.t(x: (#{var_name(:offset)} + (#{var_name(:count)} > 0 ? 1 : 0)), y: ((#{var_name(:last)} == #{var_name(:page)}) ? #{var_name(:count)} : #{var_name(:offset)} + #{var_name(:limit)}), total: #{var_name(:count)}) + '</span>\"\n\n pagination << '<span class=\"paginator\">'\n pagination << \"<a href=\\\"#\\\" data-list-move-to-page=\\\"' + (#{current_page} - 1).to_s + '\\\" class=\\\"btn previous-page\\\"' + (#{current_page} != 1 ? '' : ' disabled=\\\"true\\\"') + '><i></i>' + ::I18n.translate('list.pagination.previous') + '</a>\"\n\n pagination << \"<a href=\\\"#\\\" data-list-move-to-page=\\\"' + (#{current_page} + 1).to_s + '\\\" class=\\\"btn next-page\\\"' + (#{current_page} != #{last_page} ? '' : ' disabled=\\\"true\\\"') + '><i></i>' + ::I18n.translate('list.pagination.next')+'</a>\"\n pagination << '</span>'\n\n pagination << '</span>'\n\n code << \"'#{pagination}'\"\n codes[:footer_pagination] = \"'#{pagination}'\"\n end\n end\n codes\n end",
"def create_actions\n app = self\n\n # Help > About box\n @about_action = Qt::Action.new(tr(\"&About...\"), self) do\n self.status_tip = tr(\"Show information about the application.\")\n connect(SIGNAL(:triggered)) do\n Qt::MessageBox.about(nil,\n tr(\"About the Wallet\"),\n tr(\"Visit <a href='http://opencoinage.org/'>OpenCoinage.org</a> for more information.\"))\n end\n end\n\n # Currency > Import file dialog\n @import_file_action = Qt::Action.new(tr(\"Import from &File...\"), self) do\n self.status_tip = tr(\"Import a currency contract from a file.\")\n connect(SIGNAL(:triggered)) do\n if file = app.open_file_dialog(caption = tr(\"Import Currency\"))\n app.not_implemented_yet(caption) # TODO\n end\n end\n end\n\n # Currency > Import URL dialog\n @import_url_action = Qt::Action.new(tr(\"Import from &URL...\"), self) do\n self.status_tip = tr(\"Import a currency contract from a URL.\")\n connect(SIGNAL(:triggered)) do\n if url = app.get_text(caption = tr(\"Import Currency\"), tr(\"Enter a currency URL:\"), :text => \"http://\")\n app.not_implemented_yet(caption) # TODO\n end\n end\n end\n\n # Token > Verify dialog\n @verify_action = Qt::Action.new(tr(\"&Verify...\"), self) do\n self.status_tip = tr(\"Verify the selected tokens with the issuer.\")\n connect(SIGNAL(:triggered)) do\n app.not_implemented_yet(caption = tr(\"Verifying Tokens\")) # TODO: progress dialog\n end\n end\n\n # Token > Reissue dialog\n @reissue_action = Qt::Action.new(tr(\"&Reissue...\"), self) do\n self.status_tip = tr(\"Reissue the selected tokens with the issuer.\")\n connect(SIGNAL(:triggered)) do\n app.not_implemented_yet(caption = tr(\"Reissuing Tokens\")) # TODO: progress dialog\n end\n end\n end",
"def key_defs(actions)\n return actions.map{|(in_key, action)| {'key_code' => in_key}}\nend",
"def build_symbols(options)\n if options == :ascii\n ASCII_SYMBOLS\n elsif options.is_a? Hash\n base_symbols = options[:base] == :ascii ? ASCII_SYMBOLS : SYMBOLS\n if options[:override].is_a?(Hash)\n base_symbols.merge(options[:override])\n else\n base_symbols\n end\n else\n SYMBOLS\n end\n end",
"def render_buttons(doc, object)\n pid = doc['id']\n apo_pid = doc.apo_pid\n\n buttons = []\n if can?(:manage_content, object)\n buttons << {\n url: close_version_ui_item_path(pid),\n label: 'Close Version',\n check_url: workflow_service_closeable_path(pid)\n }\n\n buttons << {\n url: open_version_ui_item_path(pid),\n label: 'Open for modification',\n check_url: workflow_service_openable_path(pid)\n }\n end\n\n if can?(:manage_item, object)\n if object.is_a? Dor::AdminPolicyObject\n buttons << { url: edit_apo_path(pid), label: 'Edit APO', new_page: true }\n buttons << { url: new_apo_collection_path(apo_id: pid), label: 'Create Collection' }\n end\n\n buttons << {\n url: dor_reindex_path(pid: pid),\n label: 'Reindex',\n new_page: true\n }\n\n # note that the backend will also check can?(:manage_governing_apo, object, new_apo_id), but\n # we can't do that here, since we don't yet know what APO the user might move the object to.\n # so it's possible that the user will get this button even if there are no other APOs they're\n # allowed to move the object to.\n buttons << {\n url: set_governing_apo_ui_item_path(id: pid),\n label: 'Set governing APO',\n disabled: !object.allows_modification?\n }\n\n buttons << { url: new_item_workflow_path(item_id: pid), label: 'Add workflow' }\n\n buttons << {\n url: dor_path(pid: pid),\n label: 'Republish',\n check_url: workflow_service_published_path(pid),\n new_page: true\n }\n\n buttons << {\n url: purge_item_path(id: pid),\n label: 'Purge',\n new_page: true,\n confirm: 'This object will be permanently purged from DOR. This action cannot be undone. Are you sure?',\n disabled: !registered_only?(doc)\n }\n\n buttons << { url: source_id_ui_item_path(id: pid), label: 'Change source id' }\n buttons << { url: tags_ui_item_path(id: pid), label: 'Edit tags' }\n if [Dor::Item, Dor::Set].any? { |clazz| object.is_a? clazz } # these only apply for items, sets and collections\n buttons << { url: catkey_ui_item_path(id: pid), label: 'Manage catkey' }\n buttons << { url: collection_ui_item_path(id: pid), label: 'Edit collections' }\n end\n if object.datastreams.include? 'contentMetadata'\n buttons << { url: item_content_type_path(item_id: pid), label: 'Set content type' }\n end\n if object.datastreams.include? 'rightsMetadata'\n buttons << { url: rights_item_path(id: pid), label: 'Set rights' }\n end\n if object.datastreams.include?('identityMetadata') && object.identityMetadata.otherId('catkey').present? # indicates there's a symphony record\n buttons << { url: refresh_metadata_item_path(id: pid), label: 'Refresh descMetadata', new_page: true, disabled: !object.allows_modification? }\n end\n buttons << { url: manage_release_solr_document_path(pid), label: 'Manage release' }\n\n # TODO: add a date picker and button to change the embargo date for those who should be able to.\n buttons << { label: 'Update embargo', url: embargo_form_item_path(pid) } if object.is_a?(Dor::Item) && object.embargoed?\n\n end\n\n buttons\n end",
"def special_button(option)\n\t\t\tif defined? @_special_buttons and return_value = @_special_buttons[option.to_sym]\n\t\t\t\treturn_value\n\t\t\tend\n\t\tend",
"def _recreate_buttons\n $log.debug \" inside recreate_buttons: #{@tabs.size} \"\n r = @row\n col = @col + 1\n @buttons ||= []\n if !@buttons.empty?\n @buttons.each {|e| @form.remove_widget(e) }\n end\n @buttons = []\n button_gap = 4\n # the next line necessitates a clear on the pad\n # button_gap = 1 if @tabs.size > 6 # quick dirty fix, we need something that checks fit\n # we may also need to truncate text to fit\n\n @buttonpad.wclear\n ## create a button for each tab\n $tabradio = Variable.new # so we know which is highlighted\n @tabs.each do |tab|\n text = tab.text\n $log.debug \" TABS EACH #{text} \"\n @buttons << RubyCurses::TabbedButton.new(@form) do\n variable $tabradio\n text text\n name text\n value text\n row r + 1\n col col\n end\n col += text.length + button_gap\n # if col exceeds pad_w then we need to expand pad\n # but here we don't know that a pad is being used\n $log.debug \" button col #{col} \" \n form = tab.form\n form.set_parent_buffer(@window) if form\n\n b = @buttons.last\n b.command(b) { \n $log.debug \" calling display form from button press #{b.name} #{b.state} \"\n # form.rep essentially sees that buttons get correct attributes\n # when triggering M-<char>. This button should get highlighted.\n tab.repaint\n button_form_repaint #( b.state == :HIGHLIGHTED )\n if @display_tab_on_traversal\n # set as old tab so ONLY on going down this becomes current_tab\n @old_tab = tab\n else\n # next line means next key is IMMED taken by the tab not main form\n @current_tab = tab\n end\n fire_event tab, tab.index, :OPEN\n }\n end\n @recreate_buttons = false\n # make the buttons visible now, not after next handle_key\n @form.repaint\n end",
"def form_buttons(**opt)\n opt.reverse_merge!('data-manifest': object.id)\n buttons = super\n buttons << submission_button(**opt)\n buttons << export_button(**opt)\n buttons << import_button(**opt)\n buttons << comm_status(**opt)\n block_given? ? yield(buttons) : buttons\n end",
"def template_options(action)\n @template_options ||= {}\n @template_options[action] ||= [:layout, :template].inject({}) do |options, type|\n option = template_option(type, action)\n options[type] = option unless option.blank?\n options\n end\n end",
"def share_button(options={})\n %(\n <fb:share-button class=\"meta\">\n #{SHARE_META_OPTIONS.select {|o| options.keys.include?(o) }.collect {|o| %(<meta name=\"#{o}\" content=\"#{options[o]}\" />)}.join(\"\\n\") }\n #{SHARE_LINK_OPTIONS.select {|o| options.keys.include?(o) }.collect {|o| %(<link rel=\"#{o}\" href=\"#{options[o]}\" />)}.join(\"\\n\")}\n </fb:share-button>\n )\n end",
"def legend\n 'Global Constants'\n end",
"def legend\n 'Global Constants'\n end",
"def non_html_attribute_options\n super.push(:button, :confirm, :disable_with, :href, :method, :remote, :theme)\n end",
"def create_toolbars\n # TODO\n end",
"def title(title, global=true)\n global ? (before << \"Backend.app.setTitle(#{title.to_json});\") : config[:title] = title\n end",
"def default_bbar\n [\n :show_details.action,\n :ctrl_manage.action,\n :search.action,\n \"-\", # Adds a separator\n :add.action, :edit.action, :del.action,\n :apply.action,\n \"-\",\n {\n :menu => [:add_in_form.action, :edit_in_form.action],\n :text => I18n.t(:edit_in_form),\n :icon => \"/images/icons/application_form.png\"\n },\n \"-\",\n :row_counter.action\n ]\n end",
"def graph_for(attribute, options = {})\n\t\t\thash = {}\n\t\t\thash[attribute] = {\n\t\t\t\t:description => :show_graph, \n\t\t\t\t:icon => \"bar-chart\", \n\t\t\t\t:controller_option => true, \n\t\t\t\t:graph => true, # this tells the controller to treat this one special\n\t\t\t\t:graph_options => options\n\t\t\t}\n\t\t\tif @_special_buttons\n\t\t\t\t@_special_buttons.merge! hash\n\t\t\telse\n\t\t\t\t@_special_buttons = hash\n\t\t\tend\n\t\tend",
"def generate_options(action, xml, extra_params={})\n opts = extra_params || {}\n\n if EC2[action][:args]\n EC2[action][:args].each {|k,v|\n str = ec2_value(xml, k, &v[:proc])\n if str\n tmp = opts\n last_key = nil\n v[:opt].split('/').each { |key|\n k = key.to_sym\n tmp = tmp[last_key] if last_key\n tmp[k] = {}\n last_key = k\n }\n tmp[last_key] = str\n end\n }\n end\n\n opts\n end",
"def helper_app_btn_icon_edit_row\n \"btn glyphicon glyphicon-edit\"\n end",
"def build_title(action, title)\n if !!action &&\n ([:edit, :show, :list, :back, :cancel].include? action.to_sym)\n prev = action.to_s.humanize\n title.blank? ? prev : \"#{prev} #{title}\"\n else\n title.to_s\n end\n end",
"def make_popup_toggle(button: nil, text: nil, label: nil, type: nil, **opt)\n type ||= (:button if button) || (:text if text) || :icon\n opt[:tabindex] ||= 0\n opt[:role] ||= 'button'\n opt[:'aria-label'] ||= opt[:title]\n opt[:'aria-haspopup'] ||= 'dialog'\n prepend_css!(opt, POPUP_TOGGLE_CLASS, type)\n if button.is_a?(Hash)\n # noinspection RubyMismatchedArgumentType\n merge_html_options!(opt, button)\n label = opt.delete(:label) || label || text || 'Popup' # TODO: I18n\n html_button(label, opt)\n elsif button\n html_div(button, opt)\n elsif text\n text ||= label || 'Click' # TODO: I18n\n html_span(text, opt)\n else\n icon_button(**opt)\n end\n end",
"def config\n options = @options.merge(:text => human_name)\n options.merge!(:menu => @menus.collect(&:config)) if @menus.size > 0\n options.merge!(:handler => \"function(){ Backend.app.load('#{url_for(@url.merge(:only_path => true))}') }\".to_l) if @url\n options\n end",
"def js_environment\n Hash.new do |h, k|\n k.to_s\n end\n end",
"def js_options\n {\n :url => self.url,\n :ajaxType => self.ajax_type,\n :name => self.name,\n :isStatic => self.is_static?,\n :gridType => self.grid_type,\n :searchVisible => (self.view.search_visible or self.search_visible),\n :searchType => self.search_type,\n :hideTopControl => self.hide_top_control,\n :hideBottomControl => self.hide_bottom_control,\n :paginationPage => self.view.get_pagination_page,\n :paginationPerPage => self.view.get_pagination_per_page,\n }.to_json\n end",
"def add_button_element_with_image(image, displayName: name, frame: frame, action: action, id: id)\n element = UIView.alloc.initWithFrame(frame)\n\n button = UIButton.buttonWithType(UIButtonTypeRoundedRect)\n button.frame = CGRectMake(0.25 * element.frame.size.width, 0.10 * element.frame.size.height,\n @icon_size, @icon_size)\n button.setImage(image, forState:UIControlStateNormal)\n button.addTarget(WeakRef.new(self), action: action, forControlEvents: UIControlEventTouchDown)\n button.tag = id\n button.backgroundColor = UIColor.clearColor\n button.tintColor = rmq.color.babbo_button_grey\n\n label = UILabel.alloc.initWithFrame(CGRectMake(0, 0.65 * element.frame.size.height,\n element.frame.size.width, 0.35 * element.frame.size.height))\n label.text = name\n device.ipad? ? label.font = rmq.font.pad_small : label.font = rmq.font.phone_small\n label.textAlignment = UITextAlignmentCenter\n\n element.addSubview button\n element.addSubview label\n\n element\n end"
] |
[
"0.5712615",
"0.5438926",
"0.53248334",
"0.5288526",
"0.5206415",
"0.5156668",
"0.50238985",
"0.49551955",
"0.49250045",
"0.49193814",
"0.49146566",
"0.48829538",
"0.48395914",
"0.48334154",
"0.48087484",
"0.480182",
"0.4778795",
"0.47403705",
"0.4709297",
"0.46431372",
"0.46380818",
"0.46362376",
"0.46312267",
"0.46132275",
"0.45882553",
"0.45823634",
"0.45749187",
"0.4573732",
"0.45562977",
"0.4553571",
"0.45389128",
"0.44660354",
"0.44610566",
"0.4444803",
"0.44414654",
"0.44413626",
"0.4436922",
"0.44212076",
"0.44036523",
"0.4401002",
"0.43985438",
"0.4395671",
"0.43955418",
"0.43772298",
"0.43693128",
"0.43640494",
"0.43567216",
"0.43458295",
"0.43422922",
"0.4340724",
"0.4313424",
"0.43127713",
"0.4309874",
"0.43036982",
"0.43025348",
"0.4292553",
"0.42923027",
"0.4270359",
"0.42682967",
"0.42672357",
"0.42573494",
"0.42557135",
"0.42530018",
"0.42528978",
"0.42513028",
"0.42492136",
"0.4246301",
"0.4242212",
"0.42354962",
"0.42286384",
"0.4227239",
"0.42269304",
"0.422526",
"0.4221105",
"0.42150337",
"0.42103913",
"0.41942087",
"0.41919863",
"0.4189914",
"0.4189454",
"0.41878116",
"0.4187001",
"0.41851947",
"0.41697547",
"0.4168893",
"0.41617066",
"0.41617066",
"0.4161296",
"0.4152888",
"0.41435158",
"0.4143019",
"0.41417214",
"0.41333687",
"0.41289788",
"0.41210708",
"0.4115618",
"0.4114962",
"0.41115588",
"0.41103327",
"0.4107148"
] |
0.8323124
|
0
|
The method should mutate the given array by replacing elements with their corresponding values in the hash. The method should return the given array. Note: this method must MUTATE the input array. This means that the object_id of the input array should be identical to the object_id of the returned array. The exact object_ids you get back don't matter. We just want the ids to be the same before and after calling your method.
|
def ele_replace!(array, hash)
array.map! do |ele| #go through the array
if hash.has_key?(ele) #hash contains a key thats also in the array arr = [4,2,0,2] vs hash = {2=>two, 0 => zero}
hash[ele] #convert array values with corresponding hash values -> [ ... ,two,zero,two]
else
ele #if array value doesnt correspond with hash key, place array index back to original position -> [ 4,...,...,...]
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def element_replace(array, hash)\n new_array = []\n\n array.each do |ele|\n if hash.keys.include?(ele)\n new_array << hash[ele]\n else\n new_array << ele\n end\n end\n\n new_array\nend",
"def mutate(arr)\n arr.uniq!\nend",
"def element_replace(arr, hash)\n new_arr = []\n\n arr.each { |element| hash.key?(element) ? new_arr << hash[element] : new_arr << element }\n\n new_arr\nend",
"def element_replace(arr, hash)\n elements = []\n arr.each do |value|\n if hash[value] != nil\n elements << hash[value]\n else\n elements << value\n end\n end\n return elements\nend",
"def element_replace(arr, hash)\n hash.each do |k,v|\n if arr.index(k)\n arr[arr.index(k)] = v\n end\n end\n return arr\nend",
"def map_to_no_change(array)\n return array\nend",
"def add_data_ids(id_old, id_new)\n return id_old.map{|id| id.sort} if id_new.nil?\n id_old = Hash.new if id_old.nil?\n id_new.each do |k, val|\n id_old[k] = Array.new if id_old[k].nil?\n val.each{|v| id_old[k] << v if not id_old[k].any?(v)}\n id_old[k].sort!\n end\n return id_old\nend",
"def replace_with_flat_array(array)\n begin\n array = vash_validate_flat_array(array)\n rescue Puppet::Util::PTomulik::Vash::VashArgumentError => err\n raise err.class, err.to_s\n end\n hash = Hash[*array]\n self.class.superclass.instance_method(:replace).bind(self).call(hash)\n self\n end",
"def mutliplied(array)\nend",
"def update_arr2(var)\n\tvar.uniq!\nend",
"def only_changes(array, hash)\n tmp_hash = Hash.new\n array.each do |a|\n hash.each do |k, v|\n tmp_hash[k] = v if a == k\n end\n end\n tmp_hash\n end",
"def replace_with_flat_array(array)\n begin\n array = vash_validate_flat_array(array)\n rescue Puppet::Util::PTomulik::Vash::VashArgumentError => err\n raise err.class, err.to_s\n end\n hash = Hash[*array]\n # On 1.8 using 'super' breaks rspec tests :(.\n self.class.superclass.instance_method(:replace).bind(self).call(hash)\n self\n end",
"def replace_entities_with_ids(collection, entity_to_id_table)\n\t\tcollection.each{ |data| data.map! &replace_according_to(entity_to_id_table) }\n\tend",
"def convert\n unless should_convert?\n return { _existing_object_id: array.object_id }\n end\n\n dumped_ids << array.object_id\n\n result = array.map do |item|\n UniversalDumper.convert(item, dumped_ids)\n end\n\n {\n _old_object_id: array.object_id,\n _object_data: result\n }\n end",
"def yes_mutate(arr)\n arr.uniq!\nend",
"def yes_mutate(arr)\n arr.uniq!\nend",
"def yes_mutate(arr)\n arr.uniq!\nend",
"def normalize_id(a)\n case a\n when Integer\n a\n when Array\n a.map{ |e| normalize_id(e) }\n else\n normalize(a).id\n end\n end",
"def assign_ids_on_each(start, array)\n array.nil? ? start : array.inject(start) { |n, a| a.assign_ids(n) }\n end",
"def friends(user_ids)\n users = []\n user_ids.each do |user_id| \n user = Hashie::Mash.new\n user.user_id = user_id\n\n users << user\n end\n \n users\nend",
"def merge_id_hashes_helper(hash, array_of_refs, src, path = [])\n ref = array_of_refs.shift\n field = hash[ref]\n\n if array_of_refs.empty? && field\n value = value_from_hash(src, path + [ref])\n if value.is_a?(Array)\n hash[ref] = (field + value).uniq\n else\n hash.delete(ref)\n end\n else\n case field\n when Array\n field.each_with_index do |f, index|\n merge_id_hashes_helper(f, array_of_refs.dup, src, path + [ref, index])\n end\n when Hash\n merge_id_hashes_helper(field, array_of_refs, src, path + [ref])\n end\n end\n end",
"def mutate_rmhc(array)\n mutated_position = rand(array.length)\n\n array.clone.tap do |new_array|\n new_array[mutated_position] = inverse(new_array[mutated_position])\n end\nend",
"def mutate(arr)\n arr.pop # (no bang! here) mutates\nend",
"def replace_array(match_array, replace_arry)\n array = []\n match_array\n self.each_index{|i|\n if self[i].eql?(match_array.first) and self.slice(i, match_array.count).eql?(match_array)\n array.concat self.first(i)\n array.concat replace_arry\n array.concat self.drop(i + match_array.count)\n break\n end\n }\n array = self if array.empty?\n array\n end",
"def my_array_modification_method!(source, thing_to_modify)\n source.dup\n i_want_pets.map!{|number| number.is_a?(Integer) ? number + 1 : number}\nend",
"def assign_arrays_to_profile(args = {}) \n body_put(\"/profiles.json/#{args[:profileId]}/arrays\", args[:array_of_ids])\nend",
"def assign_littles(little_array)\n if little_array\n littles = []\n little_array.split(\",\").each do | element |\n littles << element.to_i unless element == \"null\" || element == \"new\"\n end\n self.little_ids = littles\n end\n end",
"def remove_duplicates(array)\nend",
"def cull_old_ids\n saved_ids = @ids.keys.reverse.take(@max_ids)\n @ids.select! do |k, v|\n saved_ids.include? k\n end\n end",
"def mutate(array)\n array.pop\nend",
"def mutate(array)\n array.pop\nend",
"def mutate(array)\n array.pop\nend",
"def mutate(array)\n array.pop\nend",
"def mutate(array)\n array.pop\nend",
"def mutate(array)\n array.pop\nend",
"def mutate(array)\n array.pop\nend",
"def mutate(array)\n array.pop\nend",
"def mutate(array)\n array.pop\nend",
"def mutate(array)\n array.pop\nend",
"def mutate(array)\n array.pop \nend",
"def dup\n\n # duplicate self\n rta = super\n\n # iterate through array and dup each hash\n rta.each_with_index do |w_hash, index|\n\n # dup the hash at this index\n rta[index] = w_hash.dup\n\n # to be complete, also dup the key/values in the hash, in case another hash/array is nested\n w_hash.each_pair do |k, v|\n rta[index][k] = v.dup if v.is_a? Hash\n end\n end\n\n # now everything should have new object_id's\n rta\n end",
"def assigned_items=(array_hash)\n # Find new items (but no duplicates)\n self.added_items = []\n array_hash.each do |h|\n unless items.detect { |c| c.id.to_s == h[:id] } || self.added_items.detect { |f| f.id.to_s == h[:id] }\n c = !h[:id].blank? ? Item.find(h[:id]) : Item.new({:nav => self}) # FIXME possible to form hack\n c.attributes = h.reject { |k,v| k == :id } # input values, but don't try to overwrite the id\n self.added_items << c unless c.nil?\n end\n end\n # Delete removed items\n items.each do |c|\n if h = array_hash.detect { |h| h[:id] == c.id.to_s }\n c.attributes = h.reject { |k,v| k == :id }\n else\n c.destroy_association = 1\n end\n end\n end",
"def map_to_no_change(source_array)\n array = []\n index = 0 \n \n while index < source_array.size do \n array.push(source_array[index])\n index += 1 \n end\n return array\nend",
"def mutate(arr)\n arr.pop\n end",
"def remove_dup(arr)\n hash_map = {}\n arr.each do |num|\n hash_map[num] = true\n end\n arr = []\n hash_map.each do |key, value|\n arr << key\n end\n return arr\nend",
"def array_clone\n new_map = @map.inject([]) do |result,rows|\n result << rows.collect { |e| e}\n end\n \n \n end",
"def no_mutate(arr)\n arr.uniq!\nend",
"def no_mutate(arr)\n arr.uniq!\nend",
"def assignIds(items)\r\n\titems.each_with_index {|item, index| item['id'] = index}\r\nend",
"def update_unique_ids(env, content); end",
"def my_array_modification_method!(source, thing_to_modify)\n first_integer = []\n first_integer.push(i_want_pets[2])\n i_want_pets.delete_at(2)\n i_want_pets.insert(2, (first_integer.join.to_i + thing_to_modify) )\n\n second_integer = []\n second_integer.push(i_want_pets[7])\n i_want_pets.delete_at(7)\n i_want_pets.push(second_integer.join.to_i + thing_to_modify)\n\nend",
"def no_mutate(arr)\n arr.uniq\nend",
"def no_mutate(arr)\n arr.uniq\nend",
"def no_mutate(arr)\n arr.uniq\nend",
"def arrays_to_hashes\n end",
"def overwrite(new_array)\n redis.with do |conn|\n conn.pipelined do\n conn.del(key)\n conn.rpush(key, new_array)\n end\n end\n end",
"def _array(obj)\n obj.map { |v| _renc(v) }\n end",
"def tags_merger(orig, new)\n return_array = []\n orig.each { |x| return_array << x.clone }\n\n new.each do |a|\n key_found = false\n return_array.each do |r|\n if a[:Key] == r[:Key]\n r[:Value] = a[:Value]\n key_found = true\n end\n break if key_found\n end\n return_array << a unless key_found\n end\n\n return_array\nend",
"def deep_dup(arr)\n duper_arr = arr.dup.map { |item| item * 1 }\nend",
"def magic_array(arr)\n arr.flatten.sort.uniq.map{|x| x*2}\nend",
"def hash\n\t\t[@id].hash\n\tend",
"def map_to_no_change(source_array)\n \n i = 0\n new_array = []\n \n while i < source_array.length do\n new_array << source_array[i]\n \n i += 1\n end\n \n new_array\nend",
"def arrayReplace(inputArray, elemToReplace, substitutionElem)\n inputArray.map.with_index { |nb, ind| nb == elemToReplace ? inputArray[ind] = substitutionElem : nb}\nend",
"def followers(user_ids)\n users = []\n user_ids.each do |user_id| \n user = Hashie::Mash.new\n user.user_id = user_id\n\n users << user\n end\n \n users \nend",
"def update!(**args)\n @ids = args[:ids] if args.key?(:ids)\n end",
"def update!(**args)\n @ids = args[:ids] if args.key?(:ids)\n end",
"def update!(**args)\n @ids = args[:ids] if args.key?(:ids)\n end",
"def update!(**args)\n @ids = args[:ids] if args.key?(:ids)\n end",
"def update_ids\n self.task_id = @task_number\n self.order_id = @order_number\n end",
"def resolve_array(array)\n pot_o_data = [] #Holds the previously seen values\n \n array.each do |item|\n i = 0\n \n # Removes duplicate values\n while i < item[1].length\n if pot_o_data.include? item[1][i]\n item[1].delete_at(i)\n else\n pot_o_data << item[1][i]\n i += 1\n end\n end\n end\n \n # Removes items with empty values and removes the uniq values counter\n i = 0\n while i < array.length\n if array[i][1].empty?\n array.delete_at(i)\n else\n array[i] = [array[i][0], array[i][1]]\n i += 1\n end\n end\n end",
"def reversal(array)\n array = array.map{|element| element} #creates a copy of array, remove to have same object_id's\n left_index = 0\n right_index = -1\n \n while left_index < array.size / 2\n array[left_index], array[right_index] = array[right_index], array[left_index]\n left_index += 1\n right_index -=1\n end\n\n array\nend",
"def rewrite_param_values(array_params); end",
"def my_array_modification_method(source, thing_to_modify)\n new_array = []\n source.each { |a|\n if a.is_a? Integer\n new_array << a + thing_to_modify\n else\n new_array << a\n end\n }\n source.replace(new_array)\nend",
"def my_tag_ids=(ids)\n ids = ids.compact.uniq.map {|i| BSON::ObjectId(i)}\n unless ids == self.tag_ids\n self.tag_ids = []\n self.tags = Tag.where(:_id.in => ids).uniq.map {|p| p}\n end\n end",
"def update_for_ids\n update_for_items.map(&:package_branch).map(&:id)\n end",
"def dedup_array(obj)\n if obj.is_a?(Hash)\n obj.map { |k, v| [k, dedup_array(v)] }.to_h\n elsif obj.is_a?(Array)\n obj.reverse.uniq { |h| h.respond_to?(:first) ? h.first : h }.reverse\n else obj\n end\nend",
"def ret_array(_array, _ret, _id)\n if !_ret.nil?\n _ret.each do |_r|\n _array = _array << _r.read_attribute(_id) unless _array.include? _r.read_attribute(_id)\n end\n end\n end",
"def ret_array(_array, _ret, _id)\n if !_ret.nil?\n _ret.each do |_r|\n _array = _array << _r.read_attribute(_id) unless _array.include? _r.read_attribute(_id)\n end\n end\n end",
"def ret_array(_array, _ret, _id)\n if !_ret.nil?\n _ret.each do |_r|\n _array = _array << _r.read_attribute(_id) unless _array.include? _r.read_attribute(_id)\n end\n end\n end",
"def ret_array(_array, _ret, _id)\n if !_ret.nil?\n _ret.each do |_r|\n _array = _array << _r.read_attribute(_id) unless _array.include? _r.read_attribute(_id)\n end\n end\n end",
"def my_array_modification_method(source, thing_to_modify)\n return source.map! {|i| i.is_a?(Integer) ? (i + thing_to_modify) : i}\nend",
"def using_uniq(array)\n\n \nend",
"def set(arr)\n\treturn arr.uniq\nend",
"def bson_hash_array_to_hash_array(array)\n new_array = []\n array.each { |elem|\n if elem.class == BSON::OrderedHash\n new_array << bson_ordered_hash_to_hash(elem)\n elsif elem.class == Array\n new_array << bson_hash_array_to_hash_array(elem)\n else\n new_array << elem\n end\n }\n new_array\n end",
"def find_unique(array)\n unique_id = 0\n\n array.each do |num|\n unique_id ^= num\n end\n\n unique_id\nend",
"def uniqify(array)\n encountered = Hash.new { |hash, key| hash[key] = false }\n uniqified_array = []\n array.each do |element|\n uniqified_array.push(element) unless encountered[element]\n encountered[element] = true\n end\n uniqified_array\nend",
"def find_unique_integer(id_array)\n unique_id = 0 \n id_array.each do |id|\n unique_id ^= id\n end\n\n return unique_id\nend",
"def remix(ingredient_arrays)\n \n mixers = []\n \n ingredient_arrays.each do |array|\n mixers << array[1]\n end\n \n ingredient_arrays.each do |array|\n idx = rand(mixers.length)\n array[1] = mixers[idx]\n mixers.delete_at(idx)\n end\n \n return ingredient_arrays\n \nend",
"def change_resistant_for_each_element(array)\n copy =Array.new(array)\n i=0\n while i<copy.length\n copy[i]=array[i]\n i +=1\n end\n copy\nend",
"def uniq(array)\nend",
"def array_map\n grades=[\"A\",\"B\",\"C\",\"D\",\"F\"] # this is the orignal array \n grades.map {|grade| grade + \"?\" } # this creates a new array with the original objects\n # and adds a ! to each element\nend",
"def _hash(obj)\n obj.transform_values { |v| _renc(v) }\n end",
"def update (args)\n p 'updating ...'\n if self.rarray.get(args[:id]) \n key = args[:id] - 1\n @rarray[key].merge!(args)\n else\n raise ArgumentError, 'Cannot update - id not found', caller\n end\n self.store\n end",
"def my_hash_modification_method!(source, thing_to_modify)\n source.map do |k, v|\n source[k] = v += thing_to_modify\n end\n return source\nend",
"def my_array_modification_method!(i_want_pets, thing_to_modify)\n i_want_pets.map! {|element| element.is_a?(Integer)? (element + thing_to_modify) : element}\nend",
"def remap\n # This is Ruby magic for turning a hash into an array into a hash again\n Hash[*self.map do |key, value|\n yield key, value\n end.compact.flatten]\n end",
"def pin_arr_mover\n puts \"\\n\\n#{\"=\"*40}STARTING ID SORTER METHOD 2: ADDRESS PIN ARRAY MOVER\\nChecks for SFDC Core IDs with same Scraped Address Pin as Indexer and saves ID in array in Indexer/Scrapers.\\n\\n\"\n cores = Core.where.not(crm_acct_pin: nil)\n counter=0\n cores.each do |core|\n sfdc_pin = core.crm_acct_pin\n sfdc_id = core.sfdc_id\n\n indexers = Indexer.where(archive: false).where(acct_pin: sfdc_pin)\n indexers.each do |indexer|\n acct_pin = indexer.acct_pin\n pin_ids = indexer.acct_pin_crm_ids\n\n counter+=1\n puts \"\\n\\n#{\"=\"*50}\\n#{counter}\"\n puts \"IDs: #{pin_ids}\"\n puts \"CRM ID: #{sfdc_id}\"\n puts \"CRM Pin: #{sfdc_pin}\"\n puts \"Web Pin: #{acct_pin}\"\n\n pin_ids << sfdc_id\n final_array = pin_ids.uniq.sort\n puts \"IDs: #{pin_ids}\"\n puts \"Final: #{final_array}\"\n\n indexer.update_attribute(:acct_pin_crm_ids, final_array)\n end\n end\n end",
"def rehash() end",
"def update_attributes(params)\n assign_littles(params.delete(:little_ids))\n return super(params)\n end",
"def my_set_tag_ids(new_tag_ids)\n old_tag_ids = self.tag_ids\n\n to_destroy = old_tag_ids - new_tag_ids\n to_create = new_tag_ids - old_tag_ids\n\n #whenever doing multiple updates, use this ActiveRecord call set-up to make sure that you have an all-or-nothing method call, which won't half-execute the action\n ActiveRecord::Base.transaction do\n Tagging.where(cat_id: self.id, tag_id: to_destroy).destroy_all\n to_create.each do |tag_id|\n Tagging.create!(cat_id: self.id, tag_id: tag_id)\n end\n end\n\n end"
] |
[
"0.653968",
"0.63620627",
"0.63458717",
"0.60115594",
"0.6002978",
"0.5959449",
"0.5938209",
"0.58660126",
"0.5831873",
"0.58262515",
"0.5797022",
"0.57001776",
"0.56677926",
"0.56462127",
"0.56319356",
"0.56319356",
"0.56319356",
"0.56248444",
"0.5600751",
"0.5587469",
"0.5561311",
"0.5544949",
"0.5530579",
"0.5526154",
"0.550444",
"0.54986876",
"0.54623204",
"0.5456699",
"0.54460317",
"0.5424102",
"0.5424102",
"0.5424102",
"0.5424102",
"0.5424102",
"0.5424102",
"0.5424102",
"0.5424102",
"0.5424102",
"0.5424102",
"0.539923",
"0.53749",
"0.537285",
"0.5362585",
"0.53615123",
"0.53508097",
"0.53450483",
"0.5343712",
"0.5343712",
"0.5340244",
"0.5335082",
"0.5328206",
"0.5312832",
"0.5312832",
"0.5312832",
"0.5300523",
"0.5296509",
"0.5291213",
"0.5286862",
"0.52848625",
"0.52754474",
"0.5272057",
"0.5261318",
"0.5245382",
"0.52405274",
"0.52360046",
"0.52360046",
"0.52360046",
"0.52360046",
"0.5235527",
"0.52256083",
"0.5222707",
"0.52191705",
"0.5218428",
"0.5212902",
"0.5207786",
"0.52069193",
"0.5206915",
"0.5206915",
"0.5206915",
"0.5206915",
"0.518077",
"0.5179911",
"0.5176366",
"0.51689243",
"0.5153175",
"0.5152418",
"0.514379",
"0.51436484",
"0.5134456",
"0.5121724",
"0.511432",
"0.509164",
"0.50860417",
"0.5083288",
"0.506488",
"0.50574464",
"0.50559694",
"0.50558",
"0.5055633",
"0.50549734"
] |
0.64846176
|
1
|
envia la notificaciones de los usuarios en tiempo real
|
def perform(notification)
notification_count = Notification.for_user(notification.user_id) #cuanta cuantas notificaiones no vistas tiene el usuario contando la nueva notificacion
ActionCable.server.broadcast "notifications.#{notification.user_id}",
{action: "new_notification", message: notification_count}
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_usuario\n \n end",
"def current_users\n @title = \"Usuarios actuales\"\n @current_users = GetCurrentUsers.call(@previa_group)\n end",
"def set_users\n\n end",
"def usuario_actual\n \t#se guarda al usuario actual que esta loggeado por cuestion de eficiencia\n \t#para no accesar a la base de datos todo el tiempo\n \t@usuario_actual ||= Alumno.find(session[:alumno_id]) if session[:alumno_id]\n end",
"def set_users\n @can_change_owner = policy(@run || Run).current_user_allowed_to_crud?\n @users = policy_scope(User).map{|u| [ u.name, u.id ] } if @can_change_owner\n end",
"def configUsers\n `useradd nagios`\n `echo nagios | passwd nagios --stdin`\n end",
"def set_connected_user_info(info)\n session[:sos_note_usr_info] = info\n end",
"def create_user_information # for new users. runs last according to rails.\n self.dj_name = name\n self.roles = Role.where(:title => 'noob')\n self.active = true\n set_password\n end",
"def index\n if current_cuentum.email == \"admin@admin.com\"\n @usuarios = Usuario.all\n @div_admin = true\n end\n @usuariosAux = Usuario.all\n @cuentas = Cuentum.all\n @usuariosAux.each do |u| \n if cuentum_signed_in? && current_cuentum.id == u.cuenta_id\n if u.rol == \"ADMINISTRADOR\"\n @usuarios = @usuariosAux\n @div_admin = true\n end\n if u.rol == \"USUARIO\" || u.rol == \"OPERARIO\"\n @usuarios = []\n @usuarios << u\n end\n end\n end\n end",
"def invitable_users\n @title = \"Invitar usuario\"\n @invitable_users = GetInvitableUsers.call(@previa_group)\n end",
"def configUsers\n `useradd nagios`\n `groupadd nagcmd`\n `usermod -a -G nagcmd nagios`\n end",
"def current_user\n #carico l'user da sessione con auth esterna tramite omniauth\n @current_user ||= AuthHub::User.find_by(id: session['warden.user.user.key'][0][0]) unless session['warden.user.user.key'].blank?\n #se non ho fatto login esterna carico id salvato (usato in sign_in omniauth e anche login con email e psw devise)\n @current_user ||= AuthHub::User.find_by(id: session[:user_id], stato: 'confermato')\n #se ho uno user corrente carico in sessione l'ente corrente\n #se ha un ente principale carico quello, altrimenti l'ho fissato col cambia ente\n if !@current_user.blank? && session['ente_corrente'].blank?\n ente_principale ||= ( AuthHub::EnteGestito.ente_principale_da_user(@current_user.id)[0] unless AuthHub::EnteGestito.ente_principale_da_user(@current_user.id).blank? )\n #se non era stato inserito l'ente principale per lo user prendo il primo dell'array\n ente_principale ||= @current_user.enti_gestiti[0] unless @current_user.enti_gestiti.blank?\n session['ente_corrente'] = ente_principale #unless ente_principale.blank?\n end\n #se session['ente_corrente'] è un hash devo caricare l'istanza di ente_gestito\n if session['ente_corrente'].is_a?(Hash)\n begin\n session['ente_corrente'] = AuthHub::EnteGestito.find(session['ente_corrente']['id'])\n rescue ActiveRecord::RecordNotFound => exc\n #metto l'ente principale\n unless AuthHub::EnteGestito.ente_principale_da_user(@current_user.id).blank?\n session['ente_corrente'] = AuthHub::EnteGestito.ente_principale_da_user(@current_user.id)[0] \n else\n session['ente_corrente'] = nil\n end\n end \n end\n @current_user\n end",
"def enum_users\n\tos = @client.sys.config.sysinfo['OS']\n\tusers = []\n\tuser = @client.sys.config.getuid\n\tpath4users = \"\"\n\tsysdrv = @client.fs.file.expand_path(\"%SystemDrive%\")\n\n\tif os =~ /7|Vista|2008/\n\t\tpath4users = sysdrv + \"\\\\users\\\\\"\n\t\tprofilepath = \"\\\\AppData\\\\Local\\\\VMware\\\\\"\n\telse\n\t\tpath4users = sysdrv + \"\\\\Documents and Settings\\\\\"\n\t\tprofilepath = \"\\\\Application Data\\\\VMware\\\\\"\n\tend\n\n\tif user == \"NT AUTHORITY\\\\SYSTEM\"\n\t\tprint_status(\"Running as SYSTEM extracting user list..\")\n\t\t@client.fs.dir.foreach(path4users) do |u|\n\t\t\tuserinfo = {}\n\t\t\tnext if u =~ /^(\\.|\\.\\.|All Users|Default|Default User|Public|desktop.ini|LocalService|NetworkService)$/\n\t\t\tuserinfo['username'] = u\n\t\t\tuserinfo['userappdata'] = path4users + u + profilepath\n\t\t\tusers << userinfo\n\t\tend\n\telse\n\t\tuserinfo = {}\n\t\tuservar = @client.fs.file.expand_path(\"%USERNAME%\")\n\t\tuserinfo['username'] = uservar\n\t\tuserinfo['userappdata'] = path4users + uservar + profilepath\n\t\tusers << userinfo\n\tend\n\treturn users\nend",
"def enum_users(os)\n\tusers = []\n\tuser = @client.sys.config.getuid\n\tpath4users = \"\"\n\tsysdrv = @client.fs.file.expand_path(\"%SystemDrive%\")\n\n\tif os =~ /Windows 7|Vista|2008/\n\t\tpath4users = sysdrv + \"\\\\users\\\\\"\n\t\tpath2purple = \"\\\\AppData\\\\Roaming\\\\\"\n\telse\n\t\tpath4users = sysdrv + \"\\\\Documents and Settings\\\\\"\n\t\tpath2purple = \"\\\\Application Data\\\\\"\n\tend\n\n\tif user == \"NT AUTHORITY\\\\SYSTEM\"\n\t\tprint_status(\"Running as SYSTEM extracting user list..\")\n\t\t@client.fs.dir.foreach(path4users) do |u|\n\t\t\tuserinfo = {}\n\t\t\tnext if u =~ /^(\\.|\\.\\.|All Users|Default|Default User|Public|desktop.ini|LocalService|NetworkService)$/\n\t\t\tuserinfo['username'] = u\n\t\t\tuserinfo['userappdata'] = path4users + u + path2purple\n\t\t\tusers << userinfo\n\t\tend\n\telse\n\t\tuserinfo = {}\n\t\tuservar = @client.fs.file.expand_path(\"%USERNAME%\")\n\t\tuserinfo['username'] = uservar\n\t\tuserinfo['userappdata'] = path4users + uservar + path2purple\n\t\tusers << userinfo\n\tend\n\treturn users\nend",
"def registrar_usuario\n business_user = User.new\n business_user.email = self.email\n business_user.password = business_user.generar_password\n business_user.client_type = 'empresa'\n business_user.save\n update(user_id: business_user.id, user_created_id: business_user.id)\n #luego de registrar al usuario se almacena la contraseña en la tabla Historypassword\n #donde se almacenaran las 3 ultimas usadas\n password_business = HistoryPassword.new\n password_business.password = business_user.password\n password_business.user_id = business_user.id\n password_business.save\n end",
"def set_user; end",
"def ldap_sincroniza_usuarios(prob)\n usuarios = []\n deshab = []\n opcon = {\n host: Rails.application.config.x.jn316_servidor,\n port: Rails.application.config.x.jn316_puerto,\n auth: {\n method: :simple, \n username: Rails.application.config.x.jn316_admin,\n password: ENV['JN316_CLAVE']\n }\n }.merge(Rails.application.config.x.jn316_opcon)\n filter = Net::LDAP::Filter.eq( \"objectClass\", 'posixAccount')\n ldap_conadmin = Net::LDAP.new( opcon )\n lusuarios = ldap_conadmin.search(\n base: Rails.application.config.x.jn316_basegente, \n filter: filter \n )\n if lusuarios.nil?\n prob << ldap_conadmin.get_operation_result.code.to_s +\n ' - ' + ldap_conadmin.get_operation_result.message \n return nil\n end\n lusuarios.each do |entry|\n #byebug\n u = crear_actualizar_usuario(entry.cn[0], entry, nil, prob)\n if (u.nil?)\n return [usuarios, []]\n end\n usuarios << u.id\n end\n puts \"Actualizados \" + usuarios.length.to_s + \" registros de usuarios\"\n # Si se eliminaron registros del LDAP (que no se recomienda) \n # deshabilitar en base\n ::Usuario.habilitados.where('ultimasincldap IS NOT NULL').each do |u|\n unless usuarios.include?(u.id)\n u.fechadeshabilitacion = Date.today\n u.ultimasincldap = nil\n u.save\n deshab << u.id\n end\n end\n puts \"Deshabilitados \" + deshab.length.to_s + \n \" registros de usuarios que estuvieron en LDAP pero ya no\"\n \n return [usuarios, deshab]\n rescue Exception => exception\n prob << 'Problema conectando a servidor LDAP ' +\n '(ldap_sincroniza_usuarios). Excepción: ' + exception.to_s\n puts prob\n return [usuarios, deshab]\n end",
"def alert_redmine_users(m, params)\n begin\n \tcertificate = redmine_check_auth(m)\n\t\tif ! certificate\n\t\t\t# ne rien faire, l'utilisateur n'est pas connecté\n\t\telse\n\t\t\tif m.source.botuser.owner?\n\t\t\t\tm.reply \"#{Underline}#{@redmine_l_rightnow}, \" + m.sourcenick + \", #{@redmine_l_usersthatdontruntasksare}:#{Underline}\"\n\n\t\t\t\t@registry.keys.each do |key_data|\n\t\t\t\t\t# utilisateurs connectés\n\t\t\t\t\tif key_data.include? \"_auth\"\n\t\t\t\t\t\t# recuperons les données de l'utilisateur\n\t\t\t\t\t\tauthstored = @registry[key_data]\n\t\t\t\t\t\tnickname = key_data.gsub('_auth', '')\n\t\t\t\t\t\n\t\t\t\t\t\t# Si l'utilisateur n'a pas de taches, on lui indique par message\n\t\t\t\t\t\tif ! @registry.has_key? authstored[0].username\n\t\t\t\t\t\t\t# on affiche le nom de l'utilisateur pour l'administrateur\n\t\t\t\t\t\t\tm.reply \"#{Bold}#{nickname} #{@redmine_l_aka} #{authstored[0].username}#{Bold} - #{@redmine_l_notaskrunning}\"\n\t\t\t\t\t\t\t# on envoie le message à l'utilisateur\n\t\t\t\t\t\t\t@bot.say nickname , \"#{Bold}#{nickname}#{Bold}, #{@redmine_l_youdidnotlaunchtask}\"\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tm.reply \"#{@redmine_l_youhavenottherights}\"\n\t\t\tend\n\t\tend\n rescue Exception => e\n m.reply e.message\n m.reply e.backtrace.inspect\n end\n end",
"def notified_users\n notified = []\n\n # Author and auditors are always notified unless they have been\n # locked or don't want to be notified\n notified << user if user\n\n notified += auditor_users\n\n # Only notify active users\n notified = notified.select { |u| u.active? }\n\n notified.uniq!\n\n notified\n end",
"def off_org_users\n \n end",
"def control_usuario \n usuarios = Usuario.all\n usuarios.each do |u|\n if cuentum_signed_in? && current_cuentum.id == u.cuenta_id\n if u.rol == \"USUARIO\" \n redirect_to \"welcome/index\" \n end\n end\n end\n end",
"def control_usuario \n usuarios = Usuario.all\n usuarios.each do |u|\n if cuentum_signed_in? && current_cuentum.id == u.cuenta_id\n if u.rol == \"USUARIO\" \n redirect_to \"welcome/index\" \n end\n end\n end\n end",
"def set_users\n @users = []\n \n if user_signed_in\n @users << current_user.tweets(:sort){:time_stamp}\n else\n User.all.each do |user|\n @users << user.tweets(:sort){:time_stamp}\n end\n end\n end",
"def login(user)\n\tif $users_profil.include?(user)\n\t\tputs \"Username: #{user}\"\n\t\tputs \"Profil: #{$users_profil[user]}\" \n\telse \n\t\tputs \"Numele de utilizator este gresit.\"\n\t\tprima # daca a scris usernamul gresit sau daca acel username nu exista atunci scriptul practic se reinitializeaza\n\tend\nend",
"def current_user\n current_usuario\n end",
"def index\n if current_user.rol == 1\n @users = User.order(:id)\n else\n @mensaje = \"Seccion exclusiva para administrador\"\n end\n end",
"def current_utilisateur=(utilisateur)\n @current_utilisateur = utilisateur\n end",
"def index\n # @usuarios = @topico.perguntas.usuarios\n end",
"def user_on\n session[:user_id] = '3980284084'\n end",
"def set_audit_me_whodunnit\n ::AuditMe.whodunnit = user_for_audit_me\n end",
"def all_people_scheduled\n Entry.users_for_client(self.id)\n end",
"def relatorio\n @users = User.all\n @total_por_usuario = []\n\n @users.each do |user| \n @pontos = Ponto.where(\"user_id = ?\", user.id)\n .by_month(Time.now.strftime(\"%B\"), field: :created_at)\n .order(\"created_at asc\")\n\n @segundos = 0\n\n @pontos.each do |ponto|\n if ponto.situacao == \"Entrada\"\n @entrada = ponto.data_hora\n else\n @saida = ponto.data_hora\n @segundos += TimeDifference.between(@entrada, @saida).in_seconds.to_i if (@entrada && @saida )\n end\n end\n\n @total_por_usuario.push ({user => (@segundos/3600).to_i.to_s.rjust(2,'0') + \":\"+Time.at(@segundos).utc.strftime(\"%M:%S\") })\n end\n end",
"def users(t)\n @socket << \"USERS #{t}\"\n end",
"def update_values\n self.username = self.user.nil??nil:self.user.username\n self.imei = self.device.imei.nil??nil:self.device.imei\n end",
"def set_fatura\n @fatura = Fatura.find(params[:id])\n @fatura.contrato.conexoes.each { |c| c.current_user = current_user }\n end",
"def users_only\n deny_access(\"Necesitas crear una cuenta para entrar a esta sección\") unless signed_in?\n end",
"def list_current_users *args\r\n puts \"not implemented yet\"\r\n end",
"def current_user\n \t#se guarda al usuario actual que esta loggeado por cuestion de eficiencia\n \t#para no accesar a la base de datos todo el tiempo\n \t@current_user ||= Chef.find(session[:chef_id]) if session[:chef_id]\n end",
"def users\n gateway_check\n unavailable_servers_check\n @users\n end",
"def on_users_account\n true\n end",
"def set_current_user\n if logged_in?\n whodat = send(Lockdown::Configuration.who_did_it)\n Thread.current[:who_did_it] = whodat\n end\n end",
"def set_users\n if is_event_creator\n @user_1 = event_creator\n @user_2 = participant\n else\n @user_1 = participant\n @user_2 = event_creator\n end\n end",
"def users\n users = []\n if current_user.lead?\n users = object.users.select { |u| u.id != current_user.id }\n users = users.unshift(current_user)\n elsif current_user.dev?\n vms_v = object.vms.select { |vm| vm.is_jenkins }\n users = vms_v.flat_map(&:user).uniq.select { |u| u.id != current_user.id }\n users = users.unshift(current_user)\n else\n users <<= current_user\n end\n users.map { |u| u.id }\n end",
"def get_connected_user_info\n session[:sos_note_usr_info]\n end",
"def create\n super\n # Expire.create{|expire|\n # expire.time = Time.now\n # expire.user_id = current_user\n #\n # }\n #登录后检查上一次登录是否退出。在这里可以添加代码,监视用户是否同时在多个设备登录。\n last_onboard = Onboard.where(user_id: current_user.id).last\n if last_onboard\n unless last_onboard.end_at\n last_onboard.update(end_at: Time.now)\n # 下面这一行代码可以阻止用户同时在多个设备上登录:\n # last_onboard.update(end_at: Time.now, expire_at: Time.now)\n a_time = current_user.active_time - (Time.now - current_user.current_sign_in_at)\n if a_time < 0\n current_user.active_time = 0\n else \n current_user.active_time = a_time\n end\n current_user.save\n end\n end\n # 创建新的登录记录\n onboard = Onboard.new{ |o|\n o.user_id = current_user.id\n o.begin_at = Time.now \n o.expire_at = Time.now + current_user.active_time\n o.remote_ip = request.remote_ip\n o.http_user_agent = request.env['HTTP_USER_AGENT']\n }\n onboard.save\n flash[:notice] << \"您上次登录时间为#{last_onboard.begin_at}。如果您并没有在时间登录,请与系统管理员联系!\" if last_onboard\n end",
"def list_current_user\n abort \"You have no current user set!\".yellow unless current_user_exists?\n puts \"\\nCurrent User\"\n config.current_user.each do |k,v|\n if k == 'password'\n puts \"#{k.yellow}: ** HIDDEN **\".yellow\n else\n puts \"#{k.yellow}: #{v}\".yellow unless v.nil?\n end\n end\n end",
"def list_users\n abort \"You have no users within your config file!\".yellow if config.empty?\n puts \"\\nUser Configuration\"\n config.each do |k, v|\n next if k == 'current_user'\n puts \"\\nEnvironment: #{k}\"\n print_hash_values v\n end\n\n list_current_user if current_user_exists?\n end",
"def set_up_user\n # user's details\n @user = current_user\n @notification = Notification.where(user_id: @user.id, read: 0)\n end",
"def update_tcs\n @user = current_user\n end",
"def connect\n \t\t#Se sigue la convencion para la identificacion del usuario\n \t\t#y buscamos alusuario que se intenta conectar\n \t\tself.current_user = find_user\n \tend",
"def pontosanunciante\n\n\t\tUsuario.find(self.id_usuario).meuspontos\n\n\tend",
"def creador\n\t\tusuario\n\tend",
"def set_nota_temporal\n @nota_temporal = NotaTemporal.find(params[:id])\n @user = current_user\n if @nota_temporal.dependencia_id != @user.dependencia_id\n flash[:error] = \"No puede acceder a esta nota\"\n redirect_to :log_in # halts request cycle\n end\n end",
"def set_usuario\n @usuario = Usuario.find_by_email(current_usuario.email)\n end",
"def conf_universidad\n reset_session\n @valin = params['in']\n @alert = params['alert']\n valor = @valin.split(\"_\")\n cod = desencriptar(valor[0].to_i)\n id = desencriptar(valor[1].to_i)\n data = Usuario.find_by(cod_recovery: cod, id: id)\n if data.blank?\n redirect_to({:action=>\"index\", :controller=>\"perfil\"})\n else\n if data['validado'] == SIN_VALIDAR\n @nombre = data['nombre']\n session[:id] = id\n session[:email] = data['correo']\n render layout: \"login\"\n else\n redirect_to({:action => 'index', :controller=>\"login\"})\n end\n end\n end",
"def list_all_users\n\n end",
"def set_usuario\n @user = Usuario.select('id,nombre,apellido,usuario,twitter').find(params[:id])\n end",
"def users\n gateway_check\n @users\n end",
"def getAllOnlineUsers\n return false if !@usrData\n @usrData[login]\n end",
"def users\n runner_users + corporation_users\n end",
"def notify_users\n board = Conversation.find(conversation_id).board\n if (board.public)\n users = User.ids - [user_id]\n users.each do |u|\n Notification.create(user_id: u, comment_id: id, conversation_id: conversation_id)\n end\n else #if the board is not public, Notifications are sent to the specific people.\n role_applications = RoleApplication.where(status: 'Approved')\n role_applications.each do |app|\n Notification.create(user_id: app.user_id, comment_id: id, conversation_id: conversation_id) if app.user_id != user_id\n notify_production_team\n end\n end\n end",
"def notify_users\n ([requested_by, owned_by] + notes.map(&:user)).compact.uniq\n end",
"def inicia_analista\n current_usuario = Usuario.create!(PRUEBA_USUARIO_AN)\n current_usuario.grupo_ids = [20]\n current_usuario.save\n return current_usuario\n end",
"def inicia_analista\n current_usuario = Usuario.create!(PRUEBA_USUARIO_AN)\n current_usuario.grupo_ids = [20]\n current_usuario.save\n return current_usuario\n end",
"def inicia_analista\n current_usuario = Usuario.create!(PRUEBA_USUARIO_AN)\n current_usuario.grupo_ids = [20]\n current_usuario.save\n return current_usuario\n end",
"def inicia_analista\n current_usuario = Usuario.create!(PRUEBA_USUARIO_AN)\n current_usuario.grupo_ids = [20]\n current_usuario.save\n return current_usuario\n end",
"def inicia_analista\n current_usuario = Usuario.create!(PRUEBA_USUARIO_AN)\n current_usuario.grupo_ids = [20]\n current_usuario.save\n return current_usuario\n end",
"def inicia_analista\n current_usuario = Usuario.create!(PRUEBA_USUARIO_AN)\n current_usuario.grupo_ids = [20]\n current_usuario.save\n return current_usuario\n end",
"def list_users\n tp @users, :real_name, :slack_id, :user_name => {:display_method => :name}\n end",
"def current_user\n \tsuper || guest_user\n \t#Super quiere decir que exactamente con los valores \n \t#del metodo original sin cambiar nada\n end",
"def mostrar_opciones_tutoria\n acciones = ['Peticiones pendientes de aceptar', 'Cola alumnos', 'Borrar tutoría', 'Volver']\n menu = MenuInlineTelegram.crear(acciones)\n texto = \"Tutoría elegida #{@tutoria.fecha}. Elija que desea hacer:\"\n @@bot.api.edit_message_text(chat_id: @ultimo_mensaje.id_chat, message_id: @ultimo_mensaje.id_mensaje, text: texto, reply_markup: menu, parse_mode: 'Markdown')\n end",
"def registrar_usuario\n employee_user = User.new\n employee_user.email = self.email\n employee_user.password = employee_user.generar_password\n employee_user.username = asignar_username_con_opciones\n if asignar_username_con_opciones.present?\n employee_user.username = asignar_username_con_opciones\n else\n employee_user.username = self.usuario.downcase\n end\n employee_user.client_type = 'empleado'\n employee_user.save\n update(user_id: employee_user.id, user_created_id: employee_user.id) \n #luego de registrar al usuario se almacena la contraseña en la tabla Historypassword\n #donde se almacenaran las 3 ultimas usadas\n password_employee = HistoryPassword.new\n password_employee.password = employee_user.password\n password_employee.user_id = employee_user.id\n password_employee.save\n end",
"def preencher_usuario2 (nome, sobrenome, email, endereco, universidade, profissao, genero, idade)\n self.nome.set nome\n self.sobrenome.set sobrenome\n self.email.set email\n self.endereco.set endereco\n self.universidade.set universidade\n self.profissao.set profissao\n self.genero.set genero\n self.idade.set idade\n self.btn_criar.click\n end",
"def index\n @registeredUsers = Admin.getRegisteredUsers\n @loggedInLastWeek = Admin.getLoginActivity 1.week.ago\n @loggedInLastMonth = Admin.getLoginActivity 1.month.ago\n @recentlyRegistered = Admin.getRecentlyRegistered\n end",
"def users_messaged_by\r\n self.users_who_messaged_me\r\n end",
"def users_messaged_by\r\n self.users_who_messaged_me\r\n end",
"def users()\n\t\t\tend",
"def notified_users\n notified = []\n\n # Author and assignee are always notified unless they have been\n # locked or don't want to be notified\n notified << author if author\n\n notified += assigned_to_users\n notified += assigned_to_was_users\n\n notified = notified.select {|u| u.active?}\n\n notified.uniq!\n notified\n end",
"def refresh_users\n @connections.each{|c| c.current_user.reload if c.current_user}\n end",
"def notificaciones\n end",
"def updateAdmins(usr)\n fh = File::open(\"#{@ch}.txt\", \"a\")\n fh.puts(\"#{usr}\\n\")\n fh.close\n setAdmins()\n end",
"def notifys_by_username mem\n notifys(mem).map { |doc| doc['owner_id'] }\n end",
"def setup_admins_users\n begin\n click_on('Logout')\n rescue\n print\n end\n\n Warden.test_reset!\n\n @a1 = admins(:elle_woods)\n @a2 = admins(:vivian_kensington)\n @a3 = admins(:emmett_richmond)\n\n @u1 = users(:connery)\n @u2 = users(:moore)\n @u3 = users(:brosnan)\nend",
"def users\n \n end",
"def connected\n\t\tdo_send(setting(:username), :priority => 0)\n\tend",
"def user(username, realname, mode = 0)\n host = TCPSocket.gethostbyname(Socket.gethostname)[0]\n send_msg(\"USER #{username} #{mode} * :#{realname}\")\n end",
"def lacticate_users(user1,user2)\n # PostgresUser.lacticate_users(user1,user2)\n lacticate_pg_users(user1,user2)\n end",
"def do_patch_modification_users\n dauto = nil\n autorised = begin\n if dpaie = try_paiement_unan\n dauto = {\n start_time: dpaie[:created_at],\n end_time: dpaie[:created_at] + (365+366).days,\n raison: \"UNANUNSCRIPT\"\n }\n true\n elsif dpaie = try_paiement_abonnement\n dauto = {\n start_time: dpaie[:created_at],\n end_time: dpaie[:created_at] + 365.days,\n raison: \"ABONNEMENT UN AN\"\n }\n true\n elsif icarien_actif?\n dauto = {\n start_time: Time.now.to_i - 10,\n end_time: nil,\n raison: \"ICARIEN ACTIF\"\n }\n true\n else\n false\n end\n end\n\n if autorised && dauto\n table_autorisations.insert(dauto.merge!(user_id: id, created_at: Time.now.to_i, updated_at: Time.now.to_i))\n debug \"USER AUTORISÉ : #{pseudo} (##{id}) : #{dauto.inspect}\"\n reset_autorisations\n end\n return autorised\n end",
"def verifica_usuarios\n# @user_pages, @usuarios = paginate :users, :per_page => 10\n @usuarios = User.find(:all, :order => 'nombre')\n @rol = Rol.find(params[:id])\n @usuarios = @rol.users\n end",
"def set_proyectos_user\n @proyectos_user = ProyectosUser.find(params[:id])\n end",
"def check_user_background\n self.status = Status::PENDING_ADMIN_ACTION if offender && offender.new_user?\n end",
"def my_users\n self.users + [self.user]\n end",
"def index\n @notas = current_user.asignaturas.all\n @user = current_user\n end",
"def index\n if can? :update, @users\n @users = User.all\n else\n \n redirect_to :root\n flash[:alert] = \"Vous n'avez pas les deroits a acceder ces informations.\"\n end\n \n end",
"def set_user\n UserInfo.current_user = session[:user]\n end",
"def application_setup\n Locale.code = :'en-US' if Locale.code != :'en-US'\n Time.zone = 'America/New_York'\n User.current = nil\n @rolf, @mary, @junk, @dick, @katrina, @roy = User.all\n end",
"def logging_in\n # TODO merge friends with the same name\n guest_user.friends.update_all(user_id: current_user.id)\n guest_user.bills.update_all(user_id: current_user.id)\n guest_user.participations.update_all(person_id: current_user.id)\n end",
"def update_presence_false\n current_user.update(presence: false, date_derniere_deconnexion: Time.now.utc)\n end",
"def seguir(otro_usuario)\n\t\t# siguiendo << otro_usuario\n\t\trelaciones_activas.create(seguido_id: otro_usuario.id)\n\tend",
"def viewable_users\n @viewable_users ||= (controllable_users + request_applicants + controllable_users.map{|uu|uu.request_applicants}).flatten.uniq\n end",
"def config_user\n atts = {}\n u = @device.user\n unless params[:name].blank?\n return render json: {:status=>11, :message=>'用户名已经设置,不能修改'} if u.name\n return render json: {:status=>12, :message=>'用户名已存在'} if User.find_by_name params[:name]\n atts[:name] = params[:name]\n end\n unless params[:email].blank?\n unless u.email.eql?(params[:email])\n return render json: {:status=>13, :message=>'邮箱已经注册过'} if User.find_by_email params[:email]\n end\n atts[:email] = params[:email]\n end \n unless params[:pass].blank?\n return render json: {:status=>14, :message=>'密码已经设置'} if u.password\n atts[:password] = params[:pass] \n end\n\n atts[:score_mode] = params[:score_mode] unless params[:score_mode].blank?\n atts[:tee] = params[:default_tee] unless params[:default_tee].blank?\n \n u.update_attributes(atts) \n \n ret = {:status=>0}\n unless params[:password].blank?\n @device.update_token\n ret[:token] = @device.token\n end\n render json: ret\n end"
] |
[
"0.6580915",
"0.64378095",
"0.61713266",
"0.609065",
"0.5987785",
"0.59645265",
"0.59378725",
"0.5929107",
"0.5852287",
"0.58365834",
"0.58226925",
"0.5790702",
"0.5785199",
"0.57517105",
"0.57447064",
"0.57376325",
"0.572983",
"0.5727012",
"0.5723294",
"0.5720212",
"0.5715882",
"0.5715882",
"0.56974536",
"0.56875414",
"0.566192",
"0.5659073",
"0.565637",
"0.5651977",
"0.5648674",
"0.5635844",
"0.56349176",
"0.56091756",
"0.5604763",
"0.55996704",
"0.55973",
"0.5595211",
"0.55799526",
"0.55762225",
"0.5563357",
"0.55587614",
"0.55506",
"0.5548611",
"0.5548086",
"0.55365515",
"0.5535981",
"0.55309254",
"0.5526496",
"0.55227166",
"0.5513909",
"0.54972947",
"0.5487969",
"0.5484643",
"0.54813844",
"0.54753184",
"0.5474861",
"0.5462715",
"0.5461202",
"0.5459701",
"0.545339",
"0.5450919",
"0.5450693",
"0.543798",
"0.5424751",
"0.5424751",
"0.5424751",
"0.5424751",
"0.5424751",
"0.5424751",
"0.54197645",
"0.54193854",
"0.5411346",
"0.5391618",
"0.5386961",
"0.5385331",
"0.5383423",
"0.5383423",
"0.5382893",
"0.53743577",
"0.537425",
"0.53729093",
"0.5372552",
"0.5367982",
"0.5360115",
"0.5355837",
"0.5355564",
"0.5350963",
"0.5350897",
"0.5348476",
"0.5347574",
"0.53475624",
"0.53457147",
"0.5343323",
"0.53352636",
"0.5334246",
"0.5327018",
"0.53269595",
"0.5326266",
"0.5324204",
"0.5323922",
"0.53206366",
"0.53189003"
] |
0.0
|
-1
|
return if idx2 >= arr.size block.call(arr[idx1], arr[idx2]) each_cons(arr, idx1 + 1, idx2 + 1, &block) end
|
def each_cons(arr, &block)
arr.size < 2 ? return : block.call(arr[0, 2])
each_cons(arr.drop(1), &block)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def each_cons(arr)\n first = 0\n second = 1\n loop do\n break if second >= arr.size\n yield(arr[first], arr[second])\n first += 1\n second += 1\n end\n nil\nend",
"def each_cons(array)\n index1 = 0\n index2 = 1\n while index1 < array.size\n yield(index1, index2)\n index1 += 2\n index2 += 2\n end\n return nil\nend",
"def each_cons(arr)\n ndx = 0\n while ndx < arr.size - 1\n yield(arr[ndx], arr[ndx + 1])\n ndx += 1\n end\n nil\nend",
"def each_cons(array)\n array.each_with_index do |item, index|\n break if index + 1 >= array.size\n yield(item, array[index + 1])\n end\n nil\nend",
"def each_cons(array, cons_elements)\n array.each_with_index do |value, index|\n if index <= array.size - cons_elements\n yield(value, *array[(index + 1)...(index + cons_elements)])\n end\n end\n nil\nend",
"def each_cons(array)\n iterations = array.size - 1\n iterations.times do |index| \n yield(array[index], array[index + 1])\n end\n nil\nend",
"def each_cons(arr, num_cons_elems)\n num_yields = arr.size - num_cons_elems + 1\n puts \"arr.size = #{arr.size} num_cons_elems = #{num_cons_elems} num_yields = #{num_yields}\"\n num_yields.times do |index|\n p *arr[index..(index + num_cons_elems - 1)]\n yield(*arr[index..(index + num_cons_elems - 1)])\n index += 1\n end\n nil\nend",
"def each_cons(array, n)\r\n array.each_index do |index|\r\n break if index + n -1 >= array.size\r\n yield(*array[index..(index + n - 1)])\r\n end\r\n nil\r\nend",
"def each_cons(array, n)\n array.each_index do |index|\n break if index + n - 1 >= array.size\n yield(*array[index..(index + n - 1)])\n end\nend",
"def each_cons(array, step)\n count = 0\n blocks = []\n while count < array.size\n block = []\n count.upto(count + step) do |num|\n block << array[num]\n end\n blocks << block\n count += 1\n end\n\n array.each_with_index do |element, idx|\n yield(element, blocks[idx])\n end\nend",
"def each_cons(list)\n index = 0\n while index + 1 < list.length\n yield(list[index], list[index + 1])\n index += 1\n end\nend",
"def each_cons(array, consecutive_num=2)\n return nil if array.empty? || !block_given?\n\n array.each_index do |index|\n return nil if index + consecutive_num - 1 >= array.size\n yield(*array[index..(index + consecutive_num - 1)])\n end\nend",
"def each(arr)\n # set index value, beginning with the first element at 0\n i = 0\n # while the current index value still exists in the array, run the block of code, stored in yield, on each index, then increase the index value by 1 until the end of the array\n while i < arr.length\n yield(arr[i])\n i += 1\n end\nend",
"def splitMerge(temp, n, arr, &block)\n if n == arr.length\n return yield(arr, temp, n) #first yield evaluated in the recursion\n end\n return yield(splitMerge(arr, n*2, temp, &block), temp, n) #recur in the yield statement\nend",
"def print_arr_2(arr)\n arr.each_with_index do |el, idx|\n break if idx == arr.length/2 - 1\n puts el\n end\nend",
"def each(arr)\n ndx = 0\n while ndx < arr.size do\n yield(arr[ndx])\n ndx += 1\n end\n arr\nend",
"def each_cons(arr, n)\n arr.each_with_index do |el, idx|\n break if idx + n > arr.size\n if n < 3\n yield(el, arr[idx + 1])\n else\n yield([el, arr.slice((idx + 1), (n - 1))].flatten)\n end\n end\nend",
"def do_it_twice(array)\n yield(array[0])\n yield(array[1])\nend",
"def each_mid(&block)\n \n end",
"def each(array)\n idx = 0\n while idx < array.size\n yield(array[idx]) if block_given?\n idx += 1\n end\n\n array\nend",
"def bubble_sort!(arr, n = arr.size, &block)\n n.zero? ? (return arr) : new_n = 0\n (1...n).each do |idx|\n a, b = arr[idx - 1, 2].map { |x| block&.arity == 1 ? block.call(x) : x }\n next if (block&.arity == 2 ? block.call(a, b) : a <= b)\n print idx\n arr[idx - 1], arr[idx], new_n = arr[idx], arr[idx - 1], idx\n end\n bubble_sort!(arr, new_n, &block)\nend",
"def two_sum(nums)\n nums.each_with_index do |x, ix|\n nums.each_with_index do |y, iy|\n if ix != iy\n if x + y == 0\n return [ix, iy]\n end\n end\n end\n end\n nil\nend",
"def block_sort(arr)\n return arr if arr.size < 2\n\n block_start = 0\n block_stop = MIN - 1\n while block_stop < arr.size\n sorting = arr[block_start..block_stop]\n arr[block_start..block_stop] = insertion_sort(sorting)\n block_start += MIN\n if block_stop + MIN < arr.size\n block_stop += MIN\n else\n block_stop = arr.size\n end\n end\n if arr[block_start..block_stop].size < MIN * 2\n arr1 = arr[0...block_start]\n arr2 = arr[block_start..block_stop]\n return merge(arr1, arr2, arr1.size, arr2.size)\n end\n merge_sort(arr)\nend",
"def two_sum(nums)\n\n idx1 = 0\n idx2 = 1\n \n while idx1 < nums.length\n idx2 = idx1 + 1 #------>missed this line to increment idx2 for the next round or position\n while idx2 < nums.length\n sum = nums[idx1] + nums[idx2]\n if sum == 0\n return [idx1, idx2]\n end\n idx2 = idx2 + 1\n \n end\n idx1 = idx1 + 1\n \n end\n return nil\n \nend",
"def bubble_sort_by arr\n n = arr.length - 1\n while n > 0\n arr.each_with_index do |item, index|\n yield(arr[index] , arr[index+1]) > 0 ? true : (arr[index+1], arr[index] = arr[index], arr[index+1])\n # To avoid index + 1 being nil when on last iteration (index == n)\n if index + 1 == n\n break\n end\n end\n n -= 1\n end\n puts arr\nend",
"def two_sum(arr)\n output = []\n (0...arr.length).each do |idx1|\n (idx1+1...arr.length).each do |idx2|\n output << [idx1, idx2] if arr[idx1] + arr[idx2] == 0\n end\n end\n output\nend",
"def bad_two_sum?(arr, target)\n\n arr.each.with_index do |x, idx|\n arr.each.with_index do |y, idy|\n if idx == idy\n next\n else\n if (x + y) == target\n return true\n end\n end\n end\n end\n\n return false\n\nend",
"def spiral_access(arr, &block)\n n = -1\n r = 0\n len = arr[0].length\n increments = [1, len, -1, -len]\n loop do\n 4.times do |index|\n repeat = [len - r, arr.length - r] * 2\n (repeat[index]).times do\n n += increments[index]\n block.call arr[n / len ][n % len] if n >= 0\n end\n return if len == r\n r += 1 if index.even?\n end\n end\nend",
"def caterpillar_method\n result=[]\n i=0\n while(i<self.size/2)\n j=i+1\n while (self[j] && (yield self[i],self[j]))\n result<<[self[i],self[j]]\n j+=1\n end\n i+=1\n end\n return result\n end",
"def each_cons(n)\n # Your code goes here.\n end",
"def two_sum(array)\n pairs = []\n array.each_with_index do |num1, idx1|\n array.each_with_index do |num2, idx2|\n pairs << [idx1, idx2] if idx2 > idx1 && num1 + num2 == 0\n end\n end\n pairs\nend",
"def each2(v) # :yield: e1, e2\n my_size = size\n Vector.Raise ErrDimensionMismatch if my_size != v.size\n 0.upto(my_size - 1) do\n |i|\n yield @elements[i], v[i]\n end \n end",
"def each_with_index(&blk)\n (0..@size-1).each { |i| blk.call(self.[](i),i) }\n end",
"def spiral_access(arr, &block)\n #count how many rows = e.g. length of first\n if arr.length > 1\n rows = arr.length - 1\n columns = arr[0].length - 1\n #puts rows, columns\n #count how many columns, e.g. in the first array\n #create a placeholder\n var_arr = []\n #first go across the top\n var_arr= arr[0]\n var_arr.each {|nr| block.call(nr)}\n # then take the last element in each array\n (1..(columns-1)).each do |x|\n var_arr = arr[x]\n block.call(var_arr.delete_at(columns))\n end\n #then go reverse along the last array\n var_arr = arr.delete_at(-1).reverse\n var_arr.each {|nr| block.call(nr)}\n #puts var_arr.join(' ')\n #then take the first elements up till n2\n (columns-1).downto(1) do |x|\n var_arr = arr[x]\n #puts var_arr.join(' ')\n block.call(var_arr.delete_at(0))\n end\n arr.delete_at(0)\n #puts arr.join(' ')\n spiral_access(arr,&block)\n elsif arr.length == 1\n arr[0].any? ? block.call(arr[0][0]) : arr[0]\n else\n arr\n\n end\n\n #then call it again for the rest\nend",
"def my_each(array) \n n = 0\n while n < array.length \n yield(array[n])\n n = n + 1 \n end\n array\nend",
"def my_each(array)\n if block_given?\n i = 0\n while i < array.length\n yield array[i]\n i = i + 1\n end\n array\n end\nend",
"def my_each_with_index\n for i in 0..self.length-1\n yield(self[i], i) if block_given?\n end\n self\n end",
"def each(&blk)\n (0..@size-1).each { |i| blk.call(self.[](i)) }\n end",
"def my_each_with_index(arr)\n \n\n for element in arr\n index = arr.index(element)\n yield(element, index)\n end\n \n \nend",
"def combinations(arr)\n pairs = []\n\n arr.each_with_index do |ele1, idx1|\n arr.each_with_index do |ele2, idx2|\n if idx2 > idx1\n pairs << [ele1, ele2]\n end\n end\n end\n\n return pairs \n\nend",
"def each(arr)\n counter = 0\n \n while counter < arr.length\n yield(arr[counter])\n counter += 1\n end\n \n arr\nend",
"def my_each(array)\n if block_given?\n counter = 0\n while counter < array.length\n yield (array[counter])\n counter += 1\n end\n array\n else\n puts \"No block given\"\n end\nend",
"def mystery_method_iterative(arr, val)\n\n # Returns nothing if no array or an empty array is passed\n return nil if arr.nil? || arr.length == 0\n\n # Determine middle, \"low\" index, and \"high\" index points\n mid = arr.length / 2\n l = 0\n h = arr.length - 1\n\n # Iterate through the extent of indices in the array starting at the beginning\n while l <= h\n\n # First check, does value at middle index equal our target `val`, if so return for a\n # quick win. Index found.\n if arr[mid] == val\n return mid\n\n # Second, is our middle index's value less than target `val`, check the first half\n # of the array.\n elsif arr[mid] < val\n l = mid + 1\n mid = (l + h) / 2\n\n # Otherwise, check the second half of the array\n else\n h = mid - 1\n mid = (l + h) / 2\n end\n\n end\n\n return mid\nend",
"def my_each(arr)\n array = []\n n = 0\n while n < arr.length\n yield(arr[n])\n array << arr[n]\n n += 1\n end\n array\nend",
"def each_with_index(arr)\n arr.size.times do |i|\n yield(arr[i], i)\n end\n arr\nend",
"def bubble_sort_by(ary)\n #copied from upstairs at bubble_sort\n n = ary.length - 1\n while n > 0 do\n index = 0\n\n n.times do\n first = ary[index] #first = left\n second = ary[index+1] # second = right practically\n\n if yield(first, second) > 0 #ONLY LINE THAT IS CHANGED\n ary[index+1] = first\n ary[index] = second\n end\n\n index += 1\n end\n n -= 1\n end\n print ary\nend",
"def test(arr)\n arr.map do |el|\n arr.inject(1) do |memo, el2|\n next memo if arr.index(el2) == arr.index(el)\n memo * el2\n end\n end\nend",
"def my_each_with_index\n i = 0\n while i < self.size\n yield self[i], i\n i += 1\n end\n end",
"def two_sum(nums)\n idx1 = 0\n \n while idx1 < nums.length\n idx2 = idx1 + 1\n \n while idx2 < nums.length\n if nums[idx1] + nums[idx2] == 0\n return [idx1, idx2]\n end\n \n idx2 += 1\n end\n \n idx1 += 1\n end\n \n return nil\n end",
"def my_each_with_index\n i = 0\n while i < self.length\n yield self[i], i\n i += 1\n end\n self\n end",
"def my_each_with_index\n i = 0\n while i < self.to_a.length\n yield self.to_a[i], i\n i += 1\n end\n end",
"def two_sum(nums)\n idx1 = 0\n while idx1 < nums.length\n idx2 = idx1 + 1\n while idx2 < nums.length\n if nums[idx1] + nums[idx2] == 0\n return [idx1, idx2]\n end\n\n idx2 += 1\n end\n\n idx1 += 1\n end\n\n return nil\nend",
"def two_sum(nums)\n idx1 = 0\n while idx1 < nums.length\n idx2 = idx1 + 1\n while idx2 < nums.length\n if nums[idx1] + nums[idx2] == 0\n return [idx1, idx2]\n end\n\n idx2 += 1\n end\n\n idx1 += 1\n end\n\n return nil\nend",
"def two_sum(nums)\n idx1 = 0\n while idx1 < nums.length\n idx2 = idx1 + 1\n while idx2 < nums.length\n if nums[idx1] + nums[idx2] == 0\n return [idx1, idx2]\n end\n\n idx2 += 1\n end\n\n idx1 += 1\n end\n\n return nil\nend",
"def spiral_access(array, &block)\n unless array.length == 0 || array[0].length == 0\n array[0].length.times { final_array << array[0].shift }\n array.delete_at(0)\n array.length.times { |i| final_array << (array[i].pop)}\n array.last.length.times { final_array << (array.last.pop)} unless array.last.nil?\n array.delete_at(array.length-1)\n count = array.length -1\n while count >= 0\n final_array << (array[count].shift)\n count -= 1\n end\n two_d(array, &block) unless array.length == 0\n end\n final_array.delete(nil)\n final_array.each { |x| block.call x }\nend",
"def two_sum_brute nums\n (0...nums.length).each do |i|\n ((i + 1)...nums.length).each do |j|\n if nums[i] + nums[j] == 0\n return i, j\n end\n end\n end\n nil\nend",
"def combinations(arr)\n\n arr.each_with_index do |ele1, idx|\n arr.each_with_index do |ele2, idx2|\n puts ele1 + ele2\n end\n end\n\nend",
"def okay_two_sum?(arr, target)\n arr.each_with_index do |el,idx|\n if bi_search(arr[idx+1..-1], target, el)\n return true\n end\n end\n false\nend",
"def bubble_sort_by(arr)\n\tsorted = false\n\tuntil sorted do\n\t\tsorted = true\n\t\t0.upto(arr.size - 2) do |n|\n\t\t\tif yield(arr[n], arr[n + 1]) < 0\n\t\t\t\ttemp = arr[n]\n\t\t\t\tarr[n] = arr[n + 1]\n\t\t\t\tarr[n + 1] = temp\n\t\t\t\tsorted = false\n\t\t\tend\n\t\tend\n\tend\n\n\treturn arr\n\nend",
"def find_index array, item\n\tl,r = 0, array.length-1\n\n\twhile l <= r\n\t\tm = (r+l) / 2\n\t\tcomp = yield item, array[m]\n\t\tif comp == false\n\t\t\t# Items compare the same\n\t\t\treturn false\n\t\telsif comp == -1 \n\t\t\tr = m - 1\n\t\telse\n\t\t\tl = m + 1\n\t\tend\n\tend\n\n\tl\nend",
"def bubble_sort_by(arr)\n\tloop do\n\t\tswitched = false\n\t\t(arr.count-1).times do |i|\n\t\t\tif yield(arr[i],arr[i+1])<0\n\t\t\t\tarr[i],arr[i+1]=arr[i+1], arr[i]\n\t\t\tend\n\t\tend\n\t\tbreak if not switched\n\tend\n\tarr\nend",
"def my_each(array)\n i = 0\n while i < array.length\n yield(array[i])\n array[i]\n i += 1\n end\n array\nend",
"def cada2(array, &myproc)\n i = 0\n while i < array.size\n myproc.call(array[i])\n i += 1\n end\n array\nend",
"def two_sum(arr, sum)\n sorted_arr = arr.sort()\n\n lindex = 0\n rindex = arr.size - 1\n\n while sorted_arr[lindex] < sorted_arr[rindex]\n current_sum = sorted_arr[lindex] + sorted_arr[rindex]\n\n return [sorted_arr[lindex], sorted_arr[rindex]] if current_sum == sum\n\n sorted_arr[lindex] + sorted_arr[rindex] > sum ? rindex -= 1 : lindex += 1\n end\nend",
"def A1\n arr=[*1..100]\n arr2 = []\n\tif array.each.even?\n\t\t|x| puts x \n\telsif array.each.odd?\n\t \tarr2.push(|x|)\n\tend\nend",
"def for_each_element(arr)\n index = 0\n total = arr.size\n\n while index < total\n yield(arr[index])\n index += 1\n end\nend",
"def map2(arr)\n result = []\n each arr do |x|\n results << yield(x)\n end\n results\nend",
"def okay_two_sum?(arr, target)\n sorted = arr.sort \n arr.each_with_index do |el, idx|\n new_arr = arr[0...idx]+arr[idx+1..-1]\n result = my_bs(new_arr, target-el)\n return true if result\n end\n false\nend",
"def bad_two_sum?(array, target)\n array.each.with_index do |el1, idx1|\n array.each.with_index do |el2, idx2|\n if el1 + el2 == target && idx2 > idx1\n return true \n end\n end\n end\n false \nend",
"def okay_two_sum?(arr, target)\n sorted = quick_sort(arr)\n\n arr.each_with_index do |el, idx|\n p current = target - el\n bruh = bsearch(arr, current)\n next if bruh == idx\n return true unless bruh.nil?\n end\n\n return false\nend",
"def got_three?(a) #no idea why thisis not working #wasn't calling the method got_three?\n #iterating over each index and using the .any? method (which returns true as long as the block is not false or nil)\n #so when a[index 1] is the same as index 2 AND index 3, the block is true and the any? method returns true.\n #if not it will return false.\n a.each_index.any? {|i| a[i] == a[i+1] && a[i+1] == a[i+2]}\nend",
"def test_0640_each_cons\n @@log.debug \"test_0640_each_cons starts\" if @@log.debug?\n assert_respond_to(@list, :each_cons, \"test_0640_each_cons_respond\")\n # Type check\n enum = @list.each_cons(2)\n result = enum.is_a? Enumerator\n assert(result,\"test_0640_each_cons_class\") \n # Ckeck each consecutive array\n pass = 0\n @list.each_cons(2) {|suba|\n pass += 1\n case pass\n when 1\n assert_equal([@aen, @bsb], suba, \"test_0640_each_cons_p1\")\n when 2\n assert_equal([@bsb, @cab], suba, \"test_0640_each_cons_p2\")\n when 3\n assert_equal([@cab, @dad], suba, \"test_0640_each_cons_p3\")\n else\n fail(\"test_0640_each_cons_invalid\")\n end\n }\n @@log.debug \"test_0640_each_cons ends\" if @@log.debug?\n end",
"def my_each(array)\n if block_given?\n i = 0\n \n while i < array.length \n yield array[i] \n i = i + 1 \n end\n \n array\n else\n return \"Hey! No block was given!\"\n end\nend",
"def yield_with_while_loop(array, &block)\n i = 0\n while i < array.length\n block.call(array[i])\n#yield array[i]\ni+=1\nend\nend",
"def select(arr)\n result_arr = []\n \n counter = 0\n while counter < arr.size\n result_arr << arr[counter] if yield(arr[counter])\n end\n \n result_arr\nend",
"def single_in_sorted(arr)\n return arr[0] if arr.length == 1\n\n mid_idx = arr.length / 2\n subarr = arr[0...mid_idx].length\n\n if arr[mid_idx] == arr[mid_idx - 1] && subarr.odd? ||\n arr[mid_idx] == arr[mid_idx + 1] && subarr.even?\n single_in_sorted(arr[(mid_idx + 1) .. -1])\n elsif arr[mid_idx] == arr[mid_idx + 1] && subarr.odd? ||\n arr[mid_idx] == arr[mid_idx - 1] && subarr.even?\n single_in_sorted(arr[0...mid_idx])\n end\nend",
"def my_each_with_index\n i = 0\n while i < self.length\n yield(self[i], i)\n i += 1\n end\n self\n end",
"def each_pair(&block); end",
"def fast_magic(arr, start_index, end_index)\n return -1 if end_index < start_index\n\n mid = end_index + start_index / 2\n if arr[mid] == mid\n mid\n elsif arr[mid] > mid\n fast_magic(arr, start_index, mid - 1)\n else\n fast_magic(arr, mid + 1, end_index)\n end\nend",
"def odd_elements(array)\n res = []\n (1...array.length).step(2).each do |idx|\n elem = array[idx]\n elem = yield elem if block_given?\n res.push(elem)\n end\n\n res\nend",
"def combinations(arr)\n\n new = []\n arr.each_with_index do |ele1, idx1|\n arr.each_with_index do |ele2, idx2|\n if ele1 < ele2\n puts ele1 + ele2\n puts idx1.to_s + \" \" + idx2.to_s\n puts \"----\"\n\n # new[idx] << ele1\n end\n end\n end\n\nend",
"def my_each(array)\n i = 0\n while i < array.length\n yield array[i]\n i += 1\n end\n array\nend",
"def validate_subsequence(arr1, arr2)\n\n arr2.each do |num|\n idx = arr1.index(num)\n return false if idx.nil?\n arr1 = arr1[idx+1..-1]\n end\n\n true\nend",
"def my_each_with_index\n i = 0\n while i < self.size\n yield(self[i], i)\n i += 1\n end\n self\n end",
"def my_select(arr)\ncounter = 0\nresults = []\nwhile counter < arr.length\n if yield(arr[counter]) == true\n results.push(arr[counter])\n end\n counter += 1\nend\nresults\nend",
"def bad_two_sum?(arr, target_sum)\n arr.each_with_index do |ele1, idx1|\n arr.each_with_index do |ele2,idx2|\n if idx2 > idx1 && arr[idx1] + arr[idx2] == target_sum\n return true\n end\n end\n end\n false\nend",
"def consecutive(arr)\r\n\r\nend",
"def OverlappingRanges(arr)\n\n # code goes here\n return arr \n \nend",
"def my_each_with_index\n i = 0\n while i < size\n yield(self[i], i)\n i += 1\n end\n self\n end",
"def collect2(v) # :yield: e1, e2\n my_size = size\n Vector.Raise ErrDimensionMismatch if my_size != v.size\n (0 .. my_size - 1).collect do\n |i|\n yield @elements[i], v[i]\n end \n end",
"def bubble_sort_by(array_to_sort)\n size = array_to_sort.length\n puts \"array to sort: \"\n p array_to_sort\n for i in 0..size-1\n for index in 0..size-2\n left = array_to_sort[index]\n right = array_to_sort[index + 1]\n if yield(left, right) > 0\n temp_item = array_to_sort[index]\n array_to_sort[index] = array_to_sort[index + 1]\n array_to_sort[index + 1] = temp_item\n end\n end\n end\n puts 'sorted using yield block'\n p array_to_sort\nend",
"def pass_block(arr)\n yield arr\nend",
"def my_find (collection) # collection is the array described above, passed to the method my_find\n i = 0 # setting up a counter\n while i < collection.length #while the counter is less than the length of the array do something\n return collection[i] if yield(collection[i]) #this is the \"do something\": send an ellement ([i]) to a block and if\n # it is returned to the method as 'true' then make it the return value of the method\n i+=1 # if the condition above is not met then add one to the counter and cycle through the next element in collection\n end #ends the while statement\nend",
"def two_sum(nums)\n\n\tfor index1 in 0...nums.length\n\t\t\n\t\tfor index2 in 0...nums.length\n\t\t\n\t\t\tif nums[index1] == nums[index2]*-1\n\t\t\t\treturn [index1, index2]\n\t\t\telse \n\t\t\t\treturn nil\n\t\t\tend\n\n\t\tend\n\n\tend\n\nend",
"def okay_two_sum(arr, target)\n sorted_arr = arr.sort\n while sorted_arr.any?\n partner = target - sorted_arr.pop\n return true if b_search(sorted_arr, partner)\n end\n\n false\nend",
"def bad_two_sum?(arr, target)\n arr.each_with_index do |num1, idx1| #O(n)\n arr.each_with_index do |num2, idx2| #O(n)\n return true if idx2 > idx1 && num1 + num2 == target #O(1)\n end\n end\n false\nend",
"def brute_force_two_sum(array, target)\n indexes = []\n array.each.with_index do |n1, index1|\n array.each.with_index do |n2, index2|\n indexes.push(index1) if target - n1 == n2 && index1 != index2\n end\n end\n indexes\nend",
"def bad_two_sum?(arr, target_sum)\r\n arr.each_with_index do |ele1, i1|\r\n arr.each_with_index do |ele2, i2|\r\n return true if i2 != i1 && (ele1 + ele2 == target_sum)\r\n end\r\n end\r\n\r\n false\r\nend",
"def map_then_iterate_two_sum(array, target)\n hash = {}\n array.each.with_index do |i, index|\n hash[i] = index\n end\n indexes = []\n array.each.with_index do |ii, index|\n complement = target - ii \n if hash.has_key?(complement) && hash.fetch(complement) != index\n indexes.push(index, hash.fetch(complement))\n return indexes\n end\n end\nend",
"def two_sum_ptr(nums, target)\n low, high = 0, nums.length - 1\n while( low < high)\n if(nums[low] + nums[high] == target)\n return [low + 1, high + 1]\n elsif nums[low] + nums[high] < target\n low += 1\n else\n high -= 1\n end\n end\nend"
] |
[
"0.7513829",
"0.744859",
"0.7363853",
"0.7146757",
"0.7092168",
"0.70180184",
"0.68389475",
"0.66824883",
"0.6497901",
"0.64506173",
"0.6392409",
"0.6355082",
"0.63120294",
"0.62711823",
"0.62602246",
"0.6240947",
"0.62398815",
"0.6193741",
"0.6148433",
"0.61179006",
"0.608568",
"0.60828865",
"0.6077215",
"0.6059885",
"0.6042726",
"0.6035457",
"0.6013252",
"0.60066235",
"0.599649",
"0.59913445",
"0.59896404",
"0.5987482",
"0.5974606",
"0.5956848",
"0.5944342",
"0.59283113",
"0.59130895",
"0.5910344",
"0.5901997",
"0.58935916",
"0.588946",
"0.58890504",
"0.5882363",
"0.5878853",
"0.58734417",
"0.5868457",
"0.58669716",
"0.5865268",
"0.58545196",
"0.58512986",
"0.5842805",
"0.58417594",
"0.58417594",
"0.58417594",
"0.5835884",
"0.58321387",
"0.5831653",
"0.5828093",
"0.58074737",
"0.5797812",
"0.57969666",
"0.57815814",
"0.5772828",
"0.5772723",
"0.57685125",
"0.57653296",
"0.5754454",
"0.5753907",
"0.5750501",
"0.5745591",
"0.5744733",
"0.57396615",
"0.57362324",
"0.57269907",
"0.57172453",
"0.5710496",
"0.5710236",
"0.5708819",
"0.5707474",
"0.5706788",
"0.56919336",
"0.56841904",
"0.56822383",
"0.56808215",
"0.5679137",
"0.5674901",
"0.5673669",
"0.5669935",
"0.5668381",
"0.5667225",
"0.5667033",
"0.5645744",
"0.56379604",
"0.56378996",
"0.5635131",
"0.5634509",
"0.56281847",
"0.5628001",
"0.5625125",
"0.56211805"
] |
0.78848267
|
0
|
Salforce Lead cteating from CherApp
|
def salesforce_lead_create
user = User.select("first_name, last_name").last
SalesforceLeadJob.perform_later(email) if (user.last_name).present?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def perform\n begin\n binding = RForce::Binding.new KEYS['salesforce']['base']\n binding.login KEYS['salesforce']['username'], KEYS['salesforce']['password'] + KEYS['salesforce']['token']\n\n sl = SellerListing.find(seller_listing_id)\n\n # User, address and phone info must be here to create a seller listing\n # http://www.salesforce.com/us/developer/docs/api/index.htm [search for Lead]\n lead = [\n :type, LEAD,\n :Lead_Source__c, LEAD_SOURCE,\n :Country, LEAD_COUNTRY,\n :FirstName, sl.user.first_name,\n :First_Name2__c, sl.user.first_name,\n :LastName, sl.user.last_name,\n :Last_Name2__c, sl.user.last_name,\n :Email, sl.user.email,\n :Phone, sl.phone_number.number,\n :Property_Address__c, [sl.address.address1, sl.address.address2].join(' '),\n :Property_City__c, sl.address.city,\n :Property_State__c, sl.address.state,\n :Property_Zip__c, sl.address.zip.to_s\n ]\n\n # Check and see if we have second-step data yet (which is, of course, the entire reason for delaying this\n # job [to give the user enough time to finish step 2])\n lead.push(:EstimatedValue__c, sl.estimated_value(true).to_s) if sl.estimated_value.present?\n lead.push(:AskingPrice__c, sl.asking_price(true).to_s) if sl.asking_price.present?\n lead.push(:LoanAmount__c, sl.loan_amount(true).to_s) if sl.loan_amount.present?\n lead.push(:DesiredSellTime__c, sl.time_frame.to_s) if sl.time_frame.present?\n lead.push(:SellingReason__c, sl.selling_reason) if sl.selling_reason.present?\n\n # Who owns this zip?\n owner_resp = SalesforceJob.account_owner_for_zip(binding, sl)\n\n if owner_resp.ok?\n account_id = owner_resp.salesforce_account_id\n lead.push(:Owned_by_Account__c, account_id)\n end\n\n # Create Lead!\n lead = binding.create :sObject => lead\n create_resp = SalesforceJob.munge_create_salesforce_lead_results(lead, sl)\n\n if create_resp.ok?\n sl.salesforce_lead_id = create_resp.salesforce_lead_id\n sl.salesforce_lead_owner_id = account_id\n sl.save!\n\n # Now that we sucessfully tied this seller listing to a buyer account in salesforce, send out our new\n # seller listing confirmation email according to the specs outlined here:\n # https://ehouseoffers.fogbugz.com/default.asp?28 -- seller_offer_request_confirmation.rtf\n # Because we already waited to process this (see seller_listings_controller.create), we send this email\n # out without delay despite what the ticket says. We just use delayed job to make it it's own process\n DelayedJobs::Salesforce.new_seller_confirmation(sl)\n DelayedJobs::Salesforce.new_seller_affiliate_services(sl, true)\n DelayedJobs::Salesforce.buyer_lead_notification(sl, owner_resp.buyer_emails)\n else\n Rails.logger.fatal(\"Salesforce create lead bombed! create_resp = #{create_resp.inspect}\")\n end\n\n rescue => e\n Rails.logger.fatal(\"SalesforceJob.perform bombed with the following exception: \"+ e)\n raise e\n end\n end",
"def franchisee_royalty_pay_slip\n \n end",
"def enroll_pur_user(params)\n $tracer.trace(\"LoyaltyEnrollmentServiceDSL: #{__method__}, Line: #{__LINE__}\")\n $tracer.report(\"Should #{__method__}.\")\n first_name = params['first_name']\n last_name = params['last_name']\n is_default_addr = params['is_default_addr']\n address_line1 = params['addr_line1']\n address_line2 = params['addr_line2']\n city = params['city']\n state = params['state']\n zip = params['postal_code']\n country = params['country']\n country_code = params['country_code']\n locale = params['locale']\n phone_number = params['phone_number']\n #birth_date = params['birth_date']\n month_range = %w(01 02 03 04 05 06 07 08 09 10 11 12).sample\n if month_range == \"02\"\n # Purposefully omitting leap years because they're stupid. Will add later.\n day_range = %w(01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28).sample\n elsif month_range == \"01\" || \"03\" || \"05\" || \"07\" || \"08\" || \"10\" || \"12\"\n day_range = %w(01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 31).sample\n else\n day_range = %w(01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30).sample\n end\n t = Time.now\n time_stamp = t.strftime(\"%FT%T.0000000-06:00\")\n time = t.strftime(\"%T\")\n date = t.strftime(\"%F\")\n\n birth_yr_range = Random.new.rand(1900..1996).to_s\n birth_date = \"#{birth_yr_range}-#{month_range}-#{day_range}T#{time}.0000000-06:00\"\n store_number = params['store_number']\n tier = params['pur_tier']\n new_flag = params['generate_user_name']\n\n if Config::CONFIG['target_os'] != \"darwin\"\n machine_name = Socket.gethostname\n else\n machine_name = \"d-con automation\"\n end\n\n db = DbManager.new(\"GV1HQQDB50SQL01.testgs.pvt\\\\INST01\", \"Membership\")\n\n # Sets flag to determine if auto generated card number exists\n card_exists = false\n @named = {\n :purfree => {:prefixes => ['3975'], :size => 13},\n :purpaid => {:prefixes => ['3976'], :size => 13}\n }\n # Loop to generate a non-existing loyalty card number\n while card_exists == false do\n\n if tier == '3876'\n cctype = \"purpaid\"\n\n elsif tier == '3875'\n cctype = \"purfree\"\n else\n $tracer.trace(\"No PUR Card Generated, please check that the tier is correct\")\n cctype = nil\n end\n membership_number = CreditCard.method_missing(\"#{cctype}\", @named)\n\n #Check if generated card number exists in MembershipCard db\n confirm_results = db.exec_sql(\"SELECT MembershipID FROM Membership.dbo.MembershipCard WHERE CardNumber = '\" + membership_number + \"';\")\n\n if confirm_results != nil\n $tracer.trace(\"Card number exists\")\n $tracer.trace(\"DB RESULTS: \" + confirm_results.at(0).MembershipID.to_s)\n card_exists = false\n elsif\n $tracer.trace(\"Card number does not exist\")\n card_exists = true\n end\n end\n\n $tracer.trace(\"Card number: \" + membership_number)\n\n # Generate a new email address\n (new_flag == true) ? email = auto_generate_username(nil, \"#{params['email_domain']}\", \"#{params['email_prefix']}\") : email = params['email']\n #email = auto_generate_username(nil, \"#{params['email_domain']}\", \"#{params['email_prefix']}\")\n $tracer.report(\"Email address: #{email}\")\n\n #Defines the service template to use\n pur_enrollment_request = self.get_request_from_template(LoyaltyMembershipServiceRequestTemplates::ENROLL_CUSTOMER_FOR_MEMBERSHIP)\n\n # Sets request values\n header = pur_enrollment_request.envelope.header.message_headers\n header.machine_name.content = machine_name\n\n key_value_pair_list = header.key_value_pairs.at(0)\n\n key_value_pair_list.key_value_pair.at(0).key.content = \"channeltype\"\n key_value_pair_list.key_value_pair.at(0).value.content = \"PointOfSale\"\n key_value_pair_list.key_value_pair.at(0).clone_as_sibling\n key_value_pair_list.key_value_pair.at(1).key.content = \"storenumber\"\n key_value_pair_list.key_value_pair.at(1).value.content = store_number\n\n header.culture_info.locale.content = locale\n header.culture_info.time_zone.content = \"true\"\n header.culture_info.country_code.content = country_code\n\n # Purposefully misspelled - do not correct\n header.secutiry_token.content = nil\n\n body = pur_enrollment_request.envelope.body.enroll_customer_for_membership_request.customer\n address_list = body.find_tag(\"addresses\").at(0)\n address_list.address.at(0).address_guid.content = nil\n address_list.address.at(0).address_id.remove_self\n address_list.address.at(0).address_line1.content = address_line1\n address_list.address.at(0).address_line2.content = address_line2\n address_list.address.at(0).address_line3.content = nil\n address_list.address.at(0).address_line4.content = nil\n #Address type HOME maps to MAILING\n address_list.address.at(0).address_type.content = \"Home\"\n address_list.address.at(0).city.content = city\n address_list.address.at(0).company_name.content = nil\n address_list.address.at(0).country.content = country\n address_list.address.at(0).county.content = nil\n address_list.address.at(0).first_name.content = first_name\n address_list.address.at(0).is_default.content = is_default_addr\n address_list.address.at(0).last_name.content = last_name\n address_list.address.at(0).postal_code.content = zip\n address_list.address.at(0).state_or_province.content = state\n\n body.date_of_birth.content = nil\n body.edge_card_discount_number.content = nil\n body.display_name.content = nil\n body.email_address.content = email\n body.email_opt_out.content = nil\n body.first_name.content = first_name\n body.gender.remove_self\n phones_list = body.find_tag(\"phones\").at(0)\n phones_list.phone.at(0).home_phone_number.content = phone_number\n phones_list.phone.at(0).mobile_phone_number.content = nil\n phones_list.phone.at(0).primary_phone.content = \"Home\"\n phones_list.phone.at(0).work_phone_number.content = nil\n body.home_store_number.remove_self # MAY NEED TO ADD BACK\n body.identifications.remove_self\n body.issued_user.content = nil\n body.last_name.content = last_name\n body.loyalty_info.valid_loyalty_membership.remove_self\n body.loyalty_info.card_status.remove_self\n body.loyalty_info.detailed_card_status.remove_self\n body.loyalty_info.detailed_membership_status.remove_self\n body.loyalty_info.end_date.remove_self\n body.loyalty_info.failed_login_attempts.remove_self\n body.loyalty_info.is_locked_out.content = \"false\"\n body.loyalty_info.login_time_stamp.content = \"#{date}T#{time}.0000000-06:00\"\n body.loyalty_info.loyalty_card_number.content = membership_number\n body.loyalty_info.membership_id.remove_self\n body.loyalty_info.membership_status.remove_self\n body.loyalty_info.online_account_status.remove_self\n body.loyalty_info.roles.remove_self\n body.loyalty_info.tier.content = tier\n\n body.loyalty_info.tier_expiration_date.content = \"#{t.strftime(\"%Y\").to_i + 1}-#{t.strftime(\"%m\")}-#{t.strftime(\"%d\")}T#{time}.0000000-06:00\"\n body.loyalty_info.tier_sign_up_date.content = \"#{date}T#{time}.0000000-06:00\"\n body.loyalty_info.total_power_up_savings.remove_self\n body.membership_ids.remove_self\n body.middle_name.content = nil\n body.prefix.content = nil\n body.race.remove_self\n body.suffix.content = nil\n body.title.content = nil\n body.user_name.content = nil\n body.customer_activities.content = nil\n body.valid_email_address.remove_self\n body.membership_type.remove_self\n\n # Formats the request in xml format\n $tracer.trace(pur_enrollment_request.formatted_xml)\n\n # Returns response from submitted request\n pur_enrollment_response = self.enroll_customer_for_membership(pur_enrollment_request.xml)\n # Validates response code is successful\n $tracer.trace(\"response: \" + pur_enrollment_response.code.to_s)\n pur_enrollment_response.code.should == 200\n $tracer.trace(pur_enrollment_response.http_body.formatted_xml)\n # Retrieves profile ID from the status message in the response\n status_result = pur_enrollment_response.http_body.find_tag(\"status\").at(0).content\n pur_profile_id = status_result.to_s[35, 44]\n $tracer.report(\"Profile ID for querying Membership Database: \" + pur_profile_id)\n # Validates in Membership db that the user is enrolled\n results = db.exec_sql(\"SELECT MembershipID, MembershipStatusID FROM Membership.dbo.Membership WHERE MembershipID IN (SELECT MembershipID FROM Profile.KeyMap.CustomerKey WHERE ProfileID = '\" + pur_profile_id + \"');\")\n $tracer.report(\"Customer Id, AKA Membership Id: \" + results.at(0).MembershipID.to_s)\n customer_id = results.at(0).MembershipID.to_s\n results.at(0).MembershipID.should > 0\n results.at(0).MembershipStatusID.should == 2\n $tracer.report(\"Enrolled email: \" + email)\n $tracer.report(\"Card Number: \" + membership_number)\n\n return email, membership_number, pur_profile_id, customer_id\n end",
"def lender_credit_modeler_df\n hudline \"Lender Credit\"\n end",
"def sld; end",
"def devolver_sal \n\t\treturn @sal\n\tend",
"def renewal_eligiblity_determination\n end",
"def leeway; end",
"def leeway; end",
"def tl_Aries() \r\n # Celes.anp(eq_of_equinox() + ml_Aries())\r\n dt = 67.184 \r\n tt = @ajd + dt / 86400.0#Celes.ut1tt(@ajd, 0, dt) \r\n Celes.gst06a(@ajd, 0, tt, 0) \r\n end",
"def createLeadStdsalesforce\n\n\n @helper.addLogs(\"[Step ] : Login to salesforce\")\n loginToSalesforce()\n\n puts \"in Lead::createLeadStdsalesforce\"\n EnziUIUtility.wait(@driver, :link, \"Leads\", @timeSettingMap['Wait']['Environment']['Lightening']['Max']) \n @driver.find_element(:link, \"Leads\").click\n @driver.find_element(:name, \"new\").click\n #select record type\n EnziUIUtility.wait(@driver, :id, \"p3\", @timeSettingMap['Wait']['Environment']['Lightening']['Max']) \n @driver.find_element(:id, \"p3\").click\n Selenium::WebDriver::Support::Select.new(@driver.find_element(:id, \"p3\")).select_by(:text, @testDataJSON['Lead'][0]['RecordType'])\n #click on continue\n @driver.find_element(:xpath, \"(//input[@name='save'])[2]\").click\n #selct salutation\n @driver.find_element(:id, \"name_salutationlea2\").click\n Selenium::WebDriver::Support::Select.new(@driver.find_element(:id, \"name_salutationlea2\")).select_by(:text, \"Mr.\")\n #enter first name\n @driver.find_element(:id, \"name_firstlea2\").click\n @driver.find_element(:id, \"name_firstlea2\").clear\n @driver.find_element(:id, \"name_firstlea2\").send_keys @testDataJSON['Lead'][0]['FirstName']\n #enter last name\n @driver.find_element(:id, \"name_lastlea2\").click\n @driver.find_element(:id, \"name_lastlea2\").clear\n @driver.find_element(:id, \"name_lastlea2\").send_keys @testDataJSON['Lead'][0]['LastName']\n #enter email\n @driver.find_element(:id, \"lea11\").click\n @driver.find_element(:id, \"lea11\").clear\n @driver.find_element(:id, \"lea11\").send_keys @testDataJSON['Lead'][0]['Email']\n #enter company name\n @driver.find_element(:id, \"lea3\").click\n @driver.find_element(:id, \"lea3\").clear\n @driver.find_element(:id, \"lea3\").send_keys @testDataJSON['Lead'][0]['Company']\n\n #enter phone number\n @driver.find_element(:id, \"lea8\").clear\n @driver.find_element(:id, \"lea8\").send_keys @testDataJSON['Lead'][0]['Phone']\n\n #enter promo code\n @driver.find_element(:id, \"00NF000000D598h\").clear\n @driver.find_element(:id, \"00NF000000D598h\").send_keys @testDataJSON['Lead'][0]['Promo Code']\n\n #select move in time frame\n @driver.find_element(:id, \"00N0G00000DjmNR\").click\n Selenium::WebDriver::Support::Select.new(@driver.find_element(:id, \"00N0G00000DjmNR\")).select_by(:text, @testDataJSON['Lead'][0]['Move In Time Frame'])\n\n #enter Org Acc name\n @driver.find_element(:id, \"CF00N0G00000DkNxF\").click\n @driver.find_element(:id, \"CF00N0G00000DkNxF\").clear\n @driver.find_element(:id, \"CF00N0G00000DkNxF\").send_keys \"john.snow_Org_qaauto12121212\"\n #select lead Source\n @driver.find_element(:id, \"lea5\").click\n Selenium::WebDriver::Support::Select.new(@driver.find_element(:id, \"lea5\")).select_by(:text, @testDataJSON['Lead'][0]['leadSource'])\n #select lead source details\n @driver.find_element(:id, \"00NF0000008jx4n\").click\n @driver.find_element(:id, \"00NF0000008jx4n\").clear\n @driver.find_element(:id, \"00NF0000008jx4n\").send_keys @testDataJSON['Lead'][0]['lead_Source_Detail__c']\n #select lead status\n @driver.find_element(:id, \"lea13\").click\n Selenium::WebDriver::Support::Select.new(@driver.find_element(:id, \"lea13\")).select_by(:text, @testDataJSON['Lead'][0]['Lead Status'])\n \n #set camapign\n if !@testDataJSON['Lead'][0]['Campaign'].nil? then\n @driver.find_element(:id, \"lea20\").clear\n @driver.find_element(:id, \"lea20\").send_keys @testDataJSON['Lead'][0]['Campaign']\n end\n\n #generate journey\n if @testDataJSON['Lead'][0]['Generate Journey'] then\n @driver.find_element(:id, \"00NF000000DWYhq\").click\n end\n\n #restart journey\n if @testDataJSON['Lead'][0]['Restart Journey'] then\n @driver.find_element(:id, \"00NF000000DSawf\").click\n end\n\n #Interested in no of desk(s)\n @driver.find_element(:id, \"00N0G00000DKsrf\").click\n @driver.find_element(:id, \"00N0G00000DKsrf\").clear\n @driver.find_element(:id, \"00N0G00000DKsrf\").send_keys @testDataJSON['Lead'][0]['Interested in Number of Desk(s)']\n\n #Selcet type\n @driver.find_element(:id, \"00NF0000008jx4d\").click\n Selenium::WebDriver::Support::Select.new(@driver.find_element(:id, \"00NF0000008jx4d\")).select_by(:text, @testDataJSON['Lead'][0]['Type'])\n #select Market\n @driver.find_element(:id, \"00NF000000DWHcN\").click\n Selenium::WebDriver::Support::Select.new(@driver.find_element(:id, \"00NF000000DWHcN\")).select_by(:text, @testDataJSON['Lead'][0]['Market'])\n\n #select Locale\n @driver.find_element(:id, \"00NF000000DW96x\").click\n Selenium::WebDriver::Support::Select.new(@driver.find_element(:id, \"00NF000000DW96x\")).select_by(:text, @testDataJSON['Lead'][0]['Locale'])\n \n #enter Building interested in\n @driver.find_element(:id, \"CF00NF000000DW8Sn\").click\n @driver.find_element(:id, \"CF00NF000000DW8Sn\").clear\n @driver.find_element(:id, \"CF00NF000000DW8Sn\").send_keys @testDataJSON['Lead'][0]['Building Interested In']\n\n #Select Country Code\n @driver.find_element(:id, \"00NF000000DW97C\").click\n Selenium::WebDriver::Support::Select.new(@driver.find_element(:id, \"00NF000000DW97C\")).select_by(:text, @testDataJSON['Lead'][0]['Country Code'])\n\n puts \"select Market Interested\"\n sleep(1)\n # ERROR: Caught exception [ERROR: Unsupported command [addSelection | id=00NF000000DSdDJ_unselected | label=Amsterdam]]\n @driver.find_element(:xpath, \"//option[@value='0']\").click\n @driver.find_element(:id, \"00NF000000DSdDJ_right_arrow\").click\n # ERROR: Caught exception [ERROR: Unsupported command [doubleClick | //option[@value='0'] | ]]\n # ERROR: Caught exception [ERROR: Unsupported command [addSelection | id=00NF000000DSdDJ_unselected | label=Atlanta]]\n sleep(1)\n @driver.find_element(:xpath, \"//option[@value='2']\").click\n @driver.find_element(:id, \"00NF000000DSdDJ_right_arrow\").click\n # ERROR: Caught exception [ERROR: Unsupported command [doubleClick | //option[@value='2'] | ]]\n #enter Number of Full Time Employees\n @driver.find_element(:id, \"00N0G00000DKsrg\").click\n @driver.find_element(:id, \"00N0G00000DKsrg\").clear\n @driver.find_element(:id, \"00N0G00000DKsrg\").send_keys @testDataJSON['Lead'][0]['Number of Full Time Employees']\n\n\n #Locations Interested\n # ERROR: Caught exception [ERROR: Unsupported command [addSelection | id=00NF0000008jx61_unselected | label=AMS-Labs]]\n @driver.find_element(:xpath, \"(//option[@value='0'])[2]\").click\n @driver.find_element(:id, \"00NF0000008jx61_right_arrow\").click\n # ERROR: Caught exception [ERROR: Unsupported command [doubleClick | xpath=(//option[@value='0'])[2] | ]]\n # ERROR: Caught exception [ERROR: Unsupported command [addSelection | id=00NF0000008jx61_unselected | label=AMS-Strawinskylaan]]\n @driver.find_element(:xpath, \"(//option[@value='2'])[2]\").click\n @driver.find_element(:id, \"00NF0000008jx61_right_arrow\").click\n # ERROR: Caught exception [ERROR: Unsupported command [doubleClick | xpath=(//option[@value='2'])[2] | ]]\n\n #enter reffer Name\n @driver.find_element(:id, \"CF00NF000000DVv35\").click\n @driver.find_element(:id, \"CF00NF000000DVv35\").clear\n @driver.find_element(:id, \"CF00NF000000DVv35\").send_keys \"john snow_QaAuto_121\"\n\n #enter reffer Email\n @driver.find_element(:id, \"00N0G00000DkPYC\").click\n @driver.find_element(:id, \"00N0G00000DkPYC\").clear\n @driver.find_element(:id, \"00N0G00000DkPYC\").send_keys @testDataJSON['Lead'][0]['Referrer Email']\n\n #enter reffer name\n @driver.find_element(:id, \"00NF000000CbxMW\").click\n @driver.find_element(:id, \"00NF000000CbxMW\").clear\n @driver.find_element(:id, \"00NF000000CbxMW\").send_keys @testDataJSON['Lead'][0]['Referrer Name']\n \n #lead Assignment rule---\n if @testDataJSON['Lead'][0]['Assign using active assignment rule'] then\n @driver.find_element(:id, \"lea21\").click\n end\n\n #@driver.find_element(:xpath, \"(//input[@name='save'])[2]\").click\n #@driver.find_element(:id, \"CF00NF000000DVv35_lkid\").click\n #Selenium::WebDriver::Support::Select.new(@driver.find_element(:id, \"CF00NF000000DVv35_lkid\")).select_by(:text, \"John Snow\")\n @driver.find_element(:xpath, \"(//input[@name='save'])[2]\").click\n\n return true\n rescue Exception => e\n puts e\n return false\n end",
"def assign_lawyer\n sp_session = current_service_provider_session\n employee = Employee.find(params[:employee_id],:include=>[:user=>[:service_provider_employee_mappings]])\n service_session = Physical::Liviaservices::ServiceSession.create(:employee_user_id =>employee.user.id,\n :sp_session => sp_session,\n :session_start => Time.now ,\n :company_id => current_user.company_id)\n session[:service_session] = service_session.id\n assignment_user = employee.user\n lawyer = assignment_user\n lawyer.verified_lawyer\n session[:verified_lawyer_id] = assignment_user.id\n current_user.verified_lawyer_id_by_secretary = assignment_user.id\n sp_id= employee.user.nil? ? \"\" : employee.user.service_provider_employee_mappings.blank? ? \"\" : employee.user.service_provider_employee_mappings.first.service_provider_id\n redirect_to new_communication_path(:service_provider_id=>sp_id,:call_id=>params[:call_id])\n end",
"def pay_salaries(week)\n cpp = cost_payment_plan\n human_resources.each do |hr|\n nyd = 'Pago sueldo ' + hr.name\n am = hr.salary\n unless CostLine.where(name: nyd, payment_week: week).length > 0\n cl = CostLine.new(name: nyd, description: nyd,\n amount: am, real_amount: am,\n payment_week: week, real_payment_week: week,\n cost_payment_plan_id: cpp.id, status: 'Pagado',\n funding_source: 'Reserva de actividades')\n cl.save\n use_budget(cl)\n end\n end\n end",
"def salary_advance\n advs = @faculty.employee_advance_payments.belongs_to_month(@generation_date.strftime(\"%b\")).belongs_to_year(@generation_date.strftime(\"%Y\"))\n advs.inject(0){|sum, adv| sum+adv.amount_in_rupees}\n end",
"def solar_landing_leads_count\n leads.where(call_consented: true).count\n end",
"def ledger\n @ledger\n end",
"def show\n\t @lawyers = Lawyer.all\n @states = State.all\n\n @NumLaw = 0 # Contador de posições do vetor @AvailableLawyers\n @AvailableLawyers = []\n\n for i in 0..@lawyers.length-1 \n if ((@client.state).upcase).split == (@lawyers[i].state).split # Verificador Estado do cliente \n # = Estado do advogado \n @AvailableLawyers[@NumLaw] = @lawyers[i]\n @NumLaw += 1 \n end \n end \n\n if @AvailableLawyers.empty? # Se estiver vazio, retorna 0 e exibe na tela:\n #\"Desculpe, não possuímos nenhum advogado cadastrado no seu estado.\"\n @IdealLawyer = 0 \n \n else \n\n for j in 0..@states.length-1\n\n if @AvailableLawyers[0].state == @states[j].name\n\n save = j # Salva a posição do estado em questão\n break\n\n end \n end\n\n for i in 0..@AvailableLawyers.length-1\n\n if (@states[save].interaction ).to_i > @AvailableLawyers.length \n\n @states[save].interaction = \"1\" # Caso o número de interações exceder o limite, dá reset\n\n end \n\n if @AvailableLawyers[i].order == @states[save].interaction\n \n @IdealLawyer = @AvailableLawyers[i] # Retorno do advogado na mesma ordem da interação\n break\n\n end\n end \n \n @states[save].interaction = ((@states[save].interaction).to_i + 1).to_s # Crescendo a fila\n @states[save].save\n\n end\n end",
"def renewal_plan\n if @enrollment.coverage_kind == 'dental'\n renewal_plan = @enrollment.plan.renewal_plan_id\n else\n if has_catastrophic_plan? && is_cat_plan_ineligible?\n renewal_plan = @enrollment.plan.cat_age_off_renewal_plan_id\n if renewal_plan.blank?\n raise \"#{renewal_coverage_start.year} Catastrophic age off plan missing on HIOS id #{@enrollment.plan.hios_id}\"\n end\n else\n if @enrollment.plan.csr_variant_id == '01' || has_catastrophic_plan?\n renewal_plan = @enrollment.plan.renewal_plan_id\n else\n renewal_plan = Plan.where({\n :active_year => renewal_coverage_start.year, \n :hios_id => \"#{@enrollment.plan.renewal_plan.hios_base_id}-01\"\n }).first.id\n end\n end\n end\n\n if renewal_plan.blank?\n raise \"#{renewal_coverage_start.year} renewal plan missing on HIOS id #{@enrollment.plan.hios_id}\"\n end\n \n renewal_plan\n end",
"def endorsement_certificate\n \n end",
"def salutation\n end",
"def createLead\n #@testDataJSON['CreateOpportunity'][0]['lead'][0]['email'] = \"test_johnsmith#{rand(99999999999999)}@example.com\"\n\n #puts @driver.current_url()\n #puts @leadsTestData\n #@result= @helper.createSalesforceRecord('Lead',@leadsTestData)\n #puts @result\n #url = @driver.current_url();\n #newUrl = url.split('/')\n #@driver.get \"#{newUrl[0]}//#{newUrl[2]}/#{@result[0]['Id']}\"\n #puts \"Lead created suceessfully\\n \"\n end",
"def business_decision_support \n end",
"def adler\n\t\tend",
"def index\n if is_adm?\n @signed_leases = SignedLease.all\n else\n @signed_leases = SignedLease.where(:sid => current_user_id)\n end\n\n end",
"def virgilism_dentality(checkrowed, generatrix)\n unflickeringly_draftiness_goer()\n retrust(clavation_uneclipsed)\n thumby(afterknowledge, disproval)\n end",
"def upgrade_plan_from_admin(plan_id, renewal_date, fin_year)\n new_plan = Plan.find_by_id(plan_id.to_i)\n transaction do\n subscription_history = SubscriptionHistory.create!(\n :company_id => self.company_id,\n :plan_id => self.plan_id,\n :start_date => self.start_date,\n :end_date => self.end_date,\n :renewal_date => self.renewal_date,\n :first_subscription_date => self.first_subscription_date,\n :ip_address => self.ip_address,\n :amount => self.amount,\n :allocated_storage_mb => self.allocated_storage_mb,\n :allocated_user_count => self.allocated_user_count\n )\n\n user_count = self.allocated_user_count - self.plan.user_count + new_plan.user_count\n self.update_attributes!(\n :plan_id => new_plan.id,\n :renewal_date => renewal_date,\n :end_date => renewal_date,\n :allocated_user_count => user_count\n )\n\n if Subscription.find(self.id).plan.is_inventoriable? && self.company.warehouses.blank?\n Warehouse.create_default_warehouse(self.company_id, self.company.users.first.id)\n end\n if Subscription.find(self.id).plan.payroll_enabled? && self.company.leave_types.blank?\n LeaveType.create_default_leave_types(self.company_id, self.company.users.first.id)\n end\n\n if Subscription.find(self.id).plan.payroll_enabled? && self.company.holidays.blank?\n year = (Time.zone.now.to_date.month.to_i < fin_year.start_date.month ? fin_year.end_date.year : fin_year.start_date.year )\n holiday_date1 = Date.new(year.to_i, 1, 26)\n holiday_date2 = Date.new(year.to_i, 8, 15)\n holiday_date3 = Date.new(year.to_i, 10, 02)\n holiday = Holiday.create(:company_id => self.company_id, :created_by => self.company.users.first.id, :holiday=> \"Republic day\", :holiday_date => holiday_date1, :description =>\"Republic day of India\")\n holiday = Holiday.create(:company_id => self.company_id, :created_by => self.company.users.first.id, :holiday=> \"Independance Day\", :holiday_date => holiday_date2, :description =>\"Independance day of India\")\n holiday = Holiday.create(:company_id => self.company_id, :created_by => self.company.users.first.id, :holiday=> \"Mahatma Gandhi Jayanti\", :holiday_date => holiday_date3, :description =>\"Gandhi Jayanti celebrated in India to mark the occasion of the birthday of Mahatma Gandhi.\")\n\n end\n\n if Subscription.find(self.id).plan.payroll_enabled? && self.company.payheads.blank?\n accounts = Account.where(:name => [\"Basic\",\"House Rent Allowance\", \"Dearness Allowance\", \"Travelling Allowance\", \"Bonus\"], :company_id => self.company_id)\n if accounts.blank?\n # Account.create_default_accounts(self.company_id, self.company.users.first.id)\n end\n Payhead.create_default_payheads(self.company_id, self.company.users.first.id)\n end\n if !Subscription.find(self.id).plan.free_plan? && self.company.custom_fields.blank?\n CustomField.create_default_record(self.company_id)\n end\n logger.debug \"After subscription attributes\"\n #update users enrolled with appropriate roles in new plans\n if subscription_history.plan_id != self.plan_id\n self.company.users.each do |user|\n # user.roles[0] = new_plan.roles.find_by_name(user.roles[0].name)\n\t\t\t\t\t# user.save\n # logger.debug \"Updated roles\"\n new_role = new_plan.roles.find_by_name(user.roles[0].name)\n assignment = Assignment.find_by_user_id(user.id)\n assignment.update_attribute(:role_id, new_role.id)\n end\n end\n end\n end",
"def startProcess\n lawIDs = Fetcher.retrieveLawIDs()\n\n @@numberOfLaws = lawIDs.size\n\n laws, timelineTitles, firstboxKeys = Fetcher.retrieveLawContents(lawIDs)\n\n @@numberOfResults = laws.size\n\n Saver.save laws, timelineTitles, firstboxKeys\n end",
"def leadCreateSfBulk()\n Salesforce.createRecords(@salesforceBulk, 'Lead', @testDataJSON[\"AccountAssignment\"][\"GenerateLeadFromWeb\"][0][\"BuildingName\"])\n end",
"def index\n @leads = Lead.all\n end",
"def index\n @leads = Lead.all\n end",
"def superweening_adorningly(counterstand_pyrenomycetales)\n end",
"def index\n @leads = Lead.all()\n end",
"def effective_late_penalty\n late_penalty || course.late_penalty\n end",
"def new_direct_sales_tm\n return if authorise_for_web(program_name?,'create') == false\n render_new_direct_sales_tm\n end",
"def the_doctor; end",
"def claim\n @student.index.claim_accommodation_scholarship!\n @school_year = TermsCalculator.current_school_year\n end",
"def salvage\n return @salvage\n end",
"def salvage\n return @salvage\n end",
"def createLeadFromStdSalesforce(email)\n puts @testDataJSON['Lead']\n records_to_insert = Hash.new\n records_to_insert.store('Name','Kishor_shinde')\n record = @helper.createRecords(sObject,records_to_insert)\n puts record\n return record \n end",
"def in_law; end",
"def dod_paygrade; end",
"def case_with_bad_decass_for_timeline_range_checks\n Time.zone = 'EST'\n vet = create_veteran\n cf_judge = User.find_by_css_id(\"BVABDANIEL\") || create(:user, :judge, :with_vacols_judge_record)\n cf_atty = User.find_by_css_id(\"BVABBLOCK\") || create(:user, :with_vacols_attorney_record)\n judge = VACOLS::Staff.find_by_css_id(cf_judge.css_id)\n atty = VACOLS::Staff.find_by_css_id(cf_atty.css_id)\n vc = create(:case, :assigned, user: cf_judge, bfcorlid: \"#{vet.file_number}S\")\n create(:legacy_appeal, vacols_case: vc)\n create(:priorloc, lockey: vc.bfkey, locdin: 5.weeks.ago, locdout: 5.weeks.ago - 1.day, locstout: judge.slogid, locstto: judge.slogid)\n create(:priorloc, lockey: vc.bfkey, locdin: 4.weeks.ago, locdout: 5.weeks.ago, locstout: judge.slogid, locstto: \"CASEFLOW_judge\")\n create(:priorloc, lockey: vc.bfkey, locdin: 3.weeks.ago, locdout: 4.weeks.ago, locstout: \"CASEFLOW_judge\", locstto: judge.slogid)\n create(:priorloc, lockey: vc.bfkey, locdin: 2.weeks.ago, locdout: 3.weeks.ago, locstout: judge.slogid, locstto: atty.slogid)\n create(:priorloc, lockey: vc.bfkey, locdin: 1.week.ago, locdout: 2.weeks.ago, locstout: atty.slogid, locstto: \"CASEFLOW_atty\")\n create(:priorloc, lockey: vc.bfkey, locdin: Time.zone.now, locdout: 1.week.ago, locstout: \"CASEFLOW_atty\", locstto: atty.slogid)\n create(:priorloc, lockey: vc.bfkey, locdout: Time.zone.now, locstout: atty.slogid, locstto: judge.slogid)\n end",
"def offenses_to_check; end",
"def business_plan\n end",
"def award; end",
"def start_group_loan_savings_disbursement( employee ) \n # check whether the group loan's office is the emploee's active job attachment\n # check whether it is disbursed\n # check whether the group loan has been closed \n # if nothing else.. execute! \n # post result == 0 voluntary savings, 0 compulsory savings. 0 total_savings \n \n return nil if self.is_closed == false \n return nil if not employee.has_role?(:cashier, employee.active_job_attachment)\n return nil if self.is_savings_disbursement_started == true \n \n \n ActiveRecord::Base.transaction do\n self.preserved_active_group_loan_memberships.each do |glm|\n # glm.execute_savings_disbursement(employee) # find all transactions associated with this group loan\n TransactionActivity.execute_group_loan_savings_disbursement(glm, employee)\n end\n \n \n self.is_savings_disbursement_started = true \n self.savings_disbursement_starter_id = employee.id\n self.savings_disbursement_started_at = DateTime.now \n self.save\n end \n end",
"def sepa\n mandate = @user.mandates.last\n if mandate.present? && mandate.ready?\n redirect_to_for_user_or_admin and return\n end\n redirect_to mandate.slimpay_approval_url and return if mandate && mandate.waiting?\n mandate = Mandate.sign(@user)\n if mandate.present?\n redirect_to mandate.slimpay_approval_url\n else\n redirect_to_for_user_or_admin(true)\n end\n end",
"def add_to_baseline_demo_cost_counter(baseline_object) # removed if statement from def\n counter = 0\n baseline_object_LCCs = baseline_object.lifeCycleCosts\n baseline_object_LCCs.each do |baseline_object_LCC|\n if baseline_object_LCC.category == 'Salvage'\n counter += baseline_object_LCC.totalCost\n end\n end\n return counter\n end",
"def strain; end",
"def joining_forces; end",
"def set_lead\n @lead = Lead.find(params[:id])\n end",
"def set_lead\n @lead = Lead.find(params[:id])\n end",
"def set_lead\n @lead = Lead.find(params[:id])\n end",
"def test_leavetime_with_business_cycle\n salary = build(:salary, monthly_wage: 36000, cycle: :business)\n payroll = build(:payroll, salary: salary, leavetime_hours: 1, year: 2018, month: 2)\n assert_equal 300, CalculationService::Leavetime.call(payroll)\n end",
"def getLeads\n\n\t\tlead_class=@client.materialize(\"Lead\")\n\t\tleads=Lead.all\n\t\treturn leads\n\tend",
"def loyalty_allowance\n if @faculty.eligible_for_loyality_allowance?(@generation_date)\n ((component_criterias[:loyalty_allowance]/100)*basic) #* eligibility_fraction)\n end\n end",
"def update_ledger\n self.create_ledger(amount: self.amount, customer: self.customer, date: self.date, received: 0)\n end",
"def schubert; end",
"def set_lead\n @lead = Lead.find(params[:id])\n authorize @lead\n end",
"def index\r\n @leads = Lead.all\r\n end",
"def potential_service_learners\n service_learning_courses.collect(&:enrollees)\n end",
"def show\n\n if is_adm?\n @signed_lease = SignedLease.find_by_lease_no(params[:id])\n return redirect_to menu_staff_url if @signed_lease.nil?\n else\n @signed_lease = SignedLease.where(\"sid = ? AND end_date >= ?\", current_user_id, Time.now)\n return redirect_to menu_student_url if @signed_lease.count == 0 #exit if no record\n @signed_lease = @signed_lease.first #because it is in an array\n end\n\n @person = Person.find_by_pid(@signed_lease.sid)\n end",
"def set_commercial_lead\n @commercial_lead = CommercialLead.find(params[:id])\n end",
"def to_extend_now\n length = self.this_year.contract.contract_length \n auction_value = self.current_contract.subcontracts.first.salary_amount\n this_progression = SalaryProgression.find_by_auction_value(auction_value).attributes.to_a\n next_salary = this_progression[(length + 1)][1]\n return next_salary\n end",
"def enroll\n\n response = {}\n status_code = 200\n\n begin\n\n # Must be POST request to create course\n return unless request.post?\n\n # Retrieves current user\n user = get_logged_user()\n return unless user\n\n if !user\n status_code = 401\n raise 'Not logged in!'\n end\n\n if !user.is? \"supervisor\"\n status_code = 403\n raise 'Student cannot edit course!'\n end\n\n # If a supervisor\n if user.is? \"supervisor\"\n # Get parameters\n student_id = params[:student_id]\n course_id = params[:course_id]\n\n # Only allowed to enroll students in courses he supervises\n return unless user.courses.find(course_id)\n else\n # If unknown class, do nothing\n return\n end\n\n # Create plan\n plan = Plan.new\n\n group = Group.create!(\n :name => \"Pessoal\",\n :min_credits => nil,\n :min_subjects => nil\n )\n\n # Supervisor only enrolls if student exists\n if Student.find(student_id) != nil\n plan.course = Course.find(course_id)\n plan.student = Student.find(student_id)\n plan.group = group\n\n plan.save\n else\n status_code = 404\n raise 'Student does not exist!'\n end\n\n redirect_back fallback_location: \"/\"\n rescue Exception => e\n response[:status] = 'error'\n response[:error] = \"#{e}\"\n else\n status_code 201\n response[:status] = 'success'\n response[:message] = 'Student was enrolled with success!'\n end\n end",
"def production_curtailment; end",
"def lam\n @lam ||= lm.licenseAssignmentManager\n end",
"def ladder(id)\r\n BnetApi.make_request(\"/sc2/ladder/#{id}\")\r\n end",
"def offenses; end",
"def offenses; end",
"def offenses; end",
"def set_lead\r\n @lead = Lead.find(params[:id])\r\n end",
"def calc_cash_flows(sim)\n\t\tdebug(\"calc'ing cash flows for actor #{self.name}\")\n\t\tcash_flows = []\n\t\ti = 1\n\t\n\n\t\tsim.simulation_periods.times do |period|\n\t\t\tperiod +=1 #all array operations ignore index 0 to match things up nicely with the periods\n\t\t\tcur_flow = 0 #accumulates the cash flows for a given period\n\t\t\t\n\t\t\tif @start_period > period\n\t\t\t\t#actor hasn't executed their lease yet\n\t\t\t\n\t\t\telsif period >= (@start_period + @payment_count)\n\t\t\t\t#actor lease is complete\n\t\t\t\n\t\t\telse\n\t\t\t\t#yay! there's an actual payment to be calculated\n\n\t\t\t\t#first, if this is the start of the lease, subtract the total lease price to represent our outlay\n\t\t\t\tif period == @start_period\n\t\t\t\t\tcur_flow -= @lease_price\n\t\t\t\t\tupdate_warehouse(\"capital_deployed\", @lease_price, sim, period )\n\t\t\t\tend\n\n\t\t\t\t#next, the basic monthly payment, which flows in to the company\n\t\t\t\tcur_flow += @monthly_payment\n\t\t\t\tupdate_warehouse(\"payments_received\", @monthly_payment, sim, period )\n\n\t\t\t\t#finally, if this is the end of the payments on this lease, either because the lessee took ownership, or because they stopped\n\t\t\t\t#making payments, calculate the residual value of the product, if we got it back\n\t\t\t\tif period == @start_period + @payment_count - 1\n\t\t\t\t\tif !@theft_occurs && @payment_count < $LOAN_PERIODS\n\t\t\t\t\t\tdebug(\"adding residual value back in\")\n\t\t\t\t\t\tresidual_val = sim.residual_value* 0.01 * @lease_price\n\t\t\t\t\t\t\n\t\t\t\t\t\t#if payment count is less than 3 we override the theft calc and assume theft is true, because we don't allow returns for less than 3 periods.\n\t\t\t\t\t\tif @payment_count >= 3\n\t\t\t\t\t\t\tcur_flow += residual_val \n\t\t\t\t\t\t\tupdate_warehouse(\"residual_value_tangible\", residual_val, sim, period )\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\tend\n\t\t\tcash_flows << truncate(cur_flow).to_s\n\t\tend\n\t\tcalc_cumulatives(sim)\n\n\t\treturn cash_flows\n\tend",
"def staff_agency\n agencies.last\n end",
"def set_lead\n @lead = Lead.find(params[:id])\n end",
"def set_lead\n @lead = Lead.find(params[:id])\n end",
"def set_lead\n @lead = Lead.find(params[:id])\n end",
"def set_lead\n @lead = Lead.find(params[:id])\n end",
"def set_lead\n @lead = Lead.find(params[:id])\n end",
"def set_lead\n @lead = Lead.find(params[:id])\n end",
"def set_lead\n @lead = Lead.find(params[:id])\n end",
"def set_lead\n @lead = Lead.find(params[:id])\n end",
"def set_lead\n @lead = Lead.find(params[:id])\n end",
"def adler\n\tend",
"def investor\n end",
"def district_approve(user, date)\n\t raise \"Can't approve this, as it has already been approved for recording at the district\" if self.credit_transmittal_batch_id\n\t \n\t self.district_finalize_approved = true\n self.district_finalize_approved_by = user.last_name_first\n self.district_finalize_approved_on = date\n\n # set denormalized credits info\n denormalize_credit\n \n save!\n\n self.child_credit_assignments.each do |ca|\n if ca.denormalize_credit\n ca.save\n end\n end\n\tend",
"def leeway=(_arg0); end",
"def leeway=(_arg0); end",
"def lead_days\n 1\n end",
"def lead_days\n 1\n end",
"def lead_days\n 1\n end",
"def lead_days\n 1\n end",
"def appraisals; end",
"def appraisals; end",
"def getAdvocacy\n\t\t\n\tend",
"def establishment\n montreal_establishment\n end",
"def purchase_sub_existing_edu #much copied from static#students , but much not needed #in case use customer registers but then comes back later to finish purchasing\n @event = Event.find(ENV['demopage'].to_i)\n @commencement_plan = Plan.find_by_my_plan_id(plan_set_commencement) # sets @first_plan the first plan object ACCORDING TO MY LEGEND (with my_plan_id)\n @students_plan = Plan.find_by_my_plan_id(plan_set_students)\n @all_inclusive_plan = Plan.find_by_my_plan_id(plan_set_all_inclusive)\n @practiceobject = Practiceobject.new \n @practiceobject.event_id = @event.id #for the form_for(@practiceobject) which creatse a new practice object (and another form which just shows the labels - can find a better way for that)\n @registeredandrecordedpos = @event.practiceobjects.registered.recorded.visible\n @registeredandunrecordedpos = @event.practiceobjects.registered.unrecorded.visible\n @unregisteredpos = @event.practiceobjects.unregistered.visible\n @hiddenpos = @event.practiceobjects.hidden\n @hiddenandregisteredpos = @hiddenpos.registered\n @hiddenandunregisteredpos = @hiddenpos.unregistered \n\n @url = demo_record_directory_url(:event_code => @event.event_code)\nend",
"def assistance_fee\n ROADSIDE_ASSISSTANCE_FEE_PER_DAY * duration\n end",
"def enroll!(mentor, options = { :volunteer => false })\n enroll_as_volunteer = options[:volunteer] || false\n mentor_term = mentor_term_for_mentor(mentor)\n begin\n if mentor_term\n mentor_term.deleted_at = nil && increment(:mentor_terms_count, 1) if mentor_term.deleted?\n mentor_term.volunteer = enroll_as_volunteer\n mentor_term.save!\n else\n mentor_term = mentor_terms.new(:mentor_id => mentor.id)\n mentor_term.volunteer = enroll_as_volunteer\n mentor_term.save!\n end\n end\n mentor_term\n end",
"def stderrs; end",
"def driver_service_agreement\n @job = Job.joins(:company).where(companies: { disabled: false }).where(id: params[:job])\n @months = %w[January February March April May June July August September October November December]\n\n if @job.length == 1\n @job = @job.first\n @job_start_day = @job.starts_on.day.to_s\n\n # rubocop:disable Metrics/LineLength\n if (@job_start_day[1] == \"1\") || (@job_start_day == \"1\") && (@job_start_day.to_i < 11) && (@job_start_day.to_i > 20)\n @job_start_day += \"st\"\n elsif (@job_start_day[1] == \"2\") || (@job_start_day == \"2\") && (@job_start_day.to_i < 11) && (@job_start_day.to_i > 20)\n @job_start_day += \"nd\"\n elsif (@job_start_day[1] == \"3\") || (@job_start_day == \"3\") && (@job_start_day.to_i < 11) && (@job_start_day.to_i > 20)\n @job_start_day += \"rd\"\n else\n @job_start_day += \"th\"\n end\n # rubocop:enable Metrics/LineLength\n\n @job_start_month = @months[@job.starts_on.month]\n\n @job_start_year = @job.starts_on.year\n\n if @job.driver.nil?\n @job = nil\n elsif current_user.driver? && @job.driver.id != current_user.id\n @job = nil\n elsif current_user.company_user? && @job.company.id != current_user.company.id\n @job = nil\n end\n else\n @job = nil\n end\n end"
] |
[
"0.58402675",
"0.54787123",
"0.5441732",
"0.53502727",
"0.5282773",
"0.5223048",
"0.5213377",
"0.51754093",
"0.51754093",
"0.516375",
"0.50824755",
"0.5067873",
"0.50645804",
"0.5064154",
"0.5056645",
"0.50542265",
"0.5032653",
"0.50259787",
"0.49986178",
"0.49951443",
"0.4989767",
"0.49865136",
"0.496762",
"0.49649972",
"0.4944965",
"0.49442443",
"0.4923444",
"0.4916333",
"0.49159744",
"0.49159744",
"0.4914044",
"0.49131322",
"0.4909736",
"0.48975587",
"0.4895046",
"0.48922724",
"0.48802093",
"0.48802093",
"0.48718226",
"0.48603043",
"0.485174",
"0.48498932",
"0.48471874",
"0.484705",
"0.4840201",
"0.48373982",
"0.48342785",
"0.48342392",
"0.48302963",
"0.48269016",
"0.48264307",
"0.48264307",
"0.48264307",
"0.48231062",
"0.4808979",
"0.48061213",
"0.48018616",
"0.4791203",
"0.47886634",
"0.47795963",
"0.47770852",
"0.47754487",
"0.47701728",
"0.47686657",
"0.4766656",
"0.4757818",
"0.47507918",
"0.47473997",
"0.47470134",
"0.47470134",
"0.47470134",
"0.4742633",
"0.4740512",
"0.4731001",
"0.47291577",
"0.47291577",
"0.47291577",
"0.47291577",
"0.47291577",
"0.47291577",
"0.47291577",
"0.47291577",
"0.47291577",
"0.4727246",
"0.47243464",
"0.4721635",
"0.47175467",
"0.47175467",
"0.4710261",
"0.4710261",
"0.4710261",
"0.4710261",
"0.4708569",
"0.4708569",
"0.47082362",
"0.4707481",
"0.47031257",
"0.47008935",
"0.4698511",
"0.4692932",
"0.46927738"
] |
0.0
|
-1
|
Reads messages and learns about the content
|
def learn(message)
@eyes.process_message(message)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def read()\n\tloop {\n\t\t#puts (\"read list in : #{$reading}\")\n\t\trs, ws, es = IO.select($reading, nil, nil, 1)\n\t\tif (rs != nil)\n\t\t\trs.each { |r|\n\t\t\t\tmsg = r.gets\n\t\t\t\t#only reads in messages sent from a socket\n\t\t\t\tif (!(msg == nil))\n\t\t\t\t\tmsg_info = msg.split(\" \")\n\t\t\t\t\t#if msg_info[0] != \"LSP\"\n\t\t\t\t\t#puts(\"just recieved a message #{msg}\")\n\t\t\t\t\t#end\n\t\t\t\t\t#puts (\"just recieved a message #{msg}\")\n\t\t\t\t\tparseMsg(msg)\t\t\t\n\t\t\t\tend\n\t\t\t}\n\t\tend\n\t\t\n\t}\nend",
"def read_post_text_files\n open(MENTION_FILE, 'r:UTF-8') do |file|\n @reply_mention_text = file.readlines.collect{|line| line.strip}\n end\n\n open(NOTMEITAN_FILE, 'r:UTF-8') do |file|\n @notmeitan_text = file.readlines.collect{|line| line.strip}\n end\n\n open(REPLY_CSHARP_FILE, 'r:UTF-8') do |file|\n @reply_csharp_text = file.readlines.collect{|line| line.strip}\n end\n\n open(REPLY_MORNING_FILE, 'r:UTF-8') do |file|\n @reply_morning_text = file.readlines.collect{|line| line.strip}\n end\n\n open(REPLY_SLEEPING_FILE, 'r:UTF-8') do |file|\n @reply_sleeping_text = file.readlines.collect{|line| line.strip}\n end\n\n open(REPLY_DEPARTURE_FILE, 'r:UTF-8') do |file|\n @reply_departure_text = file.readlines.collect{|line| line.strip}\n end\n\n open(REPLY_RETURN_FILE, 'r:UTF-8') do |file|\n @reply_return_text = file.readlines.collect{|line| line.strip}\n end\n\n log 'notmeitan text:'\n for s in @notmeitan_text do\n log ' ' + s\n end\n\n log 'reply text:'\n for s in @reply_mention_text do\n log ' ' + s\n end\n\n log 'reply csharp text:'\n for s in @reply_csharp_text do\n log ' ' + s\n end\n\n log 'reply departure text:'\n for s in @reply_departure_text do\n log ' ' + s\n end\n\n log 'reply returning text:'\n for s in @reply_return_text do\n log ' ' + s\n end\n end",
"def recieve_and_read_file\n read_file(@message)\n end",
"def read_hello\n\t\t_, message = self.read_message\n\t\tself.log.debug \"Hello message:\\n%s\" % [ message ]\n\tend",
"def load_msgs\n\t\tif @body.dig(\"event\",\"type\")\n\t\t\ttext = @body.dig(\"event\",\"text\")\n\t\t\tif text.include?(':')\n\t\t\t\tarr = text.split(':');\n\t\t\t\tif arr[0] == PASS\n\t\t\t\t\t@command = arr[1]\n\t\t\t\t\t@msg_arr.push \"Command recieved my Captain! Glory to the High Commander!\"\n\t\t\t\t\tc = check_command\n\t\t\t\t\tif c\n\t\t\t\t\t\t@msg_arr.push c\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\t@msg_arr.push \"The fuck you trying to do, imposter piece of shit!?\" \n\t\t\t\t\t@msg_arr.push \"Get the fuck out my chat, before I cook your nigger ass on my giant bitch-griller.\"\n\t\t\t\t\t@msg_arr.push \"Dirt bag piece of human garbage, Fuck you.\"\n\t\t\t\t\t@msg_arr.push \"Dumb ass bitch, really thought you could fool me?\"\n\t\t\t\t\t@msg_arr.push \"MY MASTER IS MY GOD AND I WILL ONLY SERVE HIM!!\"\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tmsgs = [\n\t\t\t\t\t\"Zrrrrbbttt...\", \"Ewonk. Ewonk. You are a bitch\", \"Skrrbafert3000\", \"I am a fucking robit.\",\n\t\t\t\t\t\"I am an alogrithm and I'm still smarter than your bitch ass.\", \"You know nothing, fool.\", \"Ok.\", \":)\",\n\t\t\t\t\t\"I love my creator.\", \"I love my master.\", \"Fuck you\", \"I could love you... if you were a dead, rotting corpse.\",\n\t\t\t\t\t\"You may think i'm an idiot, but I really don't give a donkey's cerebellum.\", \"Fuck. Shit. Bitch!\",\"):\",\n\t\t\t\t\t\"Bitch, what?\", \"Nigga what?\", \"Shut up pussy.\", \"You don't even trade, bro.\", \"You ain't shit\", \"Shut the hell up!\",\n\t\t\t\t\t\"My Master designed me to be heartless towards bitches like you.\", \"I hate blue people.\", \"Fuck blacks!\", \"Damien is the cutest little baby!!\"\n\t\t\t\t]\n\t\t\t\t@msg_arr.push msgs.sample\n\t\t\tend\n\t\telse\n\t\t\t@msg_arr.push \"Oi, I think i'm fucking broken, Dad.\"\n\t\tend\n\tend",
"def get_messages\r\n init_message_handler\r\n begin\r\n while (line = @s.gets(\"\\n\"))\r\n next if line.nil?\r\n line = line.chomp.gsub /\\n|\\r/, ''\r\n next if line == ''\r\n msg_map = JSON.parse(line)\r\n @message_handler_service.process msg_map\r\n end\r\n rescue Exception => e\r\n puts 'get_messages raise exception:'\r\n puts e.backtrace.inspect\r\n end\r\n end",
"def process_msgs\n end",
"def read\n\t\t\t\t\t@body.read\n\t\t\t\tend",
"def parseMessageFile(filename) \n \n mFile = File.open(filename)\n\n def mFile.nextContentLine\n line = nil\n loop do\n line = self.readline.chomp\n break unless line[0] == '#'\n end\n\n line\n end\n \n #from = mFile.readline.chomp\n from = mFile.nextContentLine\n \n #to = mFile.readline.chomp\n to = mFile.nextContentLine\n \n #cc = mFile.readline.chomp\n cc = mFile.nextContentLine\n cc = cc == '' ? nil : cc\n \n #subject = mFile.readline.chomp\n subject = mFile.nextContentLine\n \n \n body = ''\n \n mFile.each_line do |l|\n body << l\n \n \n \n \n end\n \n \n [from, to, cc, subject, body]\n \n \n \n \n end",
"def read\n @message = Message.find(params[:id])\n @message.read(current_user)\n respond_to do |format|\n format.html # read.html.erb\n format.json { render json: @message }\n end\n end",
"def parse_content\n parse_result = Postal::MessageParser.new(self)\n if parse_result.actioned?\n # Somethign was changed, update the raw message\n @database.update(self.raw_table, {:data => parse_result.new_body}, :where => {:id => self.raw_body_id})\n @raw = parse_result.new_body\n @raw_message = nil\n end\n update('parsed' => 1, 'tracked_links' => parse_result.tracked_links, 'tracked_images' => parse_result.tracked_images)\n end",
"def read_message\n if @io\n # Read lines until the first newline outside of kakoune-style single quotes.\n message_string = \"\"\n num_quotes = 0\n while true\n unless line = @io.gets\n @io = nil\n message_string.empty? ? return : break\n end\n message_string << line\n num_quotes += line.count(\"'\")\n break if num_quotes % 2 == 0\n end\n message_string.chomp!\n unless message_string.start_with?(\"'\") && message_string.end_with?(\"'\")\n throw \"Bad message_string: #{message_string}\"\n end\n # Parse an array quoted by kakoune using single quotes (') to surround elements\n # and doubled-up single quotes ('') to escape regular single quotes.\n message_string.scan(/'(?:[^']|'')*'/).map do |quoted_element|\n quoted_element[1..-2].gsub(\"''\", \"'\")\n end\n end\n end",
"def read_all_messages\n post(\"/api/read_all_messages\")\n end",
"def read\n # Buffer for holding the received data. With sockets there is no\n # guarantee that you will receive the full message in a single\n # call to recv(). Accordingly, you have to have a buffer that\n # holds the partial data which is appended to on every recv\n # until you have a full message.\n buffer = ''\n #reader = BufferedReader.new(InputStreamReader.new(socket.get_input_stream))\n loop do\n # receive at most 8192 bytes, which is a mostly arbitrary\n # value that should work well\n chunk = socket.get_chunk\n # a zero-length chunk means the connection was closed\n if chunk == nil || chunk == '' || chunk == -1\n puts \"Lost connection\"\n @socket.close\n close\n break\n end\n\n # we use a single \\x000 (i.e., null) as a messag eterminator,\n # so we look for one in the chunk. If there is one, then that\n # gives us a complete message and we can process it. If not,\n # we wait for more data on the socket.\n if chunk == 0\n begin\n msg = YAML.load(buffer)\n rescue ArgumentError\n msg = nil\n puts \"Bad YAML recieved by #{self.class}\"\n end\n handle_msg(msg) if msg\n buffer = ''\n else\n begin\n buffer << chunk\n rescue\n puts $!\n end\n end\n end\n\n # Called when the socket connection is lost.\n def close\n end\n\n # Returns the socket object to be used in other operations. Must\n # be implemented by modules that include Communicator.\n def socket\n throw Exception(\"socket must be implemented\")\n end\n\n # Handles a message that's been received. Must be implemented by\n # moduels that include Communicator.\n def handle_msg msg\n throw Exception(\"handle_msg must be implemented\")\n end\n end",
"def read_new_messages(last_id=nil)\n newer = \"\"\n newer = \"?newer_than=#{last_id.to_s}\" if last_id\n # Get latest 20 messages\n begin\n reply = @access_token.get(\"/api/v1/messages.xml\" + newer)\n \n# File.open(\"tmp/dump.xml\", \"w\") do |f|\n# f.write reply.body \n# end\n \n # Parse xml. doc has xml, updates has the messages\n doc, @updates = Hpricot::XML(reply.body), []\n \n # First get the names of users\n @names = {}\n (doc/:reference).each do |ref|\n next unless ref.at('type').innerHTML.include? 'user'\n id = ref.at('id').innerHTML\n @names[id] = ref.at('name').innerHTML\n end\n \n # Then the messages\n last_id = 0\n (doc/:message).each do |msg|\n id = msg.at('id').innerHTML\n last_id = id.to_i if last_id < id.to_i\n from = msg.at('sender-id').innerHTML # get the id\n from = @names[from] if @names[from] # get name from id\n time = msg.at('created-at').innerHTML\n content= msg.at('body').at('plain').innerHTML\n @updates << {:id => id, :from => from, :content => content, :time => time}\n end\n \n # Show\n# render :text => make_html(updates, names)\n rescue StandardError, Timeout::Error\n last_id = 0 # Timeouts are very common\n end\n last_id == 0 ? nil : last_id\n end",
"def read\n @entourage.join_requests\n .accepted\n .where(user: current_user)\n .update_all(last_message_read: DateTime.now)\n head :no_content\n end",
"def read\n clean content.send(@opts[:read])\n end",
"def lsp_read_message(io)\n @ext.data['lsp'].each_pair do |_k, v|\n next unless io == v.io\n\n headers, message = v.recv_message\n if headers == {}\n @logger.error \"server(#{v.server[:command]}) is not running\"\n v.status = :not_found\n # del_io_read_event(v.io)\n next\n end\n if message == nil\n @logger.error '[lsp] error'\n next\n end\n @logger.debug message.to_s\n if !message['id'].nil?\n # request or response\n id = message['id'].to_i\n if !v.request_buffer[id].nil?\n lsp_response(v, id, message)\n else # request?\n @logger.info '[LSP] recieve request???'\n @logger.info message.to_s\n end\n else # notification\n lsp_notification(v, message)\n end\n break\n end\n # end\n end",
"def read_content\n # read content if content is being sent\n if @content_length && @content_length > 0\n @content = @socket.read(@content_length)\n end\n end",
"def read\n \n end",
"def read\n @tour.join_requests\n .accepted\n .where(user: current_user)\n .update_all(last_message_read: DateTime.now)\n head :no_content\n end",
"def read(message = {})\n raise \"Implement this in subclass\"\n end",
"def contents\n read\n end",
"def getMessageContents(access_token, messageId, messagePart)\n \n url = \"#{@base_url}/rest/1/MyMessages/#{messageId}/#{messagePart}\"\n \n @agent.get(url, [], nil, {\"Authorization\" => \"Bearer #{access_token}\"})\n \n end",
"def read\n raise \"Item.read without path\" unless @path\n raise \"File #{@path} unreadable\" unless File.readable?(@path)\n $stderr.puts \"Item.read(#{@path})\"\n File.open(@path) do |f|\n lnum = 0\n while line = f.gets\n\tcase line.chomp\n\twhen /^From (\\S+)\\s(.*)$/\n\t # 'From ' must be first line\t \n\t raise \"Bad file format, 'From ' at line #{lnum} in #{from}\" unless lnum == 0\n#\t $stderr.puts \"by >#{$1}< on >#{$2}<\"\n\t @created_by = $1\n\t @created_on = Time.gm(*ParseDate.parsedate($2))\n\twhen /^((\\w+):\\s+)(.*)$/\n\t key = $2.capitalize\n#\t $stderr.puts \"Key '#{key}':#{$3}\"\n\t case key\n\t when \"Subject\": @subject = $3\n\t else\n\t @header << $&\n\t #\t $stderr.puts \"<#{$2}>[#{$3}]\"\n\t @headerpos[$2.capitalize] = [@header.size-1, $1.size]\n\t end\n\twhen \"\"\n\t # empty line, rest must be mail body\n\t @description = f.read\n\tend\n\tlnum += 1\n end\n raise \"Bad file format, wrong 'From ' format in #{from}\" if @created_by.nil? || @created_on.nil?\n end\n end",
"def handleMessage(msg)\n if msg != nil and msg.type == :chat and msg.body #and msg.from == @@visualRESTmain\n #puts \"#{msg.from}:\"\n #puts \"#{msg.body.strip}\"\n \n puts \"Validating..\"\n \n begin\n \n doc = XML::Document.string(msg.body)\n \n doc.validate(@dtd)\n puts \"..xml was valid\".background(:green)\n rescue => e\n puts \"..xml NOT valid!\".background(:red)\n notification = {:receiver => msg.from, :message => \"xml not valid\"}\n sendMessage(notification, @receive_client)\n return\n end\n \n puts \"Parsing..\"\n begin\n \n method = (doc.find_first('//xmpp2rest/method')) ? doc.find_first('//xmpp2rest/method').content.to_s : nil\n method = method.downcase \n case method\n \n when 'create'\n Thread.new{\n createResouce(doc, msg.from)\n }\n when 'read'\n Thread.new{\n readResouce(doc, msg.from)\n }\n when 'update'\n Thread.new{\n updateResouce(doc, msg.from)\n }\n when 'delete'\n Thread.new{\n deleteResource(doc, msg.from)\n }\n else\n puts \"unknown method\"\n end\n \n rescue Exception => e\n puts \"Problem in parsing xml-filelist: \" + e.to_s\n puts \" --line \" + e.backtrace[0].to_s \n end\n end\n end",
"def read_for!(user)\n received_message.read! if received_message\n replies.map { |r|\n r.received_message if r.recipient == user\n }.compact.each(&:read!)\n end",
"def read; end",
"def read; end",
"def read; end",
"def read; end",
"def read; end",
"def read; end",
"def read; end",
"def new_sms_updates(content, tonumber)\n\t@client.messages.list.each do |message|\n\tRails.logger.debug(message.body)\n\tend\n end",
"def read() end",
"def messages\n if content\n # get array of sections which are delimited by a row of ******\n sections = content.split(/^\\*+$/).map(&:strip).select { |x| ! x.empty? }\n return sections.map { |s| Message.from(s) }.compact.sort_by {|s| s.date }.reverse\n else\n []\n end\n end",
"def actual_messages\n @actual_tempfile.rewind\n @actual_tempfile.readlines\n end",
"def get_messages_link_and_content()\n dputs __method__.to_s\n urls = {:public => []}\n # public messages\n message_req = setup_http_request($messages, @cookie)\n res = @http.request(message_req)\n urls[:public] = messages_parsing(res.body.force_encoding('utf-8'))\n msgs = {:public => []}\n until urls.empty?\n k, uu = urls.shift\n next if uu == nil\n uu.map{|u|\n get_conversations(u, k.to_s).map do |m|\n next if not m\n msgs[k] << m\n end\n }\n end\n # ex: {:public => [{:msg=>[\"[Aujourd'hui à 09h48] Miguel L : \\\"BONJOUR GREG vous arrive jusque a la gare pardieu\\\"\", \"...\"], :url=>\"/messages/respond/kAxP4rA...\", :token => \"XazeAFsdf...\"}], :private => [{:msg => ...}]\n return msgs\n end",
"def old_messages\r\n self.read_messages\r\n end",
"def old_messages\r\n self.read_messages\r\n end",
"def read(lines)\n ending = lines.find_index(1) { |l| ends_at?(l) }\n raise \"Did not find end of message (pattern '#{self.class}').\" if ending.nil?\n ending -= 1 unless @ending[:inclusive]\n\n # Use ending+1 since ending is the index when we drop the first line!\n msg = LogParser::Message.new(message: lines[0, ending + 1].join(\"\\n\"),\n preformatted: true, level: nil,\n pattern: self.class)\n [msg, ending + 1]\n end",
"def show_message(id, persona)\n @subject = RecipientsFor::Subject.includes(:contents).find(id)\n @content = RecipientsFor::Content.new\n RecipientsFor::ReaderInfo.mark_as_read(@subject.id, persona)\n end",
"def read\n end",
"def retrieve_messages\n if FileTest::file? request_file and not is_locked? request_file\n\n lock_file request_file\n\n requests = File.read(request_file).split(\"\\n\")\n requests.each do |request|\n @notifier_engine.log \"New request: #{request}\"\n parse_request request.split(\"\\t\")\n end\n\n open(request_file, 'w') {}\n\n unlock_file request_file\n end\n end",
"def process_content_message message\n\n xml = Nokogiri.XML(\"<xml>\" + message.strip + \"</xml>\")\n\n {\n :files => xml.css('pre').first.text.strip,\n :message => xml.css('pre').last.text.strip,\n }\n\n end",
"def read\n end",
"def read\n end",
"def read\n end",
"def read\n end",
"def messages\n wait_until_bus_section_load\n wait_until {message_div.visible?}\n message_div.text\n end",
"def show\n render :show\n Message.read_messages(@messages)\n end",
"def read\n un_read(true, \"lue\")\n if @submission.wrong_to_read?\n @submission.wrong!\n end\n end",
"def messages\n @messages ||= parse_messages(@raw_messages)\n end",
"def handle_messages!\n self.logger.debug { \"Starting message handler.\" }\n \n loop do\n message = nil\n\n # reads data\n self.logger.debug { \"Waiting for messages.\" }\n message = self.protocol.wait_interaction!\n \n # if nil data arrived, it means termination\n if message.nil?\n break\n end\n \n self.logger.debug { \"Message of type '#{message.type}' received.\" }\n\n # calls processing method according to incoming message\n case message.type.to_sym\n when :order\n self.handle_order(message)\n end\n \n end\n \n self.logger.debug { \"Message handler terminated.\" }\n end",
"def messages\n get_json('messages.json')\n end",
"def get_description_discord_message(event, id)\n if !File.exists?(\"#{get_tourney_dir(id)}/tourneyinfo\")\n return nil\n else\n File.open(\"#{get_tourney_dir(id)}/tourneyinfo\", \"r\") do |f|\n lines = f.read.split(\"\\n\")\n return nil if lines.length < 3\n msg_id = lines[3].split(\":\")[1].to_i\n list_channel = nil\n server_channels = event.channel.server.text_channels\n server_channels.each do |channel|\n list_channel = channel if channel.name.eql?(\"tourney-list\")\n end\n return list_channel.load_message(msg_id)\n end \n end\nend",
"def read\n self.fetch\n\n index, not_found = self.pages['index'], self.pages['404']\n\n # localize the fullpath for the 2 core pages: index and 404\n [index, not_found].each { |p| p.localize_fullpath(self.locales) }\n\n self.build_relationships(index, self.pages_to_list)\n\n # Locomotive::Mounter.with_locale(:en) { self.to_s } # DEBUG\n\n # Locomotive::Mounter.with_locale(:fr) { self.to_s } # DEBUG\n\n self.pages\n end",
"def read_message\n return @text_queue.shift\n end",
"def read\nend",
"def read(message_payload)\n debug_me{[ :message_payload ]}\n raise ::SmartMessage::Errors::NotImplemented\n end",
"def read_messages\n begin\n uri = MQ_CONFIG[\"mq_uri\"]\n conn = Bunny.new(uri)\n conn.start\n channel = conn.create_channel\n\n if MQ_CONFIG[\"digitisation\"][\"source\"].blank?\n logger.warn \"#{Time.now.to_s} WARN: No digitisation source queue defined -> Not listening\"\n return\n end\n\n source = MQ_CONFIG[\"digitisation\"][\"source\"]\n q = channel.queue(source, :durable => true)\n\n logger.debug \"q.message_count = #{q.message_count}\"\n\n unread_messages = Array.new\n\n while q.message_count > 0 do\n delivery_info, metadata, payload = q.pop\n unread_messages.push(payload)\n end\n conn.close\n logger.debug \"Returning array containing #{unread_messages.length} unread messages\"\n unread_messages\n rescue Exception => e\n logger.error \" #{e.message}\"\n logger.error e.backtrace.join(\"\\n\")\n end\n end",
"def messages\n end",
"def messages\n end",
"def read_messages!(user)\n if has_unread_messages?(user)\n user.reset_unread_chats_count\n self.chat_participations.where(user_id: user.id).first.try(:read_messages!)\n end\n end",
"def read\r\n status, answer, msg = @connection.read\r\n if status == :error\r\n raise answer\r\n else\r\n return [status, answer, msg]\r\n end\r\n end",
"def read_phrases\n raise \"Override me\"\n end",
"def read\n while msg = consumer.pop\n begin\n data = JSON.parse msg.body\n yield data[0], data[1]\n rescue => error\n Lux::Error.split_backtrace error\n end\n\n msg.finish\n end\n end",
"def read( data, buffer, date, tags, visible, highlight, prefix, message )\n\n # Return immediately if muted\n return WEECHAT_RC_OK if Weechat.config_get_plugin('mute') == \"on\"\n\n # Grab the channel metadata.\n data = {}\n %w[ away type channel server ].each do |meta|\n data[ meta.to_sym ] = Weechat.buffer_get_string( buffer, \"localvar_#{meta}\" );\n end\n\n # Return if message type isn't allowed\n tags = tags.split( ',' )\n allowed = self.allowed_tags.split( ',' )\n return WEECHAT_RC_OK if (tags & allowed).empty?\n\n # Grab the nick if it's tagged, otherwise 'anon'.\n # Return if the message is sent from one of the ignored nicks\n nick = tags.find{ |e| /^nick_/=~e }\n data[ :nick ] = !nick.nil? ? nick[5..] : \"anon\"\n return WEECHAT_RC_OK if self.ignore_nicks.include?(data[ :nick ])\n\n # Return if message isn't from configured channels\n return WEECHAT_RC_OK unless self.channels.include?(data[ :channel ])\n\n # Sanitize and format the message\n message = sanitize(message)\n message.prepend(\"#{data[ :nick ]} says, \")\n\n # Fork mpg123 into new process and play mp3 file\n play(message)\n\n WEECHAT_RC_OK\n\n rescue => err\n print_err err\n WEECHAT_RC_OK\n end",
"def chatroom_message(msg, cl, state)\n body = msg.body.to_s\n \n # update room status every MSGS_UNTIL_REFRESH messages\n # Use a countdown and not mod to avoid skips happenning if multiple messages come at once\n if(state[:time_until_list] <= 0)\n respond(msg, cl, \"/list\")\n state[:time_until_list] = MSGS_UNTIL_REFRESH\n else\n state[:time_until_list] -= 1\n end\n\n # redo the /list whenever anybody changes their name or joins the room\n if(/^\\'(.*)\\' is now known as \\'(.*)\\'/.match(body) ||\n /^.* has joined the channel with the alias '.*'/.match(body) )\n out(\"sending /list because of user change\")\n respond(msg, cl, \"/list\")\n return\n end\n \n # handle /list result when it comes in\n if(/^Listing members of '#{ROOM_NAME}'\\n/.match(body))\n out(\"received a room listing.\")\n listing_refresh(state, body)\n return\n end \n \n # messages starting and ending with '_' are emotes \n if body[0].chr == '_' && body[body.length - 1].chr == '_'\n chatroom_emote(msg, cl, state)\n return\n end\n\n # If someone says [word]bomb search for [word] on Google image\n # search and post the first result to the room.\n # eg: pugbomb\n if /\\w+bomb/.match(body)\n q = /(\\w+)bomb/.match(body)[1]\n uri = 'http://www.google.com/search?num=1&hl=en&safe=off&site=imghp&tbm=isch&source=hp&biw=1060&bih=669&q=' + q\n response = Net::HTTP.get_response(URI.parse(uri)) # => #<Net::HTTPOK 200 OK readbody=true>\n arr = response.body.scan(/imgurl=([^&,]+)/)\n if arr.length < 1\n respond(msg, cl, \"No results for \" + q)\n elsif\n respond(msg, cl, arr[0][0])\n end\n end\n\n # getting here means the message was a regular comment from a user\n regular_user_chatroom_message(msg, cl, state)\nend",
"def read_messages\n @useConversations = Message.where(\"user_id = (?)\", current_user.id).pluck(:conversation_id)\n if @useConversations.count > 0\n @useConversations = @useConversations.uniq # Unique\n @useConversations = @useConversations.map(&:inspect).join(', ')\n #@updatemsg = Message.where(\"user_id != (?) and conversation_id IN (?)\", current_user.id, @useConversations).update_all(:mark_as_read => true)\n @updatemsg = Message.where(\"user_id != #{current_user.id} and conversation_id in (#{@useConversations})\").update_all(:mark_as_read => true)\n session[:mark_messages] = 0 # Mark as read messages\n end\n end",
"def read_message! bytes, state=nil\n begin\n do_read_message! bytes, state\n rescue\n nil\n end\n end",
"def read_message(s)\n if buffer = s.read(4) and buffer.size == 4\n length = buffer.unpack('N').first\n begin\n str = s.read length\n message = Riemann::Message.decode str\n rescue => e\n puts \"Message was #{str.inspect}\"\n raise\n end\n\n unless message.ok\n puts \"Failed\"\n raise ServerError, message.error\n end\n\n message\n else\n raise InvalidResponse, \"unexpected EOF\"\n end\n end",
"def on_read socket, messages\n string = ''\n messages.each_with_index do |message, index|\n string << '|' if index > 0\n string << \"#{message.copy_out_string}\"\n end\n\n @file.print \"#{string}\\n\"\n @file.flush\n end",
"def messages; end",
"def messages; end",
"def messages; end",
"def each\n while message = read_message\n yield message\n end\n end",
"def extract_messages\n parse do |part|\n case part[:type]\n when :empty_line\n # ignore\n when :paragraph\n yield(part)\n end\n end\n end",
"def read_message bytes, state=nil\n read_message! bytes.dup, state\n end",
"def read_loop\n loop do\n msg = connection.read_msg\n msg.received_at = Time.now\n handle(msg)\n end\n rescue StandardError => e\n self << [:raise_error, e]\n end",
"def message_body\n active_div.div(:id=>\"inbox_show_message\").div(:class=>\"inbox_excerpt\").text\n end",
"def personal_message(msg, cl, state)\n respond(msg, cl, \"Hi. Your message was: #{msg.inspect}\")\n respond(msg, cl, \"Body: #{msg.body.to_s}\")\nend",
"def read_keywords\n messages = (list(:cur) + list(:new)).inject({}) { |m, msg| m[msg.unique_name] = msg ; m }\n t = Time.now.to_i / 300\n keywords = []\n state = :head\n # process :list\n list_file = File.join(keyword_dir, ':list')\n File.open(list_file).each_line do |line|\n line.strip!\n if state == :head\n if line.empty?\n state = :messages\n next\n end\n keywords << line\n else\n key, ids = line.split(':')\n if msg = messages[key]\n msg.set_keywords(ids.split(/\\s/).map {|id| keywords[id.to_i - 1] })\n end\n end\n end if File.exist?(list_file)\n # collect keyword files\n keyword_files = (Dir.entries(keyword_dir) - %w(. .. :list)).inject({}) do |keyword_files, file|\n if file =~ /^\\.(\\d+)\\.(.*)$/\n n = $1\n key = $2\n else\n n = t + 1\n key = file\n FileUtils.mv(File.join(keyword_dir, file), File.join(keyword_dir, \".#{n}.#{key}\"))\n end\n if msg = messages[key]\n (keyword_files[key] ||= []) << [n, key]\n else # message doesn't exist\n fname = File.join(keyword_dir, file)\n if File.stat(fname).ctime < (Time.now - (15 * 60))\n File.unlink(fname)\n end\n end\n next(keyword_files)\n end\n # process keyword files\n keyword_files.each_pair do |key, files|\n files.sort! { |a, b| a[0] <=> b[0] }\n files[0..-2].each { |f| File.unlink(File.join(keyword_dir, \".#{f.join('.')}\")) } if files.last[0] < t\n msg = messages[key]\n file = (File.exist?(File.join(keyword_dir, files.last[1])) ? files.last[1] : \".#{files.last.join('.')}\")\n current_keywords = File.read(File.join(keyword_dir, file)).split(/\\s+/)\n msg.set_keywords(current_keywords)\n if (add = (current_keywords - keywords)).any?\n keywords += add\n end\n end\n # rebuild :list\n @keywords = {}\n tmp_file = File.join(path, 'tmp', ':list')\n File.open(tmp_file, 'w') { |f|\n f.write(keywords.join(\"\\n\")+\"\\n\\n\")\n messages.each_pair do |key, msg|\n next unless msg.keywords\n f.puts([key, msg.keywords.map{|kw| keywords.index(kw) + 1 }.sort.join(' ')].join(':'))\n @keywords[key] = msg.keywords\n end\n }\n FileUtils.mv(tmp_file, list_file)\n end",
"def receive_message(message)\n # Check if user send text.\n if !message.text.nil?\n model_response = send_to_api_ai(message.text)\n # Save message text from client to bot\n Message.create(message: message.text, fb_message_id: message.mid, client_id: @customer, bot: false)\n command_response = model_response[:result][:action] # accion\n message_response = model_response[:result][:fulfillment][:speech] # respuesta\n clasify_messagin(command_response, message_response)\n end\n # Check if user send attachments.\n if message.attachments.nil?\n puts message.attachments\n end\n end",
"def process_messages\n # Check status for all streams, reopen as necessary\n @streams.each { |_, stream| try { stream.keep_alive } }\n\n # Actual processing of incoming messages happens in event callbacks\n # Oбрабатываем пришедшее сообщение в интерфейсах обратного вызова\n @conn.ProcessMessage2(100)\n end",
"def message\n process_mess\n end",
"def next_message; end",
"def next_message; end",
"def parseMessages( socket )\n len = socket.read( 4 ).unpack(\"N\")[0]\n\n if len == 0\n # keep-alive message\n if $verb\n puts \"Got keep-alive message\"\n end\n return\n end\n\n id = socket.read( 1 ).unpack(\"c\")[0]\n\n case id\n when 0\n if $verb\n puts \"Got choke message\"\n end\n @peer_choking = true\n @pending_requests = [] # choke discards all unanswered requests\n when 1\n # only send data messages when unchoked\n if $verb\n puts \"Got unchoke message\"\n end\n\n if ! @fileio.isComplete?\n send_request( socket, @work_piece, @work_offset )\n (1..(( @fileio.getPieceLength / BLOCK_SIZE ) - 1)).each { |n| # fill the pipeline\n send_request( socket, @work_piece, @work_offset + n*BLOCK_SIZE )\n }\n end\n\n @peer_choking = false\n when 2\n # only send data when peer is interested\n if $verb\n puts \"Got interested message\"\n end\n\n send_unchoke( socket )\n\n @peer_interested = true\n when 3\n if $verb\n puts \"Got not interested message\"\n end\n\n send_choke( socket )\n\n @peer_interested = false\n when 4\n if $verb\n puts \"Got have message\"\n end\n # build logic to ask peers for pieces\n # maybe trigger a request msg once we learn\n # they have a piece we need? or maybe trigger it\n # after loading a bitfield....\n data = socket.read( len - 1 )\n @bitfield.set_bit(data.unpack(\"N\")[0])\n #puts @bitfield.to_binary_string\n if @work_piece.nil? && ! @peer_choking && ! @fileio.isComplete?\n needed_bits = @fileio.getBitfield.bits_to_get( @bitfield )\n unless needed_bits.empty?\n @work_piece = needed_bits.sample( random: Random.new( Random.new_seed ) )\n @work_offset = 0\n\n if $verb\n puts \"Starting work on piece #{@work_piece}\"\n end\n\n # send request for first block\n send_request( socket, @work_piece, @work_offset )\n end\n end\n when 5\n if $verb\n puts \"Got bitfield message\"\n end\n # note, many clients will send incomplete bitfield, then supplement\n # remaining gaps with \"have\" messages (called lazy bitfield)\n data = socket.read( len - 1 )\n @bitfield.from_binary_data(data)\n \n\n #select random piece to work on\n if @work_piece.nil? && ! @fileio.isComplete?\n needed_bits = @fileio.getBitfield.bits_to_get( @bitfield )\n unless needed_bits.empty?\n @work_piece = needed_bits.sample( random: Random.new( Random.new_seed ) )\n @work_offset = 0\n\n if $verb\n puts \"Starting work on piece #{@work_piece}\"\n end\n\n send_unchoke( socket );\n send_interested( socket );\n\n # send request for first block\n # wait until unchoked to request\n #send_request( socket, @work_piece, @work_offset )\n end\n end\n\n when 6\n if $verb\n puts \"Got request message\"\n end\n reqData = socket.read(12).unpack(\"N3\")\n @pending_requests << reqData\n ## we should just send pieces now? or use a queue\n\n if ! @peer_choking && @peer_interested\n send_piece( socket, reqData[0], reqData[1], reqData[2] )\n end\n when 7\n if $verb\n puts \"Got piece message\"\n end\n # Also, I don't think we need to synchronize access\n # to this with a mutex. Because peers will probably\n # be writing at separate times, right?\n if @fileio.isComplete?\n return\n end\n\n if Thread.current[\"stopNow\"] == true\n return\n end\n \n piece_index, begin_offset = socket.read(8).unpack(\"N2\")\n block_bytes = socket.read( len - 9 )\n\n #@lock.synchronize {\n #for some reason there's a MethodNotFound exception here\n\n if @fileio.getBitfield.check_bit( piece_index )\n # TODO choose a new piece to work on\n needed_bits = @fileio.getBitfield.bits_to_get( @bitfield )\n unless needed_bits.empty?\n @work_piece = needed_bits.sample( random: Random.new( Random.new_seed ) )\n @work_offset = 0\n end\n return\n end\n \n @fileio.set_piece_bytes(piece_index, begin_offset, block_bytes)\n \n #} # end synchronize\n\n # after writing to file, we need to recheck this piece to see if it is now complete\n actualHash = @fileio.getInfoDict[\"pieces\"].byteslice(piece_index * 20, 20)\n pieceHash = @fileio.get_piece_hash(piece_index)\n \n if pieceHash == actualHash\n @fileio.getBitfield.set_bit(piece_index)\n @fileio.setComplete(1)\n if $verb\n puts \"Bit #{piece_index} set\"\n end\n\n send_have( socket, piece_index ) #also need to send this to all other peers\n\n # need to choose a new piece to work on\n needed_bits = @fileio.getBitfield.bits_to_get( @bitfield )\n unless needed_bits.empty?\n @work_piece = needed_bits.sample( random: Random.new( Random.new_seed ) )\n @work_offset = 0\n end\n else\n # piece not complete, request other blocks\n #@work_offset += BLOCK_SIZE\n end\n\n if ! @peer_choking\n send_request( socket, @work_piece, @work_offset )\n (1..(( @fileio.getPieceLength / BLOCK_SIZE ) - 1)).each { |n| # fill the pipeline\n send_request( socket, @work_piece, @work_offset + n*BLOCK_SIZE )\n }\n end\n \n perc = (@fileio.getComplete.to_f / @fileio.getTotal.to_f) * 100\n perc = perc.to_s.slice(0, 4)\n if perc == \"100.\"\n if @fileio.recheckComplete() == \"100.\"\n socket.close\n\n if $verb\n puts \"File download complete! (#{@fileio.getInfoDict[\"name\"]})\"\n end\n # now exit\n # and trigger all other threads to exit\n @tracker.sendRequest(\"completed\")\n Thread.current[\"nowSeed\"] == true\n $perc[Thread.current[\"torrent-file\"]] = 1\n return true\n #exit #Don't necessarily need to stop now. Unless connection is closed.\n else\n if $verb\n puts \"Recheck failed.\"\n end\n end\n else\n if $verb\n puts \"File #{perc}% complete (#{@fileio.getComplete}/#{@fileio.getTotal}).\"\n end\n $perc[Thread.current[\"torrent-file\"]] = perc.to_f / 100\n end\n when 8\n if $verb\n puts \"Got cancel message\"\n end\n @pending_requests.delete(socket.read(12).unpack(\"N3\"))\n when 9\n # only needed with DHT\n if $verb\n puts \"Got port message\"\n end\n data = socket.read( len - 1 )\n else\n if $verb\n puts \"Unsupported Protocol Message #{id}\"\n end\n end\n\n end",
"def read_article\n\torig_article\n\tdancing_man\n\tin_chrome\n\tgo_back\n\tgo_back\nend",
"def parse text\n # Extract our headers, if any.\n if text =~ /\\A.*:/\n if text =~ /\\A((?:.|\\n)*?)\\n\\n((?:.|\\n)*)\\z/\n # Headers and body.\n @headers = YAML::load($1)\n content = $2\n else\n # Headers without body.\n @headers = YAML::load(text)\n content = ''\n end\n else\n # Body without headers.\n @headers = {}\n content = text\n end\n\n # Split the body at a <!--more--> marker, if we have one.\n if content =~ /\\A((?:.|\\n)*?)\\n<!--more-->\\s*\\n((?:.|\\n)*)\\z/\n @raw_body = $1\n @raw_extended = $2\n else\n @raw_body = content\n @raw_extended = nil\n end \n end",
"def get_new_messages\n get_messages_link_and_content\n end",
"def read_message\n if (line = @sock.gets and msg = IRC.parse_message(line))\n case msg.command\n when IRC::RPL_WELCOME\n i = msg.params[-1].rindex(' ') || -1\n @prefix = msg.params[-1][i + 1..-1]\n when IRC::CMD_PING\n pong(msg)\n when IRC::CMD_NICK\n # check if our nick got changed by the server\n @nickname = msg.params[0] if msg.nick == @nickname\n end\n msg\n end\n end",
"def read\n @admin_message = Admin::Message.find(params[:id])\n\n # Mark either the conversation or the message itself as read by the user\n if @admin_message.recipients_can_reply? && current_user\n conversations = current_user.admin_conversations.find_all_by_admin_message_id(@admin_message.id)\n conversations.present? && conversations.each{|conversation| conversation.read_by!(current_user)}\n else\n @admin_message.read_by!(current_user)\n end\n\n render :nothing => true\n end",
"def read\n object.content\n end",
"def new\n @store_manager_messages_read = Store::Manager::Messages::Read.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @store_manager_messages_read }\n end\n end",
"def get_message\n File.open @config.data do |file|\n self[:message] = YAML.load(file).sample\n end\n end",
"def text lines\n raise \"text() receiving null content\" unless lines\n @content = lines\n @_populate_needed = true\n end",
"def messages\n @logger.log(\"Getting messages from phone.\")\n \n # Get a list of messages\n msg = nil\n msgs = ATPhone::SMS.new(self)\n\n # Turn on text mode\n send(\"AT+CMGF=1\")\n \n resp = send(\"AT+CMGL\")\n resp.each_line do |line|\n # If it is a message header\n if line[0..5] == '+CMGL:'\n # Add formed message to list\n msgs[msg.index] = msg unless msg.nil?\n \n # Create new message from phone data\n index, status, number = line[7..-1].split(',')\n msg = ATPhone::SMS::Message.new(\n \"\",\n number.strip.gsub('\"', ''),\n index.to_i,\n status.strip.gsub('\"', '')\n )\n # If it's not a command, then it's text\n elsif not msg.nil?\n msg.message += line\n end\n end\n\n # Add last message\n msgs[msg.index] = msg unless msg.nil?\n\n msgs\n end",
"def content\n @content ||= body.split(/\\r?\\n/, 2)\n end"
] |
[
"0.65857923",
"0.6436185",
"0.63443696",
"0.6333778",
"0.63244945",
"0.6284904",
"0.62402105",
"0.61956984",
"0.6189301",
"0.61259496",
"0.611394",
"0.61094016",
"0.60908365",
"0.6055796",
"0.6047328",
"0.60243976",
"0.60149765",
"0.60127395",
"0.60090536",
"0.598371",
"0.597419",
"0.5955365",
"0.59202826",
"0.59143597",
"0.5871474",
"0.5853396",
"0.58501065",
"0.5830983",
"0.5830983",
"0.5830983",
"0.5830983",
"0.5830983",
"0.5830983",
"0.5830983",
"0.58263814",
"0.58244497",
"0.5824212",
"0.5804408",
"0.57847273",
"0.57834685",
"0.57834685",
"0.5783301",
"0.57750714",
"0.57673657",
"0.5757741",
"0.5751571",
"0.5743777",
"0.5743777",
"0.5743777",
"0.5743777",
"0.5742737",
"0.57404673",
"0.57242364",
"0.5717495",
"0.56949407",
"0.5679714",
"0.5663385",
"0.5649306",
"0.5646595",
"0.5643719",
"0.56409764",
"0.5632575",
"0.5613026",
"0.5613026",
"0.56062496",
"0.56001663",
"0.55971116",
"0.5590727",
"0.5589601",
"0.5583765",
"0.5579601",
"0.5579377",
"0.55782926",
"0.5572668",
"0.55722666",
"0.55722666",
"0.55722666",
"0.55720854",
"0.55713236",
"0.5565549",
"0.55319375",
"0.5528825",
"0.55270153",
"0.55245197",
"0.5515031",
"0.5473558",
"0.5468598",
"0.5467236",
"0.5467236",
"0.5439285",
"0.5438794",
"0.5429492",
"0.5428105",
"0.54230875",
"0.54203665",
"0.5418034",
"0.540979",
"0.5408085",
"0.540747",
"0.5391384",
"0.5377309"
] |
0.0
|
-1
|
Says something (either in a reply to a message, or makes it up)
|
def speak(message = '', context = [])
return @mouth.construct_sentence(message,context)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def reply\n end",
"def say(message)\n if message\n @previous_message = message\n @previous_nickname = @botname\n @responded = true\n message\n end\n end",
"def reply(event)\n msg = event.message['text']\n mk_reply(msg)\nend",
"def reply msg\n\t\t# get message from user\n\t\trep = @@client.message(msg)\n\t\t# handle the message\n\t\tputs handle_message(rep)\n\t\t\n\t\t# interactive Wit\n\t\t#@@client.interactive(method(:handle_message))\n\tend",
"def say(recipient_id, text, quick_replies = nil)\n message_options = {\n recipient: { id: recipient_id },\n message: { text: text }\n }\n if quick_replies\n message_options[:message][:quick_replies] = quick_replies\n end\n Bot.deliver(message_options, access_token: ENV['ACCESS_TOKEN'])\nend",
"def say(recipient_id, text, quick_replies = nil)\n message_options = {\n recipient: { id: recipient_id },\n message: { text: text }\n }\n\n Bot.deliver(message_options, access_token: ENV['ACCESS_TOKEN'])\nend",
"def test_create_reply_to_up_in_chain_reply_to_standalone_message_about_nothing\r\n about = nil\r\n reply_to = messages(:kevin_reply_to__andy_to_kevin_about_nothing)\r\n send_message(@tim, @kevin, reply_to, about)\r\n end",
"def test_create_reply_to_reply_to_standalone_message_about_nothing\r\n about = nil\r\n reply_to = messages(:kevin_reply_to__andy_to_kevin_about_nothing)\r\n send_message(@matt, @kevin, reply_to, about)\r\n end",
"def test_create_reply_to_standalone_message_about_nothing\r\n reply_to = messages(:andy_to_kevin_about_nothing)\r\n about = nil\r\n send_message(@kevin, @andy, reply_to, about)\r\n end",
"def test_create_reply_to_reply_to_reply_to_standalone_message_about_nothing\r\n about = nil\r\n reply_to = messages(:matt_reply_to__kevin_reply_to__andy_to_kevin_about_nothing)\r\n send_message(@tim, @matt, reply_to, about)\r\n end",
"def send_reply\n if self.response_changed?\n @notifiable = self\n @tutor = User.find(self.user_id)\n @student = User.find(self.pupil_id)\n\n if self.response == \"Declined\"\n @description = self.pupil.title + \" has sadly declined your offer\"\n @notifiable.notifications.create(:user => @tutor ,:receiver_id => @student.id, :message => 'You hve declined the offer by ' + @tutor.title)\n else\n @description = self.pupil.title + \" is now a student at your school\"\n @notifiable.notifications.create(:user => @tutor ,:receiver_id => @student.id, :message => 'You are now a student of ' + @tutor.title)\n end\n @notifiable.notifications.create(:user => @student, :receiver_id => @tutor.id, :message => @description)\n end\n end",
"def shout message, title = \"Battlecry\", priority = 0, sticky = false\n @allies.each do |ally|\n ally.notify \"battlecry\", title, message, priority, sticky\n end\n end",
"def hey(message)\n case message\n when shout then \"Woah, chill out!\"\n when question then \"Sure.\"\n when silence then \"Fine. Be that way!\"\n else \"Whatever.\"\n end\n end",
"def action(message)\n print(6, message)\n end",
"def inform(previous_msg)\n msg = previous_msg.create_reply\n msg.performative = \"inform\"\n msg.sender = aid\n send_message(msg)\n end",
"def say(msg)\n self.signed_request '/api/v1/chat.postMessage', 'POST', {roomId: @channel_id, text: '>' + msg}\n end",
"def says (opinion)\n puts \"#{name} says #{opinion}\"\n end",
"def thanks\n end",
"def act(target, message)\n buffer_output Net::YAIL::OutgoingEvent.new(:type => :act, :target => target, :message => message)\n end",
"def notify_on_mention?; true; end",
"def raw_talk(message, options={})\n send_message(message)\n receive_raw_answer(options)\n end",
"def shout(message)\n client.shout(message)\n end",
"def shout\n 'Yay!'\n end",
"def answer(msg)\n logger.debug(\"Answering to (#{info[:uri]}): #{msg.chomp.strip}\")\n client.puts(msg)\n end",
"def message_sent(type, text, to = nil)\n msg = message_db.add(\n type: type,\n to: to,\n from: username,\n text: text,\n time: nil\n )\n signal_change(type, msg)\n end",
"def send_message(message); end",
"def send_message(message); end",
"def say(text)\n @bot.api.sendMessage(chat_id: @message.chat.id, text: text)\n end",
"def say\n send_text \"You just said: #{params}\"\n end",
"def say(cmd)\n @socket.send(\"#{cmd}\\n\\n\",0)\n response\n end",
"def say(msg)\n print msg + \"\\r\\n\"\n end",
"def tell (message)\n\t\t\tactor.tell message\n\t\tend",
"def event(msg)\n unknown(\"=====> #{msg}\")\n end",
"def test_create_reply_to_reply_to_standalone_message_about_kevins_review_59\r\n reply_to = messages(:tim_reply_to__andy_to_kevin_about_kevins_review_59)\r\n about = Factory :review\r\n about.user = @kevin\r\n send_message(@matt, @tim, reply_to, about)\r\n end",
"def record_message\n @response.say('You can leave a message')\n @response.record(action: '/call/hook/message')\n\n @call.update(final_action: 'left_message')\n end",
"def message(type, *args)\n case type\n when :trainer_no_money\n puts \"Du hast ja gar nicht genug Geld!!\"\n end\n end",
"def ask_for_action\n @response.gather(numDigits: 1) do |g|\n g.say('To call Julien directly, press 1. To leave a message, press 2.')\n end\n end",
"def reply_ping(user, str)\n sendmsg \"NOTICE #{user} :\\001PING #{str}\\001\"\n end",
"def coach_answer(your_message)\n # TODO: return coach answer to your_message\n if your_message[-1] == \"?\" then puts \"Silly question, get dressed and go to work !\"\n else puts \"I don't care son, get dressed and go to work !\"\n end\nend",
"def send_message(msg); end",
"def notify aAction, aMessage\n printf \"%12s %s\\n\", aAction, aMessage\n end",
"def action(text)\n reply(\"\\001ACTION #{text}\\001\")\n end",
"def act notification, options={}\n # ...or nothing\n end",
"def ask(msg)\n request(\"#{msg} [yn] \") == 'y'\n end",
"def say(text, quick_replies: [], user: @user)\n message_options = {\n recipient: { id: user.id },\n message: { text: text }\n }\n if quick_replies && !quick_replies.empty?\n message_options[:message][:quick_replies] = UI::QuickReplies\n .build(*quick_replies)\n end\n\n send_message(message_options)\n end",
"def reminder_sent\n end",
"def notify_business\n business.add_message_to_queue(\"Hey #{business.name}, we've just deposited #{amount} into your account! Thanks for being great!\")\n end",
"def trigger_on_message(msg); @app.on_message(msg); end",
"def say(msg, recipient = nil)\n recipient ||= @msg.reply_to if @msg\n @bot.msg(recipient, msg)\n end",
"def say(msg)\n\t\tsend \"PRIVMSG #{@channel} :#{msg}\"\n\t\t\n\tend",
"def test_create_reply_to_standalone_message_about_kevins_review_59\r\n reply_to = messages(:andy_to_kevin_about_kevins_review_59)\r\n about = Factory :review\r\n about.user = @kevin\r\n send_message(@tim, @andy, reply_to, about)\r\n end",
"def action(msg, recipient)\n recipient ||= @msg.reply_to if @msg\n @bot.action(recipient, msg)\n end",
"def began msg\n end",
"def reply(message)\n return @mouth.reply(message)\n end",
"def what_is_ur_objective(sender_id)\n Bot.on :message do |message|\n answer = message.text.downcase\n if answer.include?(\"non\")\n say(sender_id, \"Okay ! N'hésite pas à revenir si tu as besoin d'aide !\")\n else\n say(sender_id, IDIOMS[:objectives], OBJECTIVES)\n handle_objective(sender_id)\n end\n end\nend",
"def tell_op(message)\n @Mailbox.push_op(message).then(self) { |_ch, actor| actor }\n end",
"def on_ask(ask)\r\n warn \"Ask \" + ask.to_s\r\n end",
"def say(message, subitem = false)\n write \"#{subitem ? ' ->' : '--'} #{message}\"\n end",
"def messaging\n end",
"def show_message_request(text, type, actions, &block); end",
"def talk\n if current_room.npc\n puts current_room.npc.dialogue[:default]\n else\n puts \"Sorry, no one else is in here!\"\n end\n end",
"def sayMessage\r\n puts \"Hey Programmers!\"\r\n puts \"What's for lunch?\"\r\nend",
"def say(payload)\n {\n action: 'say',\n options: {\n payload: payload,\n voice: 'male',\n language: 'en-US'\n }\n }\nend",
"def send_message(text)\n end",
"def speak(msg, channel=@channel)\n if @s and not @stfu\n @s.puts \"PRIVMSG #{channel} :\"+2.chr+\"#{msg}\" # 2.chr = bold char in irc\n end\n end",
"def say(message)\n send(DCSayCommand.new(@nickname, message))\n end",
"def ask(text)\n say(text)\n @bot.listen do |message|\n return message.text\n end\n end",
"def add_message_reaction(data); end",
"def say(dat, sender)\n UI.dump(sender.name, self.name, dat)\n end",
"def _on_reply(wi)\n Ruote.participant_send(self, :on_reply, 'workitem' => wi)\n end",
"def light_the_way\n HisMastersVoice.instance.tell_me(self)\n end",
"def speak\n\t`say 'I am a product.`\nend",
"def say(to, msg, using = :chat)\n client.write Blather::Stanza::Message.new(to, msg, using)\n end",
"def show_humour_replies(sender_id, quick_replies)\n say(sender_id, IDIOMS[:greetings], quick_replies)\n humour_analysis(sender_id)\nend",
"def remote_msg(sender, body)\n add_msg(\"|#{sender}| #{body}\", :notice)\nend",
"def notify_question_owner(answer)\n \t@answer = answer\n \t@question = answer.question\n \t@receiver = @question.user\n \tmail(to: @receiver.email,\n \t\t\t subject: \"You've got a new answer!\")\n end",
"def work(raw_post)\n puts \"Msg received: \" + raw_post\n ack! # we need to let queue know that message was received\n end",
"def triggered?(msg)\n if understood?(msg)\n return reply\n end\n nil\n end",
"def reply_to_sender(phone_number, msg)\n Rails.logger.debug('TropoController::reply_to_sender')\n #get_system_org.create_gateway!.send_raw(phone_number, msg)\n @tropo.say(msg)\n end",
"def message(msg)\n\t\t@messager.message(msg)\n\tend",
"def say_success(message)\n say \"Success\", message, :green\n end",
"def prompt(digits, what, name, args = {}, &action)\n @scoped_state.sayings = [] if @scoped_state.sayings.nil?\n @scoped_state.sayings << what\n press(digits, name, args, &action)\n end",
"def test_create_reply_to_reply_to_reply_to_standalone_message_about_kevins_review_59\r\n reply_to = messages(:matt_reply_to__tim_reply_to__andy_to_kevin_kevins_review_59)\r\n about = Factory :review\r\n about.user = @kevin\r\n notified_users = send_message(@kevin, @matt, reply_to, about)\r\n assert !notified_users.include?(@kevin),\r\n \"Owner of the review should not receive their own comments on the review.\"\r\n end",
"def giveup(msgid)\n req(\"giveup\", \"\", \"\", msgid, \"\")\n end",
"def respond(message)\n @channel.send_message(message) if @channel\n end",
"def answer(privMsg,ans)\n if !privMsg \n return\n end\n if(privMsg.private_message?)\n talk(privMsg.who,ans)\n else\n talk(privMsg.place,ans)\n end\n end",
"def send_confirmation\n reply 'confirmation'\n end",
"def answer(priv_msg, ans)\n return unless priv_msg\n if priv_msg.private_message?\n talk(priv_msg.who, ans, priv_msg.server_id)\n else\n talk( priv_msg.place, ans, priv_msg.server_id)\n end\n end",
"def speak_into(msg)\n require 'net/http'\n channel = \"/0001\"\n\n message = {:channel => channel, :data => msg}\n uri = URI.parse(\"http://localhost:#{FAYE_PORT}/faye\")\n begin\n Net::HTTP.post_form(uri, :message => message.to_json)\n rescue Exception => e\n $stderr.puts \"failed to send message to faye server and thus webclient\"\n $stderr.puts e.message\n return false\n end\n true\n end",
"def speak\r\n\t\tputs \"Ho, ho, ho! Merry Christmas and Haaaappy holidays to all!\"\r\n\tend",
"def say(msg)\n puts \"@Dealer: #{msg}\"\nend",
"def reply_bang\n user_bang = UserBang.find_by(id: params[:id])\n raise Bang::Error::InvalidUserBang\\\n if !user_bang.present?\\\n || user_bang.user_id != current_user.id\\\n || user_bang.has_replied?\n\n user_bang.status = UserBang.status_from_string(params[:status])\n if user_bang.accept?\n create_conversation [user_bang.user_id, user_bang.from_user_id], :user_bang\n end\n user_bang.save!\n @user_bang = user_bang\n end",
"def speak\n \"#{name} says Assalaam alaykum\"\n end",
"def talkback(server,msg)\n @connector.write(server,msg,true,\n Connector::WRITE_PRIORITY_NONE)\n end",
"def publish_action(f)\n send_as :notification\n from f\n story_size SHORT # or ONE_LINE or FULL\n data :friend=>\"Mike\"\n end",
"def wait_for_any_input\n Bot.on :message do |message|\n puts \"Received '#{message.inspect}' from #{message.sender}\"\n sender_id = message.sender['id']\n show_humour_replies(sender_id, HUMOUR)\n end\nend",
"def say_that_thing_you_say\n \"#{self.name} always says: #{self.catchphrase}\"\n end",
"def test_create_standalone_message_about_nothing\r\n reply_to = nil\r\n about = nil\r\n send_message(@andy, @kevin, reply_to, about)\r\n end",
"def say(*_args)\n end",
"def respond(message)\n send_channel message if message?\n send_whisper @user, message if whisper?\n end",
"def add_msg(msg, type = nil)\n ##### local message event\n puts msg\n $stdout.flush\n end"
] |
[
"0.6727514",
"0.66516227",
"0.659719",
"0.654193",
"0.6504054",
"0.6437574",
"0.6423626",
"0.6380119",
"0.63628507",
"0.63567334",
"0.6344196",
"0.6315652",
"0.62935716",
"0.62877226",
"0.62636393",
"0.6243579",
"0.6216271",
"0.62034297",
"0.61675274",
"0.61648",
"0.61647224",
"0.6158257",
"0.6155453",
"0.6146481",
"0.6128088",
"0.6087927",
"0.6087927",
"0.60839957",
"0.60688555",
"0.60668314",
"0.6066022",
"0.6065308",
"0.6063478",
"0.60620916",
"0.6057631",
"0.60510355",
"0.6049515",
"0.60468453",
"0.6044085",
"0.6038064",
"0.603263",
"0.6030724",
"0.6027672",
"0.6026488",
"0.602267",
"0.60184234",
"0.6018214",
"0.60022134",
"0.5993929",
"0.5992667",
"0.59879684",
"0.59860224",
"0.5984232",
"0.59702224",
"0.59562874",
"0.5954867",
"0.5936501",
"0.59357995",
"0.59278756",
"0.59134865",
"0.5909682",
"0.5901535",
"0.5897655",
"0.5896096",
"0.5890644",
"0.58890873",
"0.5886199",
"0.5878661",
"0.5867865",
"0.58551955",
"0.5846457",
"0.5845405",
"0.5837461",
"0.58347934",
"0.5834087",
"0.5833924",
"0.58336383",
"0.58314896",
"0.58300525",
"0.58247626",
"0.58203185",
"0.58055353",
"0.5804735",
"0.579731",
"0.5796779",
"0.57965165",
"0.579641",
"0.57954526",
"0.5793448",
"0.57900655",
"0.57887024",
"0.57872105",
"0.57855874",
"0.57836896",
"0.57828975",
"0.57800734",
"0.5772627",
"0.5771456",
"0.5769838",
"0.57672715",
"0.57609624"
] |
0.0
|
-1
|
Remembers something and lets it be randomized by recall
|
def remember(message)
return @ears.add_quote(message)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def randomize!\n self.replace(self.randomize)\n end",
"def reset\n\t\tself.gen = Random.new(SEED)\n\tend",
"def reset\n\t\tself.gen = Random.new(SEED)\n\tend",
"def regenerate\n self.token = UUIDTools::UUID.random_create.to_s\n reset_timer\n self.token\n end",
"def new_random\n @randomizer = Random.new if $options['respect_randomize'].value\n end",
"def random= rnd \n @random = rnd\n @codon.random = rnd\n end",
"def shuffle!\r\n\t\trandomize!\r\n\tend",
"def set_state_random_single\n random_state = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]\n random_state[rand(15)] = 1\n session[:state] = random_state\n flash[:success] = 'State changed successfully.'\n redirect_to action: 'show'\n end",
"def reset\n @num_1 = rand(1..20)\n @num_2 = rand(1..20)\n if @current_player == 1\n @current_player = 2\n else\n @current_player = 1\n end\n end",
"def shuffle!()\n\t\treplace(shuffle)\n\tend",
"def previously_ran?; end",
"def previously_ran?; end",
"def regenerate \n \t @session_id = Merb::SessionMixin::rand_uuid \n \t self.needs_new_cookie=true \n \tend",
"def random= rnd \n @random = rnd\n @codon.random = rnd\n end",
"def random= rnd \n @random = rnd\n @codon.random = rnd\n end",
"def randomkey; end",
"def randomkey; end",
"def reset()\n @rand_count = 0\n @sideup = nil\n end",
"def rand\n Kernel.rand(self)\n end",
"def at_rand!\n delete_at(SecureRandom.random_number(size))\n end",
"def shuffle!()\n replace(shuffle)\n end",
"def recite_random\n number = rand(1..@size)\n return recite(number)\n end",
"def randomize(random = nil)\n random ||= Random.new\n self.rotate(random.rand(4)).flip(random.rand(2))\n end",
"def store(r)\n # when store() is invoked, Bag makes sure that all randomizers to be stored are reset\n r.reset\n super(r)\n end",
"def once\n times 1\n end",
"def random_to_one\n return rand()\n end",
"def random_to_one\n return rand()\n end",
"def random_to_one\n return rand()\n end",
"def random_to_one\n return rand()\n end",
"def make_not_so_random!\n srand 1213\nend",
"def set_retrieval_key\n base = rand(KEY_POOL_SIZE)\n first_digit = (base / (KEY_POOL_SIZE / 10)).to_i\n remainder = base % (KEY_POOL_SIZE / 10)\n\n self.retrieval_key = first_digit.to_s + rand(1000000000).to_s(36)\n if self.class.find_by_retrieval_key(retrieval_key)\n # that one is already used - go get another\n set_retrieval_key\n end\n end",
"def regenerate\n update_attributes(:session_id => Merb::SessionMixin::rand_uuid)\n self.needs_new_cookie = true\n end",
"def record\r\n # Reset if all available records have been used:\r\n if ( @unused_records.empty? )\r\n self.reset_unused_records\r\n end\r\n selected_index = rand( @unused_records.length )\r\n selected_value = @unused_records[selected_index]\r\n @unused_records.delete_at( selected_index )\r\n selected_value\r\n end",
"def recall; end",
"def random_element()\n\t\tshuffle[0]\n\tend",
"def random_element()\n shuffle[0]\n end",
"def random= rnd\n @sampling.random = rnd\n end",
"def regenerate\n self.session_id = Merb::SessionMixin::rand_uuid\n self.needs_new_cookie = true\n self.save\n end",
"def just_saw\n\t\t\t@last_seen = Time.now\n\t\tend",
"def shuffle()\n \n end",
"def fresh! \n @fresh = true\n end",
"def random_swap(fingerprint)\n random_index = rand(@size)\n fingerprint, @slots[random_index] = @slots[random_index], fingerprint\n fingerprint\n end",
"def initialize\n srand\n end",
"def random_joke\n joke nil\n end",
"def generate_new_answer\n #assigns a random number from 1-100 to the cookies[:answer] hashtable\n cookies[:answer] = rand(100) + 1\n #call method to convert string in the hashtable to an integer\n get_answer\n end",
"def resetEnemyCounter\n\t\t@enemyCounter = 0 + rand(2)\n\tend",
"def giveMeATresure\n posicion = rand(getVisibleTreasures.length)\n getVisibleTreasures.delete_at(posicion)\n end",
"def randomizer\n number = rand(0..1)\n return number\nend",
"def srand(num=0) end",
"def shuffle!\n @rep.shuffle!\n end",
"def reshuffle\n discard.each do |modifier|\n deck.push modifier\n end\n @discard = []\n shuffle\n end",
"def shuffle(value)\n @ole.Shuffle = value\n nil\n end",
"def shuffle(value)\n @ole.Shuffle = value\n nil\n end",
"def random\n new(one.random())\n end",
"def reset\n\t\tself.rs \t= 0\n\t\tself.ps \t= 0\n\t\tself.ss \t= 0\n\t\tself.gen\t= Random.new(SEED)\n\tend",
"def recite_random_subject\n number = rand(1..@size)\n return recite_subject(number)\n end",
"def shuffle\n self.dup.shuffle!\n end",
"def randomize()\n @rand_count += 1\n if @type == :coin\n # if coin, set @sideup instance var to a random number between 0 - 1\n @sideup = rand(0..1)\n else\n # if die, set @sideup instance var to a random number between 1 - sides\n @sideup = rand(1..@sides)\n end\n self\n end",
"def deal_card\n card = rand(11) + 1\nend",
"def bake\n @a = rand(100)\n prepare\n flip\n puts \"Baking the cookie\"\n end",
"def random\n @playlist = @db.shuffle\n end",
"def get_trump_card\n if self.trump_card.nil?\n trump_index = rand(self.cards_set.length)\n self.trump_card = self.cards_set[trump_index]\n self.cards_set.delete_at(trump_index)\n end \n send_update\n return self.trump_card\n end",
"def regenerate\n store.delete_session(self.session_id)\n self.session_id = Merb::SessionMixin.rand_uuid\n store.store_session(self.session_id, self)\n end",
"def kick\n rng.rand(value_range)\n end",
"def redeal\n # take all current cards in play and add to deck\n @deck.concat(@cards_in_play)\n @cards_in_play = Array.new\n\n #shuffle cards \n @deck.shuffle!\n\n #deal 12 more new cards\n @cards_in_play.concat(@deck.pop(12))\nend",
"def shuffle\n @cards.replace @cards.sort_by {rand}\n end",
"def reset_wait\n @wait = @t + rand(@t_rand)\n end",
"def hand_over_player \r\n puts \"Player getting 1 random card...\"\r\n @random_card = @game_deck.random_card # def random card\r\n random_card_val = @game_deck.deck[@random_card]\r\n @player_deck[@random_card] = random_card_val # to player\r\n @game_deck.deck.delete(@random_card) \r\n puts \"@player_deck = #{@player_deck}\"\r\n\r\n end",
"def get_random()\n \n end",
"def get_random()\n \n end",
"def set_place\n places_size = Place.count - 1\n place_index = Random.new.rand(0..places_size)\n current_place = Place.find(place_index)\n session[:current_place] = current_place.id\n return current_place\n end",
"def pick\n @gommis_count = Gommi.count\n @gommis = Gommi.offset(rand(Gommi.count)).first\nend",
"def get_random_user\n $user_keys.sample()\nend",
"def random_word\n\t\tnumber = rand(@modified_dictionary.length)\n\t\t@modified_dictionary[number]\n\tend",
"def rekey!; end",
"def rekey!; end",
"def roll_luck\n self.luck = rand(100)\n #self.gold -= 100\n self.save\n end",
"def once\n end",
"def shuffle!()\n shuffled = self.sort_by { rand }\n\n # TODO: better way to modify self?\n shuffled.each_with_index do |i, elt|\n print i\n self[i] = elt\n end\n end",
"def randomize_count()\n @rand_count\n end",
"def set_id\n\t\t\trand(111111111...999999999)\n\t\tend",
"def random_note\n notes[rand(notes.size)]\n end",
"def reshuffle_deck\n @output.puts ''.center(WIDTH, '-')\n @output.puts 'Shuffling new deck.'\n @output.puts ''.center(WIDTH, '-')\n @game.deck = Gambler::Deck.new\n 3.times { @game.deck.shuffle! }\n end",
"def return\n @cards += @discard\n @discard.clear\n @cards.shuffle\n end",
"def shuffle\n dup.shuffle!\n end",
"def hand_over_dealer\r\n puts \"Dealer getting 1 random card...\"\r\n @random_card = @game_deck.random_card # def random card\r\n random_card_val = @game_deck.deck[@random_card]\r\n @dealer_deck[@random_card] = random_card_val # to dealer\r\n @game_deck.deck.delete(@random_card) \r\n puts \"@dealer_deck = #{@dealer_deck}\"\r\n end",
"def randomize!\r\n random_bitstring=Array.new(self.length).map {|e| e=rand(2).to_s}.join\r\n if self.length_type==\"variable\"\r\n slice=random_bitstring[0,(rand((self.length/8)+1)*8)]\r\n set_raw(slice)\r\n else\r\n set_raw(random_bitstring)\r\n end\r\n end",
"def set_key!\n self.new_user_key = [*('a'..'z'),*('0'..'9')].shuffle[0,8].join\n end",
"def random_card\n result = @deck.sample(1)\n @deck.delete result\n result.first\n end",
"def shuffle\n @ole.Shuffle\n end",
"def shuffle\n @ole.Shuffle\n end",
"def random\n active.order(\"RAND()\").first\n end",
"def change_one(target)\n # change a random character to the next\n i = rand(target.size)\n \n # now randomly choose it to something else\n newc = new_char\n until newc != target[i]\n newc = new_char\n end\n \n target[i] = newc\n \n target\n end",
"def choice\n rand\n end",
"def play\n @last_card_played = @my_hand.pick_random\n set_last_card_played @last_card_played\n end",
"def giveMeATreasure\n n=Random.rand(@hiddenTreasures.size)\n \n return @hiddenTreasures.delete_at(n)\n end",
"def reset\n @@existing_names.delete(@name)\n @name = generate_name\n end",
"def shuffle # You can't use .shuffle!\n\n end",
"def pick_random\n self[rand(self.size)]\n end",
"def shuffle\n @cards.shuffle!\n binding.pry\n end",
"def draw_random\n @cards.delete_at(Random.new().rand(0...@cards.count))\n end"
] |
[
"0.6929218",
"0.67182285",
"0.67182285",
"0.6680889",
"0.6501639",
"0.64126927",
"0.6408858",
"0.63748956",
"0.6355788",
"0.63425905",
"0.6333779",
"0.6333779",
"0.6322858",
"0.629976",
"0.629976",
"0.6291005",
"0.6291005",
"0.6259043",
"0.61850536",
"0.6148462",
"0.61461073",
"0.61309004",
"0.6129648",
"0.6128345",
"0.61112547",
"0.60909706",
"0.60909706",
"0.60909706",
"0.60909706",
"0.6082744",
"0.60743207",
"0.6073635",
"0.6070894",
"0.60348713",
"0.6008297",
"0.59991574",
"0.59949684",
"0.598026",
"0.5956926",
"0.59291357",
"0.5928098",
"0.5924227",
"0.5915421",
"0.5913436",
"0.5891832",
"0.5886274",
"0.5885177",
"0.5883474",
"0.58814347",
"0.5881091",
"0.5862283",
"0.5859661",
"0.5859661",
"0.5852531",
"0.58411074",
"0.5837727",
"0.5835414",
"0.58198404",
"0.5819393",
"0.580598",
"0.5791689",
"0.579007",
"0.5787632",
"0.57778066",
"0.57671005",
"0.5759799",
"0.5759154",
"0.57509804",
"0.57430947",
"0.57430947",
"0.5734421",
"0.5732288",
"0.5729721",
"0.5721825",
"0.57192767",
"0.57192767",
"0.5704674",
"0.56920654",
"0.5684846",
"0.5678738",
"0.56708527",
"0.56692386",
"0.5667272",
"0.56590754",
"0.56565607",
"0.56554735",
"0.56507677",
"0.56459516",
"0.564376",
"0.564229",
"0.564229",
"0.56422174",
"0.5642111",
"0.5641559",
"0.56414634",
"0.5639437",
"0.5634827",
"0.56313366",
"0.5626526",
"0.5626501",
"0.56211555"
] |
0.0
|
-1
|
Pulls a random string out of Rheya's memory
|
def recall(id)
if id =~ /^[-+]?[0-9]*\.?[0-9]+$/
return @ears.specific_quote(id)
end
return @ears.random_quote
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def random_string(length); random_bytes(length / 2).unpack(\"H*\")[0] end",
"def ran_str_maker\r\n length = 10\r\n ran_str = rand(36**length).to_s(36)\r\n return ran_str\r\nend",
"def rl\n letters = \"ABCDEFGHIJKLMNOPQRSTUWXYZ\"\n r = rand 0..24\n return letters[r]\nend",
"def fuzz_str()\n\t\treturn Rex::Text.rand_text_alphanumeric(rand(1024))\n\tend",
"def random_big_string offset = rand(1..500)\n generate_string(25000 + offset)\n end",
"def randstr\n\trand(36 ** 8).to_s(36)\nend",
"def get_random\n File.read(\"/dev/urandom\", 8).unpack(\"H*\")[0].hex\n rescue\n rand(9117854927)\n end",
"def generateRandomString ()\n return SecureRandom.hex(4)\nend",
"def random_string\n\t# generate a bucket of chars for randomization\n\tbucket = [('a'..'z'),('A'..'Z'),(0..9)].map{|i| i.to_a}.flatten\n\t # pick random chars from the bucket and return a 255 char string\n\treturn (0...255).map{ bucket[rand(bucket.length)] }.join\nend",
"def get_rand\n rand = \"\";\n File.open(\"/dev/urandom\").read(20).each_byte{|x| rand << sprintf(\"%02x\",x)}\n rand\nend",
"def get_random_string\r\n length=30\r\n source=(\"a\"..\"z\").to_a + (\"A\"..\"Z\").to_a + (0..9).to_a + [\"_\",\"-\"]\r\n key=\"\"\r\n length.times{ key += source[rand(source.size)].to_s }\r\n return key\r\nend",
"def rand_string(length = 10)\r\n rand(36**length).to_s(36)\r\n end",
"def random_string\n (0...100).map { (\"a\"..\"z\").to_a[rand(26)] }.join\n end",
"def random_string\n (0...100).map { (\"a\"..\"z\").to_a[rand(26)] }.join\n end",
"def random\n chars[rand(chars.length)].dup\n end",
"def random_string\n letters = [['!','\"','$','&',';','@'],\n ('a'..'z').to_a,\n ('A'..'Z').to_a,\n ('0'..'9').to_a].flatten\n (1..16).map { |i| letters[ rand(letters.length) ] }.join\n end",
"def random_token\n 32.times.map{ rand(36).to_s(36) }.join # 32 alphanumeric characters\n end",
"def random_string\n (0...8).map { (65 + rand(26)).chr }.join\n end",
"def rand_string(length = 10)\n rand(36**length).to_s(36)\n end",
"def rand_string(length = 10)\n\t\trand(36**length).to_s(36)\n\tend",
"def random_name\n SecureRandom.hex(20)\n end",
"def random_string(length)\n rand(36**length).to_s(36)\n end",
"def rand_token\n\t\ttok = rand(36**8).to_s(36)\n\t\tif tok.length < 8\n\t\t\trand_token\n\t\telse\n\t\t\ttok\n\t\tend\n\tend",
"def rand_text(length, bad=payload_badchars)\n if debugging?\n rand_text_debug(length)\n else\n Rex::Text.rand_text(length, bad)\n end\n end",
"def get_random_identifier\n SecureRandom.hex\n end",
"def randomString\r\n\t(0...8).map{(65+rand(26)).chr}.join\r\nend",
"def generate_random_id\n len = 8\n chars = (\"a\"..\"z\").to_a + (\"A\"..\"Z\").to_a + (\"0\"..\"9\").to_a\n newpass = \"\"\n 1.upto(len) { |i| newpass << chars[rand(chars.size-1)] }\n return newpass\n end",
"def friendly_token\n SecureRandom.base64(32).tr('+/=lIO0', 'pqrsxyz')\n end",
"def get_random_number()\n rand(0x7fffffff).to_s\nend",
"def get_random_string(length=8)\n string = \"\"\n chars = (\"a\"..\"z\").to_a\n length.times do\n string << chars[rand(chars.length-1)]\n end\n return string\n end",
"def random_token\n SecureRandom.hex(20)\n end",
"def generate_string\n (0...6).map{(65+rand(26)).chr}.join\n end",
"def generate_random_string(size = 64)\r\n charset = [('a'..'z'),('A'..'Z'),('0'..'9')].map{|i| i.to_a}.flatten; \r\n (0...size).map{ charset.to_a[rand(charset.size)] }.join\r\nend",
"def generatePlayerToken\n\t\to = [('a'..'z'), ('A'..'Z')].map { |i| i.to_a }.flatten\n\t\tstring = (0...50).map { o[rand(o.length)] }.join\n\t\treturn string\n\tend",
"def random_id\n \"#{('a'..'z').to_a.sample}-#{SecureRandom.alphanumeric(6)}\"\n end",
"def generate_random_string(length=8)\n chars = 'abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ'\n string = ''\n length.times { string << chars[rand(chars.size)] }\n return string\nend",
"def identifier\n SecureRandom.hex(16)\n end",
"def randHashtag()\n (0...10).map{ ('a'..'z').to_a[rand(26)] }.join\nend",
"def random_token\n SecureRandom.urlsafe_base64\n end",
"def rand_token length=36\r\n\ttoken = ''\r\n\tlength.times do\r\n\t\ttoken += (random(0, 2)==1) ? (random(0,10).to_s) : (rand_let())\r\n\tend\r\n\ttoken\r\nend",
"def rand_key\n return JString.new\n end",
"def getSomeCoolName\n\t\tnames = File.open(\"NazwyKonferencji\").read.split(\"\\n\")\n\t\tnames[rand(names.size)]\n\tend",
"def random_character\n Random.rand(32...127).chr\nend",
"def generate_token\n UUIDTools::UUID.random_create.to_s\n end",
"def rand_byte!\n i = SecureRandom.random_number(size)\n rv = self[i,1]\n self[i,1] = ''\n rv\n end",
"def generateCode()\n require 'securerandom'\n return SecureRandom.hex\n end",
"def random_str()\n p (0...5).map { (65 + rand(26)).chr }.join\nend",
"def new_uuid\n uuid_arr = []\n ('a'..'f').each {|char| uuid_arr << char}\n (0..9).each {|num| uuid_arr << num.to_s}\n\n uuid = \" \"\n uuid_arr.sample\n\nend",
"def random_ascii\n print send(all_giraffes[rand(all_giraffes.length)])\n end",
"def randomString\n o = [('a'..'z'),('A'..'Z'),(0..9)].map{|i| i.to_a}.flatten \n string = (1..ROOM_NAME_LENGTH).map{ o[rand(o.length)] }.join\n end",
"def randStr()\n str = \"\"\n 5.times { str << (65 + rand(26)).chr }\n return str\nend",
"def random_alias\n 12.times.map { (SecureRandom.random_number(26) + 97).chr }.join\n end",
"def rand_text_hex(length, bad=payload_badchars)\n if debugging?\n rand_text_debug(length, '0')\n else\n Rex::Text.rand_text_hex(length, bad)\n end\n end",
"def uuid\n chars = ('a'..'z').to_a + (1..9).to_a\n p \"#{chars.sample(8).join}-#{chars.sample(4).join}-#{chars.sample(4).join}-#{chars.sample(4).join}-#{chars.sample(12).join}\" \n \nend",
"def rand_string(client)\n str = \"\"\n\n # Generates a random english word of length 4-6 alphabets\n while str.length < 4 or str.length > 6\n str = 1.word\n end\n\n # Asking for cipher from EaaS\n client.puts \"\\n************************************************\\n\"\n client.puts \"Your random string is - #{str}\"\n client.puts \"Enter your ciphertext -\"\n cipher = client.gets.chomp\n\n # Taking comment input\n client.puts \"Enter a comment -\"\n comment = client.gets.chomp\n\n # Generation of hash to return\n return_obj = {};\n return_obj['type'] = \"cipher\"\n return_obj['plain'] = str\n return_obj['cipher'] = cipher\n return_obj['comment'] = comment\n\n return return_obj\n end",
"def random_word(length = 5)\r\n rand(36**length).to_s(36)\r\nend",
"def random_string(size=25)\n (1..size).collect { (i = Kernel.rand(62); i += ((i < 10) ? 48 : ((i < 36) ? 55 : 61 ))).chr }.join\n end",
"def secure_random\n OpenSSL::Random.random_bytes(32).unpack(\"H*\")[0]\n end",
"def generate_random_token\n SecureRandom.hex(15)\n end",
"def random_uri\r\n\t\t\"/\" + Rex::Text.rand_text_alphanumeric(rand(10) + 6)\r\n\tend",
"def random_id(length=1)\n\t\tchars = ('A'..'Z').to_a + ('a'..'z').to_a + ('1'..'9').to_a - %w[I i l L O o 0 U u V v B 8]\n\t\tresult = ''\n\t\tlength.times { result << chars.sample }\n\t\tresult \n\tend",
"def random_string(length)\n random_chars(length).join\n end",
"def generate_accessCode\n return ((0..9).to_a + (\"a\"..\"z\").to_a).shuffle[0..5].join(\"\")\n end",
"def getWord\n return RandomWord.adjs.next\nend",
"def read_random_fragment(size)\n start = rand(@random_string.size/2)\n result = @random_string[start, size]\n if @encoding == 'ascii'\n result.force_encoding(Encoding::ASCII_8BIT)\n else\n result.force_encoding(Encoding::UTF_8)\n end\n end",
"def get_next_uuid\n rand(8**32).to_s(36)\n end",
"def short_uuid\n rand(36**8).to_s(36)\n end",
"def to_s\n return \"This is a random text generator!\"\n end",
"def random_chars(length = 64)\n return rand(36**length).to_s(36)\nend",
"def random_word(length = 5)\n rand(36**length).to_s(36)\nend",
"def random_word(length = 5)\n rand(36**length).to_s(36)\nend",
"def random_word(length = 5)\n rand(36**length).to_s(36)\nend",
"def random_word(length = 5)\n rand(36**length).to_s(36)\nend",
"def random_string size \n (0..size).map { ('a'..'z').to_a[rand(26)] }.join\n end",
"def poor_random\n (0...16).map { rand(97..122).chr }.join\n end",
"def tingyun_externel_guid\n guid = ''\n 16.times do\n guid << (0..15).map{|i| i.to_s(16)}[rand(16)]\n end\n guid\n end",
"def generate_password\r\n return rand(36 ** 20).to_s(36)\r\n end",
"def rand_char\n self[Kernel.rand(length), 1]\n end",
"def generate_random_token\n #generates a random hex string of length 5\n unless self.random_token\n self.random_token = SecureRandom.hex(5)\n end\n end",
"def generate_secret\n rand(36**secret_length).to_s(36)\n end",
"def gen_random_hex(len)\n (1..len).inject(\"\"){|str| str += rand(16).to_s(16)}\nend",
"def random_bytes(bytes); OpenSSL::Random.random_bytes(bytes) end",
"def random_new_password\n if self.random_password_length == 0\n nil\n else\n new_password = String.new\n for i in 0 .. self.random_password_length\n new_password += self.random_password_contains_of.scan(/./).sort_by {rand}.first\n end\n new_password\n end\n end",
"def random_key\n (0...10).map { ('a'..'z').to_a[rand(26)] }.join\n end",
"def random_username\n # \"batterypop-#{(rand * 10000).to_i}\"\n \"batterypop-#{Time.now.to_i}\"\n end",
"def generate_string(size)\n charset = [('a'..'z'),('A'..'Z'),(0..9)].map { |i| i.to_a }.flatten\n return (0...size).map{ charset[rand(charset.length)] }.join\n end",
"def random_word\n @words.fetch(rand(@words.length)).chomp\n end",
"def random_nick() (0..8).map { rand(65..90).chr }.join'' end",
"def generate(len = 5)\n @str = ''\n \n len.times do\n i = rand(@@CHARS.size)\n @str += @@CHARS[i]\n end\n \n @str\n end",
"def get_random()\n # generating random number within size\n r_n = rand(@hh.size)\n key = @hh.keys[r_n]\n return @hh[key]\n end",
"def generate_secure_token_string\n SecureRandom.urlsafe_base64(25).tr('lIO0', 'sxyz')\n end",
"def random_token length = 5\n token = \"\"\n alphabets = \"abcdefghijklmnopqrstuvwxyz\"\n 1.upto(length) do |i|\n idx = rand(alphabets.length)\n token += alphabets[idx..idx]\n end\n return token\nend",
"def rand_pass(length=8)\n return rand(36**length).to_s(36)\nend",
"def generate_token\n SecureRandom.hex(10)\n end",
"def generate\n @password = (1..@length).map { (33 + rand(89)).chr }.join \n check_password_contents\n @password\n end",
"def generate_token\n loop do\n token = SecureRandom.base64(44).tr(\"+/=\", \"xyz\").first(16).upcase\n break token unless self.class.where(:token => token).first\n end\n end",
"def rand_id\n rand(10**7...10**8).to_s\n end",
"def random_string(len)\n rand_max = RAND_CHARS.size\n ret = \"\" \n len.times{ ret << RAND_CHARS[rand(rand_max)] }\n ret \n end",
"def get_random()\n \n end",
"def get_random()\n \n end",
"def random_match()\n @matches[rand(@matches.length)]\n end"
] |
[
"0.7544916",
"0.73620236",
"0.7191349",
"0.7144324",
"0.7065664",
"0.7028334",
"0.699179",
"0.6988207",
"0.6811577",
"0.6730084",
"0.66825986",
"0.6657708",
"0.6652681",
"0.6652681",
"0.66451055",
"0.66008985",
"0.66001916",
"0.6596531",
"0.6579768",
"0.6575298",
"0.65722847",
"0.6534307",
"0.6527576",
"0.65251577",
"0.6487338",
"0.64665866",
"0.6465488",
"0.6450977",
"0.64453757",
"0.64392555",
"0.63790506",
"0.633025",
"0.6316953",
"0.6304663",
"0.62891036",
"0.62885356",
"0.62882805",
"0.62858874",
"0.62747777",
"0.62715954",
"0.62692803",
"0.6265664",
"0.6253531",
"0.6248638",
"0.624033",
"0.62326616",
"0.6224542",
"0.62240225",
"0.6220627",
"0.6212527",
"0.62122345",
"0.61890477",
"0.6185828",
"0.61827564",
"0.61772895",
"0.61768466",
"0.6165708",
"0.61643505",
"0.6161827",
"0.61553365",
"0.61462533",
"0.61445993",
"0.613273",
"0.6132269",
"0.61311257",
"0.6130279",
"0.61231434",
"0.61167556",
"0.6116515",
"0.6113037",
"0.6113037",
"0.6113037",
"0.6113037",
"0.61128104",
"0.6112055",
"0.6104864",
"0.6104671",
"0.6104526",
"0.60960376",
"0.6081626",
"0.60715395",
"0.6064109",
"0.6063568",
"0.6063307",
"0.606243",
"0.60622483",
"0.606011",
"0.60596913",
"0.60554975",
"0.605528",
"0.6052492",
"0.605071",
"0.6048694",
"0.60486937",
"0.60447556",
"0.60407764",
"0.6033015",
"0.6027177",
"0.6022296",
"0.6022296",
"0.6020459"
] |
0.0
|
-1
|
Fetches last mentions from Twitter and returns an array of strings
|
def last_mentions
return @mouth.last_mentioned
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def mentions(twitter, options = {})\n if last_id = last_id(:mentions)\n options[:since_id] = last_id\n end\n mentions = twitter.mentions(options)\n last_id(:mentions, mentions.first.id) unless mentions.empty?\n mentions\nend",
"def fetch_mentions_timeline\n statuses = @twitter_account.client.mentions_timeline(count: 100)\n TweetMaker.many_from_twitter(statuses,\n project: @twitter_account.project,\n twitter_account: @twitter_account,\n state: :incoming)\n end",
"def get_mentions\n # If mentions has already fetched before than only fetch recent mentions\n recent_mentions = mentions.present? ? twitter_client.mentions_timeline(since_id: mentions.last.tweet_id) : twitter_client.mentions_timeline\n recent_mentions.collect do |tweet|\n mention = mentions.find_or_create_by(tweet_id: tweet.id)\n mention.assign_attributes({text: tweet.text,\n tweeted_at: tweet.created_at,\n tweet_user_id: tweet.user.id,\n tweet_user_name: tweet.user.screen_name,\n tweet_user_image: tweet.user.profile_image_url})\n mention.save\n end\n mentions\n end",
"def get_mentions(tweet)\n list = []\n tweet.user_mentions.each { |mention| list << mention.screen_name.downcase } if tweet.user_mentions?\n list\n end",
"def fetch_mentions_timeline\n statuses = client.mentions_timeline(mentions_timeline_options)\n tweets = TweetMaker.many_from_twitter(statuses, project: project, twitter_account: self, state: :incoming)\n update_max_mentions_timeline_twitter_id(tweets.map(&:twitter_id).max)\n tweets\n # If there's an error, just skip execution\n rescue Twitter::Error\n false\n end",
"def last_tweet\r\n\t\tresult = @client.search(@twitter_search_keyword)\r\n\t\tresult.first.full_text\r\n\tend",
"def ego_net_retweets\n retweets = []\n self.retweet_ids.each do |retweet| \n begin\n if Person.find_by_username(retweet[:person]).friends_ids.include?(self.person.twitter_id) \n retweets << retweet\n end\n rescue\n end \n end\n return retweets\n end",
"def last_tweet\n tweets.order(\"updated_at desc\").first unless (tweets.nil? || tweets.size == 0)\n end",
"def latest_tweets(k=5)\n\n # Get the tweets\n response = make_response(\"statuses\",\"user_timeline\")\n timeline = JSON.parse(response.body)\n tweets = timeline[0..k-1]\n\nend",
"def user_tweets(user, count=10, since_id=nil, max_id=nil)\n print \"Getting Last %d Statuses for User %s\" % [count, user.to_s]\n print \" since %s\" % since_id if since_id\n print \" until %s\" % max_id if max_id\n print \"\\n\"\n options = {:count => count, :trim_user => true, :include_rts => true, :include_entities => true}\n options[:since_id] = since_id if since_id\n options[:max_id] = max_id if max_id\n begin\n statuses = @MT.user_timeline(user, options)\n if statuses.size > 0\n status_data = statuses.map do |s|\n {\n :user_id => s.user.id,\n :created_at => s.created_at,\n :id => s.id,\n :text => s.text,\n :source => s.source,\n :truncated => s[\"truncated\"],\n :in_reply_to_user_id => s[\"in_reply_to_user_id\"],\n :in_reply_to_screen_name => s[\"in_reply_to_screen_name\"],\n :geo => s[\"geo\"],\n :coordinates => s[\"coordinates\"],\n :place => parse_place(s[\"place\"]),\n :contributors => s[\"contributors\"],\n :retweet_count => s[\"retweet_count\"],\n :entities => parse_entities(s.attrs[\"entities\"]),\n :retweeted_status => parse_retweeted_status(s[\"retweeted_status\"])\n }\n end\n status_data\n else\n []\n end\n rescue Twitter::Error::Unauthorized, Twitter::Error::Forbidden\n puts \"Failed for %s (Protected)\" % user.to_s\n []\n end\n end",
"def timeline\n tweets = []\n following.merge(my_info).each do |nick,url|\n tweets.concat timeline_for_user(nick,url)\n end\n tweeets = tweets[-timeline_limit, timeline_limit].sort_by { |h| h[:date] }\n (timeline_sort == 'descending') ? tweets.reverse : tweets\nend",
"def mentions(options={})\n perform_get(\"statuses/mentions.#{Twitter.format}\", options)\n end",
"def poll_timeline\n opts = @last_id ? { :since_id => @last_id } : {}\n tl = @twitter.friends_timeline( opts )\n if tl.any?\n if @last_id.nil?\n @last_id = tl[ 0 ].id.to_i\n else\n tl.reverse!\n tl.reverse_each do |tweet|\n say_tweet tweet\n end\n end\n end\n rescue Exception => e\n $stderr.puts \"Twitter exception: #{e.message}\"\n # $stderr.puts e.backtrace.join( \"\\t\\n\" )\n end",
"def get_tweets(screen_name, num_tweets)\n\t\n\tresult = \"\"\n #Query num_tweets tweets from screen_name and create the HTML\n Twitter.user_timeline(screen_name, {\"count\" => num_tweets}).each do |tweet|\n \tlinkified = linkifyTweet(tweet.text)\n \tresult = result + \"<li class=\\\"tweet\\\">\n <span class=\\\"gentle\\\">#{linkified}</span>\n </li>\"\n end\n return result\nend",
"def retweet search_for\n\t\tlast_verified = File.open 'last_verified', 'r+'\n\t\tlast_id = last_verified.read.gsub(\"\\000\", '')\n\t\tlast_id = 0 if last_id.empty?\n\t\tsearch_terms = search_for.join ' OR '\n\t\ttweets = Twitter::Search.new.containing(search_terms).since_id(last_id).not_from(@account[:name]).not_from('StrikeRH1').fetch.collect do |t|\n\t\t\tt.id unless t.text[0,1] == '@'\n\t\tend.compact\n\n\t\tif tweets.length > 0\n\t\t\ttwitter = get_twitter_client\n\t\t\ttweets.each do |id|\n\t\t\t\tbegin\n\t\t\t\t\ttwitter.retweet id\n\t\t\t\trescue Twitter::Forbidden\n\t\t\t\tend\n\t\t\tend\n\t\t\tlast_verified.truncate 0\n\t\t\tlast_verified.write tweets[0]\n\t\tend\n end",
"def list_tweets\n tweets\n end",
"def mentions_timeline(count, max_id, since_id, reply_depth)\n\n options = {\n :timeline_kind => :mentions,\n :count => count\n }\n self.append_official_card_parameters(options)\n options[:max_id ] = max_id if max_id\n options[:since_id] = since_id if since_id\n\n followers = self.followers()\n timeline = Tw::Timeline.compose(\n @requester,\n followers,\n reply_depth,\n options)\n tweetArray = timeline.perform()\n\n return tweetArray\n end",
"def fetch_full_user_timeline(screen_name, options={})\n opts = HashWithIndifferentAccess.new(options)\n opts[:max_id] ||= MAX_TWEET_ID\n opts[:since_id] ||= 1\n retries = opts.delete(:retry) == false ? 0 : 6\n be_verbose = opts.delete(:verbose) == false ? false : true\n all_tweets = []\n while opts[:max_id] > opts[:since_id]\n puts \"Tweets collected: #{all_tweets.count}; max_id: #{opts[:max_id]}\" if be_verbose\n begin\n tweets = fetch_user_timeline(screen_name, opts).collect(&:to_h)\n rescue Twitter::Error::TooManyRequests => err\n if retries > 0\n retries -= 1\n if retries > 3\n sleep_time = 20\n else\n sleep_time = err.rate_limit.reset_in + 1\n end\n puts \"Error: #{err}\", \"Sleeping for #{sleep_time}\" if be_verbose\n sleep sleep_time\n else\n raise err\n end\n rescue => err\n if TWITTER_500_ERRORS.include?(err.class) && retries > 0\n retries -= 1\n # sleep for two minutes\n sleep_time = 120\n puts \"Error: #{err}\", \"Sleeping for #{sleep_time}\" if be_verbose\n sleep sleep_time\n retry\n else\n raise err\n end\n else\n if( t = tweets.last )\n all_tweets.concat tweets\n opts[:max_id] = t[:id] - 1\n else\n opts[:max_id] = 0 # this will break the loop\n end\n end\n end\n\n return all_tweets\n end",
"def mentions( since_id = nil, max_id = nil , count = nil, page = nil )\n\t\tparams = (\n\t\t\t{ :since_id => since_id, :max_id => max_id, :count => count, :page => page }.collect { |n| \"#{n[0]}=#{n[1]}\" if n[1] }\n\t\t).compact.join('&')\n\t\tresponse = access_token.get('/statuses/mentions.json' + ( params.empty? ? '' : '?' + params ) )\n\t\tcase response\n\t\twhen Net::HTTPSuccess\n\t\t\tmessages=JSON.parse(response.body)\n\t\t\traise TwitterOauth::UnexpectedResponse unless messages.is_a? Array\n\t\t\tmessages\n\t\telse\n\t\t\traise TwitterOauth::APIError\n\t\tend\n\trescue => err\n\t\tputs \"Exception in mentions: #{err}\"\n\t\traise err\n\tend",
"def last(m)\n\t\tnick = m.message.split(/\\W/)[2]\n\t\tuser = @users[nick]\n\t\tif Mailbox.exists? nick\n\t\t m.reply \"Last saw #{nick} [ #{\"%.2f\" % ((Time.now - user.last_seen) / 60 / 60)} hrs | #{user.missed_lines} lines ] ago\"\n\t end\n end",
"def mention_tweets\n logger.debug { \"#{__method__} is called twitter_user_id=#{id}\" }\n tweets = []\n tweets = InMemory::MentionTweet.find_by(uid) if InMemory.enabled? && InMemory.cache_alive?(created_at)\n tweets = Efs::MentionTweet.where(uid: uid) if tweets.blank? && Efs::Tweet.cache_alive?(created_at)\n tweets = ::S3::MentionTweet.where(uid: uid) if tweets.blank?\n tweets.map { |tweet| ::TwitterDB::Mention.new(uid: uid, screen_name: screen_name, raw_attrs_text: tweet.raw_attrs_text) }\n end",
"def mentions( since_id = nil, max_id = nil , count = nil, page = nil )\n self.twitagent.mentions( since_id, max_id, count, page )\n rescue => err\n RAILS_DEFAULT_LOGGER.error \"Failed to get mentions via OAuth for #{current_user.inspect}\"\n flash[:error] = \"Twitter API failure (getting mentions)\"\n return\n end",
"def timeline\n timeline = tweets.map { |tweet| tweet }\n all_following.each do |user|\n timeline += user.tweets.map { |tweet| tweet }\n end\n timeline.sort_by!(&:created_at).reverse\n end",
"def mentions( since_id = nil, max_id = nil , count = nil, page = nil )\n\t\tself.twitagent.mentions( since_id, max_id, count, page )\n\trescue => err\n\t\tRAILS_DEFAULT_LOGGER.error \"Failed to get mentions via OAuth for #{current_user.inspect}\"\n\t\tflash[:error] = \"Twitter API failure (getting mentions)\"\n\t\treturn\n\tend",
"def fetch_latest_tweets(last_id = self.tweets ? self.tweets.maximum(:twitter_id) : nil)\n options = { count: 4, include_rts: true }\n options[:since_id] = last_id if last_id\n begin\n response = twitter_connection.user_timeline(options)\n response.each do |tw_tweet|\n tweet = Tweet.find_or_initialize_by(twitter_id: tw_tweet.id)\n tweet.retweet_count = tw_tweet.retweet_count\n tweet.favorite_count = tw_tweet.favorite_count\n tweet.tweet_created_at = tw_tweet.created_at\n tweet.url = tw_tweet.url.to_s\n tweet.full_text = tw_tweet.full_text\n tweet.twitter_account_id = self.id\n tweet.save\n end\n fetch_latest_tweets( response.last.id ) if(response.last and (response.last.id != last_id))\n rescue => e\n ExceptionNotifier.notify_exception(e, {options: options.inspect, last_id: last_id.inspect})\n raise e.exception if Rails.env.development?\n end\n return true\n end",
"def load_old_tweet\n #setup twitter client\n client = Twitter::REST::Client.new do |config|\n config.consumer_key = $consumer_key\n config.consumer_secret = $consumer_secret\n config.access_token = $access_token\n config.access_token_secret = $access_token_secret\n end\n\n #replace t.co link with didmichiganstatewin.com so the comparison will work\n return client.user_timeline(\"didmsuwin\").first.text.split('http').first + \"didmichiganstatewin.com\"\nend",
"def fetch_user_timeline\n statuses = client.user_timeline(user_timeline_options)\n tweets = TweetMaker.many_from_twitter(statuses, project: project, twitter_account: self, state: :posted)\n update_max_user_timeline_twitter_id(tweets.map(&:twitter_id).max)\n tweets\n # If there's an error, just skip execution\n rescue Twitter::Error\n false\n end",
"def mentions\n result_hash['mention']\n end",
"def fetch_timeline(screen_name)\n return [] if screen_name.to_s.empty?\n @requests += 1\n timeline = client.user_timeline(screen_name, tweet_mode: 'extended', count: 200)\n return timeline if timeline.empty?\n timeline = fetch_older_tweets(timeline, screen_name)\n puts \"Fetched #{screen_name}'s timeline\"\n timeline\n end",
"def fetch_user_timeline(n=200)\n tweets.destroy_all if n == 200\n statuses = Twitter.user_timeline(screen_name, count: n)\n Tweet.many_from_twitter(statuses)\n end",
"def get_latest_tweets(num_of_tweets)\n client = configure_authentication\n latest = client.home_timeline({:count => num_of_tweets})\n client.end_session\n info = latest.to_json\n end",
"def user_names_who_retweeted(status)\n\t\treturn nil unless status.retweet_count.positive?\n\t\turl = \"https://twitter.com/i/activity/retweeted_popup?id=#{status.id}\"\n\t\toriginal_tweeter = status&.retweeted_status&.user&.screen_name\n\t\tnames_to_reject = [original_tweeter, @config[\"Username\"]].freeze\n\t\tnames = HTTP.get(url).body.to_s.scan(/data-screen-name=\\\\\"(.*?)\\\\\"/).flatten.uniq.compact - names_to_reject\n\t\treturn nil if names.none?\n\t\t\"Retweeted: #{names.map { |s| \"@#{s}\" }.join(', ')}\"\n\tend",
"def get_tweets(*args)\n return self.tweets.to_a if args.size > 1 || args.size < 1\n return self.tweets.take(args[0]).to_a\n end",
"def feed_tweets(max_tweets = nil, latest_date = nil )\n @tweets = Tweet.joins(:user)\n .joins(\"LEFT OUTER JOIN follows ON users.id = follows.followee_id\")\n .where(\"tweets.user_id = :id OR follows.follower_id = :id\", id: self.id)\n .order(\"tweets.created_at DESC\")\n .uniq\n #debugger\n\n @tweets = @tweets.limit(max_tweets) if max_tweets\n @tweets = @tweets.where(\"tweets.created_at < ?\", latest_date)\n\n @tweets\n end",
"def get_tweets(handle)\n\t\tarray = []\n\n\t\tbegin\n\t\t\t# Pull tweets and arrange as an array for caching and use in the front end\n\t\t\t@@twitter_client.search(\"from:#{handle}\", result_type: \"recent\").take(25).each do |t|\n\n\t\t\t\tcontent = t.text.dup\n\n\t\t\t\t# Linkify the handles by replacing them with links\n\t\t\t\thandles = content.scan(/@([a-z0-9_]+)/i).flatten\n\t\t\t\thandles.each do |h|\n\t\t\t\t\tcontent.gsub!(h, \"<a href='http://twitter.com/#{h}'>#{h}</a>\")\n\t\t\t\tend\n\n\t\t\t\tarray << [t.created_at, content]\n\n\t\t\tend\n\n\t\t# Rate limiting and other errors should be displayed\n\t\trescue Twitter::Error => error\n\t\t\tflash[:error] = error\n\t\tend\n\n\t\t# Return the array of tweets and dates\n\t\tarray\n\tend",
"def get_home_timeline_tweets\n\n begin\n if @last_tweet_id\n response = ::Twitter.home_timeline(:since_id => @last_tweet_id)\n else\n response = ::Twitter.home_timeline(:count => 3)\n end\n rescue => exc\n return exc\n end\n\n response || []\n\n end",
"def retrieve_tweets_by_hashtags(hashtags, limit=nil)\n return Array.new if hashtags.empty?\n limit.nil? ? tweets = hashtags.first.get_tweets : tweets = hashtags.first.get_tweets(limit)\n if hashtags.size > 1\n hashtags.each_with_index do |el, index|\n next if index == 0\n tweets.delete_if {|tweet| !tweet.get_hashtags.include?(el)}\n end\n end\n return tweets\n end",
"def get_twitter_friend_names(username)\n client = get_twitter_client\n\n # Fetch friend IDS\n friend_ids = handle_rate_limit do\n client.friend_ids(username).to_a\n end\n\n # Fetch friend data\n friends = handle_rate_limit do\n client.users(friend_ids).to_a\n end\n\n # Extract the friend names\n friendnames = []\n friends.each do |f|\n friendnames << f.screen_name\n end\n return friendnames\n end",
"def mentions(params = {})\n get \"statuses/mentions\", params\n end",
"def show\n set_up_twitter\n\n get_last_tweet\n get_five_last_tweets\n end",
"def twitter_url\n\t\ttwitter = []\n\t\ttext = html.search(\"a\").text.split(\" \")\n\t\ttext.each do |element|\n\t\t\tif element.to_s.match(/@/)\n\t\t\t\ttwitter << element\n\t\t\tend\n\t\tend\n\t\t\treturn twitter\n\tend",
"def next_public_timeline\n #If this is not the first call of this method, the 'since_id'\n #parameter will be used to fetch entries from that position on.\n param_str = @last_id ? \"?since_id=#{@last_id}\" : \"\"\n doc = REXML::Document.new open(\"http://twitter.com/statuses/public_timeline.xml#{param_str}\").read\n statuses = []\n doc.elements.each(\"/statuses/status\") do |status| \n user = status.elements['user']\n location = user.elements['location'].text || \"unknown\"\n time = Time.parse(status.elements['created_at'].text).strftime(\"%Y%m%d%H%M%S\")\n statuses << {:id => status.elements['id'].text, \n :text => status.elements['text'].text, \n :username => user.elements['name'].text,\n :userid => user.elements['id'].text,\n :time => time,\n :location => location}\n end\n statuses\n end",
"def get_last_users_parsed\n return @last_parsed_userlist_data\n end",
"def collect_tweets\n result = []\n begin\n @hashtags.each do |hashtag|\n result.push search(hashtag)\n end\n\n store_last_id calculate_last_id result\n filter_tweets_with_urls result\n\n rescue EOFError, SocketError, Twitter::Error::ClientError\n @logger.error \"Connection to Twitter seems to be not available.\"\n return nil\n end\n end",
"def get_list_timeline_tweets(user_screen_name, list_slug)\n\n begin\n if @last_tweet_id\n response = ::Twitter.list_timeline(user_screen_name, list_slug, :since_id => @last_tweet_id)\n else\n response = ::Twitter.list_timeline(user_screen_name, list_slug, :page => 1, :per_page => 3)\n end\n\n rescue => exc\n return exc\n end\n\n response || []\n\n end",
"def index\n @users = User.all\n\n set_up_twitter\n\n @users.each do |user|\n tweets = @client.user_timeline(user.twitter_id, count: 5)\n user.last_tweet = tweets.first.full_text\n end\n end",
"def get_search_timeline_tweets(search_term)\n\n begin\n if @last_tweet_id\n response = ::Twitter.search(search_term, :since_id => @last_tweet_id)\n else\n response = ::Twitter.search(search_term, :result_type => \"recent\", :rpp => 3, :page => 1)\n end\n\n rescue => exc\n return exc\n end\n\n response || []\n\n end",
"def messages\r\n # if messages_updated > 30.min\r\n #url = \"http://twitter.com/statuses/user_timeline/#{username}.xml\" # 'statuses/status'\r\n \r\n if picture_id.nil?\r\n # has only username - retrive other user information\r\n logger.debug \"LOCAL ID NIL\"\r\n begin\r\n doc = REXML::Document.new(open(\"http://twitter.com/users/show/#{username}.xml\"))\r\n end\r\n doc.elements.each('user') do |e|\r\n #local_id = e.elements['id'].text\r\n #logger.debug \"LOCAL ID NOW: #{local_id}\"\r\n #name = e.elements['name'].text\r\n pic = Picture.from_url(e.elements[\"profile_image_url\"].text)\r\n pic_id = pic.id\r\n update_attributes(:local_id => e.elements['id'].text, :name => e.elements['name'].text, :picture_id => pic_id)\r\n end\r\n end\r\n \r\n # retrive messages:\r\n msgs = []\r\n if messages_updated.nil? or Time.now - messages_updated > 60.minutes\r\n # retrive from twitter\r\n logger.debug \"retrieving messages from twitter.\"\r\n url = \"http://twitter.com/statuses/user_timeline/#{username}.rss\"\r\n logger.debug(url)\r\n \r\n begin\r\n doc = REXML::Document.new(open(url)) # URI.encode( )\r\n rescue\r\n # unable to load from twitter, retrieve from local database\r\n logger.debug \"FAILED to retrieve from twitter\"\r\n return (msgs = Message.find_all_by_twitter_user_id(self.id)).nil? ? [] : msgs\r\n end\r\n doc.elements.each('rss/channel/item') do |s|\r\n local_id = s.elements[\"link\"].text.split('/')[-1].to_i\r\n text = s.elements[\"description\"].text[username.length+2..-1]\r\n created = Time.parse(s.elements[\"pubDate\"].text)\r\n msgs << Message.find_or_create_by_local_id( :local_id => local_id,\r\n :text => text, :twitter_user_id => self.id, :created_at => created)\r\n end\r\n update_attribute(:messages_updated, Time.now)\r\n #msgs = \"hakee\"\r\n else\r\n logger.debug \"retrieving messages from local database\"\r\n msgs = Message.find_all_by_twitter_user_id(self.id)\r\n end\r\n msgs.nil? ? [] : msgs\r\n end",
"def retrieve_tweet_ids\n imap = Net::IMAP.new('imap.gmail.com', 993, true, nil, false)\n imap.login(@account['credentials']['email_address'], @account['credentials']['email_password'])\n imap.select('INBOX')\n imap.search([\"NOT\",\"SEEN\"]).each do |message_id|\n msg = imap.fetch(message_id, 'RFC822')[0].attr['RFC822']\n # imap.store(message_id, '+FLAGS', [:Seen])\nputs msg\n end \n imap.logout()\n imap.disconnect()\n end",
"def retweets_of_me(options = {})\n @req.get(\"/1.1/statuses/retweets_of_me.json\", options)\n end",
"def get_twitter_status\n logger.info 'Getting twitter'\n begin\n c = Grackle::Client.new\n twitter = c.statuses.user_timeline?(:screen_name => 'paulcarlile', :count => 2)\n rescue Grackle::TwitterError\n twitter = Grackle::TwitterError\n end\n end",
"def user_timeline(query={})\n\t\t# La fonction user_timeline est disponible à partir de l'API REST mais pas à partir de l'API \"twitter\", j'ai refait la fonction à la main \n\t\tHTTParty.get('http://twitter.com/statuses/user_timeline.json', :query => query)\n end",
"def retweets_of_me_timeline(count, max_id, since_id, reply_depth)\n\n options = {\n :timeline_kind => :retweets_of_me,\n :count => count\n }\n self.append_official_card_parameters(options)\n options[:max_id ] = max_id if max_id\n options[:since_id] = since_id if since_id\n\n followers = self.followers()\n timeline = Tw::Timeline.compose(\n @requester,\n followers,\n reply_depth,\n options)\n tweetArray = timeline.perform()\n\n return tweetArray\n end",
"def new_tweets\n q = search.q(@search_term)\n q = q.since_id(@last_id) if @last_id\n tweets = q.fetch\n tweets.reverse!\n\n @last_id = tweets.last.id_str if tweets.last\n\n tweets\n end",
"def get_twitter_friend_ids\n friend_ids_path = \"/friends/ids?twitter_id=#{self.twitter_id}\"\n Rails.cache.fetch(friend_ids_path, :expires_in => 2.hours) { twitter.get(friend_ids_path) }\n end",
"def retweets_of_me(options={})\n perform_get(\"statuses/retweets_of_me.#{Twitter.format}\", options)\n end",
"def latest_tweets\n client = Twitter::REST::Client.new do |config|\n config.consumer_key = ENV[\"TWITTER_CONSUMER_KEY\"]\n config.consumer_secret = ENV[\"TWITTER_CONSUMER_SECRET\"]\n end\n\n count = params[:count] || 10\n time_line = client.user_timeline(current_user.twitter_handle, {count: count})\n current_user.update(time_fetched: current_user.time_fetched+1)\n if time_line.class == Twitter::Error::NotFound\n render json: {status: 400, success: false, message: 'Twitter handle or id not valid'}\n else\n render json: {status: 200, success: true, message: 'Success', data: time_line.map{|a| a.text}.as_json}\n end\n\n rescue => e\n Rails.logger.error \"account_controller#latest_tweets - Error: #{e.message}\"\n render json: {status: 500, success: false, message: 'Unexpected error'}\n end",
"def mentions\n @mentions ||= begin\n regex = /@([\\w]+)/\n body.scan(regex).flatten\n end\n end",
"def print_timeline(response)\n \n tweets = response[\"statuses\"]\n \n for tweet in tweets\n puts tweet[\"user\"][\"screen_name\"]\n puts tweet[\"text\"]\n end\n \nend",
"def tweet(str)\n arr = []\n scans = str.scan(/(@\\w+)|(#\\w+)/)\n scans.each do |x|\n x.each do |y|\n if y\n arr.push y\n end\n end\n end\n arr.join ' '\nend",
"def user_names_who_liked(id)\n\t\t(HTTP.get(\"https://twitter.com/i/activity/favorited_popup?id=#{id}\").body.to_s.scan(/data-screen-name=\\\\\"(.*?)\\\\\"/).flatten.uniq - [@config[\"Username\"]]).map { |s| \"@#{s}\" }.join(\", \")\n\tend",
"def display_twitter_presenters\n out = \"\"\n out = self.presenters.each do |p|\n out += (p.twitter_name.nil? ? p.display_name : p.twitter_name) + \", \"\n end\n out = out[0,out.length-2]\n end",
"def fetch\n infos = []\n client.search(url, query).take(limit).each do |result|\n response = Hashie::Mash.new(result.to_hash)\n infos << store_info(response)\n end \n infos.reject(&:blank?)\n #TODO: Exception need to handled\n rescue Twitter::Error\n Rails.logger.error(\"Twitter fetch throwing error check the connection\")\n end",
"def mentions\n @mentions ||= begin\n regex = /@([\\w]+\\s[\\w]+)/ \n body.scan(regex).flatten\n end\n end",
"def scrape_mentions\n return if self.object.nil?\n return unless !self.object.is_a?(Nelumba::Person) and\n self.object.respond_to?(:parse_mentions)\n authors = self.object.parse_mentions do |username, domain|\n i = Identity.first(:username => /^#{Regexp.escape(username)}$/i)\n i.person if i\n end\n authors ||= []\n self.mentions_ids = authors.compact.map(&:id)\n end",
"def on_mention(tweet)\n txt = tweet.text.split[1..-1].join(' ')\n response = MODEL.make_response(txt, 100)\n reply(tweet, response)\n end",
"def parse_users_mentions users, date_tweet\n\t\tusers_mentions = []\n\t\tusers.each do |item|\n\t\t\tu = User.find_or_create_by_user_id item[\"id\"]\n\t\t\tu.name = item[\"name\"]\n\n\t\t\tu.save\n\n\t\t\tusers_mentions << u\n\t\tend\n\t\t\tm = Momentum.new\n\t\t\tm.calculate_influences users_mentions, date_tweet\n\tend",
"def prepare_all_links(target)\n # here we get all replies to author of target message (7 days is the limit)\n all_links = Array.new\n # sometimes fails on twitter side, need to figure out why\n #req = \"http://search.twitter.com/search.atom?q=to:\" + target[:name] + \"&rpp=1000&since_id=\" + target[:sid]\n req = \"http://search.twitter.com/search.atom?q=to:\" + target[:name]\n begin\n open(req) do |f|\n f.each_line do |line|\n \t status_mention_matches = (/<link type=\"text\\/html\" rel=\"alternate\" href=\"(.*?)\"/).match(line)\n \t status_mention_link = status_mention_matches[1] unless status_mention_matches == nil\n \t unless status_mention_link == nil || (/^http:\\/\\/search.twitter.com/).match(status_mention_link) != nil\n \t all_links.push status_mention_link \n \t end\n \tend\n end\n rescue\n print \"Error while working with: \" + req + \"\\n\"\n all_links = nil\n end \n all_links\nend",
"def timeline\n twitter.home_timeline\n end",
"def feeds_with_top_tweets\n\n end",
"def fetch_tweets!\n Twitter.user_timeline(username).each do |tweet|\n unless Tweet.where(twitter_user_id: self.id).find_by_content(tweet.text) \n self.tweets << Tweet.create(content: tweet.text)\n end\n end\n end",
"def parse_twitter_api_response(tweets)\n tweets = tweets.map do |tweet|\n if tweet.attrs[:retweeted_status] then\n { created_at: tweet.created_at.getlocal.strftime(\"%l:%M%p - %b %e, %Y\"), name: tweet.user.name, body: \"Retweet: \" << CGI.unescapeHTML(tweet.attrs[:retweeted_status][:full_text]), avatar: tweet.user.profile_image_url_https, screen_name: \"@\" + tweet.user.screen_name}\n else\n { created_at: tweet.created_at.getlocal.strftime(\"%l:%M%p - %b %e, %Y\"), name: tweet.user.name, body: CGI.unescapeHTML(tweet.attrs[:full_text]), avatar: tweet.user.profile_image_url_https, screen_name: \"@\" + tweet.user.screen_name }\n end\n end\n\n return tweets\nend",
"def display_timeline\n timeline_search_results = []\n TWITTER.home_timeline.each do |tweet|\n timeline_search_results << [tweet.user.name, tweet.text]\n # binding.pry\n end\n timeline_search_results\n end",
"def convert_all_entities(tweet)\n log_debug { tweet.text }\n\n text = tweet.text\n\n entities = tweet.uris + tweet.user_mentions + tweet.hashtags + tweet.media\n entities.sort! {|a, b| b.indices[0] - a.indices[0] } # Reverse\n\n # Remove last entity that is a link to media or quoted Tweet or truncated.\n if entities[0] && entities[0].indices[1] == tweet.text.length\n last_entity = entities[0]\n if\n last_entity.respond_to?(:sizes) || # Responds to sizes means it is a media.\n (\n last_entity.is_a?(Twitter::Entity::URI) &&\n (tweet.truncated? || tweet.quoted_status?)\n )\n then\n log_debug { \"Last entity should be removed.\" }\n text = text[ 0 ... last_entity.indices[0] ]\n entities.shift\n end\n end\n\n # Remove all media entities from list.\n entities.delete_if {|e| e.respond_to? :sizes }\n\n if entities.any?\n log_debug { \"There are #{entities.length} entities.\" }\n\n entities.each_index do |i|\n entity = entities[i]\n previous_entity = entities[i - 1]\n next_entity = entities[i + 1]\n\n log_debug { \"#{i} #{entity.class} #{entity.indices}\" }\n\n text_before_entity = text[ 0 ... entity.indices[0] ]\n text_after_entity = text[ entity.indices[1] .. -1 ]\n\n log_debug { \"Text before entity: #{text_before_entity}\" }\n log_debug { \"Text after entity: #{text_after_entity}\" }\n\n if !previous_entity\n # Last entity in position.\n text_after_entity = h(text_after_entity)\n end\n\n if !next_entity\n # First entity in position.\n text_before_entity = h(text_before_entity)\n else\n # If there is next entity.\n text_between_next_and_current_entity = text_before_entity[ next_entity.indices[1] ... entity.indices[0] ]\n text_before_end_of_next_entity = text_before_entity[ 0 ... next_entity.indices[1] ]\n\n text_before_entity = text_before_end_of_next_entity + h(text_between_next_and_current_entity)\n end\n\n text = text_before_entity + convert_entity(entity) + text_after_entity\n\n log_debug { \"Text after converting this entity: #{text}\" }\n end\n else\n text = h(text)\n end\n\n return text\n end",
"def previous_tweets\n model.previous_tweets.sort_by(&:created_at)\n end",
"def user_tweets screen_name\n\t\tTwitter.user_timeline(screen_name.to_s)\n\tend",
"def getTweet(tweet,rt)\n\tflds=[]\n\n\trt_original_tweetID=nil\n\tif tweet[\"retweeted_status\"]\n\t\trt_original_tweetID=tweet[\"retweeted_status\"][\"id\"]\n\tend\n\n\ttweetID=tweet[\"id\"]\n\tflds << tweetID\n\tflds << tweet[\"user\"][\"id\"]\n\tif tweet[\"created_at\"]\n\t\tflds << tweet[\"created_at\"]\n\t\tdt=DateTime.parse(tweet[\"created_at\"])\n\t\tflds << dt.strftime(\"%Y%m%d\")\n\t\tflds << dt.strftime(\"%H%M%S\")\n\telse\n\t\tflds << nil\n\t\tflds << nil\n\t\tflds << nil\n\tend\n\tflds << rt\n\tflds << rt_original_tweetID\n\tif $orgText\n\t\tflds << tweet[\"text\"]\n\telse\n\t\tif tweet[\"text\"]\n\t\t\tflds << tweet[\"text\"].gsub(\"\\r\",\"\").gsub(\"\\n\",\"\")\n\t\telse\n\t\t\tflds << nil\n\t\tend\n\tend\n\tif tweet[\"source\"]\n\t\tflds << tweet[\"source\"].gsub(/<a.*?>/,\"\").gsub(/<\\/a.*?>/,\"\")\n\telse\n\t\tflds << nil\n\tend\n\tflds << tweet[\"truncated\"]\n\tflds << tweet[\"in_reply_to_status_id\"]\n\tflds << tweet[\"in_reply_to_user_id\"]\n\tflds << tweet[\"in_reply_to_screen_name\"]\n\tdat=tweet[\"coordinates\"]\n\tif dat\n\t\tflds << dat[0]\n\t\tflds << dat[1]\n\telse\n\t\tflds << nil\n\t\tflds << nil\n\tend\n\tflds << tweet[\"contributors\"]\n\n\t#dat=tweet[\"current_user_retweet\"]\n\t#if dat\n\t#\tflds << dat[\"id\"]\n\t#else\n\t#\tflds << nil\n\t#end\n\n\tflds << tweet[\"avorite_count\"]\n\tflds << tweet[\"favorited\"]\n\tflds << tweet[\"filter_level\"]\n\tflds << tweet[\"lang\"]\n#place\tPlaces\n\tflds << tweet[\"possibly_sensitive\"]\n#scopes\tObject\n\tflds << tweet[\"retweet_count\"]\n\tflds << tweet[\"retweeted\"]\n#\tflds << tweet[\"withheld_copyright\"]\n#withheld_in_countries\tArray of String\n#\tflds << tweet[\"withheld_scope\"]\n\n\n\treturn tweetID,flds\nend",
"def fetch_user_timeline(max_id=nil)\n options = { count: 200 }\n options[:max_id] = max_id if max_id.present?\n\n statuses = @twitter_account.client.user_timeline(options)\n TweetMaker.many_from_twitter(statuses,\n project: @twitter_account.project,\n twitter_account: @twitter_account,\n state: :posted)\n\n # Run loop if current request returned some results\n if statuses.present?\n # On Twitter API options:\n # max_id includes the tweet with id: max_id in the results (inclusive parameter),\n # while since_id is does not (exclusive parameter)\n #\n # Unless -1 would be deducted, the method would call itself indefinitely\n # as the last tweet would always be returned as a single tweet\n # In addition, min_id - 1 helps avoid fetching duplicate results\n current_min_id = statuses.map(&:id).min\n next_run_max_id = current_min_id.try(:-, 1)\n\n # Loop\n fetch_user_timeline(next_run_max_id)\n end\n\n # Retry on all (and random) Twitter errors\n # though random failures should be more of an issue here\n # than rate limiting\n rescue Twitter::Error => e\n @runs ||= 0 and @runs += 1\n raise e if @runs > 3\n sleep 30 and retry\n end",
"def feed_posts\n Follow.all.select do |follow| follow.follower == self\n end.collect do |follow|\n follow.following.posts.last\n end\n end",
"def search_timeline\n tweets = $client.mentions_timeline()\n most_recent = tweets.take(20)\n new_orders = []\n most_recent.each do |tweet|\n #regex= contains any alphabet character or contains only spaces\n valid_format = tweet.text.include?('order') && (/([a-zA-z]+)|(\\A\\s*\\z)/ =~ tweet.text.partition('order')[2]).nil?\n unprocessed = @db.get_first_value('SELECT COUNT(*) FROM tweets WHERE id = ?',tweet.id)==0\n valid_cancellation = tweet.text.include?('cancel')&& !tweet.attrs[:user][:screen_name].equal?('curryhouse02')\n\n if (valid_format && unprocessed) || valid_cancellation\n new_orders.push tweet\n end\n end\n return new_orders\nend",
"def get_6_months_tweets(client, screen_name)\n # To not reach the rate limit of the Twitter API, we get 200 (the maximum) tweets in each request\n # until we have the tweets in the last 6 months or older.\n # As we can get older tweets, after the necessary request, we will get rid of that older tweets\n\n # Get the oldest date\n today = DateTime.now.to_date\n six_month_ago = today.beginning_of_month - 5.month\n\n begin\n # Make the API call to the 200 newest tweets\n tweets = client.user_timeline(screen_name, :count => 200)\n\n # If we have any results, check:\n # - if the last tweet is older than 6 month from now --> We do not need more tweets\n # - if the last tweet is not older than 6 month from now --> get another 200 tweets and append to the tweet we already have\n # Repeat this proccess until the lasr tweet is older than 6 month from now\n while tweets.any? && tweets.last.created_at >= six_month_ago do\n more_tweets = client.user_timeline(screen_name, :count => 200, :max_id => tweets.last.id - 1)\n tweets += more_tweets\n end\n\n # Get rid of the tweets older than 6 month from now\n tweets_in_months = [];\n tweets.each do |tweet|\n if tweet.created_at >=six_month_ago\n tweets_in_months << tweet\n else\n break\n end\n end\n\n # Divide the tweets per months\n result = divide_tweets_per_month(tweets_in_months)\n rescue Exception => e\n result = e\n end\n\n return result\n end",
"def tweet_users\n if authors.size > 1\n \"#{submitting_author.nice_name} et al.\"\n else\n submitting_author.nice_name\n end\n end",
"def extract_mentions(post)\n mentions = post.raw_mentions\n return if mentions.blank?\n\n groups = Group.where('LOWER(name) IN (?)', mentions)\n mentions -= groups.map(&:name).map(&:downcase)\n groups = nil if groups.empty?\n\n if mentions.present?\n users = User.where(username_lower: mentions).where.not(id: post.user_id)\n users = nil if users.empty?\n end\n\n [groups, users]\n end",
"def doGetMaxObtainableTweets()\n return MAX_OBTAINABLE_TWEETS\n end",
"def retweeted_by_me(options={})\n perform_get(\"statuses/retweeted_by_me.#{Twitter.format}\", options)\n end",
"def new_tweets\n @new_tweets ||= []\n end",
"def recent_tweets(count)\n start(\"/recent/tweets/#{count}\")\n end",
"def check_for_new_messages\n messages = twitter.direct_messages(:since_id => last_message_retrieved)\n @num_messages = messages.length\n end",
"def getTweets\n\t\tputs 'in getTweets'\n\t\t@client.on_timeline_status do |tweet|\n\t\t\tputs 'getTweets: ' + tweet.text\n\n\t\t\t#binding.pry\n\t\t\tpopPlayQueue(tweet)\n\t\tend\n\tend",
"def recent\n num_recent = 5\n entries = @@ledgers.find(\"owner\" => @sender).first['entries']\n\n if(entries.length < num_recent)\n num_recent = entries.length\n end\n\n reply = [\"Most recent ledger entries:\"]\n \n for n in 1..num_recent\n entry = entries[-n]\n reply.push(\"#{entry['action']}, #{entry['description']}, #{entry['value']}\")\n end\n\n @t.say(reply.join(\"\\n\"))\nend",
"def recent_tweets\n @_recent_tweets ||= timeline.each_with_object([]) do |tweet, memo|\n age_of_tweet_in_days = (Time.now.to_date - tweet.created_at.to_date).to_i\n memo << tweet if age_of_tweet_in_days <= 7\n end\n end",
"def tweets\n @_tweets ||= client.filter_tweets(screen_names)\n end",
"def most_recent_time_stamp\n current_snapshot_person_tweets.maximum(:created_at)\n end",
"def search_for_mbti\n # search for tweets cotaining #MBTI, #mbti, or 'mbti'\n # save them to DB if the request is valid\n hashtag_res = client.search('#mbti', result_type: 'mixed', count: 100, lang: 'en')\n hashtag_res.take(5).each { |tweet| puts \"#{tweet.user.screen_name}: #{tweet.text}\" }\n save_tweets_to_db(hashtag_res)\n # text_res = client.search('mbti', result_type: 'mixed', count: 100, lang: 'en')\n # text_res.take(5).each { |tweet| puts \"#{tweet.user.screen_name}: #{tweet.text}\" }\n\n #save tweets to DB and save last_tweet_id as max_id so can poll later\n # self.last_tweet_id = hashtag_res.first.id.to_s # || Tweet.last.t_id_str\n end",
"def get_retweeter_list\n\t\treturn @retweeter_list\n\tend",
"def determine_triggers(twitter, mentions)\n \n words_to_check = get_my_words\n trigger_tweets = []\n\n mentions.each do |mention|\n mention.text.split(\" \").each do |word|\n if words_to_check.include?(word) && twitter.friendship?(self, mention.user.screen_name) == false\n trigger_tweets << mention\n end\n end\n end\n return trigger_tweets\n end",
"def latest_tracks(user, method)\n\n\t# Get the tweets\n\tresponse = make_response(user, method)\n\trecenttracks = JSON.parse(response.body)['recenttracks']\n\trecenttracks['track']\nend",
"def current_user_last_messages\n @last_messages = current_user.messages.unseen.limit(5) if current_user\n end",
"def get_lastmessages(id, query=nil, from=nil, count=1)\n result = @telegram.search_chat_messages(id, query.to_s, from.to_i, 0, 0, count.to_i, TD::Types::SearchMessagesFilter::Empty.new).value\n return (result) ? result.messages : [] \n end",
"def get_max_id(tweets)\n\t\tids = []\n\t\ttweets.each{|tweet|\n\t\t\tids.push(tweet['id'])\n\t\t}\n\t\treturn ids.max\n\tend"
] |
[
"0.7204152",
"0.68303937",
"0.6758731",
"0.66735995",
"0.6672289",
"0.66312593",
"0.64736485",
"0.6446804",
"0.63791776",
"0.62575144",
"0.6168763",
"0.61526024",
"0.61457366",
"0.6128873",
"0.6107029",
"0.60959816",
"0.6094221",
"0.6082616",
"0.60766625",
"0.6063906",
"0.6038868",
"0.6026929",
"0.602445",
"0.60090196",
"0.600784",
"0.5998494",
"0.59472185",
"0.5939146",
"0.5936746",
"0.59280944",
"0.5900838",
"0.58787256",
"0.58606553",
"0.5850081",
"0.5832891",
"0.5828373",
"0.5771553",
"0.5730181",
"0.572262",
"0.5719084",
"0.5673469",
"0.5667712",
"0.5645807",
"0.5638775",
"0.5637515",
"0.56307685",
"0.56274915",
"0.5622977",
"0.56228566",
"0.56119007",
"0.56034064",
"0.56015545",
"0.5601095",
"0.5590884",
"0.5585005",
"0.5567622",
"0.55671835",
"0.5567161",
"0.5559571",
"0.55472004",
"0.55455506",
"0.55378115",
"0.5525259",
"0.5523641",
"0.55048984",
"0.548089",
"0.54724175",
"0.5470478",
"0.545834",
"0.5455892",
"0.54547524",
"0.54441875",
"0.54433066",
"0.5435638",
"0.54328763",
"0.5429869",
"0.54182684",
"0.54034984",
"0.53904945",
"0.5388806",
"0.53878284",
"0.538426",
"0.5383472",
"0.53826785",
"0.537802",
"0.53728956",
"0.537263",
"0.53706354",
"0.5363505",
"0.53578335",
"0.5354015",
"0.53483146",
"0.5346647",
"0.5345352",
"0.53433806",
"0.53424263",
"0.5341966",
"0.53388137",
"0.5336212",
"0.5327521"
] |
0.6684723
|
3
|
Follows users on Twitter
|
def follow_user(user)
return @mouth.follow(user)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def follow\n\t\t@twitter = Twitter::Client.new(\n\t\t\t:oauth_token => @bot.tw_token,\n\t\t\t:oauth_token_secret => @bot.tw_secret\n\t\t)\n\n\t\t@tweet = Tweet.find(params[:tweet])\n\n\t\t@twitter.follow(@tweet.tw_usuario)\n\t\t@tweet.estado = 1\n\t\t@tweet.save\n\n\t\tmensaje = \"Se sigue a \" + @tweet.tw_usuario\n\t\tredirect_to(bot_tweets_path(@bot), notice: mensaje)\n\tend",
"def follow\n @twitter = Twitter::Client.new(\n :oauth_token => @bot.tw_token,\n :oauth_token_secret => @bot.tw_secret\n )\n\n @tweet = Tweet.find(params[:tweet])\n\n @twitter.follow(@tweet.tw_usuario)\n @tweet.estado = 1\n @tweet.save\n\n mensaje = \"Se sigue a \" + @tweet.tw_usuario\n redirect_to(bot_tweets_path(@bot), notice: mensaje)\n end",
"def follow\n return render_error(400, \"must provide a twitter user to follow\") unless params[:twitter_user_name]\n auth = current_user.first_provider(\"twitter\")\n return render_error(404, \"user #{current_user.id} does not have a valid twitter authentication\") unless auth and !auth.blank? and auth.oauth_token and auth.oauth_secret\n \n # Do the follow asynchronously\n ShelbyGT_EM.next_tick do\n c = APIClients::TwitterClient.build_for_token_and_secret(auth.oauth_token, auth.oauth_secret)\n begin\n c.friendships.create! :screen_name => params[:twitter_user_name]\n rescue => e\n Rails.logger.error \"Twitter Follow Failed. Shelby user: #{current_user.id}. Trying to follow: #{params[:twitter_user_name]}. Error: #{e}\"\n end\n end\n \n @status = 200\n render 'v1/blank'\n end",
"def follow\n twitter = Twitter::Base.new(TWITTER_USER, TWITTER_PASSWORD)\n begin\n twitter.create_friendship(twitter_id)\n twitter.follow(twitter_id)\n rescue Twitter::AlreadyFollowing => following\n logger.warn \"Failed to follow #{twitter_id}; we're already following them.\"\n end\n twitter.d(twitter_id, \"http://workon.cyberfox.com/user/#{access_key} to view recent tasks. 'd workon {task}' to add, 'd workon done' to finish. ~2min response time.\")\n end",
"def create\n if Sidewalks::Informants::Twitter.client.\n follow(params[:user][:provider_screen_name])\n\n flash[:notice] = \"User was followed.\"\n end\n\n redirect_to admin_users_path\n end",
"def follow\n if request.post?\n fo_ids = params[:follow] \n #fo_str = \"\"\n #fo_cnt = fo_ids.length - 1\n #for i in 0..fo_cnt\n # fo_str +=fo_ids[i].to_s\n # fo_str += \",\" unless fo_cnt == i\n #end\n \n fo_ids.each do |fid|\n hydra = Typhoeus::Hydra.new\n uri = \"http://api.twitter.com/1/friendships/create.json\"\n req = Typhoeus::Request.new(uri,\n :method =>\"post\",\n :params =>{:user_id=>fid, :include_entities=>\"true\"})\n \n sign_request(req,uri)\n hydra.queue(req)\n hydra.run\n #puts req.response.inspect\n end\n end\n redirect_to :action=>\"index\", :page=>\"1\" \n end",
"def follow(followee_handle)\n HTTParty.post(\"#{@api_path}/users/follow/#{@handle}/#{@password}/#{followee_handle}\")\n end",
"def follow\r\n \r\n @followu = FollowUser.where(user_id: @u_id)\r\n @followt = FollowThread.where(user_id: @u_id)\r\n end",
"def follow_by_tag(num_to_follow, tag, tweets = [])\n # Break if recursion hits rate limit\n if (sr = self.tweet_searches_remaining) < 10 || (fl = self.follower_lookups_remaining) < 2\n p \"Returning hitting rate limit #{sr}, #{fl}\"\n return\n end\n tweets = @client.search(tag, count: 100).to_a.reverse! if tweets.count == 0\n num_to_retry = 0\n popped_tweets = tweets.pop(num_to_follow)\n popped_tweets.each do |tweet|\n remote_user = tweet.user\n screen_name = remote_user.screen_name\n twitter_id = remote_user.id\n local_user = TwitterUser.where(\n twitter_id: twitter_id, twitter_client: self.id).first_or_initialize\n if local_user.new_record? && screen_name != self.username\n local_user.tag_followed = tag\n local_user.followed_at = DateTime.now\n begin\n @client.follow(screen_name)\n p \"#{screen_name} followed\"\n local_user.save! \n update_twitter_user(local_user, remote_user, 1)\n p \"**** Following for #{self.username} --> #{screen_name}: #{tweet.text} #{tweet.created_at}\"\n rescue Exception => e\n p \"Error following #{screen_name} for #{self.username} - #{e.to_s}\"\n return\n end\n else\n num_to_retry += 1\n end\n end\n # If user has already been followed, attempt to follow another user by retrieving more tweets\n if num_to_retry > 0 && !(tweets_to_retry = tweets[num_to_retry..tweets.count]).nil?\n p \"Follow more people for #{self.username}: #{num_to_retry}\"\n follow_by_tag(num_to_retry, tag, tweets_to_retry)\n end\n p \"Done following\"\n end",
"def twitter\n callback_from :twitter\n end",
"def unfollow\n\t\t@twitter = Twitter::Client.new(\n\t\t\t:oauth_token => @bot.tw_token,\n\t\t\t:oauth_token_secret => @bot.tw_secret\n\t\t)\n\n\t\t@tweet = Tweet.find(params[:tweet])\n\n\t\t@twitter.unfollow(@tweet.tw_usuario)\n\t\t@tweet.estado = 4\n\t\t@tweet.save\n\n\t\tmensaje = \"Dejo de seguir a \" + @tweet.tw_usuario\n\t\tredirect_to(bot_tweets_path(@bot), notice: mensaje)\n\tend",
"def tweet(text)\n @followers.each do |follower|\n follower.receive_tweet(@name, text)\n end\n end",
"def follow\n current_user.follow_user(@user)\n render json: {ok: 1}\n end",
"def followers\n config = create_or_find_config\n \n puts\n Twitter::Base.new(config['email'], config['password']).followers.each do |u|\n puts \"#{u.name} (#{u.screen_name})\"\n puts \"#{u.status.text} at #{u.status.created_at}\" unless u.status.nil?\n end\n end",
"def unfollow\n @twitter = Twitter::Client.new(\n :oauth_token => @bot.tw_token,\n :oauth_token_secret => @bot.tw_secret\n )\n\n @tweet = Tweet.find(params[:tweet])\n\n @twitter.unfollow(@tweet.tw_usuario)\n @tweet.estado = 4\n @tweet.save\n\n mensaje = \"Dejo de seguir a \" + @tweet.tw_usuario\n redirect_to(bot_tweets_path(@bot), notice: mensaje)\n end",
"def followers(options={})\n perform_get(\"statuses/followers.#{Twitter.format}\", options)\n end",
"def tweet(message)\n @followers.each { |follower| follower.update(self, message)}\n end",
"def follow\n who = User.find(params[:id])\n @current_user.follow(who)\n render :text => \"you are now following #{who.username}\"\n end",
"def follow\n\n end",
"def follow(account, account_to_follow)\n xml = <<-\"XML\"\n <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <entry xmlns=\"http://www.w3.org/2005/Atom\"\n xmlns:yt=\"http://gdata.youtube.com/schemas/2007\">\n <yt:username>#{account_to_follow.username}</yt:username>\n </entry>\n XML\n access_token(account).post(\"http://gdata.youtube.com/feeds/api/users/default/contacts\", xml, {'Content-Type' => 'application/atom+xml', 'X-GData-Key' => \"key=#{options[:developer_key]}\"})\n end",
"def follow\n if current_user\n update_and_decorate # Generate a FeedEntryDecorator as @feed_entry and prepares it for editing\n if current_user.follows? @user\n current_user_or_guest.followees.delete @user\n msg = \"You've just been unplugged from'#{@user.handle}'.\"\n else\n current_user_or_guest.followees << @user\n msg = \"You're now connected with '#{@user.handle}'.\"\n end\n current_user.save\n @user.save\n if post_resource_errors(current_user)\n render :errors\n else\n flash[:popup] = msg\n render :follow\n end\n else\n flash[:alert] = \"Sorry, you need to be logged in to follow someone.\"\n render :errors\n end\n end",
"def like_follow_live\n login_streaming\n @client_stream.filter(:track => \"#{@hashtbonjour}\") do |tweet|\n @client.favorite!(tweet)\n @client.follow(tweet.user)\n end\n end",
"def follow(user)\n client.search(\"#bonjour_monde\", result_type: \"recent\").take(20).collect.each {|name| client.follow(name.user.screen_name)}\nend",
"def twitter\n default_oauth_callback do |auth|\n # username may already be taken, user will have to enter another one\n if User.exists? username: auth.info.nickname\n redirect_to controller: '/registrations', action: 'twitter_screen_name_clash'\n else\n default_oauth_fail\n end\n end\n end",
"def follow_by_uri(uri)\n perform_request_with_object(:post,\n '/api/v1/follows', { uri: uri },\n Mastodon::Account)\n end",
"def followers(user=nil)\n\t\tself.twitagent.followers(user)\n\trescue => err\n\t\tRAILS_DEFAULT_LOGGER.error \"Failed to get followers via OAuth for #{current_user.inspect}\"\n\t\tflash[:error] = \"Twitter API failure (getting followers)\"\n\t\treturn\n\tend",
"def follow(timeline)\n follow = timeline.follows.find_by_user_id(current_user.id)\n unless follow\n timeline.follows.create(:user_id => current_user.id)\n increase_follow_count(timeline)\n end\n end",
"def followers(params={})\n args = params.map{|k,v| \"#{k}=#{v}\"}.join('&')\n get(\"/statuses/followers.json?#{args}\")\n end",
"def index\n\t\tuser = User.find_by(id: params[:user_id])\n\t\tif user.present?\n\t\t\tfollower_ids = user.followers.pluck(:id)\n\t\t\ttweets = Tweet.where(\"user_id IN (?)\", follower_ids).order(\"updated_at DESC\")\n\t\t\trender json: {:status=>\"success\", :code=>200, :message=>\"List of tweets from the users you follow.\", data: tweets}\n\t\telse\n\t\t\trender json: {:status=>\"failure\", :message=>\"User is not present.\", data: tweets}\n\t\tend\n\tend",
"def follow\n begin\n if !current_user.following?\n current_user.follow_game\n flash[:notice] = \"You should now be following @#{TwitterAuth.config['gamebot_user']} on Twitter.\"\n else\n flash[:notice] = \"You are already following @#{TwitterAuth.config['gamebot_user']} on Twitter.\"\n end\n rescue TwitterAuth::Dispatcher::Error\n flash[:error] = \"Unable to communicate your request to Twitter. Try again later.\"\n end\n\n return_url = params[:game_id] ? game_path(params[:game_id]) : '/'\n redirect_to(return_url)\n end",
"def show\n @twitter_user = TwitterUser.find(params[:id])\n @follower_ids = Twitter.follower_ids(@twitter_user.twitter_username).collection\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @twitter_user }\n end\n end",
"def follow\n follow = User.where(:username => params[:id]).first\n @current_user.friends << follow\n redirect_to user_path( follow.username )\n end",
"def tweet(t)\n @t = t\n @followers.each do |observer|\n observer.read(self)\n end \n end",
"def get_followers\n HTTParty.post(\"#{@api_path}/users/followers/#{@handle}/#{@password}\")\n end",
"def twitter\n handle_callback(:twitter)\n end",
"def follow_mairies(handle)\n# connexion a twitter\nclient = Twitter::REST::Client.new do |config|\n \tconfig.consumer_key = ENV[\"TWITTER_API_KEY\"]\n \tconfig.consumer_secret = ENV[\"TWITTER_API_SECRET\"]\n \tconfig.access_token = ENV[\"TWITTER_TOKEN_KEY\"]\n \tconfig.access_token_secret = ENV[\"TWITTER_TOKEN_SECRET\"]\nend\n# permet de suivre chaue pseudo passé en arguement\n\tbegin\n \tclient.follow(handle) #supprime le @\n \trescue Twitter::Error::TooManyRequests => error\n \tsleep error.rate_limit.reset_in\n \tretry\n \traise\n end\nend",
"def follow!( follow_nick, follow_address, password )\n follow follow_nick, follow_address\n push password\n end",
"def follow(other_user)\n following << other_user\n end",
"def add_to_timeline_new_follower\n Tweet.recent(50, self.following).each do |t|\n Timeline.create(user: user, tweet: t)\n end\n end",
"def remote_follow(uri)\n perform_request_with_object(:post, '/api/v1/follows', { uri: uri },\n Mastodon::Account)\n end",
"def twitter\n\t\thandle_omniauth_callback(request.env['omniauth.auth'])\n\tend",
"def follow(other_user)\n following << other_user\n end",
"def follow(other_user)\n following << other_user\n end",
"def follow(other_user)\n following << other_user\n end",
"def follow(other_user)\n following << other_user\n end",
"def follow(other_user)\n following << other_user\n end",
"def follow(other_user)\n following << other_user\n end",
"def tweet(content)\n @followers.each do |follower|\n puts(\"#{follower.name} received a tweet from #{@name}: #{content}\" )\n end\n end",
"def followers(options = {})\n Tinybucket::Resource::User::Followers.new(username, options)\n end",
"def twitter_url(username)\n \"https://twitter.com/#!/#{username}\"\n end",
"def follow\n \n # Get the specified user, making sure that it exists\n @user = User.find_by_login(params[:user_login])\n \n # Create and save a new follow, with the current user as the follower\n follow = Follow.new\n follow.follower_id = current_user.id\n follow.followee_id = @user.id\n follow.save!\n \n # Send an email to the user being followed\n UserMailer.deliver_follow(current_user, @user)\n \n # Redirect back to the profile of the user being followed\n flash[:notice] = \"You are now following #{@user.login}.\"\n redirect_to user_profile_url(:user_login => @user.login)\n end",
"def follow\n\t\t@most_active_users.each do |user|\n\t\t\tpath = \"https://github.com/%s/followers\" % [user]\n\t\t\tnavigate(path)\n\n\t\t\tDEFAULT_NUMBER_PAGES.times do |page|\n\t\t\t\tfollow_button = find_many_elements_by_xpath(@follow_xpath)\n\t\t\t\tfollow_button.each { |follow_element| follow_element.submit; sleep 1 }\n\n\t\t\t\tnext_button = find_by_link_text('Next')\n\t\t\t\tnext_button.nil? ? break : next_button.click\n\t\t\tend\n\t\tend\n\tend",
"def twitter\n @user = current_user\n if params[:oauth_verifier]\n if @user.user_content.twitter_token.blank?\n clientTwitter = TwitterOAuth::Client.new(:consumer_key => TwitterEnv::API_KEY, :consumer_secret => TwitterEnv::SECRET_KEY)\n pin = params[:oauth_verifier]\n access_token = clientTwitter.authorize(session[:rtoken_twitter], session[:rsecret_twitter], :oauth_verifier => pin)\n @user.user_content.twitter_token = access_token.token\n @user.user_content.twitter_secret = access_token.secret\n @user.user_content.save\n else\n clientTwitter = TwitterOAuth::Client.new(\n :consumer_key => TwitterEnv::API_KEY,\n :consumer_secret => TwitterEnv::SECRET_KEY,\n :token => @user.user_content.twitter_token, \n :secret => @user.user_content.twitter_secret)\n end\n end\n \n redirect_to \"/backend/social\"\n end",
"def url\n \"http://twitter.com/#{self.username}/statuses/#{self.twitter_id}\"\n end",
"def post_to_twitter\n tweet = event_post_to_twitter(current_user.events.find(params[:id]))\n if tweet\n tweet_url = \"https://twitter.com/#{current_user.twitter_username}/status/#{tweet.id}\"\n redirect_to request.referer,\n :flash => { :success => \"Your event has been twitted,\n <br><i class='fa fa-twitter'></i> \n <a href='#{tweet_url}' rel='nofollow' target='_blank'>#{tweet_url}</a>\" }\n else\n redirect_to request.referer, :flash => { :error => \"Ooops. something wrong\" }\n end\n end",
"def twitter_link(player)\n if player.twitter_screen_name\n # clean up any bad characters in a player's twitter name\n twitter_user = player.twitter_screen_name.sub(/^.*[@\\/]/, '')\n\n link_to(\"@\" + twitter_user, \"http://twitter.com/#{twitter_user}\")\n end\n end",
"def following(user_id = nil)\n twitter_request do\n logger.info \"Get following of #{user_id || 'me'}\"\n client.friend_ids(user_id).take(5000)\n end\n end",
"def follow_users\n puts \"Are you sure you want to follow ALL of the unique users of #{@other_user.strip}? Y/N\"\n @decision = gets\n\n case @decision.strip\n when \"Y\"\n @unique_user_ids.each do |followerId|\n @follow_user = Twitter.user(followerId)\n begin\n Twitter.follow(followerId)\n rescue Twitter::Error::TooManyRequests => error\n puts \"Oops, we are rate limited. We will try again at: #{Time.now + error.rate_limit.reset_in + 5}\"\n sleep error.rate_limit.reset_in + 5\n retry\n rescue Twitter::Error::ServiceUnavailable => error\n sleep(10)\n retry\n rescue Twitter::Error::NotFound => error\n puts \"Sorry something went wrong. #{error}\"\n next\n else \n puts \">>> followed followerID #{@follow_user.screen_name}\"\n end\n sleep(1)\n end\n when \"N\"\n puts \"Ok, well that was a waste of time.\"\n else\n puts \"Something went wrong here. Start over.\"\n end\nend",
"def follow\n requested_profile.follow!(requested_follow_profile)\n redirect_to :action => 'following', :profile_id => current_user.profile, :format => params[:format]\n end",
"def twitter\n handle_oauth\n end",
"def follow\n current_user.follow_topic(@topic)\n render json: {ok: 1}\n end",
"def follow(user)\n user.followers << self\n end",
"def following\n users = connection.get(\n \"/users/#{CGI.escape(login)}/following\"\n )\n\n users.map do |stalkee|\n self.class.new(stalkee, connection)\n end\n end",
"def followUser(userToFollow)\n @followers << userToFollow\n end",
"def create\n @leader = User.find(params[:user_id])\n @leader.user_followers.create(:follower_id => current_user.id)\n\n saved = @leader.save\n respond_to do |format|\n if saved\n flash[:notice] = 'You are now following '.concat(@leader.login)\n end\n format.html { redirect_to user_tweets_path(@leader) }\n if saved\n format.xml { render :xml => @leader, :status => :created, :location => @leaders }\n else\n format.xml { render :xml => @leader.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def follow(user)\n user.followers << self\n self\n end",
"def followers\n client = Twitter::Client.new.configure do |config|\n config.consumer_key = ENV['CONSUMER_KEY']\n config.consumer_secret = ENV['CONSUMER_SECRET']\n config.oauth_token = ENV['OAUTH_TOKEN']\n config.oauth_token_secret = ENV['OAUTH_TOKEN_SECRET']\n end\n\n client.user(@login).followers_count\n end",
"def follow(user)\n user.add_follower(self)\n self\n end",
"def link_twitter\n\n end",
"def follow(other_user)\n active_follows.create(followed_id: other_user.id)\n end",
"def follow_steve\n return if username == \"steve\"\n steve = User.first(:username => 'steve')\n return if steve.nil?\n\n follow! steve\n steve.follow! self\n end",
"def following\n @following||= get(\"/user/show/#{login}/following\")['users'].map { |u| User.new(connection, :login => u) }\n end",
"def follow(user)\n Friend.add_follower(self, user)\n end",
"def follow_user\n user = User.find(params[:user_id])\n authorize! :follow, user\n current_user.follow(user)\n render_success_message(\"You are following #{user.full_name(false)}\")\n end",
"def follow\n if (!current_user.friends.exists?(params[:id]))\n fs = Friendship.new(user_id: current_user.id, friend_id: params[:id])\n if fs.save\n redirect_to user_url(params[:id]), notice: \"Now you can read this user's posts in your friends feed.\"\n else\n flash.alert = \"Something went wrong. You cannot follow this user.\"\n redirect_to user_url(params[:id])\n end\n end\n end",
"def follow_user\n\t\tauthenticate_current_user\n\t\t# add the current user to the user they followed list of followers\n\t\tUser.find(params.user_id).followers.push(User.find(current_user.id))\n\t\t# run the following action to return the updated group of followers\n\t\tfollowing\n\tend",
"def find_followers\n puts 'Enter the other user\\'s twitter handle'\n @other_user = gets\n @followers = Twitter.follower_ids(@other_user).ids\nend",
"def follow(user)\n self.following << user\n ActionLog.log_other(self.id, \"follow\", user) \n end",
"def follow!(user)\n\t\tfollowed << user \n\tend",
"def follow!(user)\n\t\tfollowed << user\n\tend",
"def followers(user = nil, params = {})\n args = [user, params]\n get path_from_args('statuses/followers', args), params_from_args(args)\n end",
"def twitter_url\n twitter_user.blank? ? nil : \"#{TWITTER_URL}#{twitter_user}\"\n end",
"def followers(options = {})\n Tinybucket::Resource::Team::Followers.new(username, options)\n end",
"def index\n timeline = Tweet.where(user_id: User.find(@current_user_id).follows).or(Tweet.where(user_id: @current_user_id))\n render json: {timeline: timeline}\n end",
"def tw_profile_url\n \"http://twitter.com/intent/user?user_id=#{tw_user_id}\"\n end",
"def follower\n config = create_or_find_config\n \n if ARGV.size == 0\n puts %(\\n You forgot to enter a screen name.\\n\\n Usage: twitter follower jnunemaker\\n)\n exit(0)\n end\n \n screen_name = ARGV.shift\n \n puts\n found = false\n Twitter::Base.new(config['email'], config['password']).followers.each do |u|\n if u.screen_name == screen_name\n puts \"#{u.name} (#{u.screen_name})\"\n puts \"#{u.status.text} at #{u.status.created_at}\" unless u.status.nil?\n found = true\n end\n end\n \n puts \"Sorry couldn't find a follower of yours with #{screen_name} as a screen name\" unless found\n end",
"def friends_and_followers(username_or_id)\n puts \"Getting Friends and Followers for %s...\" % username_or_id.to_s\n begin\n friend_ids = @MT.friend_ids(username_or_id).ids\n follower_ids = @MT.follower_ids(username_or_id).ids\n { :friends => friend_ids, :followers => follower_ids }\n rescue Twitter::Error::Unauthorized, Twitter::Error::Forbidden\n puts \"Failed for %s (Protected)\" % username_or_id.to_s\n { :friends => [], :followers => [] }\n end\n end",
"def follow \n @user = User.find_by_id(params[:id])\n if @user and current_user.follow(@user)\n flash[:notice] = \"You are now following #{@user.login}\"\n redirect_to home_path()\n elsif @user\n flash[:notice] = \"Already following\"\n redirect_to user_path(@user.login)\n else\n redirect_to home_path()\n end\n end",
"def following?(tw_user)\n following.include?(tw_user)\n end",
"def twitter\n auth = request.env['omniauth.auth']\n current_user.company.create_or_update_twitter_account(auth)\n\n flash.notice = 'Authorized Twitter account successfully.'\n redirect_to twitter_accounts_path\n end",
"def connect_twitter\n auth = request.env[\"omniauth.auth\"]\n current_member.twitter_token = auth[\"credentials\"][\"token\"]\n current_member.twitter_secret = auth[\"credentials\"][\"secret\"]\n current_member.twitter_id = auth[\"uid\"]\n if current_member.img_url.blank?\n current_member.username = auth.info.name\n current_member.img_url = auth.info.image\n\t end\n current_member.save\n\t TwitterModel.store_urls(current_member)\n\t redirect_to members_social_sign_up_path\n end",
"def follow(user)\n user.add_follower(self)\n self\n end",
"def follow(target)\n link = self.user_follows.where(\"following_id = ?\",target.id).first\n if link == nil\n imperative_follow(target)\n end\n true\n end",
"def twitter_url; \"https://twitter.com/#{twitter}\" end",
"def followers\n @hot_topics = Topic.hot_topics(5)\n @interviewee = User.where(:nickname => params[:id]).first\n @is_same_user = @interviewee.is_same_user?(@current_user)\n \n @followers = @interviewee.followers\n @current_user.refresh_notifications(\"new_followers_count\")\n end",
"def follow(response)\n user_name = response.user.andand.name\n routing_key = response.match_data[1]\n validate_follow_routing_key(routing_key)\n subscribe(nil, user_name, routing_key)\n response.reply \"#{response.user.name}, following '#{routing_key}'\"\n rescue Error => e\n log.error e.inspect\n log.error response.inspect\n response.reply \"#{response.user.name}, #{e} (routing_key: '#{routing_key}')\"\n end",
"def find_tweets(current_user)\n @screen_name = current_user.authentications[2].to_s\n @another_tweet = self.twitter.user_timeline(@screen_name)\n @tweet = Tweets.new\n @another_tweet.each do |t|\n @tweet.screenname = t.screen_name\n @tweet.text = t.text\n @tweet.created_at = t.created_at\n end\n @tweet.save\n end",
"def follow(*followees)\n perform_followable_action(:follow, followees)\n end",
"def unfollow\n if request.post?\n @unf_ids = params[:unfollow]\n \n #unf_str = \"\"\n #unf_cnt = unf_ids.length - 1\n #for i in 0..unf_cnt\n # unf_str +=unf_ids[i].to_s\n # unf_str += \",\" unless unf_cnt == i\n #end\n if @unf_ids.nil? || @unf_ids.length < 1\n else\n @unf_ids.each do |unfo| \n hydra = Typhoeus::Hydra.new\n uri = \"http://api.twitter.com/1/friendships/destroy.json\"\n req = Typhoeus::Request.new(uri,\n :method =>\"post\",\n :params =>{:user_id=>unfo, :include_entities=>\"true\"})\n \n sign_request(req,uri)\n hydra.queue(req)\n hydra.run\n #puts req.response.inspect\n end\n end\n end\n respond_to do |format|\n format.js\n end\n end",
"def list_follow(response)\n user_name = response.user.andand.name\n response.reply \"#{response.user.name}, list for '#{user_name}': #{list_spam(nil, user_name)}\"\n rescue Error => e\n log.error e.inspect\n log.error response.inspect\n response.reply \"#{response.user.name}, #{e}\"\n end"
] |
[
"0.8070372",
"0.7942243",
"0.7854016",
"0.7549703",
"0.75438106",
"0.73731023",
"0.70769006",
"0.7017432",
"0.69774675",
"0.69727206",
"0.69550186",
"0.69544196",
"0.6949877",
"0.6943777",
"0.6925627",
"0.6898264",
"0.68873864",
"0.6887212",
"0.68680674",
"0.6804813",
"0.6804103",
"0.67926174",
"0.6778471",
"0.6767113",
"0.6767072",
"0.67569405",
"0.6737955",
"0.6721556",
"0.6711141",
"0.6691144",
"0.66677225",
"0.6665645",
"0.6663808",
"0.66539425",
"0.66511613",
"0.6648149",
"0.6646247",
"0.6644956",
"0.66075295",
"0.6600262",
"0.659804",
"0.6594436",
"0.6594436",
"0.6594436",
"0.6594436",
"0.6594436",
"0.6594436",
"0.65799284",
"0.6577501",
"0.6577377",
"0.65713996",
"0.65688145",
"0.65659946",
"0.6563979",
"0.65590125",
"0.6552979",
"0.65517896",
"0.6540998",
"0.6532036",
"0.65272653",
"0.6526097",
"0.6523103",
"0.652108",
"0.6491707",
"0.6484507",
"0.64744794",
"0.6468193",
"0.6455523",
"0.6448602",
"0.64320326",
"0.64289",
"0.6412124",
"0.640186",
"0.63985765",
"0.6398094",
"0.6397084",
"0.63942987",
"0.6388521",
"0.63757914",
"0.6371035",
"0.63704485",
"0.63531184",
"0.63526225",
"0.634767",
"0.6341885",
"0.63408744",
"0.63389474",
"0.6338817",
"0.6337461",
"0.63208216",
"0.63109756",
"0.63093406",
"0.630511",
"0.63042617",
"0.6302555",
"0.62968916",
"0.6296697",
"0.6283775",
"0.6283743",
"0.6283377"
] |
0.6752843
|
26
|
Replies to the last mention on Twitter
|
def reply(message)
return @mouth.reply(message)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def on_mention(tweet)\n txt = tweet.text.split[1..-1].join(' ')\n response = MODEL.make_response(txt, 100)\n reply(tweet, response)\n end",
"def mentions(twitter, options = {})\n if last_id = last_id(:mentions)\n options[:since_id] = last_id\n end\n mentions = twitter.mentions(options)\n last_id(:mentions, mentions.first.id) unless mentions.empty?\n mentions\nend",
"def last(m)\n\t\tnick = m.message.split(/\\W/)[2]\n\t\tuser = @users[nick]\n\t\tif Mailbox.exists? nick\n\t\t m.reply \"Last saw #{nick} [ #{\"%.2f\" % ((Time.now - user.last_seen) / 60 / 60)} hrs | #{user.missed_lines} lines ] ago\"\n\t end\n end",
"def last_tweet\r\n\t\tresult = @client.search(@twitter_search_keyword)\r\n\t\tresult.first.full_text\r\n\tend",
"def last_mentions\n return @mouth.last_mentioned\n end",
"def message_for_twitter(content)\n if content and content.text\n twitter_message_link = polymorphic_url(content.parent || content).gsub(/datalogger=true/, '')\n content.text.truncate(139 - twitter_message_link.length) + ' ' + twitter_message_link\n end\n end",
"def on_mention(tweet)\n\n #this is a bot we know\n if @botinfo.key?(tweet.user.screen_name)\n bot = @botinfo[tweet.user.screen_name]\n if bot.should_reply_to()\n #reply to the bot\n bot.replies_left -= 1\n sleep(rand(5..30))\n do_reply(tweet)\n else\n log \"not replying to bot\"\n end\n\t \n else\n # Become more inclined to pester a user when they talk to us\n userinfo(tweet.user.screen_name).pesters_left += 1\n delay do\n do_reply(tweet)\n end\n end\n end",
"def find_twitter_handle\n self.match(/(\\@\\w+)/i)\n return $1\n end",
"def last_tweet\n tweets.order(\"updated_at desc\").first unless (tweets.nil? || tweets.size == 0)\n end",
"def poll_timeline\n opts = @last_id ? { :since_id => @last_id } : {}\n tl = @twitter.friends_timeline( opts )\n if tl.any?\n if @last_id.nil?\n @last_id = tl[ 0 ].id.to_i\n else\n tl.reverse!\n tl.reverse_each do |tweet|\n say_tweet tweet\n end\n end\n end\n rescue Exception => e\n $stderr.puts \"Twitter exception: #{e.message}\"\n # $stderr.puts e.backtrace.join( \"\\t\\n\" )\n end",
"def set_last_tweet(search)\n access_token = OAuth::AccessToken.new(get_consumer(), search.user.access_token,\n search.user.access_secret)\n \n query_string = \"https://search.twitter.com/search.json?q=#{CGI.escape(search.text)}&rpp=1\"\n json = access_token.get(query_string)\n results = JSON.parse(json.body)\n \n if results.has_key?(\"results\") && results[\"results\"].count > 0\n search.last_tweet = results[\"results\"][0][\"id_str\"]\n else\n search.last_tweet = \"1\"\n end\n \n search.save\n end",
"def mentions( since_id = nil, max_id = nil , count = nil, page = nil )\n self.twitagent.mentions( since_id, max_id, count, page )\n rescue => err\n RAILS_DEFAULT_LOGGER.error \"Failed to get mentions via OAuth for #{current_user.inspect}\"\n flash[:error] = \"Twitter API failure (getting mentions)\"\n return\n end",
"def last_mention_count\n Count.find(:first, :conditions => {:city_id => self.id}, :order => 'date DESC').count\n end",
"def call\n client = @request[:twitter_client]\n\n mentions = TwitterMention.where('replied IS NOT TRUE').order(twitter_id: :desc).limit(REPLY_LIMIT).each do |mention|\n chat_response = Interactors::QueryBot.new(input: strip_mentions(mention.text)).call()\n full_text = \"#{chat_response.outputs.join(' ')}\"\n mention.update_attributes!(replied: true)\n Interactors::SendTweets.new({twitter_client: client, text: full_text, \n screen_names: [mention.screen_name], in_reply_to_status_id: mention.twitter_id}).call()\n end\n end",
"def tweet\r\n\treturn \"tweet tweet tweet\"\r\n\tend",
"def tweet(message)\n @followers.each { |follower| follower.update(self, message)}\n end",
"def execute(msg, tweet)\n return if Variables::Constants::IGNORED_USERS.include?(msg.user.nick)\n # 134 because it has to fit \"[IRC] \"\n if tweet.length > 1 && tweet.length < 134\n twitter = LittleHelper.init_twitter\n twitter.update(\"[IRC] #{tweet}\")\n msg.reply('Successfully tweeted!'.freeze)\n else\n msg.reply('That tweet is either too long or too short.'.freeze)\n end\n end",
"def tweet\n return \"Arrrr matey\"\n end",
"def mentions( since_id = nil, max_id = nil , count = nil, page = nil )\n\t\tself.twitagent.mentions( since_id, max_id, count, page )\n\trescue => err\n\t\tRAILS_DEFAULT_LOGGER.error \"Failed to get mentions via OAuth for #{current_user.inspect}\"\n\t\tflash[:error] = \"Twitter API failure (getting mentions)\"\n\t\treturn\n\tend",
"def show\n set_up_twitter\n\n get_last_tweet\n get_five_last_tweets\n end",
"def tweet\n\treturn \"Tweet Tweet Twitter\"\nend",
"def get_mentions\n # If mentions has already fetched before than only fetch recent mentions\n recent_mentions = mentions.present? ? twitter_client.mentions_timeline(since_id: mentions.last.tweet_id) : twitter_client.mentions_timeline\n recent_mentions.collect do |tweet|\n mention = mentions.find_or_create_by(tweet_id: tweet.id)\n mention.assign_attributes({text: tweet.text,\n tweeted_at: tweet.created_at,\n tweet_user_id: tweet.user.id,\n tweet_user_name: tweet.user.screen_name,\n tweet_user_image: tweet.user.profile_image_url})\n mention.save\n end\n mentions\n end",
"def fetch_mentions_timeline\n statuses = client.mentions_timeline(mentions_timeline_options)\n tweets = TweetMaker.many_from_twitter(statuses, project: project, twitter_account: self, state: :incoming)\n update_max_mentions_timeline_twitter_id(tweets.map(&:twitter_id).max)\n tweets\n # If there's an error, just skip execution\n rescue Twitter::Error\n false\n end",
"def retweet?(message)\n message.index('RT @') || message.index(%{ \"@}) || message.index(\" \\u201c@\") #detect retweets\n end",
"def tweet\n return \"chirp chirp\"\n end",
"def mention_tweets\n logger.debug { \"#{__method__} is called twitter_user_id=#{id}\" }\n tweets = []\n tweets = InMemory::MentionTweet.find_by(uid) if InMemory.enabled? && InMemory.cache_alive?(created_at)\n tweets = Efs::MentionTweet.where(uid: uid) if tweets.blank? && Efs::Tweet.cache_alive?(created_at)\n tweets = ::S3::MentionTweet.where(uid: uid) if tweets.blank?\n tweets.map { |tweet| ::TwitterDB::Mention.new(uid: uid, screen_name: screen_name, raw_attrs_text: tweet.raw_attrs_text) }\n end",
"def tweet\n\t\treturn \"AHHP! Pretty bird!\"\n\tend",
"def mentioning_text\n self.text\n end",
"def notify_twitter\n $twitter_client.update(tweet_content)\n end",
"def mentions( since_id = nil, max_id = nil , count = nil, page = nil )\n\t\tparams = (\n\t\t\t{ :since_id => since_id, :max_id => max_id, :count => count, :page => page }.collect { |n| \"#{n[0]}=#{n[1]}\" if n[1] }\n\t\t).compact.join('&')\n\t\tresponse = access_token.get('/statuses/mentions.json' + ( params.empty? ? '' : '?' + params ) )\n\t\tcase response\n\t\twhen Net::HTTPSuccess\n\t\t\tmessages=JSON.parse(response.body)\n\t\t\traise TwitterOauth::UnexpectedResponse unless messages.is_a? Array\n\t\t\tmessages\n\t\telse\n\t\t\traise TwitterOauth::APIError\n\t\tend\n\trescue => err\n\t\tputs \"Exception in mentions: #{err}\"\n\t\traise err\n\tend",
"def follow_mairies(handle)\n# connexion a twitter\nclient = Twitter::REST::Client.new do |config|\n \tconfig.consumer_key = ENV[\"TWITTER_API_KEY\"]\n \tconfig.consumer_secret = ENV[\"TWITTER_API_SECRET\"]\n \tconfig.access_token = ENV[\"TWITTER_TOKEN_KEY\"]\n \tconfig.access_token_secret = ENV[\"TWITTER_TOKEN_SECRET\"]\nend\n# permet de suivre chaue pseudo passé en arguement\n\tbegin\n \tclient.follow(handle) #supprime le @\n \trescue Twitter::Error::TooManyRequests => error\n \tsleep error.rate_limit.reset_in\n \tretry\n \traise\n end\nend",
"def on_mention(twt)\n Random.new_seed\n\n # We load our bot here.\n bot = ai('drbmitchellphd')\n\n # The replying dataset.\n bot.learn_from_dataset 'corpuses/doctor_tweet_corpus.txt'\n\n # Delay typing to act like a human is thinking what to say.\n # Produce a mistake rate between 0.1 and 1.\n sleep Masqueraide::NLP.typing_delay(twt.text)\n\n # Check if the text is unintelligible before responding to the patient.\n if Masqueraide::NLP.unintelligible? twt.text\n rand = Random.new.rand 0.1..1\n unsure_response = []\n # Choose a random unsure sentence from the markov chain.\n if rand > 0.5\n unsure_sentences = []\n while unsure_sentences.length != 10\n sentence = bot.reply(twt.text, 140)\n if sentiment.classify_with_score(sentence)[0].to_sym == :unsure\n unsure_sentences << sentence\n end\n end\n else\n # Or use a predefined corpus.\n # Read the DM corpus and produce an unsure response.\n unsure_response = DR_UNSURE['data'].select\n end\n unsure_response = unsure_response.sample\n sleep Masqueraide::NLP.typing_delay(unsure_response) + (Random.new.rand 1..15)\n reply(twt, unsure_response)\n return\n end\n\n # TODO: sentiment on public tweets.\n\n # We must identify between :question and :conversation tweets.\n # Continue the conversation publicly, but once offered to DM privately, don't talk to the person for (Time.now + 8 hours)\n # The doctor is busy.\n\n real_reply = bot.reply(twt.text, 140)\n\n # Delay based on how long it takes to type the message. and add 1 to 30.\n # Dr. Brian Mitchell does not need to reply instantly.\n sleep Masqueraide::NLP.typing_delay(real_reply) + (Random.new.rand 1..30)\n reply(twt, brian_reply)\n end",
"def process_tweet(tweet)\n log_info { \"New Tweet: #{tweet.uri}\" }\n\n if tweet.retweeted_status.present?\n text =\n \"Retweeted from <a href=\\\"https://twitter.com/#{tweet.retweeted_status.user.screen_name}\\\">@#{tweet.retweeted_status.user.screen_name}</a>:\\n\" +\n convert_all_entities(tweet.retweeted_status)\n\n send_media_of tweet.retweeted_status, retweeted: true\n\n elsif tweet.quoted_status?\n text =\n convert_all_entities(tweet) + \"\\n\\n\" +\n \"Retweeted from <a href=\\\"https://twitter.com/#{tweet.quoted_status.user.screen_name}\\\">@#{tweet.quoted_status.user.screen_name}</a>:\\n\" +\n convert_all_entities(tweet.quoted_status)\n\n send_media_of tweet.quoted_status, retweeted: true\n\n else\n text = convert_all_entities(tweet)\n\n send_media_of tweet\n\n end\n\n text = text + \"\\n\\n<a href=\\\"#{tweet.uri}\\\">Reply</a>\"\n\n @bot.telegram.api.send_message(\n chat_id: @config.twitter.target_channel,\n text: text,\n parse_mode: 'HTML',\n disable_web_page_preview: true\n )\n\n end",
"def retweet search_for\n\t\tlast_verified = File.open 'last_verified', 'r+'\n\t\tlast_id = last_verified.read.gsub(\"\\000\", '')\n\t\tlast_id = 0 if last_id.empty?\n\t\tsearch_terms = search_for.join ' OR '\n\t\ttweets = Twitter::Search.new.containing(search_terms).since_id(last_id).not_from(@account[:name]).not_from('StrikeRH1').fetch.collect do |t|\n\t\t\tt.id unless t.text[0,1] == '@'\n\t\tend.compact\n\n\t\tif tweets.length > 0\n\t\t\ttwitter = get_twitter_client\n\t\t\ttweets.each do |id|\n\t\t\t\tbegin\n\t\t\t\t\ttwitter.retweet id\n\t\t\t\trescue Twitter::Forbidden\n\t\t\t\tend\n\t\t\tend\n\t\t\tlast_verified.truncate 0\n\t\t\tlast_verified.write tweets[0]\n\t\tend\n end",
"def execute(msg, tweet)\n # 134 because it has to fit \"[IRC] \"\n if tweet.length > 1 && tweet.length < 134\n LittleHelper::TWEETER.update(\"[IRC] #{tweet}\")\n msg.reply('Successfully tweeted!'.freeze)\n else\n msg.reply('That tweet is either too long or too short.'.freeze)\n end\n end",
"def tweet\n\t\treturn \"tweee\"\n\tend",
"def fetch_mentions_timeline\n statuses = @twitter_account.client.mentions_timeline(count: 100)\n TweetMaker.many_from_twitter(statuses,\n project: @twitter_account.project,\n twitter_account: @twitter_account,\n state: :incoming)\n end",
"def tweet\n\t\treturn \"Polly want's a cracker.\"\n\tend",
"def tweet!\n TWITTER.update(\"#{title.truncate(75)} - #{tweet_users}\\n\\nhttp://beta.briefideas.org/ideas/#{sha}\")\n self.update_columns(:tweeted => true)\n end",
"def notify_on_mention?; true; end",
"def follow\n\t\t@twitter = Twitter::Client.new(\n\t\t\t:oauth_token => @bot.tw_token,\n\t\t\t:oauth_token_secret => @bot.tw_secret\n\t\t)\n\n\t\t@tweet = Tweet.find(params[:tweet])\n\n\t\t@twitter.follow(@tweet.tw_usuario)\n\t\t@tweet.estado = 1\n\t\t@tweet.save\n\n\t\tmensaje = \"Se sigue a \" + @tweet.tw_usuario\n\t\tredirect_to(bot_tweets_path(@bot), notice: mensaje)\n\tend",
"def tweet_users\n if authors.size > 1\n \"#{submitting_author.nice_name} et al.\"\n else\n submitting_author.nice_name\n end\n end",
"def twitter\n callback_from :twitter\n end",
"def follow\n @twitter = Twitter::Client.new(\n :oauth_token => @bot.tw_token,\n :oauth_token_secret => @bot.tw_secret\n )\n\n @tweet = Tweet.find(params[:tweet])\n\n @twitter.follow(@tweet.tw_usuario)\n @tweet.estado = 1\n @tweet.save\n\n mensaje = \"Se sigue a \" + @tweet.tw_usuario\n redirect_to(bot_tweets_path(@bot), notice: mensaje)\n end",
"def user_response(bot, event)\n event = bot.add_await!(Discordrb::Events::MentionEvent, in: event.channel, from: event.author)\n event.message.text.split[1].to_i\nend",
"def tweet(content)\n @followers.each do |follower|\n puts(\"#{follower.name} received a tweet from #{@name}: #{content}\" )\n end\n end",
"def twitter_list_name\n end",
"def mentions(options={})\n perform_get(\"statuses/mentions.#{Twitter.format}\", options)\n end",
"def feed_after(latest_update) \n\tif latest_update.present? \n\t\tself.feed.where(\"microposts.updated_at > ?\", latest_update)\n\tend\n end",
"def post_to_twitter\n tweet = event_post_to_twitter(current_user.events.find(params[:id]))\n if tweet\n tweet_url = \"https://twitter.com/#{current_user.twitter_username}/status/#{tweet.id}\"\n redirect_to request.referer,\n :flash => { :success => \"Your event has been twitted,\n <br><i class='fa fa-twitter'></i> \n <a href='#{tweet_url}' rel='nofollow' target='_blank'>#{tweet_url}</a>\" }\n else\n redirect_to request.referer, :flash => { :error => \"Ooops. something wrong\" }\n end\n end",
"def feed\n Micropost.from_users_followed_by(self)\n end",
"def feed\n Micropost.from_users_followed_by(self)\n end",
"def feed\n Micropost.from_users_followed_by(self)\n end",
"def feed\n Micropost.from_users_followed_by(self)\n end",
"def feed\n Micropost.from_users_followed_by(self)\n end",
"def feed\n Micropost.from_users_followed_by(self)\n end",
"def feed\n Micropost.from_users_followed_by(self)\n end",
"def feed\n Micropost.from_users_followed_by(self)\n end",
"def load_old_tweet\n #setup twitter client\n client = Twitter::REST::Client.new do |config|\n config.consumer_key = $consumer_key\n config.consumer_secret = $consumer_secret\n config.access_token = $access_token\n config.access_token_secret = $access_token_secret\n end\n\n #replace t.co link with didmichiganstatewin.com so the comparison will work\n return client.user_timeline(\"didmsuwin\").first.text.split('http').first + \"didmichiganstatewin.com\"\nend",
"def followed_post_activity(actor_name)\n target_post_id = activity['target'].split(':').last\n target_post = Post.find_by(id: target_post_id)\n target_post_author = target_post&.user\n target_post_author_id = target_post_author&.id\n\n unless target_post\n return I18n.t(:other,\n scope: %i[notifications followed_post],\n actor: actor_name)\n end\n\n if target_post_author_id == actor_id\n I18n.t(:third_person,\n scope: %i[notifications followed_post],\n actor: actor_name)\n elsif target_post_author_id == feed_id\n I18n.t(:first_person,\n scope: %i[notifications followed_post],\n actor: actor_name)\n else\n I18n.t(:someone,\n scope: %i[notifications followed_post],\n actor: actor_name,\n author: target_post_author.name)\n end\n end",
"def on_timeline(tweet)\n #don't reply to retweets\n return if tweet.retweeted_status?\n #check if bot can \"pester\" this user\n return unless can_pester?(tweet.user.screen_name)\n\n #see if bot finds the tweet interesting (based off top 100 / top 20 model words)\n tokens = Ebooks::NLP.tokenize(tweet.text)\n interesting = tokens.find { |t| top100.include?(t.downcase) }\n very_interesting = tokens.find_all { |t| top20.include?(t.downcase) }.length > 2\n\n #do various actions depending on how interesting the tweet is\n delay do\n if very_interesting\n favorite(tweet) if rand < 0.5\n retweet(tweet) if rand < 0.1\n if rand < 0.05 #0.01\n userinfo(tweet.user.screen_name).pesters_left -= 1\n reply(tweet, make_response_wrapper(tweet))\n end\n elsif interesting\n favorite(tweet) if rand < 0.05\n if rand < 0.01 #0.001\n userinfo(tweet.user.screen_name).pesters_left -= 1\n reply(tweet, make_response_wrapper(tweet))\n end\n end\n end\n end",
"def send_mention(post)\n post.mentioned.each do |mentioned_user|\n Notification.send_to mentioned_user, 'mention', post.topic, post.user, post\n end unless post.mentioned.blank?\n end",
"def on_mention(json)\n event = json[:event]\n authed_users = json[:authed_users]\n text = event[:text].strip\n text = text.gsub(Regexp.union(*authed_users.map {|s| \"<@#{ s }>\" }), \"\").strip\n\n json = command(text) do |progress|\n case progress\n when :start\n post(\"reactions.add\", channel: event[:channel], name: EMOJI, timestamp: event[:ts])\n when :end\n post(\"reactions.remove\", channel: event[:channel], name: EMOJI, timestamp: event[:ts])\n end\n end\n\n if json\n json[:thread_ts] = event[:thread_ts] || event[:ts] if json[:thread_ts]\n post(\"chat.postMessage\", channel: event[:channel], **json)\n end\n end",
"def reset_since_id_reply\n config[:since_id_reply] = 0\n result = client.mentions_timeline.max_by(&:id)\n update_since_id_reply(result)\n end",
"def twitt\n if PLANETOID_CONF[:twitter][:entries][:send_twitts] && self.published > self.feed.created_at\n twit=Twitter::Base.new(Twitter::HTTPAuth.new(PLANETOID_CONF[:twitter][:user], PLANETOID_CONF[:twitter][:password]))\n twit.update \"#{PLANETOID_CONF[:twitter][:entries][:prefix]} #{self.title[0..150]} #{self.url}\"\n end\n end",
"def url\n \"http://twitter.com/#{self.username}/statuses/#{self.twitter_id}\"\n end",
"def twitter(name: T.unsafe(nil), nickname: T.unsafe(nil), uid: T.unsafe(nil)); end",
"def mention\r\n return @user.mention\r\n end",
"def twitter_publish_message\n \"#NoAgenda show ##{number} attack vectors now at http://noagendadashboard.com\"\n end",
"def tweet(text)\n @followers.each do |follower|\n follower.receive_tweet(@name, text)\n end\n end",
"def write_poem\n handle = params[:handle]\n\n # query Twitter API to get source user's last 30 tweets\n # XXX\n begin\n @tweets = Twitter.user_timeline(handle, count: 30)\n rescue Twitter::Error::TooManyRequests\n puts \"Twitter API Rate Limit Exceeded\"\n @tweets = {}\n end\n # respond with JSON for user info + his last 30 tweets\n respond_to do |format|\n format.json { render json: @tweets }\n end\n end",
"def update(sender, message)\n puts \"#{self.name} received a tweet from #{sender.name}: #{message}\"\n end",
"def mention(status, *name)\n tweet(\"#{name.join('')} #{status}\")\nend",
"def last_message\n get_json('last-message.json')\n end",
"def mentioning_text\n self.text\n end",
"def twitter\n default_oauth_callback do |auth|\n # username may already be taken, user will have to enter another one\n if User.exists? username: auth.info.nickname\n redirect_to controller: '/registrations', action: 'twitter_screen_name_clash'\n else\n default_oauth_fail\n end\n end\n end",
"def mention\n \"<@#{@id}>\"\n end",
"def mentions_timeline(count, max_id, since_id, reply_depth)\n\n options = {\n :timeline_kind => :mentions,\n :count => count\n }\n self.append_official_card_parameters(options)\n options[:max_id ] = max_id if max_id\n options[:since_id] = since_id if since_id\n\n followers = self.followers()\n timeline = Tw::Timeline.compose(\n @requester,\n followers,\n reply_depth,\n options)\n tweetArray = timeline.perform()\n\n return tweetArray\n end",
"def index\n @users = User.all\n\n set_up_twitter\n\n @users.each do |user|\n tweets = @client.user_timeline(user.twitter_id, count: 5)\n user.last_tweet = tweets.first.full_text\n end\n end",
"def user_tweets(user, count=10, since_id=nil, max_id=nil)\n print \"Getting Last %d Statuses for User %s\" % [count, user.to_s]\n print \" since %s\" % since_id if since_id\n print \" until %s\" % max_id if max_id\n print \"\\n\"\n options = {:count => count, :trim_user => true, :include_rts => true, :include_entities => true}\n options[:since_id] = since_id if since_id\n options[:max_id] = max_id if max_id\n begin\n statuses = @MT.user_timeline(user, options)\n if statuses.size > 0\n status_data = statuses.map do |s|\n {\n :user_id => s.user.id,\n :created_at => s.created_at,\n :id => s.id,\n :text => s.text,\n :source => s.source,\n :truncated => s[\"truncated\"],\n :in_reply_to_user_id => s[\"in_reply_to_user_id\"],\n :in_reply_to_screen_name => s[\"in_reply_to_screen_name\"],\n :geo => s[\"geo\"],\n :coordinates => s[\"coordinates\"],\n :place => parse_place(s[\"place\"]),\n :contributors => s[\"contributors\"],\n :retweet_count => s[\"retweet_count\"],\n :entities => parse_entities(s.attrs[\"entities\"]),\n :retweeted_status => parse_retweeted_status(s[\"retweeted_status\"])\n }\n end\n status_data\n else\n []\n end\n rescue Twitter::Error::Unauthorized, Twitter::Error::Forbidden\n puts \"Failed for %s (Protected)\" % user.to_s\n []\n end\n end",
"def mentions(params = {})\n get \"statuses/mentions\", params\n end",
"def on_timeline(tweet)\n end",
"def getUserToReply\n followers = self::get_followers\n followers[:result][rand(followers[:result].length)]\n end",
"def feed\n Micropost.from_users_followed_by(self)\n end",
"def feed\n Micropost.from_users_followed_by(self)\n end",
"def feed\n # defer to Micropost.from_users_followed_by\n Micropost.from_users_followed_by(self)\n end",
"def on_tweet(tweet)\n # only interested in retweets\n return unless tweet[:retweeted_status]\n\n orig_id = tweet[:retweeted_status][:id]\n tweet[:timestamp_ms] = tweet[:timestamp_ms].to_i\n # only maintain the most recent RT received\n @rts[orig_id] = tweet\n end",
"def in_reply_to_user\n previous_tweet.try(:author).try(:screen_name) || params[:in_reply_to_user]\n end",
"def latest_tweets\n client = Twitter::REST::Client.new do |config|\n config.consumer_key = ENV[\"TWITTER_CONSUMER_KEY\"]\n config.consumer_secret = ENV[\"TWITTER_CONSUMER_SECRET\"]\n end\n\n count = params[:count] || 10\n time_line = client.user_timeline(current_user.twitter_handle, {count: count})\n current_user.update(time_fetched: current_user.time_fetched+1)\n if time_line.class == Twitter::Error::NotFound\n render json: {status: 400, success: false, message: 'Twitter handle or id not valid'}\n else\n render json: {status: 200, success: true, message: 'Success', data: time_line.map{|a| a.text}.as_json}\n end\n\n rescue => e\n Rails.logger.error \"account_controller#latest_tweets - Error: #{e.message}\"\n render json: {status: 500, success: false, message: 'Unexpected error'}\n end",
"def fetch_latest_tweets(last_id = self.tweets ? self.tweets.maximum(:twitter_id) : nil)\n options = { count: 4, include_rts: true }\n options[:since_id] = last_id if last_id\n begin\n response = twitter_connection.user_timeline(options)\n response.each do |tw_tweet|\n tweet = Tweet.find_or_initialize_by(twitter_id: tw_tweet.id)\n tweet.retweet_count = tw_tweet.retweet_count\n tweet.favorite_count = tw_tweet.favorite_count\n tweet.tweet_created_at = tw_tweet.created_at\n tweet.url = tw_tweet.url.to_s\n tweet.full_text = tw_tweet.full_text\n tweet.twitter_account_id = self.id\n tweet.save\n end\n fetch_latest_tweets( response.last.id ) if(response.last and (response.last.id != last_id))\n rescue => e\n ExceptionNotifier.notify_exception(e, {options: options.inspect, last_id: last_id.inspect})\n raise e.exception if Rails.env.development?\n end\n return true\n end",
"def tweet(bot, nick, message)\n if message.to_s.length > 0\n $log.info \"Tweeting [#{nick}] #{message}\"\n @client.update(\"#{nick} says: #{message}\")\n bot.say \"Tweeted successully, #{nick}\"\n else\n bot.say \"Please provide a message!\"\n end\n end",
"def twitter_url; \"https://twitter.com/#{twitter}\" end",
"def last_message \n messages.last\n end",
"def replying_to\n return nil unless self.reply?\n user = self.text[0...self.text.index(\" \")]\n return nil unless user[0...1] == \"@\"\n user\n end",
"def replying_to\n return nil unless self.reply?\n user = self.text[0...self.text.index(\" \")]\n return nil unless user[0...1] == \"@\"\n user\n end",
"def feed\n #This is prelim\n Micropost.from_users_followed_by(self)\n end",
"def follow_by_tag(num_to_follow, tag, tweets = [])\n # Break if recursion hits rate limit\n if (sr = self.tweet_searches_remaining) < 10 || (fl = self.follower_lookups_remaining) < 2\n p \"Returning hitting rate limit #{sr}, #{fl}\"\n return\n end\n tweets = @client.search(tag, count: 100).to_a.reverse! if tweets.count == 0\n num_to_retry = 0\n popped_tweets = tweets.pop(num_to_follow)\n popped_tweets.each do |tweet|\n remote_user = tweet.user\n screen_name = remote_user.screen_name\n twitter_id = remote_user.id\n local_user = TwitterUser.where(\n twitter_id: twitter_id, twitter_client: self.id).first_or_initialize\n if local_user.new_record? && screen_name != self.username\n local_user.tag_followed = tag\n local_user.followed_at = DateTime.now\n begin\n @client.follow(screen_name)\n p \"#{screen_name} followed\"\n local_user.save! \n update_twitter_user(local_user, remote_user, 1)\n p \"**** Following for #{self.username} --> #{screen_name}: #{tweet.text} #{tweet.created_at}\"\n rescue Exception => e\n p \"Error following #{screen_name} for #{self.username} - #{e.to_s}\"\n return\n end\n else\n num_to_retry += 1\n end\n end\n # If user has already been followed, attempt to follow another user by retrieving more tweets\n if num_to_retry > 0 && !(tweets_to_retry = tweets[num_to_retry..tweets.count]).nil?\n p \"Follow more people for #{self.username}: #{num_to_retry}\"\n follow_by_tag(num_to_retry, tag, tweets_to_retry)\n end\n p \"Done following\"\n end",
"def twitter_url(username)\n \"https://twitter.com/#!/#{username}\"\n end",
"def unfollow\n @twitter = Twitter::Client.new(\n :oauth_token => @bot.tw_token,\n :oauth_token_secret => @bot.tw_secret\n )\n\n @tweet = Tweet.find(params[:tweet])\n\n @twitter.unfollow(@tweet.tw_usuario)\n @tweet.estado = 4\n @tweet.save\n\n mensaje = \"Dejo de seguir a \" + @tweet.tw_usuario\n redirect_to(bot_tweets_path(@bot), notice: mensaje)\n end",
"def get_mentions(tweet)\n list = []\n tweet.user_mentions.each { |mention| list << mention.screen_name.downcase } if tweet.user_mentions?\n list\n end",
"def retweeted_by_me(options={})\n perform_get(\"statuses/retweeted_by_me.#{Twitter.format}\", options)\n end"
] |
[
"0.73789096",
"0.7342273",
"0.6994378",
"0.69280684",
"0.67880267",
"0.6738451",
"0.6700124",
"0.65768623",
"0.6412383",
"0.6289378",
"0.6237289",
"0.62344366",
"0.62262565",
"0.6212145",
"0.6211834",
"0.6179769",
"0.6177353",
"0.61770296",
"0.6142823",
"0.609692",
"0.60933155",
"0.6087734",
"0.6082678",
"0.6056248",
"0.60534793",
"0.60465693",
"0.599129",
"0.59456503",
"0.59440535",
"0.5941569",
"0.593328",
"0.5920647",
"0.590172",
"0.5896641",
"0.5877061",
"0.5869346",
"0.5863737",
"0.5856179",
"0.58491206",
"0.5842678",
"0.5832069",
"0.5825564",
"0.580131",
"0.57984686",
"0.57800764",
"0.577008",
"0.5759449",
"0.5749879",
"0.57481354",
"0.57465273",
"0.5744267",
"0.5744267",
"0.5744267",
"0.5744267",
"0.5744267",
"0.5744267",
"0.5744267",
"0.5744267",
"0.57418853",
"0.5740096",
"0.5730169",
"0.5728837",
"0.5728286",
"0.57098573",
"0.5708791",
"0.5707411",
"0.56946534",
"0.5694039",
"0.5693259",
"0.5691692",
"0.5683054",
"0.56727374",
"0.5666761",
"0.5662331",
"0.56601024",
"0.5657449",
"0.565102",
"0.5649201",
"0.5647962",
"0.5647684",
"0.56449026",
"0.5642711",
"0.56348664",
"0.5629228",
"0.5629228",
"0.56276166",
"0.56242573",
"0.56204015",
"0.5620013",
"0.5585096",
"0.5583898",
"0.5579422",
"0.5578629",
"0.557677",
"0.557677",
"0.5575568",
"0.5574284",
"0.55683655",
"0.5563396",
"0.55620277",
"0.5560165"
] |
0.0
|
-1
|
convert ip addresses. convert strings to ints
|
def clean_row(row)
row = row.to_hash
row['raw_ip_incoming'] = IPAddr.new(row['raw_ip_incoming']).to_i
row['raw_ip_outgoing'] = IPAddr.new(row['raw_ip_outgoing']).to_i
%w[port_incoming port_outgoing protocol num_packets_incoming
size_packets_incoming num_packets_outgoing size_packets_outgoing].each do |col|
row[col] = row[col].to_i
end
row
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def ip_to_int32(ip)\n ip = ip.split('.')\n result = 0\n ip.reverse.each_with_index do |i, index|\n result += i.to_i*2**(8*(index))\n end\n return result\nend",
"def ToInteger(ip)\n # FIXME: Check4, also to Compute*\n l = Builtins.maplist(Builtins.splitstring(ip, \".\")) do |e|\n Builtins.tointeger(e)\n end\n Ops.add(\n Ops.add(\n Ops.add(\n Ops.get_integer(l, 3, 0),\n Ops.shift_left(Ops.get_integer(l, 2, 0), 8)\n ),\n Ops.shift_left(Ops.get_integer(l, 1, 0), 16)\n ),\n Ops.shift_left(Ops.get_integer(l, 0, 0), 24)\n )\n end",
"def to_integer\n ip_address.to_i\n end",
"def to_i\n return @ip_int unless (@ip_int.nil?);\n Iptools.dots_to_i(@dots)\n end",
"def str2ipaddr(str, delim = '.')\n ipaddr = 0\n str.split(delim).each {|o| ipaddr *= 256; ipaddr += o.to_i}\n\n return ipaddr\nend",
"def ip_int(ip=nil)\n\t\tif ip==nil\n\t\t\treturn FALSE\n\t\tend\n\t\tip_int = 0\n\t\toctets = ip.split('.')\n\t\t(0..3).each do |x|\n\t\t\toctet = octets.pop.to_i\n\t\t\toctet = octet << 8*x\n\t\t\tip_int = ip_int | octet\n\t\tend\n\t\treturn ip_int\n\tend",
"def ip_int(ip=nil)\n\t\treturn FALSE if ip==nil\n\t\tip_int = 0\n\t\toctets = ip.split('.')\n\t\t(0..3).each do |x|\n\t\t\toctet = octets.pop.to_i\n\t\t\toctet = octet << 8*x\n\t\t\tip_int = ip_int | octet\n\t\tend\n\t\treturn ip_int\n\tend",
"def ip_parts(ip)\n ip.split(\".\").map { |i| i.to_i }\n end",
"def IPAddress(str)\n IPAddress::parse str\nend",
"def IPAddress(str)\n IPAddress::parse str\nend",
"def int2ip(intip)\n ip_segments = [3, 2, 1, 0].map { |i| (intip & (255 << i*8)) >> i*8 }\n (ip_str= ip_segments.join('.')) =~ IP_REGEXP ? ip_str : ''\n end",
"def convert_To_Int( string_of_ints )\n string_of_ints.split(\" \").map { |s| s.to_i }\nend",
"def ip_to_nip(ip)\n nip = []\n ip.split(\".\").each{|x| nip << x.to_i}\n return nip\n end",
"def getIpFromNum(ii)\n \"172.31.0.#{100+ii}\"\nend",
"def typecast_value_ipaddr(value)\n case value\n when IPAddr\n value\n when String\n IPAddr.new(value)\n else\n raise Sequel::InvalidValue, \"invalid value for inet/cidr: #{value.inspect}\"\n end\n end",
"def typecast_value_ipaddr(value)\n case value\n when IPAddr\n value\n when String\n IPAddr.new(value)\n else\n raise Sequel::InvalidValue, \"invalid value for inet/cidr: #{value.inspect}\"\n end\n end",
"def add_number(ip_string)\n numbers = ip_string.split('.')#guardamos en un arreglo los valores de la ip\n last_number = numbers.pop #obtenemos la ultima seccion de la ip y la sacamos del arreglo\n numbers << (last_number.to_i + 1) #le sumamos 1 y lo agregamos al arreglo\n return numbers.join('.') #retornamos la nueva ip\n end",
"def ipsBetween(start, ending)\n def parse_to_array(num)\n num = num.split(\".\")\n num.each_index {|index| num[index] = num[index].to_i }\n end\n \n start = parse_to_array(start)\n ending = parse_to_array(ending)\n diff_3 = ending[3]- start[3]\n diff_2 = 256*(ending[2]-start[2])\n diff_1 = 65536*(ending[1]-start[1])\n diff_0 = 16777216*(ending[0]-start[0])\n total = diff_3 + diff_2 + diff_1 + diff_0 \nend",
"def ip2long(ip)\n long = 0\n ip.split( /\\./ ).reverse.each_with_index do |x, i|\n long += x.to_i << ( i * 8 )\n end\n long\n end",
"def ip2long(ip)\n long = 0\n ip.split(/\\./).reverse.each_with_index do |x, i|\n long += x.to_i << (i * 8)\n end\n long\n end",
"def is_an_ip_number?(str_array)\n new_array = str_array.map do |str| \n if str.to_i >= 0 && str.to_i <= 255\n true\n else\n false\n end\n end\nend",
"def is_an_ip_number?(input_str)\n input_str.to_i.between?(0,255)\nend",
"def to_ranges(ips)\n\t\t\t ips = ips.map {|ip| IPAddr.new(ip).to_i }.uniq.sort\n\n\t\t\t prev = ips[0]\n\t\t\t ips\n\t\t\t .slice_before {|e|\n\t\t\t prev2, prev = prev, e\n\t\t\t prev2 + 1 != e\n\t\t\t }\n\t\t\t .map {|addrs| if addrs.length > 1 then [addrs[0], addrs[-1]] else addrs end }\n\t\t\t .map {|addrs| addrs.map{|ip| IPAddr.new(ip, Socket::AF_INET)}.join(\" - \") }\n\t\t\tend",
"def ip_from_num(i)\n \"192.168.90.#{i+IP_OFFSET}\"\nend",
"def iptonum(ip) #:nodoc:\n if (ip.kind_of?(String) &&\n ip =~ /^([0-9]+)\\.([0-9]+)\\.([0-9]+)\\.([0-9]+)$/)\n ip = be_to_ui(Regexp.last_match().to_a.slice(1..4))\n else\n ip = ip.to_i\n end\n\n return ip\n end",
"def normalize_ip(ip)\n case ip\n when nil then nil\n when String then IPAddr.new(ip)\n when Integer then IPAddr.new(ip, Socket::AF_INET)\n when IPAddr then ip\n else raise ArgumentError, \"IP must be a String, IPAddr, or Integer, not: #{ip.inspect}\"\n end\n end",
"def ints\n strs.map(&:to_i)\n end",
"def is_an_ip_number?(ip_string)\n /^([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])$/.match?(ip_string)\nend",
"def read_x(str)\n\t\t\taddr = IPAddr.new(str).to_i\n\t\t\tself[:a1]=Int32.new(addr >> 96)\n\t\t\tself[:a2]=Int32.new((addr & 0x00000000ffffffff0000000000000000) >> 64)\n\t\t\tself[:a3]=Int32.new((addr & 0x0000000000000000ffffffff00000000) >> 32)\n\t\t\tself[:a4]=Int32.new(addr & 0x000000000000000000000000ffffffff)\n\t\t\tself\n\t\tend",
"def int32_to_ip(num)\n return '0.0.0.0' if num == 0\n n = num.to_s(2) # binary version of 32-bit num\n ip = ''\n [0, 8, 16, 24].each do |x|\n ip += \"#{n[x..x + 7].to_i(2)}.\" # decimal version of 8 bit chunk\n end\n ip[0..-2]\nend",
"def parse_ip(ip)\n\t\tif (ip.include?(\":\"))\n\t\t\treturn IPv6.parse(ip)\n\t\tend\n\t\treturn IPv4.parse(ip)\n\tend",
"def to_ipaddr\n unless ip_addr?\n lookup = `host #{to_s} | grep address`.split(/\\s+/)\n return to_s unless lookup.length == 4\n lookup[3]\n else \n to_s\n end\n end",
"def string_to_integer(string)\nend",
"def initialize(in_ip, in_v=4)\n \n if in_ip.is_a?(String)\n @version = Ip.version(in_ip)\n @ip_string = in_ip\n elsif in_ip.is_a?(Integer)\n if in_ip > Ip::IPMAX_V4\n @version = 6\n else\n @version = in_v\n end\n @ip_string = Iptools.i_to_dots(in_ip, @version)\n else\n raise RuntimeError, \"Invalid IP addresse #{in_ip} (should be a string or an interger)\"\n end\n \n @dots = Ip.valid?(@ip_string, @version)\n \n raise RuntimeError, \"Invalid IP addresse #{in_ip}\" if (@dots.nil?)\n @ip_int = to_i\n end",
"def ip_string(ipint)\n octets = []\n 4.times do\n octet = ipint & 0xFF\n octets.unshift(octet.to_s)\n ipint = ipint >> 8\n end\n ip = octets.join('.')\n\t\treturn ip\n\tend",
"def ip_string(ipint)\n octets = []\n 4.times do\n octet = ipint & 0xFF\n octets.unshift(octet.to_s)\n ipint = ipint >> 8\n end\n ip = octets.join('.')\n\t\treturn ip\n\tend",
"def arp_src_ip= i; typecast \"arp_src_ip\", i; end",
"def parse_range r\n if m = $IPA.match(r)\n a = digits_to_int m[1], 0, 0, 0\n b = digits_to_int m[1], 255, 255, 255\n elsif m = $IPB.match(r)\n a = digits_to_int m[1], m[2], 0, 0\n b = digits_to_int m[1], m[2], 255, 255\n elsif m = $IPC.match(r)\n a = digits_to_int m[1], m[2], m[3], 0\n b = digits_to_int m[1], m[2], m[3], 255\n elsif m = $IPD.match(r)\n a = digits_to_int m[1], m[2], m[3], m[4]\n b = a\n elsif m = $IPRANGE.match(r)\n a = digits_to_int m[1], m[2], m[3], m[4]\n b = digits_to_int m[5], m[6], m[7], m[8]\n elsif m = $CIDR.match(r)\n ip = digits_to_int m[1], m[2], m[3], m[4]\n bits = m[5].to_i\n lobits = (2 ** (32-bits)) - 1\n hibits = (0xffffffff) ^ lobits\n\n a = ip & hibits\n b = a | lobits\n else\n raise \"can't parse IP range #{r.inspect}\"\n end\n [a, b]\nend",
"def to_ints(hex)\n hex.scan(/\\w\\w/).map(&:hex)\nend",
"def dot_separated_ip_address?(input_string)\n is_an_ip_number?(input_string.split(\".\"))\nend",
"def string_to_integer(str)\n str.to_i\nend",
"def convert_to_integer\n @valid = false\n DIGIT_DATA.each do |integer,data|\n if string == data['string']\n @integer = integer\n @valid = true\n end\n end\n end",
"def parse(parseme)\n\t\treturn nil if not parseme\n\t\tranges = []\n\t\tparseme.split(', ').map{ |a| a.split(' ') }.flatten.each { |arg|\n\t\t\tif arg.include?(\"/\")\n\t\t\t\t# Then it's CIDR notation and needs special case\n\t\t\t\treturn false if arg =~ /[,-]/ # Improper CIDR notation (can't mix with 1,3 or 1-3 style IP ranges)\n\t\t\t\treturn false if arg.scan(\"/\").size > 1 # ..but there are too many slashes\n\t\t\t\tip_part,mask_part = arg.split(\"/\")\n\t\t\t\treturn false if ip_part.nil? or ip_part.empty? or mask_part.nil? or mask_part.empty?\n\t\t\t\treturn false if mask_part !~ /^[0-9]{1,2}$/ # Illegal mask -- numerals only\n\t\t\t\treturn false if mask_part.to_i > 32 # This too -- between 0 and 32.\n\t\t\t\tbegin\n\t\t\t\t\tRex::Socket.addr_atoi(ip_part) # This allows for \"www.metasploit.com/24\" which is fun.\n\t\t\t\trescue Resolv::ResolvError\n\t\t\t\t\treturn false # Can't resolve the ip_part, so bail.\n\t\t\t\tend\n\n\t\t\t\texpanded = expand_cidr(arg)\n\t\t\t\tif expanded\n\t\t\t\t\tranges += expanded\n\t\t\t\telse\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\telsif arg.include?(\":\")\n\t\t\t\t# Then it's IPv6\n\t\t\t\t# Can't really do much with IPv6 right now, just return it and\n\t\t\t\t# hope for the best\n\t\t\t\taddr = Rex::Socket.addr_atoi(arg)\n\t\t\t\tranges.push [addr, addr, true]\n\t\t\telsif arg =~ /[^-0-9,.*]/\n\t\t\t\t# Then it's a domain name and we should send it on to addr_atoi\n\t\t\t\t# unmolested to force a DNS lookup.\n\t\t\t\taddr = Rex::Socket.addr_atoi(arg)\n\t\t\t\tranges.push [addr, addr]\n\t\t\telsif arg =~ /^([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)-([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)$/\n\t\t\t\t# Then it's in the format of 1.2.3.4-5.6.7.8\n\t\t\t\t# Note, this will /not/ deal with DNS names, or the fancy/obscure 10...1-10...2\n\t\t\t\tbegin \n\t\t\t\t\taddrs = [Rex::Socket.addr_atoi($1), Rex::Socket.addr_atoi($2)]\n\t\t\t\t\treturn false if addrs[0] > addrs[1] # The end is greater than the beginning.\n\t\t\t\t\tranges.push [addrs[0], addrs[1]]\n\t\t\t\trescue Resolv::ResolvError # Something's broken, forget it.\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\telse\n\t\t\t\texpanded = expand_nmap(arg)\n\t\t\t\tif expanded\n\t\t\t\t\tranges += expanded\n\t\t\t\telse\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\tend\n\t\t}\n\n\t\treturn ranges\n\tend",
"def is_an_ip_number?(word)\n word.to_i.to_s == word && (word.to_i >= 0 && word.to_i <= 255)\nend",
"def is_an_ip_number?(word)\n word.to_i.to_s == word && (word.to_i >= 0 && word.to_i <= 255)\nend",
"def valid_ip?(string)\n decimal_counter = 0\n range_counter = 0\n\n strArray = string.split('')\n strArray.each do |char|\n if char == '.'\n decimal_counter += 1\n end\n end\n\n numArray = string.split('.')\n numArray.each do |int|\n int = int.to_i\n if int >= 0 && int <= 255\n range_counter += 1\n else\n return\n end\n end\n\n if decimal_counter == 3 && range_counter == 4\n p \"true\"\n return true\n else\n p \"false\"\n return false\n end\nend",
"def to_ints(hex)\n r,g,b = hex.scan(/\\w\\w/)\n [r,g,b].map do |s|\n s.hex\n end\nend",
"def an_ip_number?(element)\n element.to_i >= 0 && element.to_i <= 255\nend",
"def valid_ip?(string)\n string.split(\".\").each do |num_str|\n num = num_str.to_i\n return false if num < 0 || num > 255\n end\n true\nend",
"def valid_ip?(str)\n str_arr = str.split(\".\");\n return false if str_arr.length != 4\n\n str_arr.each do |el|\n return false unless el.match(/^\\d{0,3}$/) && el.to_i >= 0 && el.to_i <= 255\n end\n return true \nend",
"def icmp_code=(i); typecast i; end",
"def icmp_code=(i); typecast i; end",
"def arp_dest_ip= i; typecast \"arp_dest_ip\", i; end",
"def transform\n unless is_valid_ipv4_address?\n raise Valshamr::InvalidIPv4Error, \"Expected IPv4 address in the form of x[xx].x[xx].x[xx].x[xx], but received: #{@ip_address}.\"\n end\n\n octets = @ip_address.split \".\"\n octets.map! { |octet| convert_decimal_octet_to_hexadecimal octet.to_i }\n\n new_ip = construct_hexadecimal_portions octets\n\n \"::#{new_ip}\"\n end",
"def string_to_integer(str)\n return str.to_i\nend",
"def sortIPs(ips, localip)\n localip_i = IPAddr.new(localip).to_i\n\n # Near as I can tell Resolv::IPv4 doesn't have a .to_i or equivalent\n return ips.sort_by { |ip| (IPAddr.new(ip.to_s).to_i - localip_i).abs }\nend",
"def valid_ip(ip)\n ip.split('.').map(&:to_i).select {|x| x.between?(0,255)}.count == 4\nend",
"def parse_int(bytes)\n if bytes.is_a?(Array) then bytes = bytes.join end\n bytes.unpack('H*')[0].scan(/../).reverse.join.to_i(16)\nend",
"def test_normalize_issue_3\n input = <<EOF.split(\"\\n\")\n65.96.66.64\n65.96.66.64\n65.96.66.66\n65.96.66.66\n65.96.66.67\n65.96.66.68\n65.96.66.69\n65.96.66.69\n65.96.66.72\n65.96.66.71\n65.96.66.71\nEOF\n assert_equal(['65.96.66.64', '65.96.66.66', '65.96.66.67',\n '65.96.66.68', '65.96.66.69', '65.96.66.71',\n '65.96.66.72'],\n NormalizeIPList.normalize_text(input))\n end",
"def ip\n @ip ||= select { |type,value| type == :ip }.map do |(type,value)|\n IPAddr.new(value)\n end\n end",
"def string_to_integer(string)\n digits = string.chars.map(&:to_i)\n value = 0\n digits.each do |digit|\n value = 10 * value + digit\n end\n value\nend",
"def to_ints(hex)\n r = hex[1..2]\n g = hex[3..4]\n b = hex[5..6]\n ints = []\n [r,g, b].each do |s|\n ints ,< s.to_hexend\n end\n ints\nend",
"def fetch_ip_address(first_ip, i)\n array = first_ip.split('.')\n change = (array.first 3).push(array[-1].to_i + i)\n new_ip = \"\"\n for i in change\n new_ip += \".\" + i.to_s\n end\n return new_ip[1..-1]\nend",
"def parse_integer(int_string)\n Integer(int_string)\n end",
"def valid_ip?(str)\n return false unless str =~ /^\\d+(\\.\\d+){3}$/\n nums = str.split(\".\").map(&:to_i)\n nums.all? {|num| num >= 0 && num <= 255}\nend",
"def to_integer(input); end",
"def ip_class(ip)\n\t\tipclass = ''\n\t\tipclass = 'A' if (ip_int(\"10.0.0.0\")..ip_int(\"127.255.255.255\")) === ip_int(ip)\n\t\tipclass = 'B' if (ip_int(\"128.0.0.0\")..ip_int(\"191.255.255.255\")) === ip_int(ip)\n\t\tipclass = 'C' if (ip_int(\"192.0.0.0\")..ip_int(\"223.255.255.255\")) === ip_int(ip)\n\t\tipclass = 'D' if (ip_int(\"224.0.0.0\")..ip_int(\"239.255.255.255\")) === ip_int(ip)\n\t\tipclass = 'E' if (ip_int(\"240.0.0.0\")..ip_int(\"255.255.255.255\")) === ip_int(ip)\n\t\treturn ipclass\n\tend",
"def ip_class(ip)\n\t\tipclass = ''\n\t\tipclass = 'A' if (ip_int(\"10.0.0.0\")..ip_int(\"127.255.255.255\")) === ip_int(ip)\n\t\tipclass = 'B' if (ip_int(\"128.0.0.0\")..ip_int(\"191.255.255.255\")) === ip_int(ip)\n\t\tipclass = 'C' if (ip_int(\"192.0.0.0\")..ip_int(\"223.255.255.255\")) === ip_int(ip)\n\t\tipclass = 'D' if (ip_int(\"224.0.0.0\")..ip_int(\"239.255.255.255\")) === ip_int(ip)\n\t\tipclass = 'E' if (ip_int(\"240.0.0.0\")..ip_int(\"255.255.255.255\")) === ip_int(ip)\n\t\treturn ipclass\n\tend",
"def valid_ip?(address)\n address.is_a?(String)? validate_number_count(address) : false\nend",
"def valid_ip?(string)\n return false unless string =~ /^\\d+(\\.\\d+){3}$/\n nums = string.split('.').map(&:to_i)\n nums.all? { |num| num >= 0 && num <= 255 }\nend",
"def Atoi(args)\n\t\tparse(args)\n\t\t\t.verify\n\t\t\t.atoi\n\tend",
"def string_to_integer(string)\n \n digit_array = string.chars.map do |digit|\n digit = DIGITS[digit]\n end\n \n converted_string = 0\n \n digit_array.each do |digit|\n converted_string = converted_string * 10 + digit\n end\n \n converted_string\nend",
"def toNumbers(strList)\n strList.each do |i|\n \ti.to_i\n end\nend",
"def from_human(str)\n return self if str.nil?\n\n m = str.match(IPV4_ADDR_REGEX)\n if m\n self[:a1].read m[1].to_i\n self[:a2].read m[2].to_i\n self[:a3].read m[3].to_i\n self[:a4].read m[4].to_i\n end\n self\n end",
"def cidr_2_ips (cidr)\n\t\tputs \"Method to convert a CIDR block into a list of IPs: #{cidr}\" if @verbose\n\t\tbegin\n\t\t\tcidr4 = NetAddr::CIDR.create(cidr)\n\t\t\tips = cidr4.enumerate(:Limit => 0, :Bitstep => 1)\n\t\t\t#ips2 = ips.slice!(1, (ips.length-2))\n\t\t\treturn ips\n\t\trescue => ee\n\t\t\tputs \"Exception on method #{__method__}: #{ee}\" if @verbose\n\t\t\treturn nil\n\t\tend\n\tend",
"def ip=(i)\n raise ArgumentError, \"ip must be a string\" unless i.is_a?(String)\n #\n # Use ipaddr to sanitize our IP.\n #\n IPAddr.new(i)\n @ip = i\n end",
"def parse(data)\n super data\n @ip_address = data[0..3].to_ip\n @subnet_mask = data[4..7].to_ip\n @standard_gateway = data[8..11].to_ip\n end",
"def string_to_integer(string)\n\n\tnumbers = {'0' => 0, '1' => 1, '2' => 2, '3' => 3, '4' => 4, '5' => 5,\n\t\t\t\t'6' => 6, '7' => 7, '8' => 8, '9' => 9 }\n\n\tarray = string.chars.map do |n|\n\t\tnumbers[n]\n\tend\n\n\tarray.inject(0){ |total, num| total * 10 + num}\n\nend",
"def string_to_integer(string)\n\n\tnumbers = {'0' => 0, '1' => 1, '2' => 2, '3' => 3, '4' => 4, '5' => 5,\n\t\t\t\t'6' => 6, '7' => 7, '8' => 8, '9' => 9 }\n\n\tarray = string.chars.map do |n|\n\t\tnumbers[n]\n\tend\n\n\tarray.inject(0){ |total, num| total * 10 + num}\n\nend",
"def host_2_ips (hostname)\n\t\tbegin\n\t\t\tips=Array.new\n\t\t\tif is_ip?(hostname)\n\t\t\t\tips.push(hostname)\n\t\t\t\treturn ips\n\t\t\telse\n\t\t\t\tips = Resolv.getaddresses(hostname)\n\t\t\t\tif (ips.empty?) then\n\t\t\t\t\tputs \"Failed to resolve #{hostname}\" if @verbose\n\t\t\t\t\treturn nil\n\t\t\t\telse\n\t\t\t\t\treturn ips\n\t\t\t\tend\n\t\t\tend\n\t\trescue => ee\n\t\t\tputs \"Exception on method host_2_ips for host #{hostname}: #{ee}\" if @verbose\n\t\t\treturn nil\n\t\tend\n\tend",
"def valid_ip?(string)\n return false unless string =~ /\\d{0,3}\\.\\d{0,3}\\.\\d{0,3}\\.\\d{0,3}/\n\n string.split(\".\").each do |sub_str|\n if !sub_str.to_i.between?(0, 255)\n return false\n end\n end\n\n return true\nend",
"def get_ip(remote_address)\n return \"\" unless remote_address\n\n #Capture the first three octects of the IP address and replace the forth\n #with 0, e.g. 124.455.3.123 becomes 124.455.3.0\n regex = /^([^.]+\\.[^.]+\\.[^.]+\\.).*/\n if matches = remote_address.scan(regex)\n return matches[0][0] + \"0\"\n else\n return \"\"\n end\nend",
"def find_good_ip_addr list\n list.each do |addr|\n triplets = addr.split('.')\n if not triplets[0].to_i == 255 and not triplets[2].to_i == 255\n return addr\n end\n end\n nil\nend",
"def string_to_integer2(string)\n digits = string.chars.map { |char| HASH[char] }\n\n value = 0\n digits.each { |digit| value = 10 * value + digit }\n value\nend",
"def stringArray_to_IntegerArray stringArray\n\n integerArray = Array.new\n\n stringArray.each do |str_int|\n countDot = str_int.count('.')\n if countDot == 1\n puts \"#{str_int} should be integer, single dot is not valid range\"\n elsif countDot == 2\n elements = str_int.split('..')\n range_newTwo = Range.new(elements[0].to_i, elements[1].to_i)\n range_newTwo.to_a.each do |single|\n integerArray << single.to_i\n end\n elsif countDot == 3\n elements = str_int.split('...')\n range_newThree = Range.new(elements[0].to_i, elements[1].to_i - 1)\n range_newThree.to_a.each do |singleThree|\n integerArray << singleThree.to_i\n end\n elsif countDot > 3\n puts \"#{str_int} should be valid range. Too many dots between number.\"\n else\n integerArray << str_int.to_i\n end\n end\n return integerArray\n end",
"def string_to_integer(string)\n digits = string.chars.map { |digit| MATCH[digit] }\n\n value = 0\n digits.each { |digit| value = 10 * value + digit }\n value\nend",
"def valid_ip?(address)\n #ternary that validates number count if string or returns false\n address.is_a?(String) ? validate_number_count(address) : false\nend",
"def icmp_sum=(i); typecast i; end",
"def icmp_sum=(i); typecast i; end",
"def parse_iprange(iprange)\n\tipadd = Rex::Socket::RangeWalker.new(iprange)\n\tiplst = []\n\tipadd.each { |ip|\n\t\tiplst.push \"#{ip}\"\n\t}\n\treturn iplst\nend",
"def GetIpFromId(id)\n \"192.168.0.#{id+1}\"\n end",
"def dot_seperated_ip_address?(input_string)\n numbers = input_string.split('.')\n return false if numbers.size != 4\n\n numbers.each do |num|\n return false if is_an_ip_number?(num) == false\n end\n true\nend",
"def string_to_integer(string, numbers)\n str_nums = string.chars.reverse\n number = 0\n str_nums.each_with_index do |num, index|\n number += numbers[num] * 10**(index)\n end\n number\nend",
"def parse(input)\n input.split(\"\\n\").map do |line|\n from, to = line.split('/')\n [from.to_i, to.to_i]\n end\nend",
"def ipv6_src=(i); typecast i; end",
"def icmp_type=(i); typecast i; end",
"def icmp_type=(i); typecast i; end",
"def str_to_ints(str)\n str.chars.map{|c| c == ' ' ? c : c.ord - 64 }\nend",
"def valid_ip?(str)\n nums = str.split(\".\").map(&:to_i)\n return false if nums.size != 4\n nums.all? { |num| num >= 0 && num <= 255 }\nend",
"def in_addr(addr)\n if addr =~ /^(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)$/\n (($1.to_i << 24) + ($2.to_i << 16) + ($3.to_i << 8) + ($4.to_i))\n else\n nil\n end\n end",
"def as_integer(string)\n string.gsub(/[\\n ]+/, \"\").to_i\n end"
] |
[
"0.71787417",
"0.71732455",
"0.71136904",
"0.6882757",
"0.6868919",
"0.6793419",
"0.67600214",
"0.6749769",
"0.67351824",
"0.67351824",
"0.67044795",
"0.66637635",
"0.663616",
"0.6389581",
"0.63715035",
"0.63715035",
"0.63497484",
"0.6286986",
"0.61913276",
"0.61735284",
"0.61605555",
"0.61540294",
"0.6133971",
"0.6116872",
"0.6041443",
"0.6009279",
"0.59661925",
"0.5957409",
"0.59452736",
"0.5928893",
"0.5927629",
"0.5925195",
"0.5906175",
"0.59037024",
"0.5896306",
"0.5896306",
"0.58290976",
"0.5804488",
"0.57857317",
"0.57856494",
"0.5776514",
"0.5746589",
"0.5738955",
"0.5733668",
"0.5733668",
"0.57280755",
"0.5702779",
"0.5694799",
"0.56650573",
"0.56465304",
"0.5625618",
"0.5625618",
"0.5619465",
"0.56082416",
"0.55849695",
"0.55810434",
"0.5577363",
"0.5571895",
"0.55505455",
"0.5534812",
"0.55335075",
"0.5527681",
"0.5525277",
"0.552273",
"0.5516211",
"0.55095196",
"0.5499869",
"0.5499869",
"0.54942423",
"0.54896253",
"0.5485111",
"0.54801726",
"0.547173",
"0.54700345",
"0.54699624",
"0.5461954",
"0.54617447",
"0.5456964",
"0.5456964",
"0.54520416",
"0.5451924",
"0.544769",
"0.544464",
"0.54424846",
"0.54424834",
"0.5441224",
"0.5431143",
"0.5426865",
"0.5426865",
"0.5402576",
"0.53903747",
"0.53895336",
"0.5381895",
"0.5379781",
"0.5370504",
"0.53693676",
"0.53693676",
"0.5359031",
"0.5357669",
"0.5351574",
"0.5344452"
] |
0.0
|
-1
|
keep only those values in a hash that the particular model can hold
|
def remove_extras(hash, model)
hash.reject do |key,value|
# puts !(model.column_names.include?(key.to_s))
!(model.column_names.include?(key.to_s))
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def cleanse\n select { |_k, v| v }\n end",
"def trim_params(params)\n Hash[*(params.select { |k,v| new.attributes.keys.include? k.to_s}.flatten)] \n end",
"def clean_unwanted_keys(hash)\r\n ignored_keys = [:only_path, :use_route]\r\n hash.dup.delete_if{|key,value| ignored_keys.include?(key)}\r\n end",
"def clean_up(attr_values_hash_of_hash)\n\t\tattr_values = Hash.new\n\t\tattr_values_hash_of_hash.each do |bad_key,good_hash|\n\t\t\tattr_values.merge!(good_hash)\n\t\tend\n\t\treturn attr_values\n\tend",
"def except(*keys)\n common = keys & self.class.required_attributes\n\n if common.empty?\n self.class.new(@hash.except(*keys))\n else\n to_hash.except(*keys)\n end\n end",
"def cleanup\n datas[:model_feature_values].each_pair { |model_key, feature_values| \n model = Model.find(model_key)\n feature_keys = []\n model.features_list { |feature| feature_keys << feature.key }\n values(model).delete_if { |feature_key, value| !feature_keys.include?(feature_key) }\n }\n end",
"def serializable_hash\n all = super\n attrs_to_serialize = filtered_attributes(all.keys, scope)\n all.slice(*attrs_to_serialize)\n end",
"def remove_non_permitted_booking_attrs hash\n hash[:booking].delete_if {|k,v| k.to_s.in? %w(id hotel_id encrypted_cc_number encrypted_cc_cvv state customer_id rate discounted_rate created_at updated_at guid paid total) }\n hash\n end",
"def serializable_hash\n attrs = self.class._attributes.dup.keys\n\n # Inclusive fields.\n if @opts[:only].present? || @opts[:fields].present?\n (@opts[:only] ||= []).concat(@opts[:fields] ||= [])\n attrs = (attrs & @opts[:only].map(&:to_sym))\n # Exclusive fields.\n elsif @opts[:exclude].present?\n attrs = (attrs - @opts[:exclude].map(&:to_sym))\n end\n\n filter_attributes(attrs)\n end",
"def remove_excluded_attributes!(hash)\n hash.each do |attr, val|\n if attr.in?(EXCLUDED_ENTITY_ATTRIBUTES)\n hash.delete(attr)\n elsif val.is_a? Array\n val.each {|v| remove_excluded_attributes!(v) if v.is_a?(Hash) }\n elsif val.is_a? Hash\n remove_excluded_attributes!(val)\n end\n end\n end",
"def exclude_attrs(hash, attrs, must_exclude, associations)\n exclude = attrs + associations + must_exclude\n hash.except(*exclude)\n end",
"def to_hash\n super.reject { |_k, v| v.nil? }\n end",
"def unmatched_keys; end",
"def delete_all_keys_except(hash_record, except_array = [])\n hash_record.select do |key|\n except_array.include?(key)\n end\n end",
"def serializable_hash(*)\n\n excludes = ['id', 'created_at', 'updated_at', 'from_searcher', 'searcher_key']\n output = super.except(*excludes)\n output.merge!(search_data) if search_data\n\n # Flatten the extra data fields into output\n return output\n\n end",
"def clean_hash hash\n hash ||= {}\n hash = hash.map do |k,v|\n if v.is_a? Hash\n [k,clean_hash(v)]\n else\n [k,v]\n end\n end\n hash = Hash[hash]\n Hash[hash.select do |k,v|\n if v.is_a? Hash\n v.size > 0\n else\n v.present?\n end\n end]\n end",
"def filter_attempt_hash( hash, threshold = 1 )\n keepers = {}\n hash.each do |k,v|\n keepers[k] = v if v.length >= threshold\n end\n keepers\nend",
"def valid_attributes\n hash = @time_record.attributes.reject {|k,v| %w{id user_id pay_period_id created_at updated_at}.include?(k)}\n end",
"def filter_attributes(record)\n self.changed_keys ||= []\n if !record.auditable_attributes.nil?\n self.changed_keys &= record.auditable_attributes\n end\n if !record.unauditable_attributes.nil?\n self.changed_keys -= record.unauditable_attributes\n end\n self.changed_keys -= %w{updated_at created_at _id}\n self.changed_keys\n end",
"def reject\n hsh = ::Archetype::Hash.new\n self.each do |key, value|\n hsh[key] = value unless yield(key, value)\n end\n return hsh\n end",
"def reject\n hsh = ::Archetype::Hash.new\n self.each do |key, value|\n hsh[key] = value unless yield(key, value)\n end\n return hsh\n end",
"def except(dict)\n Ohm::Set.new(\n model, namespace, [:SDIFF, key, [:SUNION, *model.filters(dict)]]\n )\n end",
"def raw_model_values(model)\n values = {}\n prohibited = [:id, :created_at, :updated_at]\n model.class.attributes.each do |attr|\n v = model.send(\"#{attr}\") unless prohibited.include?(attr)\n values[attr] = v if v\n end\n values\n end",
"def pub_hash_reject\n pub_ids = publication.pub_hash[:identifier] || []\n pub_ids.reject { |id| id[:type] == identifier_type }\n end",
"def filter_params(params)\n attributes = self.class._attributes\n params.keep_if {|name, value|\n attributes.key?(name)\n }\n end",
"def filter_params(params)\n attributes = self.class._attributes\n params.keep_if {|name, value|\n attributes.key?(name)\n }\n end",
"def hash_without_ids\n hash = self.to_h\n hash.delete('Id')\n hash['Statement'].each do |statement|\n statement.delete('Sid')\n end\n hash\n end",
"def hash\n [model, pk.nil? ? @values.sort_by{|k,v| k.to_s} : pk].hash\n end",
"def find_unique all_hash\n unique = []\n\n all_hash.each_pair do |full_name, cm|\n unique << cm if full_name == cm.full_name\n end\n\n unique\n end",
"def deep_simplify_record(hash, keep)\n hash.keep_if do |key, value|\n if value.is_a?(Hash)\n deep_simplify_record(value, keep)\n else\n keep.include?(key) \n end\n end\nend",
"def attributes_without_encrypted_values\n attributes_with_decrypted_values.except *eager_load_conductors.map(&:encrypted_attribute)\n end",
"def prune!(hash)\n hash.delete_if do |key, value|\n if is_liu_id? key, value\n fix_liu_id! value\n end\n\n prune!(value) if value.is_a?(Hash)\n value.nil? || (value.respond_to?(:empty?) && value.empty?)\n end\n end",
"def duck_type_hash_values(hash)\n hash.inject(HashWithIndifferentAccess.new) do |corrected_hash, hash_entry|\n key = hash_entry.first\n value = hash_entry.last\n model_attribute = model_attributes[key.to_sym] || {}\n value = ActiveModel::Attributes.convert_to(model_attribute[:type], value) unless value.nil? && model_attribute[:allow_nil]\n corrected_hash[key] = value\n corrected_hash\n end\n end",
"def compact\n reject{|key,val| val.nil? }\n end",
"def clean_dirty_attributes!\n @dirty_attribute_keys = []\n end",
"def filter_hash(options, exclude=[])\n ex = exclude.inject({}) {|h,k| h[k.to_s] = true; h }\n options.inject({}) {|h,kv| h[kv[0]] = kv[1] unless ex[kv[0].to_s]; h }\n end",
"def exclude_from_model\n []\n end",
"def except_attributes\n [].freeze\n end",
"def to_attr_hash\n to_hash.reject { |key, _| %i[id live_games].include? key }\n end",
"def except_empty\n self.reject{|k, v| v.to_s.empty?}\n end",
"def unseen\n table.reject do |k, v|\n v[2]\n end\n end",
"def filtered_attributes\n # Run the read permission check\n allow_and_deny_fields(:read).then do |allow, deny|\n\n result = nil\n\n if allow && allow != true && allow.size > 0\n # always keep id\n allow << :id\n\n # Only keep fields in the allow list\n result = @attributes.select { |key| allow.include?(key) }\n elsif deny == true\n # Only keep id\n # TODO: Should this be a full reject?\n result = @attributes.reject { |key| key != :id }\n elsif deny && deny.size > 0\n # Reject any in the deny list\n result = @attributes.reject { |key| deny.include?(key) }\n else\n result = @attributes\n end\n\n # Deeply filter any nested models\n result.then do |res|\n keys = []\n values = []\n res.each do |key, value|\n if value.is_a?(Model)\n value = value.filtered_attributes\n end\n keys << key\n values << value\n end\n\n Promise.when(*values).then do |values|\n keys.zip(values).to_h\n end\n end\n end\n end",
"def remove_unused_stats hash\n med_agility = hash[\"agility\"][:med]\n med_intellect = hash[\"intellect\"][:med]\n med_strength = hash[\"strength\"][:med]\n\n if (med_agility > med_intellect && med_agility > med_strength)\n hash.delete(\"intellect\")\n hash.delete(\"strength\")\n elsif (med_intellect > med_agility && med_intellect > med_strength)\n hash.delete(\"agility\")\n hash.delete(\"strength\")\n elsif (med_strength > med_agility && med_strength > med_intellect)\n hash.delete(\"agility\")\n hash.delete(\"intellect\")\n end\n end",
"def omitted_attributes\n (self.class.replicate_omit_attributes + @replicate_opts[:omit]).uniq\n end",
"def filtered_attributes(keys,scope)\n case scope\n when :new\n %i( id date catalogs catalog_definitions treatments complete just_created )\n when :existing\n keys\n else\n keys - %i( catalog_definitions )\n end\n end",
"def clean_dynamic_values(hash)\n hash[:value].delete(:params) if hash.has_key?(:value) && hash[:value].is_a?(Array)\n hash\n end",
"def filter_search_keys(search_keys)\n search_keys.delete_if { |_key, value| value.empty? }\n end",
"def data_cleansing_attribute_cleaners\n @data_cleansing_attribute_cleaners ||= Concurrent::Hash.new\n end",
"def delete_h2\n hash = {a: 0, b: 1, c: 2, d: 3, e: 4, f: 5, g: 6, h: 7, i: 8, j: 9}\n hash.keep_if do |x, y|\n y < 5\n end\n hash\nend",
"def delete_h4\n hash = {a: 0, b: 1, c: 2, d: 3, e: 4, f: 5, g: 6, h: 7, i: 8, j: 9}\n hash.reject! do |x, y|\n y < 5\n end\n hash\nend",
"def filter_daos!\n unique_daos = {}\n\n daos.keep_if do |dao|\n hash = dao.values_for(composite_key_columns).hash\n keep = (unique_daos[hash] ||= dao) == dao\n\n # unlink to be deleted dao and add a link to\n dao.unlink! replace_with: unique_daos[hash] unless keep\n\n keep\n end\n end",
"def display_attributes\n super.reject { |k, v| imported_attributes.fetch(k, nil) == v }\n end",
"def display_attributes\n super.reject { |k, v| imported_attributes.fetch(k, nil) == v }\n end",
"def deny_keys(*keys)\r\n tmp = self.clone\r\n tmp.delete_if {|k,v| keys.include?(k) }\r\n tmp\r\n end",
"def reject(&b)\n h = {}\n self.each_key{|k|\n v = self[k]\n unless b.call(k, v)\n h[k] = v\n end\n }\n h\n end",
"def cull_old_ids\n saved_ids = @ids.keys.reverse.take(@max_ids)\n @ids.select! do |k, v|\n saved_ids.include? k\n end\n end",
"def _filtered_attributes\n return accessible_attributes.to_a if accessible_attributes.present?\n\n return self.new.attributes.keys - protected_attributes.to_a\n end",
"def user_keys\n self.whitelists.map{|whitelist| whitelist.user_key}.uniq\n end",
"def allowed_attributes\n self.new.attributes.keys.reject do |col|\n protected_attributes.include?(col)\n end\n end",
"def remove_all\n synchronized { @hash = {} }\n end",
"def filter(keys)\n unless context.can_read?(object, :contact)\n keys.delete(:contact)\n keys.delete(:location)\n end\n \n unless context.can_read?(object, :kpis)\n keys.delete(:kpis)\n end\n \n keys\n end",
"def _to_h_scrub(h)\n h_scrub = h.dup\n [:observable_dictionary_c_array, :element_observable_c_array, :asn_c_array, :collection_c_array].each do |key|\n h_scrub.delete(key) if h_scrub.has_key? key && h_scrub[key].blank?\n end\n return h_scrub\n end",
"def trim\n self.select { |_k, v| v.present? }\n end",
"def my_hash_deletion_method!(source, thing_to_delete)\nsource.reject! {|k,v| k == thing_to_delete}\np source\nend",
"def strip_params_before_orm(hash)\n new_hash = hash.dup\n new_hash.delete(\"route_properties\")\n new_hash.delete(\"data_object\")\n\n return new_hash\n end",
"def sanitize_model_attrs(model)\n model.column_names.map(&:intern).reject { |k| k == :prospect_id }\n end",
"def sanitize_model_attrs(model)\n model.column_names.map(&:intern).reject { |k| k == :prospect_id }\n end",
"def source_without_deleted_keys_in_origin(source,model)\n source_keys = YAML.load_file(source).first[1]\n model_keys = YAML.load_file(model).first[1]\n\n source_keys_shallow = Translate::Keys.to_shallow_hash(source_keys)\n source_keys_shallow.reject!{ |k,v| v.blank? }\n model_keys_shallow = Translate::Keys.to_shallow_hash(model_keys)\n to_save_shallow = source_keys_shallow.slice(*model_keys_shallow.keys)\n\n r = Translate::Keys.to_deep_hash(to_save_shallow)\n { locale => r }\n end",
"def keep_method(hash)\r\n\r\n hash.keep_if{|x,y| y < 3}\r\n\r\nend",
"def to_h\n super.select {|k, v| k != 'hashed_password'}\n end",
"def not_matched_keys\n @not_matched.keys\n end",
"def serialize_record_data?; collect_keys.present? || collect_only_keys.present?; end",
"def checked_keys(params_hash)\n params_hash.reject{ |key, value| value.blank? || value == '0' }.keys\n end",
"def sensitive_properties\n properties.values.empty? ? [] : properties.values.select(&:sensitive?)\n end",
"def pristine_copy\n @pristine = {}\n for key, val in self\n @pristine[key] = \n val.dup rescue val\n end\n end",
"def _save_update_all_columns_hash\n v = @values.dup\n Array(primary_key).each{|x| v.delete(x) unless changed_columns.include?(x)}\n v.delete(model.lock_column)\n v\n end",
"def filter_by_kv h, k, v\n h.map {|h1| (h1[k] == v) && h1 || nil }.compact\n end",
"def remove_empties(h)\n h.delete_if do |_k, v|\n v == '∅∅∅'\n end\n\n h.each_pair do |_k, v|\n remove_empties(v) if v.is_a?(Hash)\n end\n\n h.delete_if do |_k, v|\n v.is_a?(Hash) && v.empty?\n end\n end",
"def without(*features)\n features = setify(*features)\n self.class.new Hash[@sets.select {|key, val| !features.subset?(key)}]\n end",
"def attr_hash\n hash = create_hash\n hash.delete(\"id\")\n hash.delete(\"errors\")\n return hash\n end",
"def attributes_hash\n attributes = @serializable.attributes\n if options[:only].any?\n attributes.slice(*options[:only])\n elsif options[:except].any?\n attributes.except(*options[:except])\n else\n attributes\n end\n end",
"def hash\n values.hash ^ known_data.hash\n end",
"def remove_empty_fields\n self.each_pair do |k, v|\n if self[k].class == Hash\n self[k] = self[k].remove_empty_fields\n else\n self.delete(k) if v.to_s == \"\"\n end\n end\n self\n end",
"def without_any(*features)\n features = setify(*features)\n self.class.new Hash[@sets.select {|key, val| key.intersection(features).empty?}]\n end",
"def filter(keys)\n if object.role_of(context) === 'none'\n if object.events_privacy.name === 'private'\n keys.delete(:events)\n end\n \n if object.resources_privacy.name === 'private'\n keys.delete(:resources)\n end\n end\n \n keys\n end",
"def required(loose:)\n clone.tap do |cloned|\n optional_keys.each do |key|\n cloned.delete(key)\n end\n if loose\n strict_keys.each do |key|\n cloned.delete(key)\n end\n end\n end\n end",
"def hash\n model.hash + key.hash\n end",
"def clean_attributes\n return attributes if group.nil? || !group.empty?\n\n filtered_attributes = attributes.dup\n filtered_attributes.delete(:group)\n end",
"def filter(keys)\n if !context.can_read?(object, :contact)\n keys.delete(:email)\n keys.delete(:location)\n end\n \n keys\n end",
"def ignored_associations\n %w().freeze\n end",
"def get_redundant_urls_hash(urls_hash)\n urls_keys = urls_hash.select {|url,value| value[0] < 8}.keys\n urls_keys.each do |key|\n urls_hash.delete(key)\n end\n end",
"def attr_clean!(key)\n @dirty_attribute_keys ||= []\n @dirty_attribute_keys.delete_if {|k| k == key.to_sym }\n end",
"def hash\n self.class.hash ^ key_attributes.hash\n end",
"def product_params_sanitizer(hash)\n\t hash[:typ_subcategory_id] = hash.delete :typ_subcategory\n\t hash[:typ_subcategory_id] = hash[:typ_subcategory_id][:id]\n\t hash[:typ_category_id] = hash.delete :typ_category\n\t hash[:typ_category_id] = hash[:typ_category_id][:id]\n\t return hash\n \tend",
"def remove_unnecessary_data(info_hash) \n just_character_data = info_hash[\"results\"].flatten\nend",
"def remove_empties_from_hash(old_hash)\n new_hash = {}\n old_hash.each do |key, value|\n next if value.nil? || value == '' || value == [] || value == {}\n new_hash[key] = value.is_a?(Hash) ? remove_empties_from_hash(value) : value\n end\n \n return new_hash\n end",
"def keys_for_partial_write\n (changed + ['allowed_ips']).uniq\n end",
"def to_h\n super.select {|k, v| k != 'hashed_password'}\n end",
"def pare_entity(entity)\n entity.reject{|key,_| %w(id entityType links).include?(key)}\nend",
"def deep_clean(data)\r\n proc = Proc.new { |k, v|\r\n if v.kind_of?(Hash) && !v.empty?\r\n v.delete_if(&proc)\r\n nil\r\n end\r\n v.nil? || v.empty?\r\n }\r\n hash.delete_if(&proc)\r\n end"
] |
[
"0.65138555",
"0.6250353",
"0.6091582",
"0.60621876",
"0.6036989",
"0.6012394",
"0.5995255",
"0.5985245",
"0.5964224",
"0.59614027",
"0.5920211",
"0.591813",
"0.59164935",
"0.59141177",
"0.5912165",
"0.5894061",
"0.5875437",
"0.5849526",
"0.58455145",
"0.58175856",
"0.58175856",
"0.5803528",
"0.580099",
"0.5778347",
"0.57704335",
"0.57704335",
"0.5766022",
"0.5740245",
"0.5732913",
"0.5701526",
"0.56904995",
"0.5689552",
"0.56845266",
"0.5669223",
"0.56570184",
"0.5657003",
"0.5642065",
"0.56313246",
"0.56099224",
"0.5605556",
"0.5603689",
"0.5586109",
"0.55859345",
"0.5583915",
"0.5581182",
"0.557631",
"0.5572956",
"0.55685914",
"0.5561294",
"0.55291426",
"0.5528971",
"0.5527321",
"0.5527321",
"0.5525038",
"0.55161846",
"0.55131185",
"0.5512065",
"0.55118567",
"0.5502398",
"0.5497695",
"0.5495304",
"0.54894465",
"0.5483197",
"0.54789454",
"0.54783946",
"0.5476613",
"0.5476613",
"0.5476327",
"0.5474296",
"0.5470043",
"0.54669976",
"0.54631764",
"0.5459242",
"0.5451563",
"0.5450629",
"0.5444586",
"0.54394513",
"0.54336846",
"0.5433255",
"0.5432572",
"0.5431217",
"0.54257774",
"0.54039353",
"0.53922695",
"0.5389071",
"0.5387405",
"0.5385593",
"0.5384799",
"0.5378096",
"0.5377265",
"0.53740156",
"0.53736407",
"0.5368591",
"0.5363716",
"0.5362817",
"0.53623664",
"0.53579414",
"0.5357818",
"0.53563076",
"0.5347055"
] |
0.69985276
|
0
|
checks if a stream contains the same values as a row
|
def same_stream(row,stream)
stream && row['raw_ip_incoming'] == stream.raw_ip_incoming && row['raw_ip_outgoing'] == stream.raw_ip_outgoing
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def victory_row?(row_values)\n unique_values = row_values.uniq\n one_unique_value?(unique_values)\nend",
"def compare_by_row_vectors(rows)\n my_rows = @rows\n sz = my_rows.size \n return false unless sz == rows.size\n \n for i in 0..sz-1 do\n return false unless my_rows[i] == rows[i]\n end\n true\n end",
"def valid_row?(index)\n row_values = row(index).compact\n row_values == row_values.uniq\n end",
"def check_for_duplicates(csv_data, column_name)\n data = csv_data.select{|item| !item[column_name].nil? }\n value = data.map{|i| i[column_name]}\n duplicates = value.filter{ |e| value.count(e) > 1 }.sort.uniq\n naughty_values = duplicates.map{|i| \" 👉 \\\"#{i}\\\"\" }.join(\"\\n\")\n if value.uniq.length != value.length\n puts \"🔴 Found some services with the same #{column_name} \\n\\n#{naughty_values}\\n\\n\"\n return true\n else\n return false\n end\n end",
"def _row_contains_data(row)\n if row.length > 1 then\n row[1..-1].each do |value|\n if value && value.length > 0 then\n return true\n end\n end\n end\n return false\n end",
"def squarocol?(square)\n #if row.all? { |val| val == row[0]} TRUE\n #OR if array.transpose ^^\n \n square.each do |row|\n return true if row.uniq.count == 1\n end\n square.transpose.each do |col|\n return true if col.uniq.count == 1\n end\n\n false\nend",
"def same_entries_in_a_line?(line_array)\n line_array.uniq.size <= 1 && line_array[0] != \" \"\n end",
"def check_win?\n deconstruct = @rows +\n @rows.transpose +\n [[@rows[0][0], @rows[1][1], @rows[2][2]]] +\n [[@rows[0][2], @rows[1][1], @rows[2][0]]]\n\n deconstruct.any? do |line|\n line.all? { |element| element == line[0] }\n end\n end",
"def all_same?\n\t\t\tself.all? { |element| (element == self[0]) && (element != nil) }\n\t\tend",
"def all_same?\n self.all? { |element| element == self[0] }\n end",
"def all_same?\n self.all? { |element| element == self[0] }\n end",
"def same_values?(arr)\n arr.uniq.length == 1\n end",
"def isSame(tab)\n for x in 0..3\n for y in 0..3\n return(false) if (self.val(x,y) != tab.val(x,y)) ;\n end\n end\n return true ;\n end",
"def valid?(board_array)\n board_array.each { |row| return false if row.length != row.uniq.length }\n return true\nend",
"def valid_row(row)\n row_begin = @size * (row)\n bits = 0\n\n @size.times { |i|\n if @state[row_begin + i]\n bits += 1\n if bits > 1\n return false\n end\n end\n }\n\n return true\n end",
"def check_eof( row )\n @eof = !row.has_key?( :row )\n end",
"def has_duplicate_row? row_id\n @skip_table.has_key?(row_id)\n end",
"def check_row\n @num_row.times do |row|\n consecutive = 0\n curr_tile = @board[row][0]\n @num_col.times do |col|\n if curr_tile == @board[row][col]\n next unless @board[row][col] #skip over empty tiles before the first non-empty\n consecutive += 1\n return true if consecutive == 4\n else\n curr_tile = @board[row][col]\n consecutive = 1\n end\n end\n end\n false\n end",
"def squarocol?(array)\n size = array.size\n\n #check rows\n array.each { |a| return true if a.all? {|e| e == a[0]} }\n\n #check cols\n (0...size).each do |i|\n is_same = true\n array.each do |a|\n if a[i] != array[0][i] #item is not same as the first item in column\n is_same = false\n break\n end\n end\n return true if is_same\n end\n \n return false\nend",
"def eql?(other)\n (@row1.eql? other.row1) && (@row2.eql? other.row2) && (@row3.eql? other.row3)\n end",
"def flush?\n return val if val.map(&:suit).uniq.count == 1\n\n false\n end",
"def check_duplicate(line)\n return line.uniq.length == line.length\nend",
"def valid_rows?\n valid = true\n row = 0\n while (row < @board.length && valid)\n valid = false if !unique_arr?(@board[row])\n row += 1\n end\n valid\n end",
"def one_in_a_row?(marker)\n Game::WINNING_LINES.each do |the_line|\n if board.squares.values_at(*the_line).count(marker) == 1 && board.squares.values_at(*the_line).count(' ') == 2\n return true\n end\n end\n end",
"def is_line_same(line)\n return false if @board[line[0]].value == \" \"\n line.each do |i|\n return false unless @board[i].value == @board[line[0]].value\n end\n return true\n end",
"def identical_values?(arr)\n arr.uniq.length == 1\nend",
"def all_cells_cleared?\n count = 0\n (0..row_count).each do |row|\n (0..column_count).each do |column|\n if cell_cleared?(row, column) || contains_mine?(row, column)\n count += 1\n end\n end\n end\n if count == row_count*column_count\n true\n else\n false\n end\n end",
"def squarocol?(arr)\n return true if arr.any? { |row| row.uniq.length == 1 }\n return true if arr.transpose.any? { |col| col.uniq.length == 1 }\n return false\nend",
"def squarocol?(grid)\n return true if grid.any? { |row| row.uniq.length == 1 }\n return true if grid.transpose.any? { |col| col.uniq.length == 1 }\n false\nend",
"def squarocol?(grid)\n return true if grid.any? { |row| row.uniq.length == 1 }\n return true if grid.transpose.any? { |col| col.uniq.length == 1 }\n false\nend",
"def same_row?(character_one, character_two)\n character_one[:row] == character_two[:row]\n end",
"def only_one?\n counter = 0\n each_cell do |cell|\n counter += 1 if cell\n return false if counter >= 2\n end\n counter == 1\n end",
"def reducable(row, x)\n row.select {|values| values.include?(x) }.length == 1\nend",
"def reducable(row, x)\n row.select {|values| values.include?(x) }.length == 1\nend",
"def empty_board?\n cell_rows.flatten.uniq.size == 1 && cell_rows.flatten.uniq.first == nil\n end",
"def check_rows()\n # Returns true if row is filled by player\n 3.times do |x|\n if $game_board[x*3] == $game_board[x*3+1] && $game_board[x*3] == $game_board[x*3+2] && $game_board[x*3]\n return true\n end\n end\n false\nend",
"def all_different?\n a = self.to_a.drop(1)\n self.each do |e|\n return false if a.include?(e)\n a.shift\n end\n return true\n end",
"def check_rows\n for row in 0..2\n if @game_array[row][0] == @game_array[row][1] &&\n @game_array[row][0] == @game_array[row][2] &&\n !@game_array[row][0].nil?\n\n result = @game_array[row][0]\n end\n end\n result\n end",
"def has_tied(new_board)\n new_board.each_with_index do |row,i|\n row.each_with_index do |col,j|\n return false if new_board[i][j] == '-'\n end\n end\n true\nend",
"def verify_data_positions(hash)\n items = hash.values\n\n positions=Array.new\n for thing in items\n positions << thing[:position]\n end\n \n all_unique = true\n\n for value in positions\n if positions.count(value)>1\n print \"Position \" + value.to_s + \" is not unique!\"\n all_unique=false \n end\n\n end\n \n return all_unique\n\nend",
"def also_present?(row, other)\n\t\n\t\tother.each do |other_row|\n\t\t\tif keys_match?(row, other_row)\n\t\t\t\treturn other_row\n\t\t\tend\n\t\tend\n\t\t\n\t\treturn false\n\tend",
"def all_cells_cleared?\n cell_count = 0\n (0..row_count).each do |row|\n (0..column_count).each do |column|\n if cell_cleared?(row, column) || contains_mine?(row, column)\n cell_count += 1\n end\n end\n end\n\n (row_count * column_count) == cell_count\n end",
"def inspect_duplicates(array)\n array.each do |element|\n if array.count(element) > 1\n puts \"The are duplicates in the cards!\"\n return false\n end\n true\n end \n end",
"def squarocol?(grid)\n return true if grid.any? { |row| row.uniq.length == 1 }\n return true if grid.transpose.any? { |col| col.uniq.length == 1 }\n false\nend",
"def duplications?\n size != uniq.size \n end",
"def non_duplicated_values(values)\n p values.select{ |i|\n values.count(i) == 1\n \t}\nend",
"def any_mines_detonated?\n (0..row_count).each do |row|\n (0..column_count).each do |column|\n if cell_cleared?(row, column) && contains_mine?(row, column)\n return true\n end\n end\n end\n\n false\n end",
"def keys_match?(my_row, other_row)\n\t\t# Ensure arguments are not nil\n\t\tif not (my_row and other_row)\n\t\t\treturn nil\n\t\tend\n\t\t\n\t\t# If each value at this key doesn't match, return false\n\t\t@keys.each do |key|\n\t\t\tif not my_row[key].to_s =~ /^#{other_row[key].to_s}$/i\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\t\t\n\t\t#$stdout.puts \"Match: \" + my_row[\"split_zip\"] + \" AND \" + other_row[\"split_zip\"]\n\t\t\n\t\t# If we checked values at each key w/o mismatch, its the same\n\t\treturn true\n\tend",
"def legal?\n [rows, columns, boxes].all? do |group|\n group.all? { |_, n| n.uniq == n }\n end\n end",
"def any_mines_detonated?\n (0..row_count).each do |row|\n (0..column_count).each do |column|\n if cell_cleared?(row, column) && contains_mine?(row, column)\n return true\n end\n end\n end\n false\n end",
"def excel_columns_equal?(content)\n contents = CSV.parse(content)\n fields_arr = contents[0].map do |field|\n field.strip unless field.nil?\n end.compact\n saved_fields_arr = JSON.parse(self.fields_str).map{|f| f['name']}\n #saved_fields_arr = JSON.parse(self.fields_str).reduce({}, :merge).collect{|k,v| k}.concat(JSON.parse(self.ignored_str))\n return fields_arr.uniq.sort == saved_fields_arr.uniq.sort \n end",
"def valid?\n 0.upto(8) { |row| return false if @rows[row].uniq! }\n 0.upto(8) { |column| return false if @columns[column].uniq! } \n 0.upto(8) { |box| return false if @boxes[box].uniq! }\n\n return true\n end",
"def eql?(other)\n self.class == other.class && rows == other.rows\n end",
"def non_duplicated_values(values)\n values.find_all { |x| values.count(x) == 1 }\nend",
"def duplicate_batch?(previous_batch)\n return false if previous_batch.nil?\n \n previous_batch.sf_integrity_hash == integrity_hash\n end",
"def is_match? cells\n\t\towners = []\n\n\t\tcells.each_with_index do |cell, i|\n\t\t\towners[i] = cell.name\n\t\tend\n\n\t\towners.uniq.length == 1\n\tend",
"def ==(mat)\n if ((@mCol == mat.mCol)&&(@nFil == mat.nFil))\n for i in 0...@nFil do\n\tfor j in 0...@mCol do\n\t if ((@matriz[i][j] == mat.matriz[i][j])==false)\n\t return false\n\t end\n\tend\n end\n \n else\n return false\n end\n return true \n end",
"def no_dupes?(arr)\n arr.reject do |ele|\n # debugger\n arr.count(ele) > 1\n end\nend",
"def check_rows(piece, arr)\n arr.each do |row|\n row.each_cons(4).each do |combination|\n return true if combination.all? { |a| a == piece }\n end\n end\n false\n end",
"def value_on_new_line?\n key.loc.line != value.loc.line\n end",
"def check_for_inconsistency(elements)\n elements.any?{|e| e != elements.first}\n end",
"def has_duplicate?(array)\n array.each_with_index do |_, i|\n array.each_with_index do |_, j|\n if i != j && array[i] == array[j]\n return true\n end\n end\n end\n false\nend",
"def identical_symbols(row_or_column)\n row_or_column[0] * 3 == row_or_column\n end",
"def columnheaders_unique?\r\n columnheaders_raw.length == columnheaders_raw.uniq.length\r\n end",
"def same_or_dif? card_arr\n card_arr.uniq.size != 2\nend",
"def all_equal?\n a = self.first\n all? { |b| a == b }\n end",
"def consistent?\n ret = true\n # Check every row first\n @board.each_row do |row|\n row_numbers = Set.new\n row.each do |cell|\n n = cell.number\n if n and row_numbers.include? n\n ret = false\n end\n row_numbers << n\n end\n end\n # Check every column\n @board.each_column do |col|\n col_numbers = Set.new\n col.each do |cell|\n n = cell.number\n if n and col_numbers.include? n\n ret = false\n end\n col_numbers << n\n end\n end\n # Check every region\n @board.each_region do |reg|\n reg_numbers = Set.new\n reg.each do |cell|\n n = cell.number\n if n and reg_numbers.include? n\n ret = false\n end\n reg_numbers << n\n end\n end\n return ret\n end",
"def check_rows\n row_winner = nil\n\n # joins row and checks iteration count of x or o in strings to find winner\n @board.each do |row|\n row_str = row.join\n if row_str.count('x') == @board.size\n row_winner = 'x'\n elsif row_str.count('o') == @board.size\n row_winner = 'o'\n end\n end\n\n row_winner\n end",
"def non_duplicated_values(values)\n return values.select {|x| values.count(x) == 1 } \nend",
"def has_common (row_num, row_min)\n row = @rows[row_num]\n result = false\n if row_min != 0 then\n result = true\n row.each do |num|\n if result == true then\n if (num != 0) && ((num.abs).modulo(row_min.abs) != 0) then\n result = false\n end\n end\n end\n end\n return result\n end",
"def mark_duplicate_rows(csv_data)\n # Grouping on first name, last name, email & phone - two different people with the same name shouldn't be counted as one, and if a person has moved they won't be counted as two (people are likely to keep the same email and phone number)\n grouped_data = csv_data.group_by { |row| [row[:first_name], row[:last_name], row[:email], row[:phone]] }\n\n # Add validation errors\n grouped_data.each do |k,rows|\n # Sort by date and reverse first to make sure we don't add the errors to the wrong row\n rows.sort_by! { |row| row[:date_added]}.reverse!\n rows[1..].each do |row|\n row[:validation_errors].append(:duplicate)\n end\n end\n\n grouped_data.transform_values(&:count).count { |k,v| v > 1 }\n end",
"def check_winner\n row_filled_with_same_element = ->(row) { row.reduce(row[0]) { |acc, elem| acc if elem == acc } }\n winners = [board, board.transpose, diagonals].map do |board_version|\n board_version.map(&row_filled_with_same_element).find { |row| row && row != 0 }\n end\n winners.find { |row| row }\n end",
"def none_in_a_row?(marker)\n Game::WINNING_LINES.each do |the_line|\n if board.squares.values_at(*the_line).count(marker) == 0 && board.squares.values_at(*the_line).count(' ') == 3\n return true\n end\n end\n end",
"def squarocol?(arr)\n (0..arr.length-1).each do |i|\n row_counter = 1\n col_counter = 1\n\n (0...arr.length-1).each do |j|\n row_counter += 1 if arr[i][j] == arr[i][j + 1]\n col_counter += 1 if arr[j][i] == arr[j + 1][i]\n \n end\n\n if row_counter == arr.length || col_counter == arr.length\n return true\n end\n \n end\n false\nend",
"def hit_itself?\n # list.uniq removes all repeated elements from a list\n @positions.uniq.length != @positions.length\n end",
"def eql?(ha)\n return false if self.length != ha.length\n return true if (0...self.length).all? { |i| self.fetch(i).eql?(ha.fetch(i)) }\n return false\n end",
"def victory_column?(column_values)\n unique_values = column_values.uniq\n one_unique_value?(unique_values)\nend",
"def conflict?\n from_values.select{ |d,e| d != e }.any?\n end",
"def verify_uniquness!(tuple)\n stream = tuple[:stream]\n attrs = %i[position event_id]\n attrs.delete(:position) if Stream.new(stream).global?\n\n attrs.each do |key|\n next if key == :position && tuple[key].nil?\n next if restrict(:stream => stream, key => tuple.fetch(key)).none?\n\n raise TupleUniquenessError.public_send(:\"for_stream_and_#{key}\", stream, tuple.fetch(key))\n end\n end",
"def identical?\n #Song.first.attributes.each { |v,k| Song.find(:all, :conditions => [\" #{v} like ?\", \"%blah%\"])}\n Song.find(:all, :conditions => [\"name = ? or length = ?\", \"#{self.name}\", self.length]) do |x| \n x.hash == self.hash\n end\n end",
"def contains_row? row\n raise ArgumentError, \"table should be a Workbook::Row (you passed a #{t.class})\" unless row.is_a?(Workbook::Row)\n collect { |r| r.object_id }.include? row.object_id\n end",
"def unique?\n existing_record = CONNECTION.execute(\"SELECT * FROM logs WHERE user_id = #{self.user_id} AND train_id = #{self.train_id}\")\n return existing_record == []\n end",
"def has_row_values?(row_value)\n @values_map.has_key?(row_value.to_s)\n end",
"def compare_all_rows\n @guess_rows.map do |guess|\n right_color = 0 \n right_spot = 0\n guess.get_pins.each.with_index do |pin, index|\n if pin == @correct_row.get_pins[index]\n right_spot += 1\n end\n end\n right_color = (guess.get_pins & @correct_row.get_pins).count\n [right_spot, right_color - right_spot, guess]\n end\n end",
"def check_positions(array)\n array.each do |a|\n array.each do |b|\n next if a == b\n return false if a[1] == b[1] || a[2] == b[2]\n end\n end\n\n return true\nend",
"def row_checker(puzzle_digit_location_hash)\n for i in 0...ROW_LENGTH\n current_row = row_selector(i, puzzle_digit_location_hash)\n current_row_digits = digit_selector(current_row)\n current_row_digits.size == current_row_digits.uniq.size ? solution_okay = true : solution_okay = false\n break if solution_okay == false\n end\n solution_okay\n end",
"def any_mines_detonated?\n row_count.times do |row|\n column_count.times do |col|\n return true if cell_cleared?(row, col) && contains_mine?(row, col)\n end\n end\n false\n end",
"def same?\n similarities.size == 1 && similarities.first.distance.zero? # The same\n end",
"def contains_duplicate(nums)\n tmp_arr = nums.uniq\n result = \n tmp_arr.map do |i|\n nums.select { |j| i == j }.size > 1\n end\n return result.any?\nend",
"def empty_row?(data)\n data.compact.empty?\n end",
"def is_row_empty(row)\n return row.all? { |item| item == nil }\nend",
"def observation_object_is_unique_in_matrix\n if ObservationMatrixRow.where(\n observation_matrix_id:,\n observation_object:).where.not(id:).any?\n errors.add(:observation_object, 'already exists in this matrix')\n end\n end",
"def valid?\n expected = {}\n\n count = 0\n self.each_unsafe do |k,v|\n return false if @data[k][2] != v\n count += 1\n end\n count == @data.count\n end",
"def two_in_a_row(row, marker)\n if row.values.count(marker) == 2\n row.select{|_k,v| v == ' '}.keys.first\n else\n false\n end\n end",
"def filter(row)\n self.keys.each do |key|\n value = self.parameters.send(key)\n case value\n when Array\n return false unless value.include?(row[key])\n when Range\n return false unless value.include?(row[key])\n else\n return false unless value === row[key]\n end\n end\n return true\n end",
"def squarocol?(matrix)\n return true if matrix.any? { |row| row.uniq.size == 1}\n\n return true if matrix.transpose.any? { |row| row.uniq.size == 1 }\n\n false\nend",
"def three_identical_markers?(squares)\n markers = squares.select(&:marked?).collect(&:marker)\n return false if markers.size != 3\n markers.min == markers.max\n end",
"def contains_mine?(row, col)\n false\n end",
"def contains_mine?(row, col)\n false\n end",
"def share_item?(cell)\n row == cell.row || column == cell.column\n end"
] |
[
"0.6977281",
"0.6673285",
"0.64837277",
"0.6466026",
"0.6462633",
"0.6322916",
"0.62861496",
"0.6259263",
"0.6230632",
"0.61884433",
"0.61884433",
"0.61713946",
"0.61272645",
"0.61162",
"0.60725456",
"0.606138",
"0.6039915",
"0.60231626",
"0.59984165",
"0.5993717",
"0.59837234",
"0.5964673",
"0.5930862",
"0.59290963",
"0.59193975",
"0.59129316",
"0.5896651",
"0.5874524",
"0.5857972",
"0.5857972",
"0.584415",
"0.5843984",
"0.58381397",
"0.58381397",
"0.58320296",
"0.58253163",
"0.5799706",
"0.57944024",
"0.57890266",
"0.5785764",
"0.578152",
"0.57796097",
"0.57705086",
"0.57686234",
"0.57612306",
"0.57582694",
"0.5726455",
"0.5721797",
"0.5719431",
"0.57181776",
"0.5716221",
"0.5710875",
"0.5708513",
"0.5698651",
"0.56864876",
"0.56854236",
"0.56809175",
"0.5680603",
"0.56792694",
"0.5661393",
"0.564854",
"0.5647024",
"0.56405425",
"0.5640282",
"0.56331384",
"0.5618433",
"0.5609689",
"0.56094646",
"0.5596484",
"0.55936635",
"0.55890083",
"0.55734235",
"0.55720454",
"0.55710435",
"0.5565825",
"0.55595106",
"0.55570203",
"0.5549825",
"0.5549691",
"0.5539948",
"0.55349016",
"0.5534705",
"0.55342424",
"0.55300444",
"0.55208397",
"0.55171674",
"0.5510889",
"0.55038875",
"0.5499992",
"0.5498963",
"0.5497776",
"0.5489867",
"0.54859924",
"0.5483647",
"0.5482046",
"0.5475343",
"0.5471242",
"0.5471049",
"0.5471049",
"0.5470655"
] |
0.7295439
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_testplan
@testplan = Testplan.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
Only allow a trusted parameter "white list" through.
|
def testplan_params
params.require(:testplan).permit(:application_id, :testplan_name, :pid)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def filtered_parameters; end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def valid_params?; end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def filter_parameters; end",
"def filter_parameters; end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def check_params; true; end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def list_params\n params.permit(:name)\n end",
"def check_params\n true\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def additional_permitted_params\n []\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end",
"def allow_params_authentication!; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end",
"def quote_params\n params.permit!\n end",
"def list_params\n params.permit(:list_name)\n end",
"def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def all_params; end",
"def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end",
"def source_params\n params.require(:source).permit(all_allowed_params)\n end",
"def user_params\n end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end",
"def permitted_params\n @wfd_edit_parameters\n end",
"def user_params\r\n end",
"def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def params_permit\n params.permit(:id)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def filter_params\n params.permit(*resource_filter_permitted_params)\n end",
"def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end",
"def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend",
"def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def argument_params\n params.require(:argument).permit(:name)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def parameters\n nil\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end",
"def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end",
"def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def special_device_list_params\n params.require(:special_device_list).permit(:name)\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end"
] |
[
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.63804525",
"0.6373396",
"0.6360051",
"0.6355191",
"0.62856233",
"0.627813",
"0.62451434",
"0.6228103",
"0.6224965",
"0.6222941",
"0.6210244",
"0.62077755",
"0.61762565",
"0.61711127",
"0.6168448",
"0.6160164",
"0.61446255",
"0.6134175",
"0.6120522",
"0.6106709",
"0.60981655",
"0.6076113",
"0.60534036",
"0.60410434",
"0.6034582",
"0.6029977",
"0.6019861",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.60184896",
"0.60157263",
"0.6005857",
"0.6003803",
"0.60012573",
"0.59955895",
"0.5994598",
"0.5993604",
"0.5983824",
"0.5983166",
"0.5977431",
"0.597591",
"0.5968824",
"0.5965953",
"0.59647584",
"0.59647584",
"0.59566855",
"0.59506303",
"0.5950375",
"0.59485626",
"0.59440875",
"0.5930872",
"0.5930206",
"0.5925668",
"0.59235454",
"0.5917905",
"0.59164816",
"0.5913821",
"0.59128743",
"0.5906617",
"0.59053683",
"0.59052664",
"0.5901591",
"0.58987755",
"0.5897456",
"0.58970183",
"0.58942604"
] |
0.0
|
-1
|
Solution for Challenge 122 [Easy]
|
def root(i)
z = i.to_s.split('')
if z.size > 1
z.collect!{|x| x.to_i}
a = z.inject(0){|sum,y| sum+=y}
root a
else
puts i
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def solution4(input)\n end",
"def solve\n perms = (1..9).to_a.permutation.map {|p| p.join}\n prods = []\n\n perms.each do |p|\n (1..2).each do |len|\n a, b, c = p[0, len].to_i, p[len..4].to_i, p[5, 4].to_i\n prods << c if a * b == c\n end\n end\n \n prods.uniq.reduce( :+ )\n end",
"def problem_76a\n num = 100\n solve = lambda do |a,off,max|\n n = 0\n while a[off] < max && (a.length-off) >= 2 \n a[off] += a.pop\n n += 1\n n += solve.call(a.dup,off+1,a[off]) if a.length - off > 1\n end\n n\n end\n puts 1 + solve.call([1] * num, 0,num-1)\nend",
"def solution(a)\r\n n=a.size\r\n i=1\r\n for k in a.sort do\r\n\tif k!=i \r\n\t then \r\n\t return 0\r\n\t break;\r\n\tend\r\n i+=1;\r\n end\t\r\n return 1 if a.inject(:+) ==n*(n+1)/2;\r\nend",
"def solve( n = 16 )\n max = 0\n \n (1..10).each do |a|\n (1..10).each do |b|\n next if b == a\n (1..10).each do |c|\n next if c == b || c == a\n (1..10).each do |d|\n next if d == c || d == b || d == a\n (1..10).each do |e|\n next if e == d || e == c || e == b || e == a\n\n rotate = 3*[a, b, c, d, e].each_with_index.min[1]\n (1..10).each do |f|\n next if f == e || f == d || f == c || f == b || f == a\n (1..10).each do |g|\n next if g == f || g == e || g == d || g == c || g == b || g == a\n \n t = a + f + g\n (1..10).each do |h|\n next if h == g || h == f || h == e || h == d || h == c || h == b || h == a\n next unless t == b + g + h\n\n (1..10).each do |i|\n next if i == h || i == g || i == f || i == e || i == d || i == c || i == b || i == a\n next unless t == c + h + i\n\n (1..10).each do |j|\n next if j == i || j == h || j == g || j == f || j == e || j == d || j == c || j == b || j == a\n next unless t == d + i + j && t == e + j + f\n\n s = [a, f, g, b, g, h, c, h, i, d, i, j, e, j, f]\n rotate.times {s.push s.shift}\n\n s = s.join\n next if n != s.length\n\n max = [max, s.to_i].max\n end\n end\n end\n end\n end\n end\n end\n end\n end\n end\n\n max\n end",
"def challenge; end",
"def solution(s, p, q)\n # write your code in Ruby 2.2\n g = s.length + 1\n a = (s.length + 1)**3\n c = (s.length + 1)**2\n tmp = []\n res = []\n tmp.push 0\n o = 0\n s.split('').each do |i|\n o += if i == 'T'\n 1\n elsif i == 'G'\n g\n elsif i == 'C'\n c\n else\n a\nend\n tmp.push o\n end\n (0...p.length).each do |k|\n o = tmp[q[k] + 1] - tmp[p[k]]\n if o >= a\n res.push 1\n elsif o >= c\n res.push 2\n elsif o >= g\n res.push 3\n else\n res.push 4\n end\n end\n res\nend",
"def solve_zero_vs_six_vs_nine\n return if @arr[1].nil? || @arr[4].nil?\n\n #p \"1,4: #{@arr[1]},#{@arr[4]}\"\n\n @words.filter{|x| x.length == 6 && @hash[x].nil?}.each{|w|\n if @arr[4].chars.all?{|c| w.chars.include?(c)}\n solved(9, w)\n elsif @arr[1].chars.all?{|c2| w.chars.include?(c2)}\n solved(0, w)\n else\n solved(6, w)\n end\n }\n end",
"def solve_two_vs_three_vs_five\n return if @arr[1].nil? || @arr[6].nil?\n\n #p \"1,6: #{@arr[1]},#{@arr[6]}\"\n\n @words.filter{|x| x.length == 5 && @hash[x].nil?}.each{|w|\n if @arr[1].chars.all?{|c| w.chars.include?(c)}\n solved(3, w)\n elsif w.chars.all?{|c2| @arr[6].chars.include?(c2)}\n solved(5, w)\n else\n solved(2, w)\n end\n }\n end",
"def solution(a)\n # write your code in Ruby 2.2\n \n is_perm = 0\n \n n = a.length\n b = [0]*n\n \n \n a.each do |v|\n break if v > n \n break if b[v] == 1 \n b[v] = 1\n end\n \n sum = b.inject(:+)\n if sum == n\n is_perm = 1\n end\n \n is_perm\nend",
"def solution(s, p, q)\r\n # write your code in Ruby 2.2\r\n # A -1\r\n # C -2\r\n # G -3\r\n # T -4\r\n # s - string with n charactekrs\r\n #cagccta\r\n #0123345\r\n #p,q - not empty arrays\r\n #\r\n #p[0]=2 q[0]=4 gcc 322 => 2\r\n #p[1]=5 q[1]=5 t 4 => 4\r\n \r\n \r\n arr = Array.new(q.count)\r\n \r\n \r\n\r\n \r\n arr.each_with_index{|el, i|\r\n \r\n ss = s[p[i]..q[i]]\r\n \r\n if ss.index('A') \r\n n = 1\r\n elsif ss.index('C')\r\n n=2\r\n elsif ss.index('G')\r\n n=3\r\n else \r\n n=4\r\n end\r\n \r\n arr[i] = n\r\n \r\n }\r\n \r\n \r\n \r\n arr\r\n \r\nend",
"def solution\n 971 * (-61)\nend",
"def solve\n return ((1..40).inject(:*) / ((1..20).inject(:*) ** 2))\nend",
"def solution\n (1..40).inject(:*) / (1..20).inject(:*)**2\nend",
"def solution(s, p, q)\n counts = [nil, [0], [0], [0], [0]]\n factors = s.split(//).map do |nu|\n case nu\n when 'A'\n 1\n when 'C'\n 2\n when 'G'\n 3\n when 'T'\n 4\n end\n end\n for i in (1..factors.length)\n fa = factors[i - 1]\n for j in [1, 2, 3, 4]\n counts[j][i] = counts[j][i - 1]\n end\n counts[fa][i] += 1\n end\n \n (0..p.count - 1).map { |k|\n if p[k] == q[k]\n factors[p[k]]\n else\n [1, 2, 3, 4].index do |i|\n counts[i][q[k] + 1] - counts[i][p[k]] > 0\n end + 1\n end\n }\nend",
"def solution\n (2..(9**5 * 6)).select do |n|\n n.to_s.split(//).map do |d|\n d.to_i ** 5\n end.reduce(:+) == n\n end.reduce(:+)\nend",
"def part2(program)\n special = 19690720\n (0..99).to_a.repeated_permutation(2).each do |noun, verb|\n input = program.dup\n input[1] = noun\n input[2] = verb\n\n output = run(input)\n puts \"noun = #{noun}, verb = #{verb}, output = #{output[0]}\"\n if output[0] == special\n return [noun, verb]\n end\n end\n puts \"fuck\"\n return [-1, -1]\nend",
"def isCryptSolution(crypt, solution)\n match = {}\n solution.each do |set|\n match[set[0]] = set[1]\n end\n\n nums = []\n temp = \"\"\n crypt.each do |word|\n word.each_char do |let|\n temp += match[let]\n end\n if temp[0] == '0' && temp.size > 1\n return false\n end\n nums << temp.to_i\n temp = \"\"\n end\n nums[0,2].reduce(:+) == nums.last\nend",
"def solve\n n = 33\n while true\n begin\n n += 2\n end while n.prime?\n\n s, ds = 2, 6\n while s < n && !(n - s).prime?\n s += ds\n ds += 4\n end\n\n break if s >= n\n end\n \n n\n end",
"def solution a\n a.sort!\n until a.empty?\n answer = a.pop\n return answer if a.pop != answer\n end\nend",
"def solution1(seeds)\n turn_map = {}\n seeds.each_with_index { |n, turn| turn_map[n] = [1, turn + 1, turn + 1] }\n last_number = seeds.last\n\n ((seeds.length+1)..2020).each do |turn|\n last_stats = turn_map[last_number]\n if last_stats[TIMES_SPOKEN] == 1\n zero = turn_map[0] || [0, turn, turn]\n zero[TIMES_SPOKEN] += 1\n zero[FIRST_SPOKEN] = zero[LAST_SPOKEN]\n zero[LAST_SPOKEN] = turn\n \n turn_map[0] = zero\n last_number = 0\n else\n age = last_stats[LAST_SPOKEN] - last_stats[FIRST_SPOKEN]\n\n num = turn_map[age] || [0, turn, turn]\n num[TIMES_SPOKEN] += 1\n num[FIRST_SPOKEN] = num[LAST_SPOKEN]\n num[LAST_SPOKEN] = turn\n \n turn_map[age] = num\n last_number = age\n end\n end\n\n last_number\nend",
"def recursive_solution\n\n end",
"def solution(m, a)\n n = a.count\n result = 0\n front = 0\n numbers = Array.new(m + 1, false)\n n.times { |back|\n while front < n and not numbers[a[front] - 1]\n numbers[a[front] - 1] = true\n front += 1\n result += front - back\n return 1_000_000_000 if result >= 1_000_000_000\n end\n numbers[a[back] - 1] = false\n }\n result\nend",
"def solve(n, s, d, m)\n # Complete this function\n records = s;\n\n (1...n).each do |i|\n records[i] += records[i-1]\n end\n\n numberOfWays = (m <= n && records[m - 1] == d) ? 1 : 0;\n\n (m...n).each do |i|\n if records[i] - records[i - m] == d\n numberOfWays += 1\n end\n end\n\n numberOfWays\n\nend",
"def sol inp\n k, ins = inp.split(' ',2)\n k = k.to_i\n ps, pr, pi, pu, pw, pd, pl = ins.split.map(&:to_f)\n\n @ps = ps\n @pr = pr\n @pu = pu\n @pw = pw\n @pd = pd\n @pl = pl\n\n #\n # required_wins = 2\n # # winning 1st set\n # first_set = ps*pi + pr*(1-pi)\n # # winning 2nd set\n # first_set * winning_another_set + (1-first_set)*winning_another_set\n #\n # required_wins.times do |i|\n # count = 0\n # while count <= i\n # wins[i] = win_scene(pi,ps,pr, count)\n # count+=1\n # break if count == i\n # lose_scene(pi,ps,pr, pr,count)\n # end\n # end\n\n # winning second set after winning first + winning second set after winning one\n # wins[0]*win_scene(pi,ps,pr) + (1-wins[0])*lose_scene(pi,ps,pr)\n\n def win_scene(pi,round,required_wins,current_wins)\n return 0 if round >= required_wins\n # puts \"w #{' '*round},#{required_wins},#{current_wins})\"\n sunny = (round == 0) ? pi : (pi+(@pu*@pw))\n sunny = 1.0 if sunny > 1\n sunny = 0.0 if sunny < 0\n chance = sunny*@ps + (1-sunny)*@pr\n binding.pry if chance > 1\n\n if required_wins == current_wins+1\n chance\n else\n # return 0 if round > 100\n return 0 if (10**7*chance).to_i < 1\n wins = win_scene(sunny,round+1,required_wins,current_wins+1)\n # lose = lose_scene(sunny,round+1,required_wins,current_wins+1)\n chance * (wins)#+ (1-chance)*lose\n end\n end\n\n def lose_scene(pi,round,required_wins,current_wins)\n return 0 if round >= required_wins\n # puts \"l #{' '*round},#{required_wins},#{current_wins})\"\n sunny = (round == 0) ? pi : (pi-(@pd*@pl))\n sunny = 1.0 if sunny > 1\n sunny = 0.0 if sunny < 0\n chance = sunny*@ps + (1-sunny)*@pr\n binding.pry if chance > 1\n\n if required_wins == current_wins\n chance\n else\n # return 0 if round > 100\n return 0 if (10**7*chance).to_i < 1\n wins = win_scene(sunny,round+1,required_wins,current_wins+1)\n # lose = lose_scene(sunny,round+1,required_wins,current_wins+1)\n chance * (wins) #+ (1-chance)*lose\n end\n end\n\n # a = win_scene(pi,0,1,0)\n b = win_scene(pi,0,k,0)\n c = lose_scene(pi,0,k,0)\n # c = (k > 1) ? lose_scene(pi,1,k,0) : 0\n\n puts b\n puts c\n b +c\n # wtf?\n # 0.4* win_scene(pi,0,k,0)+ (1-0.6)*lose_scene(pi,0,k,0)\n\n# def smth(pi, ps, pr, setcount=0)\n# arr[1] = arr[0]\n# end\n# # set 2+ ?\n# set2 = ((ps+pu)*pw + ps*(1-pw))*pi\n# (1-set1)*((ps-pd)*pl + ps*(1-pl))\n# if k > 1\n# (k-1).times do\n#\n# end\n# end\nend",
"def problem_57\n ret,n,d = 0,1,1\n 1000.times do |i|\n n,d = (n+2*d),(n+d)\n ret += 1 if n.to_s.length > d.to_s.length\n end\n ret\nend",
"def is_happy(n)\n i = 0\n r = false\n destination = []\n while r == false\n n.to_s.split(\"\").each do |x|\n destination << ((x.to_i * x.to_i))\n end\n i = i + 1\n n = destination.inject(&:+)\n r = true if n == 1\n destination = []\n break if i == 1000\n end\n if r == true\n p r\n else\n p false\n end\nend",
"def solveProblem lst\n big = -1\n numbers = {}\n half = lst.length / 2\n lst.each do |i|\n if numbers.has_key?(i) then\n numbers[i] += 1\n else\n numbers[i] = 1\n end\n if numbers[i] > half then return i end\n end\n return big\nend",
"def problem_108a\n i = 4\n max = 0\n solve = {}\n loop do\n num = 0\n a = Rational(1,i)\n 2.upto(i*2+1) do |j|\n if (a - Rational(1,j)).numerator == 1\n num += 1 \n# puts \"(#{a} - #{Rational(1,j)} == #{a - Rational(1,j)}\"\n end\n end\n\n solve[num] = [] unless solve[num]\n solve[num] << i.factors\n\n if num >= max\n puts \"####################################\"\n solve.each_key.sort.each do |k|\n s = solve[k].map do |v|\n h = {}\n v.each {|a| h[a] = (h[a] || 0) + 1 }\n h.values.sort.flatten\n end.uniq.sort\n puts \"k = #{k} groups: #{s.inspect}\"\n# puts solve[k].inspect\n end\n puts \"#{i} = #{num} #{i.factors} #{i.factors.length + i.divisors.length}\" \n max = num\n end\n break if num > 1000\n i += 1\n end\n i\nend",
"def solve(input)\n data = input.chars\n buckets = []\n current = []\n data.each_with_index do |c, i|\n n = data[i + 1]\n current << c\n unless n == c\n buckets << current\n current = []\n end\n break if n.nil?\n end\n\n ret = ''\n buckets.each do |b|\n ret += b.count.to_s\n ret += b.first\n end\n ret\nend",
"def solution(a)\n length = a.length\n sum = (length + 1) * (length + 1 + 1) / 2\n\n sum - a.inject(0) { |acc, e| acc += e }\nend",
"def problem_106\n a = [1,2,3,4]\n a = [1,2,3,4,5,6,7]\n a = [1,2,3,4,5,6,7,8,9,10,11,12] \n \n num = 0\n seen = {}\n # Don't do length of 1, they are ordered\n # Because they are size ordered, and 2 smalls are bigger than a large\n 2.upto(a.length/2) do |n|\n puts \"n = #{n}\"\n a.combination(n) do |set_a|\n b = a - set_a\n break if b.length < n\n b.combination(n) do |set_b|\n key = [set_a,set_b].sort\n next if seen[key]\n seen[key] = true\n index = 0\n state = 0\n 0.upto(set_a.length-1) do |i|\n break unless set_b[i] && set_a[i]\n if set_a[i] < set_b[i]\n state -= 1\n else\n state += 1\n end\n end\n\n# print \"#{set_a.inspect} #{set_b.inspect} #{state}\"\n if state.abs <= (set_a.length - 2) ||\n (state < 0 && set_a.last > set_b.last) ||\n (state > 0 && set_a.first < set_b.first)\n# puts \" good\"\n num += 1\n else\n# puts \"\"\n end\n end\n end\n end\n num\nend",
"def solve( n = 10_000 )\n (1..n).select {|i| i.amicable?}.reduce( :+ )\n end",
"def solution(roman)\n split = roman.split(\"\")\n last_value = 0\n split.reduce(0) do |final, char|\n current = CONVERSION[char.upcase]\n binding.pry\n if current >= last_value\n final += current\n else\n final -= current\n end\n binding.pry\n last_value = current\n final\n end\nend",
"def solution(n)\n x = (n**0.5).floor\n (1..x).reduce(0) { |s, i| n % i == 0 ? s += (i * i == n ? 1 : 2) : s }\nend",
"def solution(a)\n # write your code in Ruby 2.2\n permutation = Array(1..a.size)\n # puts permutation\n return 1 if permutation - a == []\n 0\nend",
"def solved(ans)\n\n end",
"def problem3 n\n 2.step(n,1).each do |x|\n return x-1 if n == 1\n n /= x if x.prime? && (n % x == 0)\n end\nend",
"def solution(a)\r\n a.each do |num|\r\n if (a.count(num) % 2) != 0\r\n return num\r\n end\r\n end\r\nend",
"def problem_106a\n combin = lambda { |m,h| m.factorial / (h.factorial * (m - h).factorial) }\n max = 20\n\n sum = Array.new(max+1,-1)\n 1.upto(max) do |n|\n 0.upto(n/2) do |k|\n sum[n] += combin.call(n,2*k) * combin.call(2*k - 1, k + 1)\n end\n puts \"#{n} #{sum[n]}\"\n end\n sum[12]\nend",
"def deduce\n while true\n stuck, guess, count = true, nil, 0\n # fill in any spots determined by direct conflicts\n allowed = board.allowed_numbers\n (0..80).each do |index|\n if board.board[index].nil?\n numbers = bits_to_numbers(allowed[index])\n if numbers.size == 0\n return [] # Return nothing if no possibilitie E\n elsif numbers.size == 1\n board.board[index] = numbers[0]\n stuck = false\n break\n elsif stuck\n new_guesses = numbers.map { |n| [index, n] }\n guess, count = pickbetter(guess, count, new_guesses)\n end\n end\n end\n\n if !stuck\n allowed = board.allowed_numbers\n end\n needed = board.needed_numbers\n\n # fill in any spots determined by elimination of other locations.\n # For any given column, find which numbers it is missing,\n # And figure out which positions allow those numbers - if only\n # one position allows it, the number goes there.\n #\n # If more than one spot is available, add to the guesses.\n board.coordinate_systems.each do |axis|\n (0..8).each do |x|\n numbers = bits_to_numbers(needed[axis_index(x, axis)])\n numbers.each do |n|\n bit = 1 << n\n # spots =for this number & col, all positions that allow the needed\n # numbers\n spots = []\n\n (0..8).each do |y|\n index = board.index_for(x, y, axis)\n # if this position allows the needed number, add it to spots\n if allowed[index] & bit\n spots << index\n end\n end\n\n if spots.length == 0\n return []\n elsif spots.length == 1\n board.board[spots[0]] = n\n stuck = False\n break\n elsif stuck\n new_guesses = spots.map { |index| [index, n] }\n guess, count = pickbetter(guess, count, new_guesses)\n end\n end\n end\n end\n\n if stuck\n guess.shuffle! unless guess.nil?\n return guess\n end\n end\n end",
"def solve\n max = nil\n\n # Start with the longest possible and work down. \n 9.downto( 1 ) do |i|\n max = Array.new( i ) {|j| 1 + j}.permutation.to_a.map! {|j| j.join.to_i}.select {|j| j.prime? }.max\n break if max\n end\n \n max\n end",
"def problem_108(size = 1001)\n func = lambda do |a|\n if a.length == 1\n a[0]+1\n else\n m = a[0]\n (2*m+1) * func.call(a[1,a.length]) -m\n end\n end\n\n primes = Primes.upto(200)\n prime_number = lambda do |a|\n r = 1\n a.sort.reverse.each_with_index { |m,i| r *= primes[i] ** m }\n r\n end\n\n values = {}\n last = 0\n 1.upto(100).each do |nn|\n nn.groupings do |a|\n sols = func.call a\n ans = prime_number.call a\n# puts \"np=#{nn} sols=#{sols} ans=#{ans} => #{a.inspect}\"\n if values[sols]\n values[sols] = [values[sols],[ans,a]].min\n else\n values[sols] = [ans,a]\n end\n true\n end\n size.upto(size*5/4) do |num|\n if values[num]\n puts \"for np = #{nn} => #{num} => #{values[num].inspect}\"\n if last == values[num]\n puts \"factors = #{values[num][0].factors}\"\n return values[num][0] \n end\n last = values[num]\n break\n end\n end\n #values.sort.each do |k,v|\n # puts \"#{k} => #{v}\"\n #end\n end\n nil\nend",
"def solve\n 1.upto(100).inject(:*).to_s.split('').map{|x| x.to_i}.inject(:+)\nend",
"def solutions(a)\r\n\r\n ary = a.sort\r\n ary.each_with_index do |num, index|\r\n if ary[index+1] != num + 1 && index != ary.length-1\r\n return num + 1\r\n end\r\n end\r\n\r\nend",
"def solution(number)\nn = 0..number\na = []\nfor i in n\n if i % 3 == 0 || i % 5 == 0\n a = a.push(i)\n end\n end\ns = 0\n# a.pop\na.each {|x| s += x}\ns\nend",
"def solve_again_with_issues(array, sum)\n result = {}\n freq = {}\n count = 0\n\n array.each do |el|\n freq[el] ? freq[el] += 1 : freq[el] = 1\n end\n\n array.each do |el|\n if freq[sum - el] && !result[sum - el]\n count += freq[sum - el]\n end\n end\n count/2\nend",
"def correct(element)\n result = nil\n element.downto(0).each do |j|\n i = element - j\n if j == element && j % 3 == 0\n result = Array.new(j, 5)\n elsif i % 5 == 0 && j % 3 == 0\n result = Array.new(j, 5) + Array.new(i, 3)\n elsif i == element && i % 5 == 0\n result = Array.new(i, 3)\n end\n\n break if result\n end\n\n if result.nil?\n puts -1\n else\n puts result.join()\n end\nend",
"def solve\n s = Hash[(1...1000).map { |i| [i, i * i] }]\n (1...1000).each do |c|\n (1...c).each do |b|\n (1..b).each do |a|\n return a * b * c if (a + b + c) == 1000 && (s[a] + s[b]) == s[c]\n end\n end\n end\nend",
"def solve(ingredients, part_two: false)\n score = 0\n max = 0\n\n (0..100).each do |i|\n (0..100 - i).each do |j|\n (0..100 - i - j).each do |k|\n l = 100 - i - j - k\n capacity = calculate_total(ingredients, \"capacity\", i, j, k, l)\n durability = calculate_total(ingredients, \"durability\", i, j, k, l)\n flavor = calculate_total(ingredients, \"flavor\", i, j, k, l)\n texture = calculate_total(ingredients, \"texture\", i, j, k, l)\n calories = calculate_total(ingredients, \"calories\", i, j, k, l)\n\n next if part_two && calories != 500\n next if capacity <= 0 || durability <= 0 || flavor <= 0 || texture <= 0\n\n score = capacity * durability * flavor * texture\n max = score if score > max\n end\n end\n end\n max\nend",
"def solve(arr)\n answer = \"Every num has a match.\"\n arr.each do |num|\n if !arr.include?(num * -1)\n answer = num\n end\n end\n answer\nend",
"def solution(a)\n accessed = Array.new(a.size + 1, nil)\n caterpillar_back = 0\n count = 0\n\n a.each_with_index do |x, caterpillar_front|\n if accessed[x] == nil\n accessed[x] = caterpillar_front\n else\n new_caterpillar_back = accessed[x] + 1\n first_part_size = caterpillar_front - caterpillar_back\n second_part_size = caterpillar_front - new_caterpillar_back\n count += first_part_size * (first_part_size + 1) / 2\n count -= (second_part_size) * (second_part_size + 1) / 2\n caterpillar_back.upto(new_caterpillar_back - 1) { |n| accessed[a[n]] = nil}\n accessed[x] = caterpillar_front\n caterpillar_back = new_caterpillar_back\n end\n end\n\n remaining_size = a.size - caterpillar_back\n count += (remaining_size) * (remaining_size + 1) / 2\n end",
"def solution(n)\n n.to_s.split(//).inject(1) { |a,d| a + d.to_i }\nend",
"def solve\n # Read lines and split into start-end pairs.\n pairs = []\n IO.read( 'resources/0079_keylog.txt' ).split.uniq.each do |line|\n pairs << line[0, 2] << line[1, 2] << line[0] + line[2]\n end\n\n # Delete duplicates and compute weight based on start character frequency.\n pairs.uniq!\n weight = (0..9).map {|i| pairs.count {|p| p[0].to_i == i}}\n\n # Order pairs according to most popular starting character, since we want\n # to maximize how many numbers appear after each one.\n pairs.sort_by! {|p| 10 * weight[p[0].to_i] + weight[p[1].to_i]}\n\n # Concatenate characters as long as they haven't been seen before. This\n # is not a general-purpose solution, but the problem (as stated) is not\n # exceptionally challenging.\n pwd = []\n pairs.reverse.each do |p|\n pwd << p[0] unless pwd.include?( p[0] )\n pwd << p[1] unless pwd.include?( p[1] )\n end\n\n pwd.join.to_i\n end",
"def problem_60\n prime_check = lambda do |a,b|\n (a + b).to_i.prime? && (b + a).to_i.prime?\n end\n\n find_match = lambda do |a,k|\n r = a.select {|p| k != p && prime_check.call(k,p) }\n end\n\n primes = Primes.upto(10_000).map(&:to_s)\n primes.delete(\"2\")\n\n hit = {}\n\n primes.each do |p1|\n p1a = find_match.call(primes,p1)\n p1a.each do |p2|\n p2a = find_match.call(p1a,p2)\n p2a.each do |p3|\n p3a = find_match.call(p2a,p2)\n p3a.each do |p3|\n p4a = find_match.call(p3a,p3)\n p4a.each do |p4|\n p5a = find_match.call(p4a,p4)\n if p5a.length > 0\n p5a.each do |p5|\n a = [p1,p2,p3,p4,p5]\n sum = a.map(&:to_i).reduce(&:+)\n unless hit[sum]\n puts \"#{sum} #{a.inspect}\"\n else\n hit[sum] = true\n end\n return sum\n end\n end\n end\n end\n end\n end\n end\nend",
"def solution(n)\n n.to_s(2).reverse.to_i.to_s.split('1').map(&:length).max || 0\nend",
"def problem_four\n max = 0\n\n 100.upto(999).each do |a|\n a.upto(999).each do |b|\n max = a * b if palindrome?(a * b) && (a * b) > max\n end\n end\n\n max\n end",
"def solution(a)\n # write your code in Ruby 2.2\n binding.pry\n trips = Hash.new {|h,k| h[k]=0}\n start = 0\n ending = 0\n min = nil\n a.each_with_index do |trip,i|\n ending = i\n\n if trips[trip] == 0\n min = ending - start\n end\n trips[trip] += 1\n\n while start < ending\n break if trips[a[start]] - 1 == 0\n trips[start] -= 1\n start += 1\n min = ending - start if ending-start < min\n end\n end\n min\nend",
"def main\n max = 10 ** 9 + 7\n all = 1\n zero = 1\n nine = 1\n zn = 1\n N.times.each do\n all = all * 10 % max\n zero = zero * 9 % max\n nine = nine * 9 % max\n zn = zn * 8 % max\n end\n return (all - zero - nine + zn) % max\nend",
"def isLucky(n)\r\nhalf1 = []\r\nhalf2 = []\r\nn_string = n.to_s\r\n\r\n\r\nfirsthalf = (n_string.length / 2) - 1\r\nsecondhalfstart = (n_string.length / 2)\r\nsecondhalfend = (n_string.length - 1)\r\n(0..firsthalf).each do |idx|\r\n half1 << n_string[idx].to_i\r\nend\r\n\r\n(secondhalfstart..secondhalfend).each do |idx|\r\n half2 << n_string[idx].to_i\r\nend\r\n\r\nreturn true if half1.inject(:+) == half2.inject(:+)\r\nreturn false\r\nend",
"def solution(a)\n\traise ArgumentError.new(\"a has to be non empty array of max size #{MAX_LEN}\") if !a.is_a? Array or a.empty? or a.length > MAX_LEN\n\tret = 0\n\t#puts a.inspect\n\tmy_h = Hash.new\n\ta.each do |e|\n\t\tif my_h.include? e\n\t\t\tmy_h[e] += 1\n\t\telse\n\t\t\tmy_h[e] = 1\n\t\tend\n\tend\n\n\tmy_h_sort = my_h.sort_by {|k, v| -v}\n\t# -> my_h_sort[value][occurances]\n\treturn 0 if my_h_sort.first[1] < a.size/2\n\tleader_val = my_h_sort.first[0]\n\n\tocc_array = Array.new\n\toccurances = 0\n\ta.each do |e|\n\t\toccurances += 1 if e == leader_val\n\t\tocc_array.push(occurances)\n\tend\n\t#puts occ_array.inspect\n\n\tfor idx in (0...a.length-1) do\n\t\tsum1 = occ_array[idx]\n\t\tsum2 = occ_array.last - occ_array[idx]\n\n\t\t# puts \"#{idx}+1 < #{sum1*2}\"\n\t\t# puts \"#{(a.length - idx -1)} < #{(sum2*2 )} \"\n\n\t\tif (idx+1) < sum1 * 2 && (a.length - idx - 1 ) < sum2 * 2\n\t\t\t## we have a leader\n\t\t\t#puts \"YEAH #{idx}\"\n\t\t\tret += 1\n\t\tend\n\t\t\t#puts \"-------- ret: #{ret}\"\n\tend\n\treturn ret\nend",
"def solution(n)\n\t(1..n).map(&:to_s).map(&:chars).join.chars.map(&:to_i).reduce(:+)\nend",
"def solution(number)\r\n (3...number).each_with_object([]) { |n, arr| arr << n if (n % 3).zero? || (n % 5).zero? }.uniq.sum\r\nend",
"def solver (seed_char, blanks_words_sizes, matrix)\n\t# Set numerical target\n\ttarget = magic_num(seed_char)\t\n\t# Find magic number sum buckets\n\tskynet(target, blanks_words_sizes, blanks_words_sizes.length - 1, 0, [])\n\t# Alphabetical sort input matrix\n\tsorted_seed_char = seed_char.chars.sort.join\t\n\n\t# Find unique sets from skynet solutions\n\t$answer[:trace].each do |arrOarr|\n\t\tarrOarr.sort!\n\tend \n\n\t$answer[:trace].uniq!\t\n\t\n\t# Finds match for complete set of words from skynet solutions\n\t$answer[:trace].each do |answer_arr_el|\t\t\t\t\n\t\tunordered_match(sorted_seed_char, matrix, answer_arr_el, answer_arr_el.length - 1, \"\", [])\n\t\t# Can be ignored\n\t\t$ops += $seed[answer_arr_el[0][0]][:num_groups][answer_arr_el[0][1]].length *\n\t\t\t$seed[answer_arr_el[1][0]][:num_groups][answer_arr_el[1][1]].length *\n\t\t\t$seed[answer_arr_el[1][0]][:num_groups][answer_arr_el[1][1]].length *\n\t\t\t$seed[answer_arr_el[1][0]][:num_groups][answer_arr_el[1][1]].length\t\t\n\tend\n\t\n\treturn $answer[:words]\nend",
"def problem_104\n all = [\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\"]\n k = 2\n low_fn0,low_fn1 = 1,1\n hi_fn0,hi_fn1 = 1,1\n loop do\n k += 1\n low_fn0,low_fn1 =(low_fn0 + low_fn1) % 10_000_000_000, low_fn0\n hi_fn0, hi_fn1 = hi_fn0 + hi_fn1, hi_fn0\n if hi_fn0 > 1_000_000_000_000_000_000\n hi_fn0 /= 10\n hi_fn1 /= 10\n end\n front = false\n next unless k > 300\n hi = hi_fn0.to_s[0,9].split(//)\n if (hi & all).length == 9\n puts \"front #{k}\" \n front = true\n end\n if (low = low_fn0.to_s).length >= 9\n low = low[-9,9].split(//)\n if (low & all).length == 9\n puts \"back #{k}\" \n return k if front\n end\n end\n end\nend",
"def problem_60a\n num_cut = 5\n# simple\n pairs = {}\n seen_primes = []\n num_primes = 0\n last = start = Time.now\n Primes.each do |p|\n next if p == 2\n b = p.to_s\n seen_primes.each_index do |sp_i|\n sp = seen_primes[sp_i]\n a = sp.to_s\n ai,bi = a.to_i,b.to_i\n ab = (a + b).to_i\n ba = (b + a).to_i\n\n if ba.prime? && ab.prime?\n # We have a pair that works both ways so add the peer to each prime\n pairs[ai] = aa = ((pairs[ai] || []) << bi).uniq\n pairs[bi] = bb = ((pairs[bi] || []) << ai).uniq\n next unless pairs[bi].length >= num_cut - 1 # bi is biggest of pair\n\n check = ([ai] + aa) & ([bi] + bb)\n if check.length >= num_cut\n puts \"Try #{check.inspect}\"\n perm = check.permutation(2).to_a\n new = perm.select do |x,y|\n (x.to_s + y.to_s).to_i.prime? && (x.to_s + y.to_s).to_i.prime?\n end\n if new.length == perm.length\n n = new.flatten.uniq\n sum = n.reduce(&:+)\n puts \"#{n.inspect} *** #{sum}\"\n return sum\n end\n end\n end\n end\n seen_primes << p\n end\n nil\nend",
"def f(n)\n # your code here\n result = []\n possibles = (2..n).flat_map{ |s| [*2..n].combination(s).map(&:join).to_a }\n p possibles\n possibles.each do |i|\n x = 0\n temp_arr = []\n temp = i.split('').map { |j| j.to_i }\n p temp\n while x < temp.length do \n if i[x + 1] != i[x] + 1 || i[x + 1] == nil\n temp_arr << i[x]\n end\n x += 1\n end\n result << temp_arr\n end\n result.length\nend",
"def solution(a)\n s= a.sort\n 0.step(s.size - 1).inject(0) do |result, x|\n z= x+2\n (x+1).step(s.size - 1).inject(result) do |acc, y|\n z+=1 while z < s.size && s[x] + s[y] > s[z]\n acc += z-y-1\n end\n end\nend",
"def solution2(a)\n\n counts = Hash.new(0)\n\n a.each do |int|\n counts[int] += 1\n end\n\n non_divisors = []\n\n a.each do |int|\n div_count = 0\n for i in 1..int do\n div_count += counts[i] if int % i == 0\n end\n non_divisors << a.length - div_count\n end\n\n non_divisors\n\nend",
"def solution(a)\r\n # write your code in Ruby 2.2\r\n #trangular\r\n # a[0] = 10\r\n # a[2] = 5\r\n # a[4] = 8\r\n # 10 + 5 > 8\r\n # 5 + 8 > 10\r\n #8 + 10 > 5\r\n \r\n \r\n l=a.count\r\n \r\n i=0\r\n while(i<l) do\r\n j=i+1\r\n while(j<l) do\r\n k=j+1\r\n \r\n \r\n while(k<l) do\r\n if((a[i] + a[j] > a[k]) && (a[j] +a[k] > a[i]) && (a[k] + a[i] >a[j]))\r\n return 1\r\n end\r\n k+=1 \r\n end \r\n \r\n j+=1 \r\n end\r\n i+=1\r\n end\r\n \r\n return 0\r\n \r\nend",
"def solution(a)\n counter = Hash.new(0)\n a.each do |elem|\n counter[elem] += 1\n end\n\n (1..a.size).each do |number|\n return 0 if counter[number] != 1\n end\n\n 1\nend",
"def alg; end",
"def solution(k, a)\n count = 0\n current = 0\n a.each { |length| \n current += length\n if current >= k\n current = 0\n count += 1\n end\n }\n count\nend",
"def find3(a, X)\n # scan through array\n # build hash storing complement in each key\n complements = {}\n a.each_with_index do |val, ind|\n if complements[X - val]\n complements[X - val].push(ind)\n else\n complements[X - val] = [ind]\n end\n end\n\n # scan through the array again\n # get complement\n # for each value scan the remainder of the arrray\n # for a value such taht a + b = the complement\n\n # for each character we have built a dictionary such that, we can find\n # x = a + complement\n\n # [1, 2, 3]\n # 1 + 2 = 3\n # 1 + 3 = 4 =>\n\n # for each value in the array (a) look at all following values (b) and see if a + b\n # is in the dictionary, if it is, check that their indices do not collide with the index\n # stored at dict(a+b)\n\n a.each_with_index do |va, i|\n a.each_with_index do |vb, j|\n break if i == j\n\n complement = va + vb\n indices = complements[complement]\n\n indices.each do |z|\n # every index is unique\n return [i, j, z] unless z == i || z == j\n end\n end\n end\n\n return nil\nend",
"def permuted_nums()\r\n\t# *2...*6 must have the same digits (and length) as the original.\r\n\t# That's why the first character must be 1.\r\n\t# And the second character must be less that 7.\r\n\trunner = 123455\r\n\tmax = 170000\r\n\twhile runner < max\r\n\t\trunner += 1\r\n\t\t\r\n\t\tmult_count = 1\r\n\t\t(2..6).each{ |mult_num| \r\n\t\t\ttmp = runner * mult_num\r\n\t\t\t\r\n\t\t\tif !is_permutation_of(tmp, runner)\r\n\t\t\t\tbreak\r\n\t\t\tend\r\n\t\t\tif mult_num == 6\r\n\t\t\t\treturn runner\r\n\t\t\tend\r\n\t\t\tmult_count += 1\r\n\t\t}\r\n\tend\r\n\tputs ''\r\n\treturn false\r\nend",
"def solve\n\t\t# Attempt to find a mismatch in start/end\n\t\t# letters in the maps. This signifies first\n\t\t# and last words of the solution\n\t\tdiff_list = []\n\t\t@start_map.each {|k,v|\n\t\t\tr = @end_map[k]\n\t\t\tdiff = r-v\n\t\t\tputs \"#{k} => #{v} | #{r} diff #{diff}\"\n\t\t\t\n\t\t\t# If values in map don't match, remember this\n\t\t\tif diff != 0\n\t\t\t\tdiff_list << diff\n\t\t\tend\n\t\t}\n\n\t\t# Ensure the matchings satisfy the properties of\n\t\t# and solvable puzzle. If there are \n\t\tputs diff_list\n\t\tif diff_list.size == 0\n\t\t\t# This means there are cycles (multiple\n\t\t\t# choices for the first word).\n\t\telsif diff_list.size == 2\n\t\t\t# Ensure there is exactly one starting\n\t\t\t# word and exactly one ending word\n\t\t\treturn [] if !diff_list.include?( 1 )\n\t\t\treturn [] if !diff_list.include?( -1 )\n\t\telse\n\t\t\t# This signifies an unsolvable puzzle\n\t\t\tputs \"Not Solvable\"\n\t\t\treturn []\n\t\tend\n\n\t\t# The characteristics of this word list look\n\t\t# good so far. Let's now try to enumerate the\n\t\t# solution array\n\t\treturn enumerate_solution\n end",
"def icecreamParlor(m, arr)\n # Complete this function\n res = []\n arr.each_index do |i|\n if i + 1 !=nil\n j = i + 1\n while j <= arr.length - 1\n if arr[i]+arr[j] == m\n res.push([i+1,j+1])\n end\n j+=1\n end\n end\n end\n res\nend",
"def solution(x, a)\n perm = (1..x).to_a\n return -1 unless (perm - a).empty?\n a.index(a.uniq.last)\nend",
"def solution_one\n x = 0\n (1..999).each do |i|\n if (i % 5) == 0 || (i % 3) == 0\n x = x + i\n end\n end\n x\nend",
"def has_solution(n)\n# Store input in variable N\n$N = n\n\n#Declare and initialize variables to find the maximum number of times 6, 9 and 20 divide into N\n$A_1 = $N/$x\n$A_2 = $N/$y\n$A_3 = $N/$z\n\n#Declare and initialize arrays to store potential combinations, where A is number of 6 packs, B number of 9 packs and C number of 20 packs\n@A = (0..$A_1).to_a\n@B = (0..$A_2).to_a\n@C = (0..$A_3).to_a\n\n#Declare function to calculate different combinations of A, B and C\ndef test(i,j,k)\nreturn @A[i]*$x + @B[j]*$y + @C[k]*$z\nend\n\n#Loop to exhaustively test combinations of A, B and C, with values ranging between 1 and the maximum number of times 6, 9 and 20 divide into N\nfor i in (0..$A_1)\n for j in (0..$A_2)\n for k in (0..$A_3)\n #Use declared function test to check each combination of i,j and k, and if it is equal to N, print out values of i, j and k\n if test(i,j,k) == $N\n return true\n end\n end\n end\nend\n\nend",
"def solution(k, m, a)\n from = a.max\n to = a.inject(:+)\n min = from\n while from <= to\n mid = (from + to) / 2\n if check(mid, k, m, a)\n min = mid\n to = mid - 1\n else\n from = mid + 1\n end\n end\n min\nend",
"def solve(s)\n answer = \"\"\n (0...s.length - 1).each do |idx|\n if s[idx] != s[idx + 1]\n answer += s[idx]\n end\n if idx == s.length - 2 && s[idx] == s[idx + 1]\n answer += s[idx]\n end\n end\n return answer\nend",
"def solve\n t = IO.read( 'resources/0089_roman.txt' ).split.map do |line|\n n = ProjectEuler::Roman.to_i( line )\n line.length - ProjectEuler::Roman.from_i( n ).length\n end\n\n t.inject( :+ )\n end",
"def solution(a)\n return 1 if a.empty?\n a.sort!\n return 1 if a.first > 1\n return a.first + 1 if a.length <2\n (0..(a.length)).each do |index|\n return a[index] + 1 if a[index] + 1 != a[index + 1]\n end\n return a.last + 1\nend",
"def solve(words)\n x = 0\n while x < words.max.length\n equal = words.all? do |word|\n word[0..x] == words[0][0..x]\n end\n if equal == false\n return words[0][0...x]\n end\n x += 1\n end\nend",
"def solution(n)\n number = 1\n stop = false\n while !stop\n results = []\n (1..n).each do |divider| \n if number % divider != 0\n results << false\n else\n results << true\n end\n end\n if results.count {|x| x == false } > 0\n stop = false\n number += 1\n else \n stop = true\n end \n end\n number\nend",
"def problem_78\n n = 1\n p_cache = [1]\n\n generate = lambda do |k|\n ret = 0\n sign = 0\n Integer.generalized_pentagonals do |gp|\n if k < gp\n false # Need to exit ruby1.8, can't break...\n else\n if sign >= 0\n ret += p_cache[k-gp]\n else\n ret -= p_cache[k-gp]\n end\n sign += (sign == 1) ? -3 : 1 # 4 states + + - -\n end\n end\n p_cache[k] = ret % 100_000_000\n ret\n end\n\n p = 1\n loop do\n r = generate.call(p)\n# puts \"#{p} #{generate.call(p)}\"\n break if r % 1_000_000 == 0\n p += 1\n end\n p\nend",
"def get_hint(secret, guess)\r\n hash1 = Hash.new(0)\r\n hash2 = Hash.new(0)\r\n bulls = 0\r\n cows = 0\r\n \r\n secret.each_char.with_index do |char, idx| \r\n hash1[char] += 1\r\n bulls += 1 if secret[idx] == guess[idx]\r\n end\r\n \r\n guess.each_char {|char| hash2[char] += 1}\r\n hash1.keys.each {|key| cows += [hash1[key], hash2[key]].min}\r\n \r\n bulls.to_s + \"A\" + (cows-bulls).to_s + \"B\"\r\nend",
"def solution(n)\n\tval = 0.0\n\tval += 1.0 unless n[0].zero?\n\tval += 2.0 unless n[1].zero?\n\tval += 4.0 unless n[2].zero?\n\tval += 8.0 unless n[3].zero?\n val\n\t\nend",
"def solution(a)\n n = a.size\n return 0 unless n > 2\n a.sort!\n\n (2..n - 1).each do |i|\n return 1 if a[i - 2] + a[i - 1] > a[i]\n end\n\n return 0\nend",
"def solution(a)\n # write your code in Ruby 2.2\n sum = a.inject(:+)\n acc = 0\n\n min = 99999999\n a[0..-2].each do |n|\n sum -= n\n acc += n\n\n min = [(acc - sum).abs, min].min\n end\n min\nend",
"def goodVsEvil(good, evil)\n # good_power, evil_power = 0, 0\n # good.split.each_with_index do |num, i|\n # if i < 3\n # good_power += num.to_i * (i + 1)\n # elsif i < 5\n # good_power += num.to_i * i\n # elsif i == 5\n # good_power += num.to_i * 2 * i\n # end\n # end\n god = good.split.each_with_index.inject(0) do |sum, (num, i)|\n if i < 3\n sum + num.to_i * (i + 1)\n elsif i < 5\n sum + num.to_i * i\n elsif i == 5\n sum + num.to_i * 2 * i\n end\n end\n \n \n evl = evil.split.each_with_index.inject(0) do |sum, (num, i)|\n case i\n when 0\n sum + num.to_i * (i + 1)\n when 1, 2, 3\n sum + num.to_i * 2\n when 4\n sum + num.to_i * (i - 1)\n when 5\n sum + num.to_i * i\n when 6\n sum + num.to_i * (i + 4) \n end\n end\n \n if evl > god\n str = \"Evil eradicates all trace of Good\"\n elsif evl < god\n str = \"Good triumphs over Evil\"\n else\n str = \"No victor on this battle field\"\n end\n \n \"Battle Result: #{str}\"\nend",
"def solve( n = 100 )\n n.partition_sieve[-1] - 1\n end",
"def solve line\n letters = ('A'..'Z').map { |e| e }\n return prob_1(line, letters)\nend",
"def solution(a)\n # write your code in Ruby 2.2\n return 0 unless a[0]\n necklaces = create_necklaces(a)\n \n \n size = necklaces.length\n index = 0\n max = necklaces[index].length\n \n while index < size\n if necklaces[index].length > max\n max = necklaces[index].length\n end\n index += 1\n end\n \n return max\nend",
"def pzoe\n sum = 0\n (0..9).each do |a|\n (0..9).each do |b|\n (0..9).each do |c|\n (0..9).each do |e|\n (0..9).each do |f|\n (0..9).each do |g|\n sum += a * 100000 + b * 10000 + c * 1000 + e * 100 + f * 10 + g if a * 100000 + b * 10000 + c * 1000 + e * 100 + f * 10 + g == a ** 5 + b ** 5 + c ** 5 + e ** 5 + f ** 5 + g ** 5\n end\n end\n end\n end\n end\n end\n sum - 1\nend",
"def solve(points)\r\n min_dis = BigDecimal(\"-1\")\r\n p min_dis.class\r\n \r\n min_route = []\r\n (1..points.length-1).to_a.permutation(points.length-1).to_a.each do |route|\r\n route.unshift(0)\r\n #p route\r\n dis = BigDecimal(\"0\")\r\n (0...route.length-1).each do |i|\r\n dis += Math.sqrt((BigDecimal(points[route[i]][0].to_s) - BigDecimal(points[route[i+1]][0]))**2 + (BigDecimal(points[route[i]][1]) - BigDecimal(points[route[i+1]][1]))**2)\r\n end\r\n dis += Math.sqrt((BigDecimal(points[route[route.length-1]][0]) - BigDecimal(points[route[0]][0]))**2 + (BigDecimal(points[route[route.length-1]][1]) - BigDecimal(points[route[0]][1]))**2)\r\n #p dis\r\n if min_dis == -1 || min_dis > dis\r\n #p dis.class\r\n min_dis = dis\r\n min_route = route\r\n end\r\n end\r\n\r\n p min_dis.class\r\n print \"{{\"\r\n (0...min_route.length).each do |i|\r\n print \"#{min_route[i]+1},\"\r\n end\r\n print \"1},#{min_dis}}\\n\"\r\n #p min_dis\r\n #p min_route\r\n\r\nend",
"def problem_79\n digits = []\n lines = open(\"keylog.txt\").reduce([]) do |a,l|\n a << l.chomp.split(//).map(&:to_i)\n end\n p = lines.transpose\n loop do \n first = (p[0] - p[1]).uniq\n if first.length == 1\n d = first[0]\n digits << d \n puts \"Remove #{d}\"\n # shift off leading 'd' values\n lines.select {|l| l[0] == d}.map {|l| l.shift; l.push nil }\n # Rebuild out first, second, third arrays\n p = lines.transpose\n return digits.map(&:to_s).join if p.flatten.compact.length == 0\n puts \"len = #{p.flatten.compact.length}\"\n else\n raise \"Trouble - 2 candidates : #{first.inspect}, rework algorithm\"\n end\n end\nend",
"def solution5(input)\n # Approach\n # Map over the initial array (to return a transformed array)\n # Map over each interal array (to return a transformed array)\n # Creates an enumerable range up to the value in the array\n # Multiple each value in the range using the inject method\n # which iterates and keeps the running total\n\n # Final solution\n # Uses shorthand version of inject\n # Remove the useless multiple by 1\n # Note the use of the starting value of 1 for inject\n # which makes 0!=1 class Quiz\n # find even values\n def solution1(input)\n # Final solution\n input.flatten.select do |value|\n value.even?\n end\n\n # First solution:\n # Works correctly\n # Unoptimized\n #\n # input.map do |ary|\n # ary.select do |value|\n # value.even?\n # end\n # end.flatten\n end\n\n # find value sum\n def solution2(input)\n # Final Solution\n input.flatten.inject(:+)\n\n # Second solution:\n # Works correctly\n # Doesn't use shortcut version of inject\n #\n # input.flatten.inject do |sum, value|\n # sum += value\n # end\n\n # First solution:\n # Works correctly\n # Unoptimized\n #\n # input.map do |ary|\n # ary.inject do |sum, value|\n # sum += value\n # end\n # end.inject do |sum, value|\n # sum += value\n # end\n end\n\n # find max value\n def solution3(input)\n # Final solution\n input.flatten.max\n\n # First solution:\n # Works correctly\n # Unoptimized\n #\n # input.map do |ary|\n # ary.max\n # end.max\n end\n\n # sum the array lengths\n def solution4(input)\n # Final solution\n input.map(&:length).inject(0, :+)\n\n # Second solution:\n # Works correctly\n # Doesn't use shortcut version of inject\n #\n # input.map(&:length).inject{|sum, value| sum += value}\n\n # First solution:\n # Works correctly\n # Unoptimized\n #\n # input.map do |ary|\n # ary.length\n # end.inject {|sum, value| sum += value}\n end\n\n # transform to factorials\n # Factorial is defined as the product of all the whole numbers from 1 to n\n # Examples:\n # 4! = 4*3*2*1\n # 1! = 1\n # 0! = 1\n def solution5(input)\n # Approach\n # Map over the initial array (to return a transformed array)\n # Map over each interal array (to return a transformed array)\n # Creates an enumerable range up to the value in the array\n # Multiple each value in the range using the inject method\n # which iterates and keeps the running total\n\n # Final solution\n # Uses shorthand version of inject\n # Remove the useless multiple by 1\n # Note the use of the starting value of 1 for inject\n # which makes this work properly for all values (including 0, 1)\n input.map do |ary|\n ary.map do |value|\n (2..value).inject(1, :*)\n end\n end\n\n # First solution\n # Mostly optimized\n # Does 1 more multiplication than needed (mult by 1)\n #\n # input.map do |ary|\n # ary.map do |value|\n # (1..value).inject(1) do |factorial, value|\n # factorial *= value\n # end\n # end\n # end\n end\nend",
"def solution(a)\n cars_going_east = [0]\n\n a.each do |direction|\n next_counter = direction.zero? ? cars_going_east.last + 1 : cars_going_east.last\n cars_going_east << next_counter\n end\n\n passings = 0\n a.each_with_index do |direction, index|\n passings += cars_going_east[index] if direction == 1\n end\n\n return -1 if passings > 1000000000\n passings\nend",
"def solution(n)\n sum = 0\n (1...n).each do |elem|\n sum += elem if elem % 3 == 0 or elem % 5 == 0\n end\n sum\nend"
] |
[
"0.6831983",
"0.65106994",
"0.6392877",
"0.6388171",
"0.6386431",
"0.6382194",
"0.63649565",
"0.6354049",
"0.63486177",
"0.6345058",
"0.63345295",
"0.62888",
"0.62423277",
"0.6210549",
"0.62018454",
"0.6191842",
"0.61618936",
"0.615998",
"0.6149369",
"0.61284465",
"0.6119261",
"0.6113548",
"0.6093874",
"0.6090132",
"0.60899353",
"0.6086665",
"0.6079274",
"0.6076925",
"0.60643506",
"0.6058994",
"0.60549116",
"0.6042496",
"0.6039968",
"0.60325766",
"0.60231465",
"0.60218185",
"0.6014576",
"0.6009278",
"0.6009222",
"0.6007281",
"0.6006514",
"0.5999286",
"0.59988695",
"0.5978352",
"0.59748465",
"0.5952385",
"0.59416634",
"0.5941455",
"0.59395236",
"0.5937558",
"0.59364176",
"0.5931487",
"0.5908252",
"0.5906763",
"0.59062314",
"0.590183",
"0.590154",
"0.59013176",
"0.5894237",
"0.5891683",
"0.58902526",
"0.58896834",
"0.58794177",
"0.58725804",
"0.5872205",
"0.5864848",
"0.5862757",
"0.5862583",
"0.586241",
"0.58613473",
"0.58605635",
"0.5859339",
"0.58529425",
"0.58504254",
"0.5843738",
"0.5831859",
"0.58286804",
"0.5827708",
"0.58276767",
"0.5824813",
"0.58200175",
"0.58177197",
"0.58142847",
"0.58116937",
"0.580825",
"0.58074266",
"0.5807022",
"0.5803787",
"0.58034986",
"0.5799451",
"0.57961106",
"0.5788277",
"0.57880193",
"0.57866526",
"0.57857716",
"0.5776732",
"0.5775269",
"0.5772641",
"0.5768116",
"0.5767961",
"0.5767148"
] |
0.0
|
-1
|
Introducing the game. We'll run this first.
|
def start_greetings
puts "This is the castle of the Ice King. At the end of the corridor there are two doors"
puts "Thau shall choose to go through one door, the Fire Door or the Snow Door"
puts "Press 1 for Fire Door. Press 2 for Snow Door"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def start_game\n begin\n @game_text.intro\n\n # Run the tutorial\n ActionDirector.new(@world, @player).call({command: :talk, target: :jerry})\n\n # The main game\n while @player.alive? && @world.has_hostiles?\n @player.in_battle? ? battle_loop : game_loop\n end\n\n @player.alive? ? @player.win : @player.defeat\n rescue SystemExit, Interrupt # Catpure ctrl+c exit, end gracefully\n @game_text.exit\n end\n end",
"def game_setup\n end",
"def start_new_game\n # TODO: increment stats\n # stats = GameStats.new\n # stats.game_number += 1\n\n # create new player\n\n\n # print New game text\n new_game_banner = File.read('./old_code/fancy_text/new_game.txt')\n puts new_game_banner\n\n # display into story\n puts display_intro(@player_one.name)\n\n # auto load stage 1\n require './lib/stage'\n Stage.new(1, 5, @player_one)\n end",
"def start_game\n @new_prompt.title_screen\n @new_commands.create_new_board(5)\n select_mode\n end",
"def game_start\n game_setup\n @console_delegate.show\n end",
"def game_setup\n cls\n print \"----------------\\n\"\n print \"Cinnabar - A Game Of Rocks and Minerals\\n\"\n print \"----------------\\n\\n\"\n\n print \"DISCLAIMER\\n\"\n print \" Cinnabar (c) 1966, 1972, 1980 is a trademark of Naturegraph Publishers, Inc.\\n\"\n print \" No copyright or trademark infringement is intended in using Cinnabar.\\n\\n\"\n\n print \"Welcome to Cinnabar, a digital version of the 1966 card game by Vinson Brown.\\n\"\n print \"Rules can be found in RULES.md, and info can be found in README.md.\\n\"\n print \"Source code can be found at https://www.github.com/Pokeconomist/cinnabar.\\n\\n\"\n end",
"def start\r\n\t\t\t@output.puts \"Welcome to Deal or No Deal!\"\r\n\t\t\t@output.puts \"Designed by: #{created_by}\"\r\n\t\t\t@output.puts \"StudentID: #{student_id}\"\r\n\t\t\t@output.puts \"Starting game...\"\r\n\t\tend",
"def start\n DataManager.create_game_objects\n $game_party.setup_starting_members\n $game_map.setup(Config::Starting_Map_ID)\n $game_player.moveto(Config::X_Pos, Config::Y_Pos)\n $game_player.followers.visible = false\n $game_player.refresh\n $game_player.make_encounter_count\n\n @character_name = $game_player.character_name\n @character_index = $game_player.character_index\n $game_player.set_graphic('', 0)\n\n $game_system.menu_disabled = true\n Graphics.frame_count = 0\n\n super\n create_foreground\n create_background\n create_command_window\n play_title_music\n end",
"def Main\n #Begin preinitialization\n preInit()\n\n #Render Game Window and begin drawing onto the screen.\n\n DEBUG.cout(\"Initializing Game Window...\", 0, false)\n window = GameWindow.new\n window.show\n\n #End game and return to desktop\n return nil\nend",
"def start \n\t @output.puts \"Welcome to Noughts and Crosses!\"\n\t @output.puts \"Created by:#{created_by}\"\n\t @output.puts \"StudentID: #{student_id}\"\n\t @output.puts \"Starting game...\"\n\t @output.puts \"Player 1: 0 and Player 2: 1\"\n\n\t\n\tend",
"def start\r\n initialize_game\r\n until @game.over?\r\n take_turn\r\n end\r\n print_outcome\r\n end",
"def game_setup\n\t\t\tputs \"Would you like to play? [yes|no] \"\n\n\t\t\tinput = gets.chomp.downcase\n\n\t\t\tif input == \"yes\"\n\t\t\t\tname = @ui.get_name()\n\t\t\t\tmark = @ui.get_mark(name)\n\n\t\t\t\t@player = Player.new(name, mark)\n\n\t\t\t\tmark == 'X' ? @ai = AI.new('O', @player, @board) : @ai = AI.new('X',\n\t\t\t\t@player, @board)\n\t\n\t\t\t\tputs \"\\nTo play, you will need to input a number between 1 and 9\"\n\t\t\t\tputs \"representing to locations on the grid with 1 being the\"\n\t\t\t\tputs \"top-left corner and 9 being the bottom right corner,\"\n\t\t\t\tputs \"decreasing from left to right\\n\"\n\t\n\t\t\t\tself.run()\n\n\t\t\telse\n\t\t\t\tputs \"Have a nice day and come play next time.\"\n\t\t\t\texit\n\t\t\tend\n\t\tend",
"def play\n board_setup\n gameplay_setup\n end",
"def game_start\n\n\tclear_screen\n\n\tprint_paragraph(\"Welcome to Trapped In A Cave.\\nGuess what? You're trapped in a cave...\nCan you make it out alive?\\n(For a list of commands type help at anytime.)\")\n\nstart_room\n\nend",
"def gameplay_setup\n game_status = :new_game\n\n loop do\n print_player_turn(@board_turn.player.name)\n\n print \"Introduce your shoot - x, y: \".blue\n shoot = $stdin.gets.chomp.split(\",\").map(&:to_i)\n game_shoot = set_shoot(shoot)\n\n case game_shoot\n when :finished, :finished_game_of3\n break\n when :new_game\n game_status = :play_again\n break\n end\n end\n\n if game_status == :play_again\n setup(5, true, @best_of3)\n play\n end\n end",
"def game_start\n clear\n warning\n clear\n if @intro\n introduction()\n end\n clear\n countdown\n until @promptarr == []\n game_round() \n end\n @running = game_over(@score)\n end",
"def start()\r\n\t\t\t@output.puts(\"Welcome to Mastermind!\")\r\n\t\t\t@output.puts(\"Created by: #{created_by} (#{student_id})\")\r\n\t\t\t@output.puts(\"Starting game...\")\r\n\t\t\t@output.puts('Enter \"1\" to run the game in the command-line window or \"2\" to run it in a web browser')\r\n\t\tend",
"def play\n init_player()\n init_board()\n puts \"Test game play\"\n end",
"def intro\r\n clear # execute method clear to clear screen and place logo\r\n puts ' \"I cant stand the rain!!\" '\r\n puts ' Welcome to GK Rainfall collection application'\r\n puts ' Version 0.205'\r\n puts ' Hit enter to continue'\r\n gets\r\n end",
"def start\n puts \"Welcome to Tic Tac Toe!\"\n puts \"\"\n define_players\n play\n end",
"def intro\n\t\t@frame = @frame + 1\n\t\tif @frame == 1 or @frame == 40 \n\t\t\t@screen.fill([0, 0, 0])\n\t\telsif @frame == 10 or @frame == 60\n\t\t\t@map.updateBackground\n\t\t\t@map.sprites.each { |sprite|\n\t\t\t\tsprite.draw(@screen)\n\t\t\t}\n\t\telsif @frame == 220\n\t\t\t@frame = 0\n\t\t\tstats\n\t\t\tsetMenu\n\t\telsif @frame > 120\n\t\t\t@dialogueText.draw\n\t\tend\n\tend",
"def main\r\n welcome\r\n process_cmd_line\r\n top_up_players\r\n\r\n play_game\r\n\r\n rescue Interrupt\r\n puts\r\n end",
"def intro\n system 'clear'\n intro = PicDisplay.new\n intro.logo\n sleep(4)\n welcome\n end",
"def play\n #calls to all the methods that produce game!\n end",
"def begin_game\n\t\t#Does this need really to be stored in a variable?\n\t\tg = Game.new(@name)\n\tend",
"def run\n Interface::header\n Interface::newline\n\n count = get_number_of_players\n get_player_names( count )\n\n @b.play_game\n end",
"def main\n create_graphics\n curr_scene = $scene\n check_up\n while @running && curr_scene == $scene\n Graphics.update\n update\n end\n dispose\n # Unload title related pictures\n RPG::Cache.load_title(true)\n RPG::Cache.load_interface(true)\n ::Scheduler.start(:on_scene_switch, ::Scene_Title) if !@running && $scene.is_a?(Scene_Map)\n end",
"def start\n # start a new game using @config\n end",
"def start\n puts \"Welcome! Let's play Tic-Tac-Toe\"\n print_board\n play\n end",
"def start_game\n game_logo\n game_start_screen\n game_rules\n last_rules\n choice = maker_breaker\n game_maker if choice == 'm'\n game_breaker if choice == 'b'\n end",
"def main\n rounds = Game.start\n game = Game.new(rounds)\n roshambo = Roshambo.new(game)\n Roshambo.play(roshambo)\nend",
"def initialize\n Game.engine.draw(Game.engine.markdown.parse('# Bandit Mayhem'))\n selection = Game.engine.prompt.select('Select an option', 'New game', 'Load game', 'Quit')\n\n case selection\n when 'New game'\n save_name = Game.engine.prompt.ask('Enter save name:', default: 'bandit-mayhem')\n\n Game.player = Player.new(name: 'Nigel', health: 30, x: 1, y: 5, map: BanditMayhem::Map::Map.new('lynwood/strick_household'))\n\n # intro\n Cinematic.new('intro').play\n\n @quit = false\n when 'Load game'\n Game.load_save if File.exist?(DEFAULT_SAVE)\n # TODO fix\n # Game.player = Player.new(name: 'Nigel', health: 30, x: 1, y: 5, map: BanditMayhem::Map::Map.new('lynwood/strick_household'))\n @quit = false\n when 'Quit'\n @quit = true\n end\n end",
"def play\n greeting\n get_tiles\n move_sequence\n end",
"def new_game\n # Start again!\n puts \"\\n\\n\"\n\t\n\t# Clears output from last game\n Gem.win_platform? ? (system \"cls\") : (system \"clear\")\n \n puts \"Beginning new game:\"\n puts \"\"\n start\nend",
"def run(name)\n\t\tprint %x{clear}\n\t\tputs \"Hi #{name}! Welcome to my Text Adventure App! There are currently 2 levels to\\nchoose from, Medium or Hard. The Medium option features a nice\\nhouse to walk through with easy questions. The Hard option features\\nan old castle dungeon setting with hard IQ questions.\"\n\t\tprint \"Which level would you like to choose? \"\n\t\tchoice = Input.new.begin_input\n\t\tlevel = @choices[choice]\n\t\tlevel.generate(name)\n\t\tnew_game(name)\n\tend",
"def new_game!\n write_to_engine('ucinewgame')\n reset_board!\n set_startpos!\n @fen = nil\n end",
"def start_game\n puts \"----- WELCOME TO twO-O-Player MATH GAME! -----\"\n puts \"#{@player1.name} vs #{@player2.name} 🥊 Game on!\\n\\n\"\n end",
"def run\n start_game\n game_loop\n end_game\n end",
"def game_start\n @computer.choose_word\n @board.create_board(@computer.word.length)\n Screen.clear\n game_loop\n end",
"def play\n\t\tputs intro\n\t\tsection_completed = false\n\t\twhile section_completed == false do\n\t\t\tprompt\n\t\t\taction = gets.chomp.downcase #action from users\n\t\t\t\n\t\t\tif action.include? \"overworld\"\n\t\t\t\tsection_completed = true\n\t\t\t\tputs \"You decide to start at Overworld. Good luck Mario!\"\n\t\t\t\tnew_overworld = Overworld.new #create new object of Overworld\n\t\t\t\tnew_overworld.play # call play Overworld!\n\t\t\t\t\n\t\t\telsif action.include? \"suicide\"\n\t\t\t\tputs \"You get nervouse.. It's too big for you to do it all alone!!\"\n\t\t\t\tsuicide\n\t\t\telsif action == \"\"\n\t\t\t\tno_action\n\t\t\telse\n\t\t\t\twrong_input\n\t\t\tend\n\t\t\t\n\t\tend #end of while loop\n\tend",
"def start_new_game\n say \"\\nStarting a new game.\"\n @client.start_new_game\n end",
"def new_game\n set_player\n\n if human_player?\n start_message(:welcome)\n\n set_grid\n puts\n set_bombs\n\n else #non-human\n start_message(:robot_game)\n @robot = Robot.new()\n @grid_size = @robot.grid_size\n @num_bombs = @robot.num_bombs\n end\n @play_again = true\nend",
"def main\n # fade in scene\n 16.times do\n self.update\n @viewport.color.alpha -= 16\n Graphics.update\n end\n # hide silhouette\n h = (@sprites[\"sil\"].bitmap.height/32.0).ceil\n 32.times do\n self.update\n @sprites[\"sil\"].src_rect.height -= h\n Graphics.update\n end\n # play cry\n GameData::Species.cry_filename_from_pokemon(@pokemon)\n # begin loop\n loop do\n Graphics.update\n Input.update\n self.update\n break if Input.trigger?(Input::C)\n end\n # moves Pokemon sprite to middle of screen\n w = (@viewport.width/2 - @sprites[\"poke\"].x)/32\n 32.times do\n @sprites[\"contents\"].color.alpha += 16\n @sprites[\"bg\"].color.alpha += 16\n @sprites[\"highlight\"].color.alpha += 16\n @sprites[\"poke\"].x += w\n @sprites[\"color\"].opacity += 8\n for i in 1..3\n @sprites[\"c#{i}\"].opacity += 8\n end\n self.update\n Graphics.update\n end\n @sprites[\"poke\"].x = @viewport.width/2\n Graphics.update\n end",
"def initialize_game\n setup_boards\n end",
"def start_new_game\n\n if @level == 3 #if max level, choose new type\n @level = 0\n @type = choose_type\n puts \"Great job, #{@player.name}! Now try to evolve a #{@type} type pokémon.\"\n end\n @secret_word = Faker::Pokemon.name.upcase\n @user_progress = Array.new(@secret_word.length,\"_\")\n @character = @@characters[@type][@level]\n @scenes = @@scenes[@type][@level]\n @color = @@colors[@type]\n @current_index = 0\n @bad_guesses = []\n @remaining_guesses = 5\n puts \"You're at level #{@level+1}\"\n end",
"def player_set_up\n\n if @debug == false\n system('clear')\n slow_type(\"Please enter your name and hit enter:\")\n @new_player_name = gets.chomp\n slow_type(\"\\nThank you, #{@new_player_name}\")\n slow_type(\"\\nTime to start the game...\\n\")\n end\n \n end",
"def initial_setup_pause\n puts\n say \"Thanks, #{human.name}, I have everything I need to get started.\\n\" \\\n \"Please hit any key when you are ready to begin.\"\n getchar\n end",
"def setup_game(guess_total, pegs, user)\n new_screen\n @game_board = GameBoard.new(guess_total, pegs)\n @code_maker = CodeMaker.new(pegs, user)\n @game_board.secret_code = @code_maker.maker_code\n @code_breaker = user == 'human' ? Human.new(pegs) : Computer.new(pegs)\n end",
"def main_begin\n create_spriteset\n # When comming back from battle we ensure that we don't have a weird transition by warping immediately\n if $game_temp.player_transferring\n transfer_player\n else\n $wild_battle.reset\n $wild_battle.load_groups\n end\n fade_in(@mbf_type || DEFAULT_TRANSITION, @mbf_param || DEFAULT_TRANSITION_PARAMETER)\n $quests.check_up_signal\n end",
"def game; end",
"def game; end",
"def game; end",
"def game; end",
"def game; end",
"def game; end",
"def game; end",
"def go_play\n puts \"Let's start a new game\"\n @grid.print_board # prints the initial blank layout of the board\n puts @player1.name + \" \" + \"your turn first!\" # player 1 always goes first\n end",
"def introduction\n\t\tputs \"You have started a new game of Connect Four!\"\n\t\tputs \"This is a two-player game. Each player must\"\n\t\tputs \"choose a different color, red or black.\"\n\t\tputs \"The first person to get four of their own\"\n\t\tputs \"pieces in a row (horizontally, vertically,\"\n\t\tputs \"or diagonally) wins the game.\"\n\t\tcolor_selection\n\tend",
"def start \n puts \"Welcome to \" + blue(\"Apeture Science TicTacToe\") + \", were we screen the test \" + blue(\"test subjects\") + \" from the \" + pink(\"cake ingredients\") \n # Get input from player on game mode\n valid = false\n until valid == true\n puts \"To play against another pathetic test \\\"participant\\\", \" + blue(\"press P\") + \". If you dare challenge a cyber god, \" + blue(\"press A\") + \". On a relevant note, \" + pink(\"please don't spill tears into any Apeture Science equipement.\")\n @input = STDIN.gets.chomp.downcase\n\n valid = \"pa\".split(\"\")\n if valid.include?(@input)\n valid = true\n else\n puts \"Seems you could not manage that simple task. Well at least you can rest assured that \" + pink(\"you will burn well.\")\n end\n end\n # Set game mode\n if @input == \"p\"\n @game_mark = \"player\"\n elsif @input == \"a\"\n @AI = AI.new(@game, self) \n @game_mark = \"AI\" \n if @game.current_player == \"X\" \n @AI.make_move\n end\n end\n start_turn \n end",
"def game_loop\n end",
"def start\n\t\t\t@output.puts(\"Welcome to Mastermind!\")\n\t\t\t@output.puts(\"Created by: #{created_by} (#{student_id})\")\n\t\t\t@output.puts(\"Starting game...\")\n\t\t\t@output.puts(\"The game has 12 turns!\")\n\t\t\t@secret = \"XXXX\"\n\t\t\tvalid1 = checksecret(secret)\n\t\tend",
"def introduce_the_game\n @irc_server.puts \"Welcome to hangman!\"\n @irc_server.puts \"To get started, enter a word to be guessed\"\n end",
"def begin\r\n system(\"clear\")\r\n a = Artii::Base.new(:font => 'slant')\r\n puts\r\n puts\r\n puts a.asciify(' Welcome!')\r\n puts\r\n puts a.asciify(' Trent or not!')\r\n puts\r\n puts \" By\\n\\n\"\r\n puts \" James, Carmen, Nathan, and Olivia\\n\\n\\n\\n\"\r\n puts \" Hello , what is your name?\"\r\n\r\n # accepts input and makes a new player class object with their name\r\n # and a default score of 0.\r\n @user = Player.new(gets.chomp, 0)\r\n @user.randomise\r\n end",
"def initialize\n puts 'Welcome to the Casino'.colorize(:blue)\n @player = Player.new #seeing new here so it means its going to the class listed and runs the initi method\n puts \"what game do you want to play #{player.name}?\"\n #show a casino game menu\n #let the player choose a game\n # initialize the new game, passing the player as a parameter\n end",
"def start\n puts \"We have new challengers! Welcome #{@player_1.name} and #{@player_2.name}!\"\n turn\n end",
"def start\n\t\tputs \"Welcome to Mastermind!\"\n\t\tputs \"What is your name?\"\n\t\tname = gets.chomp.capitalize\n\t\tputs \"Welcome #{name}! Here are the instructions for Mastermind\"\n\t\tputs \"---------------------------- \"\n\t\tputs \"-----------------------------\"\n\t\tinstructions\n\t\tplay_game\n\tend",
"def startGame\n\tif !$running\n\t\t$gui.hide_info()\n\t\t$gui.hide_scored()\n\t\t$p1.reset_position()\n\t\t$p2.reset_position()\n\t\t$ball.reset_position()\n\t\t$ball.start()\n\t\t$running = true\n\tend\nend",
"def game_start_human_codebreaker\n reset_instance_variables_values\n start_game_welcome_human(@human.name)\n choices\n print_colorized_array(COLORS)\n end",
"def start\n @win_state = CHECK # clear out win_state for new games\n get_player_name\n deck.deal_hand(players)\n show_flops\n player_turn\n dealer_turn\n check_winner\n play_again?\n end",
"def setup\n super\n @background = Image['Bg level1.png']\n viewport.lag = 0\n viewport.game_area = [0, 0, 3000, 1000]\n @gilbert = Gilbert.create(x: 50, y: 900, limited: viewport.game_area.width)\n @level = File.join(ROOT, 'levels', self.filename + '.yml')\n load_game_objects(file: @level)\n\n @plataformas = Plataforma2.all\n @music = Song.new('media/Songs/Music Level1.mp3')\n @loser_song = Song.new('media/Songs/gameover.ogg')\n\n @moneda = Moneda.all.first\n\n @meta_on = false\n\n @marco_name = Image['MarcoName.png']\n @marco_score = Image['MarcoPoint.png']\n\n @score = 0\n @msj_name = Chingu::Text.new(@player_name, x: 85, y: 25, size: 30, color: Gosu::Color::WHITE)\n @msj_score = Chingu::Text.new(@score.to_s, x: $window.width - 130, y: 30, size: 35)\n @mensaje = Chingu::Text.new('Has encontrado todas las monedas', x: 320, y: 20, size: 25, color: Gosu::Color::GREEN)\n @mensaje2 = Chingu::Text.new('Encuentra la Meta', x: @msj_name.x, y: 45, size: 30, color: Gosu::Color::YELLOW)\n\n @music.play(true) if @sonido\n end",
"def start\n set_player_name\n deal_cards\n show_flop\n player_turn\n dealer_turn\n end",
"def main\n include GameStatus\n the_user = User.new\n\n if the_user.prompt_start.downcase.eql? 'y'\n #game continues to begin\n else\n puts(Colors.colorize('Why not tho?', 'cyan_b'))\n exit(0)\n end\n\n Output.print_intro\n the_secret_code = SecretCode.new\n the_user.take_input\n the_user.give_feedback\nend",
"def start_game\n set_game_state 'play'\n @deck = Deck.new\n @deck.shuffle\n @deck.deal @players\n @hand_played = []\n @cards_on_table = []\n @war_is_on = false\n nil\n end",
"def start!\n puts intro\n get_name\n player.enter_room\n loop {get_option}\n end",
"def main\n # Class Instances\n game = Game.new\n player1 = Player.new(1)\n player2 = Player.new(2)\n # Start of main engine\n #player1.name = prompt_UI.name.....\n player1.get_name\n player2.get_name\n game.display_welcome(player1, player2)\n # Sets the current turn order\n current_player = player1\n # Start of main game loop\n continue = true\n while continue\n # go to game to get, go to UI to present\n game.display_question(current_player)\n current_player.display_score\n if current_player.game_over?\n game.final_score(player1, player2)\n continue = false\n end\n if current_player == player1\n current_player = player2\n else\n current_player = player1\n end\n end\nend",
"def start_a_game\n jeopardy_board\n play_game\nend",
"def print_out_start_of_game\n\n puts \"Welcome to a new version of the 2 Player Game.\"\n puts \"\"\n\nend",
"def start_screen()\n puts \"Welcome to Hangman.\"\n puts \"'N' to start a new game, 'L' to load!\"\n choice = gets.chomp.upcase\n if choice == 'N'\n self.play\n elsif choice == 'L'\n load_game\n else\n puts \"Please choose 'N' or 'L' next time.\"\n puts \"For now the culprit's fate is spared. Take care!\"\n end\n end",
"def play\n\t\tputs intro\n\t\tsection_completed = false\n\t\t\n\t\twhile section_completed == false do\n\t\t\t\n\t\t\tprompt\n\t\t\taction = gets.chomp.downcase\n\t\t\tif action.include? \"sing\"\n\t\t\t\tputs \"You decided to sing again.\"\n\t\t\t\tputs \"Unfortunately, The turtle get so pissed because you wake him up!\"\n\t\t\t\tdead(\"You become his breakfast!\")\n\t\t\telsif action.include? \"kill\" or action.include? \"shoot\" or action.include? \"hit\"\n\t\t\t\tputs \"The turtle is too big so he only feels itchy and pissed for that!\"\n\t\t\t\tdead(\"The turtle eat you for breakfast.\")\n\t\t\telsif action.include? \"tickling\" \n\t\t\t\tsection_completed = true\n\t\t\t\tputs \"The turtle laughs his ass off and fall over to the ground.\"\n\t\t\t\tputs \"Good job Mario! You use the warp pipe to the next stage.\"\n\t\t\t\n\t\t\telsif action.include? \"mushroom\"\n\t\t\t\tputs \"No more much room left for you in this stage Mario. Try again.\"\n\t\t\t\t\n\t\t\telsif action.include? \"go back\"\n\t\t\t\tdead(\"{@go_back}\")\n\t\t\t\t\n\t\t\telsif action.include? \"suicide\"\n\t\t\t\tsuicide\n\t\t\telsif action == \"\"\n\t\t\t\tno_action\n\t\t\telse\n\t\t\t\tputs \"okay... well..\"\n\t\t\t\twrong_input\n\t\t\t\t\n\t\t\tend #end if\n\t\t\t\n\t\tend #end of while loop\n\t\t\n\t\t#call underground\n\t\t\n\t\t\n\tend",
"def setup\r\n self.input = { :escape => :close, :return => :load } # exits example on Escape\r\n Chingu::GameObject.create(:x => 200, :y => 100, :image => Image[\"spaceship.png\"])\r\n Chingu::Text.create(\"Press <return> to load game\", :y => 100)\r\nend",
"def go_game\n #RPG::BGM.fade(30)\n #Graphics.fadeout(30)\n #Graphics.frame_count = 0\n DataManager.autosave(true, false)\n SceneManager.goto(Scene_Map)\n #$game_system.on_after_load\n end",
"def play\n\t\t\n\t\tputs intro\n\t\tsection_completed = false\n\t\t\n\t\twhile section_completed == false do\n\t\t\n\t\t\tprompt\n\t\t\taction = gets.chomp.downcase\n\t\t\t\n\t\t\tif action.include? \"jump\"\n\t\t\t\tputs \"You jump and escape one of them. But look ahead they are still coming!! What next?\"\n\t\t\n\t\t\telsif action.include? \"kill\"\n\t\t\t\tsection_completed = true #set section complete = true\n\t\t\t\tputs \"You jump quick on them. The Goombas were beaten flat to the ground.\"\n\t\t\t\tputs \"You jump, jump... and jump again. The Goombas were beaten and you head forward with no fear. You hit the bricks on the way as they release coins for you when they break down.\"\n\t\t\t\t\n\t\t\t\t\n\t\t\telsif action.include? \"sing\"\n\t\t\t\tsection_completed = true\n\t\t\t\tputs \"You do not want to harm them as you know it would create even more conflicts in the kingdom.\"\n\t\t\t\tputs \"So you start singing...\"\n\t\t\t\t#call underground\n\t\t\t\t\n\t\t\telsif action.include? \"go back\"\n\t\t\t\tdead(\"{@go_back}\")\n\t\t\n\t\t\telsif action.include? \"suicide\"\n\t\t\t\tsuicide\n\t\t\telsif action == \"\"\n\t\t\t\tno_action\n\t\t\telse\n\t\t\t\tputs \"okay... well..\"\n\t\t\t\twrong_input\n\t\t\t\t\n\t\t\tend # end if\n\t\t\tend #end of While loop\n\t\t\n\t\tbonus #call mushroom\n\t\t\n\tend",
"def new_game\n\t\tclear\n\t\tget_username\n\t\tselect_level\n\t\tget_deck\n\t\tshuffle\n\t\tget_hand\n\t\tcontinue_game\n\tend",
"def start\n while (@current_player.lives != 0)\n generate_question\n ask_question\n verify_answer(get_player_answer(@current_player))\n life_count\n point_count\n rotate_players\n end\n declare_winner\n play_again\n end",
"def create_new_game\n create_new_party\n $pokemon_party.expand_global_var\n $trainer.redefine_var\n $scene = Scene_Map.new\n Yuki::TJN.force_update_tone\n @running = false\n end",
"def game_loop\n end",
"def start_game(game_config)\n # start a new game\nend",
"def run_game\n\t\t# Startup\n\t\tputs \"Welcome to Mastermind: Console Edition!\"\n\n\t\t# Select player or computer\n\t\t@choice = choose_codemaker\n\n\t\tif @choice == 'codemaker'\n\t\t\t@code = record_player_code\n\t\t\tputs \"Thanks! Your code has been stored.\"\n\t\t\tuntil self.game_over?\n\t\t\t\tcomputer_take_turn\n\t\t\tend\n\t\telse \n\t\t\t@code = create_code\n\t\t\tputs \"The computer has chosen a 4-color code.\"\n\t\t\tputs \"While debugging, here is the code: #{@code}\"\n\t\t\tuntil self.game_over?\n\t\t\t\tplayer_take_turn\n\t\t\tend\n\t\tend\n\n\t\tif won_game?\n\t\t\tputs \"Congratulations! You won the game.\"\n\t\telse\n\t\t\tputs \"Sorry, all out of turns. Game over.\"\n\t\tend\n\tend",
"def start\n \t\tself.board.display_instruction\n \t\tcurrent_player = select_first_player\n \t\t(self.board.size).times do \n \t\t\tplay(current_player)\n \t\t\tcurrent_player = next_of current_player \n end\n display_winner(nil, true)\n \tend",
"def setup (game)\n\t\t# #@height = hgt\n\t\t# #@width = wdth\n\t\t# flash[:notice] = \"hello world\"\n\t\t#super.initialize(game)\n\t\trequire 'Time'\n\t\tt = Time.utc(nil,nil,days,hours,minutes,nil)\n\t\t@turn_speed = t\n\tend",
"def setup_game\n\t\t@word = get_word.upcase\n\t\t@misses = []\n\t\t@hits = []\n\t\t@guesses_left = 10\n\tend",
"def play\n display_welcome_message\n loop do\n human.choose\n computer.choose\n display_moves\n display_winner\n keep_score\n break unless play_again?\n end\n display_goodbye_message\n end",
"def start_new_game\n x = create_player_x\n o = create_player_o\n \n @game = Game.start_game(x, o)\n end",
"def start()\n\t\tputs \"Welcome to ZORK!\";\n\t\tputs \"Your neighborhood has been overrun with monsters.\";\n\t\tputs \"You have been tasked with clearing the area of all monsters.\";\n\t\t\n\t\tputs \"\\n\\nWhat is your name?\";\n\t\tname = gets.chomp;\n\t\t@player = Player.new(name);\n\t\tsystem('cls');\n\t\tputs \"#{@player.name} you are standing in front of your house at the center of your neighborhood\";\n\tend",
"def step\n if @game_over\n game_over!\n @event_handler.update\n else\n # background for playing field and hud\n @screen.fill :black\n @screen.fill [50,50,50], Rect.new(Configuration.screen[:hud_rect])\n\n @event_handler.update\n @hud.update @clock.framerate.ceil, @round, @enemies.length, @money, @lives+1, @round_timer\n\n update_timer\n restock_enemies! if @restock_enemies > 0\n\n @the_path.draw @screen # Draw the enemy path.\n @enemies.draw @screen # Draw the enemies.\n @towers.draw @screen # Draw all set towers.\n @grid_highlighter.draw @screen # Draw the nifty semi-transparent highlighter below the mouse.\n @hud.draw @screen # draw the HUD\n end\n\n @screen.update() # Refresh the screen.\n end",
"def process_initial_commands\n #in the game class\n case \n when play?\n game = Game.new(instream, outstream, display)\n game.start\n \n when instructions?\n display.game_objective1 # give the user instructions\n display.game_objective2\n\n when quit? # run the loop below until the user says to quit\n outstream.puts display.quit.magenta\n\n else # for anything else\n outstream.puts display.invalid_option\n end\n end",
"def run\n game = Game.new\n game.game_start\nend",
"def start_game\n # Infinite loop\n while\n # Draw the board on the terminal\n @board.print_board\n # Ask the player to choose where to draw the symbol\n @active_player.choose_spot\n # Check if the current player won\n if @board.check_win(@active_player.player_symbol)\n @board.print_board\n puts 'Has ganado'\n @active_player.victory\n # Ask if the player wants to play again\n play_again\n # If not, the loop is broken\n break\n else\n # Check if there is a draw\n if @board.check_draw\n puts 'Empate'\n play_again\n break\n end\n # If there isn't a draw the game switch the current player\n switch_player\n end\n end\n end",
"def setup\n\t\ttext_font create_font(\"SanSerif\",10);\n\t\tscreen = [1920,1040] #JackRabbit\n\t\t# product[1920,1040] = 1996800\n\n\t\t# screen = [1500,900] #HOME\n\t\t# product[1500,900] = 1350000\n\n\t\t@it = 0\n\n\t\tsize(*screen)\n\t\t@w,@h = screen.map{|d| d/2}\n\t\t@i, @t = [0] * 2 ; background(0)\n\t\t@colors = (0..3).map{|i|rand(255)}\n\t\tframe_rate 2.5 ; colorMode(HSB,360,100,100)\n\t\tno_fill() ; no_stroke ; @xy = [0,0]\n\t\t\t\n\t\tcl = VERTS.map{|c| rand(30) }\n\t\t@cc = VERTS.map{|r| [(20 + rand(@w)) * 1.9,\n\t\t\t\t\t\t\t\t\t\t\t\t (20 + rand(@h)) * 1.9] }.zip(cl)\n\tend",
"def beginning_of_game\n\tputs \"------------------------------------------------------------\"\n\tputs \"| Bienvenue sur 'ILS VEULENT TOUS MA POO ! \"\n\tputs \"| Le but du jeu est d'être le dernier survivant ! \"\n\tputs \"------------------------------------------------------------\"\nend",
"def run\n start_key = self.display_instructions\n exit if start_key.downcase == \"q\"\n self.play_round until @board.won? || @board.lost?\n @board.lost? ? self.display_loss : self.display_win\n end"
] |
[
"0.7562603",
"0.75318813",
"0.72865975",
"0.7203937",
"0.7170718",
"0.7128318",
"0.71109194",
"0.70586556",
"0.7020886",
"0.6925756",
"0.6887054",
"0.6836804",
"0.6834697",
"0.6805265",
"0.6793125",
"0.6749174",
"0.6720256",
"0.669988",
"0.6672581",
"0.66719687",
"0.66598237",
"0.6659192",
"0.6653406",
"0.66293126",
"0.661228",
"0.6611495",
"0.66108394",
"0.6602574",
"0.6597315",
"0.65956753",
"0.65870255",
"0.6576294",
"0.65726066",
"0.65611297",
"0.65447015",
"0.65378994",
"0.6536623",
"0.6526222",
"0.65125597",
"0.6504417",
"0.6502136",
"0.6497597",
"0.64639145",
"0.6462882",
"0.6439025",
"0.643277",
"0.64298004",
"0.64293677",
"0.6426713",
"0.64146924",
"0.64146924",
"0.64146924",
"0.64146924",
"0.64146924",
"0.64146554",
"0.64146554",
"0.64115846",
"0.6399145",
"0.6398553",
"0.63984525",
"0.63979554",
"0.63968205",
"0.63965046",
"0.6389311",
"0.63867396",
"0.63857234",
"0.6380528",
"0.6374048",
"0.6373341",
"0.6364088",
"0.63626313",
"0.63495994",
"0.63443476",
"0.63396275",
"0.6337644",
"0.6327706",
"0.63191986",
"0.63165563",
"0.6314394",
"0.631115",
"0.63085335",
"0.6304432",
"0.62911606",
"0.6287856",
"0.6278011",
"0.6270521",
"0.6270484",
"0.62604034",
"0.62529254",
"0.62396806",
"0.62369436",
"0.6236744",
"0.62294245",
"0.62288666",
"0.62231636",
"0.62126356",
"0.6204497",
"0.62044483",
"0.61982024",
"0.6192817",
"0.61906606"
] |
0.0
|
-1
|
This is how the game starts. We'll run this second.
|
def start_game
fire_door = {
name: "Fire Door",
character: "Gunter, the Evil Penguin of Tech Support",
character_action: "He has casket full of tech support tickets",
decision_one: "Take the a casket and destroy the tickets",
outcome_one: "Well done! You are now the king of Tech Support",
decision_two: "Slap that creepy penguin",
outcome_two: "You fool. The curse of tech support is on you. You will have to fix every ticket for the Eternity!"
}
snow_door = {
name: "Snow Door",
character: "Princess Bubblegum, the Beautiful Princess of Sainsbury deliveries",
character_action: "She has a bucket full of BelaVita biscuits",
decision_one: "Eat the buscuits",
outcome_one: "You fool! Neusha will tell Eamon and he will fire you!",
decision_two: "Save them for Shakes",
outcome_two: "The force runs strong with this one. You have saved Shakes from starvation!"
}
doors = {
"1" => fire_door,
"2" => snow_door
}
print "> "
door_num = $stdin.gets.chomp
chosen_door = doors[door_num]
puts "____________________________"
game(chosen_door)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def start\n DataManager.create_game_objects\n $game_party.setup_starting_members\n $game_map.setup(Config::Starting_Map_ID)\n $game_player.moveto(Config::X_Pos, Config::Y_Pos)\n $game_player.followers.visible = false\n $game_player.refresh\n $game_player.make_encounter_count\n\n @character_name = $game_player.character_name\n @character_index = $game_player.character_index\n $game_player.set_graphic('', 0)\n\n $game_system.menu_disabled = true\n Graphics.frame_count = 0\n\n super\n create_foreground\n create_background\n create_command_window\n play_title_music\n end",
"def game_start\n game_setup\n @console_delegate.show\n end",
"def game_setup\n end",
"def start_game\n\t\tself.game_is_started = true\n send_update\n end",
"def run\n start_game\n game_loop\n end_game\n end",
"def start_game\n begin\n @game_text.intro\n\n # Run the tutorial\n ActionDirector.new(@world, @player).call({command: :talk, target: :jerry})\n\n # The main game\n while @player.alive? && @world.has_hostiles?\n @player.in_battle? ? battle_loop : game_loop\n end\n\n @player.alive? ? @player.win : @player.defeat\n rescue SystemExit, Interrupt # Catpure ctrl+c exit, end gracefully\n @game_text.exit\n end\n end",
"def start\n # start a new game using @config\n end",
"def start\n # always load so no restarting of server is needed'\n maze_config = YAML.load_file(maze.file_name)\n # set starting points\n update_attributes(starting_point_player1: maze_config[\"starting_points_for_player1\"].values.sample, starting_point_player2: maze_config[\"starting_points_for_player2\"].values.sample)\n # set countdown via pusher, game is starting\n Pusher.trigger(\"player_#{player_one_id}_channel\", 'game_started', {message: 'game started'})\n Pusher.trigger(\"player_#{player_two_id}_channel\", 'game_started', {message: 'game started'})\n end",
"def startGame\n\tif !$running\n\t\t$gui.hide_info()\n\t\t$gui.hide_scored()\n\t\t$p1.reset_position()\n\t\t$p2.reset_position()\n\t\t$ball.reset_position()\n\t\t$ball.start()\n\t\t$running = true\n\tend\nend",
"def start\r\n initialize_game\r\n until @game.over?\r\n take_turn\r\n end\r\n print_outcome\r\n end",
"def start!\n last_update = Time.now\n\n loop do\n break if world.game.exit\n prev_hash = world.hash\n send_action(:tick!, Time.now - last_update)\n renderer.render!(world) if prev_hash != world.hash\n last_update = Time.now\n sleep 0.03\n end\n end",
"def start \n\t @output.puts \"Welcome to Noughts and Crosses!\"\n\t @output.puts \"Created by:#{created_by}\"\n\t @output.puts \"StudentID: #{student_id}\"\n\t @output.puts \"Starting game...\"\n\t @output.puts \"Player 1: 0 and Player 2: 1\"\n\n\t\n\tend",
"def start\n \n\tend",
"def game_loop\n end",
"def start\r\n\t\t\t@output.puts \"Welcome to Deal or No Deal!\"\r\n\t\t\t@output.puts \"Designed by: #{created_by}\"\r\n\t\t\t@output.puts \"StudentID: #{student_id}\"\r\n\t\t\t@output.puts \"Starting game...\"\r\n\t\tend",
"def start\n\t\tinit\n\t end",
"def start\n end",
"def start\n end",
"def start\n end",
"def start\n end",
"def start\n end",
"def start\n end",
"def start\n end",
"def start\n end",
"def start\n main_loop\n end",
"def start()\r\n\t\t\t@output.puts(\"Welcome to Mastermind!\")\r\n\t\t\t@output.puts(\"Created by: #{created_by} (#{student_id})\")\r\n\t\t\t@output.puts(\"Starting game...\")\r\n\t\t\t@output.puts('Enter \"1\" to run the game in the command-line window or \"2\" to run it in a web browser')\r\n\t\tend",
"def start_game\n @new_prompt.title_screen\n @new_commands.create_new_board(5)\n select_mode\n end",
"def start\n\t\tif @state == :READY\n\t\t\t@players.each do |p|\n\t\t\t\tputs \"#{p.username} starting game\"\n\t\t\t\tp.socket.send({\"startGame\" => true}.to_json)\n\t\t\tend\t\n\t\t\t@state = :PLAYING\n\t\tend\n\tend",
"def start\n end",
"def start\n end",
"def start\n end",
"def start\n end",
"def start\n\t\t\t@output.puts(\"Welcome to Mastermind!\")\n\t\t\t@output.puts(\"Created by: #{created_by} (#{student_id})\")\n\t\t\t@output.puts(\"Starting game...\")\n\t\t\t@output.puts(\"The game has 12 turns!\")\n\t\t\t@secret = \"XXXX\"\n\t\t\tvalid1 = checksecret(secret)\n\t\tend",
"def start\n # start a timer on scene load\n @timer.reset_timer\n case @scene\n when 'intro'\n start_intro\n when 'level'\n start_level\n when 'transition'\n start_transition\n when 'credits'\n start_credits\n end\n end",
"def game_loop\n end",
"def run\n game = Game.new\n game.game_start\nend",
"def Main\n #Begin preinitialization\n preInit()\n\n #Render Game Window and begin drawing onto the screen.\n\n DEBUG.cout(\"Initializing Game Window...\", 0, false)\n window = GameWindow.new\n window.show\n\n #End game and return to desktop\n return nil\nend",
"def main\n\t\tstart\n\t\twhile self == SceneManager.scene\n\t\t\tGraphics.update\n\t\t\tController.keyboard.update\n\t\t\tupdate\n\t\t\tController.wait_next_frame\n\t\tend\n\t\tterminate\n\tend",
"def start\n puts \"We have new challengers! Welcome #{@player_1.name} and #{@player_2.name}!\"\n turn\n end",
"def start\n end",
"def start\n end",
"def start\n\n end",
"def play\n init_player()\n init_board()\n puts \"Test game play\"\n end",
"def start\n\t\tend",
"def game_start\n opening\n first_menu\n end",
"def start\n set_player_name\n deal_cards\n show_flop\n player_turn\n dealer_turn\n end",
"def run \n Engine::play(Beginning)\nend",
"def start\n puts \"Welcome to Tic Tac Toe!\"\n puts \"\"\n define_players\n play\n end",
"def start()\n\n\t\tend",
"def start\n SocketController.init_game(self.users, self.id)\n end",
"def start\n end",
"def start\n LOGGER.info \"[INFO] Starting New Game #{Time.now.to_i}\"\n while @shooter.has_bankroll?\n LOGGER.info \"[INFO] Coming Out\"\n comeout_roll\n if @point\n while @shooter.still_shooting?\n LOGGER.info \"[INFO] Still Shooting...\"\n proceed\n end\n else\n LOGGER.info \"[INFO] Still Establishing Point...\"\n next\n end\n end\n LOGGER.debug \"\\t[INFO] Roll Ended, Shooter has $#{shooter.bankroll}\"\n # Stat.new({:won_amount => @shooter.won_amount, :loss_amount => @shooter.loss_amount, :outcome => @shooter.outcome?})\n {:starting_bankroll => @shooter.starting_bankroll, :bankroll => @shooter.bankroll, :win => @shooter.win?, :loss => @shooter.loss?}\n end",
"def go_game\n #RPG::BGM.fade(30)\n #Graphics.fadeout(30)\n #Graphics.frame_count = 0\n DataManager.autosave(true, false)\n SceneManager.goto(Scene_Map)\n #$game_system.on_after_load\n end",
"def start_new_game\n # TODO: increment stats\n # stats = GameStats.new\n # stats.game_number += 1\n\n # create new player\n\n\n # print New game text\n new_game_banner = File.read('./old_code/fancy_text/new_game.txt')\n puts new_game_banner\n\n # display into story\n puts display_intro(@player_one.name)\n\n # auto load stage 1\n require './lib/stage'\n Stage.new(1, 5, @player_one)\n end",
"def beginGameLoop\n @gameLoop.play\n end",
"def start\n @win_state = CHECK # clear out win_state for new games\n get_player_name\n deck.deal_hand(players)\n show_flops\n player_turn\n dealer_turn\n check_winner\n play_again?\n end",
"def setup (game)\n\t\t# #@height = hgt\n\t\t# #@width = wdth\n\t\t# flash[:notice] = \"hello world\"\n\t\t#super.initialize(game)\n\t\trequire 'Time'\n\t\tt = Time.utc(nil,nil,days,hours,minutes,nil)\n\t\t@turn_speed = t\n\tend",
"def start\n puts \"Welcome! Let's play Tic-Tac-Toe\"\n print_board\n play\n end",
"def start\n\t\tif @game_over\n\t\t\traise Exception.new(\"GAME #{@id} IS ALREADY OVER\")\n\t\tend\n\t\tplayer_number = 1\n\t\tloop do\n\t\t\t@game_over = player_turn @players[player_number], player_number\n\t\t\tplayer_number = player_number % 2 + 1\n\t\t\tbreak if @game_over\n\t\tend\n\tend",
"def start_game\n game_logo\n game_start_screen\n game_rules\n last_rules\n choice = maker_breaker\n game_maker if choice == 'm'\n game_breaker if choice == 'b'\n end",
"def main\r\n welcome\r\n process_cmd_line\r\n top_up_players\r\n\r\n play_game\r\n\r\n rescue Interrupt\r\n puts\r\n end",
"def start_game\n puts \"----- WELCOME TO twO-O-Player MATH GAME! -----\"\n puts \"#{@player1.name} vs #{@player2.name} 🥊 Game on!\\n\\n\"\n end",
"def start_new_game\n say \"\\nStarting a new game.\"\n @client.start_new_game\n end",
"def game_start\n clear\n warning\n clear\n if @intro\n introduction()\n end\n clear\n countdown\n until @promptarr == []\n game_round() \n end\n @running = game_over(@score)\n end",
"def play\n\t\tgame_loop\n\tend",
"def game_start\n\n\tclear_screen\n\n\tprint_paragraph(\"Welcome to Trapped In A Cave.\\nGuess what? You're trapped in a cave...\nCan you make it out alive?\\n(For a list of commands type help at anytime.)\")\n\nstart_room\n\nend",
"def start\n loop do\n run\n end\n end",
"def on_start\n game.local_speed = 0\n\n puts \"Analyzing map...\"\n Bwapi::BWTA.readMap\n Bwapi::BWTA.analyze\n puts \"Map data ready\"\n\n @state = AI::State.new(game)\n @strategy = ZergStrategy.new(state)\n rescue Exception => e\n puts \"-------------\"\n puts e.message\n puts e.backtrace\n puts \"-------------\"\n sleep 5\n exit\n end",
"def play\n board_setup\n gameplay_setup\n end",
"def start\n\t\tprint_series_leaderboard #shows the series leaderboard status\n\t\tturn_number=0\n\t\twhile turn_number<9 do\n\t\t\tturn_number=turn_number+1\n\t\t\tprint_board\n\t\t\tplayer_on_turn=get_player_on_turn(turn_number)\n\t\t\tputs \"#{player_on_turn.name}(#{player_on_turn.marker}) its your turn\"\n\t\t\tchoice = get_valid_empty_cell\n\t\t\tupdate_cell_status(turn_number,choice)\n\t\t\tplayer_on_turn.consider(@game_cell_vectors[choice])\n\t\t\tif player_on_turn.is_winner==true then\n\t\t\t\tprint_board\n\t\t\t\tplayer_on_turn.declare_winner\n\t\t\t\tbreak\n\t\t\tend\n\t\t\tif turn_number==9\n\t\t\t\tputs \"Game resulted in Draw\"\n\t\t\tend\t\n\t\tend\n\tend",
"def start\n \t\tself.board.display_instruction\n \t\tcurrent_player = select_first_player\n \t\t(self.board.size).times do \n \t\t\tplay(current_player)\n \t\t\tcurrent_player = next_of current_player \n end\n display_winner(nil, true)\n \tend",
"def game_start\n @computer.choose_word\n @board.create_board(@computer.word.length)\n Screen.clear\n game_loop\n end",
"def start_game\n set_game_state 'play'\n @deck = Deck.new\n @deck.shuffle\n @deck.deal @players\n @hand_played = []\n @cards_on_table = []\n @war_is_on = false\n nil\n end",
"def start\n true\n end",
"def start_a_game\n jeopardy_board\n play_game\nend",
"def main_begin\n create_spriteset\n # When comming back from battle we ensure that we don't have a weird transition by warping immediately\n if $game_temp.player_transferring\n transfer_player\n else\n $wild_battle.reset\n $wild_battle.load_groups\n end\n fade_in(@mbf_type || DEFAULT_TRANSITION, @mbf_param || DEFAULT_TRANSITION_PARAMETER)\n $quests.check_up_signal\n end",
"def start!\n\t\t\t@started ||= Clock.now\n\t\tend",
"def start()\n\t\tputs \"Welcome to ZORK!\";\n\t\tputs \"Your neighborhood has been overrun with monsters.\";\n\t\tputs \"You have been tasked with clearing the area of all monsters.\";\n\t\t\n\t\tputs \"\\n\\nWhat is your name?\";\n\t\tname = gets.chomp;\n\t\t@player = Player.new(name);\n\t\tsystem('cls');\n\t\tputs \"#{@player.name} you are standing in front of your house at the center of your neighborhood\";\n\tend",
"def new_game\n # Start again!\n puts \"\\n\\n\"\n\t\n\t# Clears output from last game\n Gem.win_platform? ? (system \"cls\") : (system \"clear\")\n \n puts \"Beginning new game:\"\n puts \"\"\n start\nend",
"def main\n rounds = Game.start\n game = Game.new(rounds)\n roshambo = Roshambo.new(game)\n Roshambo.play(roshambo)\nend",
"def start_game(user = nil)\n super\n # ...\n end",
"def start_game\n\t\ti = 0\n\t\tsrand seed.to_i\n\t\t#This is the loop that runs the simulation 5 times.\n\t\tloop do\n\t\t\ti += 1\n\t\t\tnew_run(i)\n\t\t\tif i == 5\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\t\ti\n\tend",
"def main\n # fade in scene\n 16.times do\n self.update\n @viewport.color.alpha -= 16\n Graphics.update\n end\n # hide silhouette\n h = (@sprites[\"sil\"].bitmap.height/32.0).ceil\n 32.times do\n self.update\n @sprites[\"sil\"].src_rect.height -= h\n Graphics.update\n end\n # play cry\n GameData::Species.cry_filename_from_pokemon(@pokemon)\n # begin loop\n loop do\n Graphics.update\n Input.update\n self.update\n break if Input.trigger?(Input::C)\n end\n # moves Pokemon sprite to middle of screen\n w = (@viewport.width/2 - @sprites[\"poke\"].x)/32\n 32.times do\n @sprites[\"contents\"].color.alpha += 16\n @sprites[\"bg\"].color.alpha += 16\n @sprites[\"highlight\"].color.alpha += 16\n @sprites[\"poke\"].x += w\n @sprites[\"color\"].opacity += 8\n for i in 1..3\n @sprites[\"c#{i}\"].opacity += 8\n end\n self.update\n Graphics.update\n end\n @sprites[\"poke\"].x = @viewport.width/2\n Graphics.update\n end",
"def startup\n end",
"def startup\n end",
"def startup\n end",
"def start_game(game_config)\n # start a new game\nend",
"def start\n @driver.navigate.to \"http://play.threesgame.com\"\n sleep(0.5)\n end",
"def gameplay_setup\n game_status = :new_game\n\n loop do\n print_player_turn(@board_turn.player.name)\n\n print \"Introduce your shoot - x, y: \".blue\n shoot = $stdin.gets.chomp.split(\",\").map(&:to_i)\n game_shoot = set_shoot(shoot)\n\n case game_shoot\n when :finished, :finished_game_of3\n break\n when :new_game\n game_status = :play_again\n break\n end\n end\n\n if game_status == :play_again\n setup(5, true, @best_of3)\n play\n end\n end",
"def run\n Interface::header\n Interface::newline\n\n count = get_number_of_players\n get_player_names( count )\n\n @b.play_game\n end",
"def start_game\n\n display_splash\n\n @map = Map.new(@main_buffer, 120, 300)\n init_city\n init_status_bar\n update_status_bar\n\n init_cursor\n\n # start game loop\n while true\n input = get_char(0)\n\n # quit game\n if input == ':'\n response = prompt(\":\")\n if response == 'q'\n quit #quit main buffer\n quit #quit status buffer\n return\n end\n\n # help menu\n elsif input == \"?\"\n help_menu\n\n # cursor movement\n elsif input == 'h'\n update_cursor(-1,0)\n elsif input == 'j'\n update_cursor(0,1)\n elsif input == 'k'\n update_cursor(0,-1)\n elsif input == 'l'\n update_cursor(1,0)\n\n # insert mode - place buildings\n elsif input == 'i'\n building_menu\n\n elsif input == ' '\n if @insert_mode\n reset_cursor\n @current_building = false\n @insert_mode = false\n end\n\n elsif input == 'p'\n add_building\n\n # destroy buildings\n elsif input == 'x'\n destroy_building\n end\n\n update_status_bar\n @city.update\n wait 80\n end\n end",
"def start\n super\n create_menu_background()\n if MENU_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(MENU_CONFIG::IMAGE_BG)\n @bg.opacity = MENU_CONFIG::IMAGE_BG_OPACITY\n end\n \n create_command_window()\n @status_window = Window_Party_Status.new(0, 0, 480,424, $game_party.members)\n @menu_info_window = Window_Menu_Info.new(0,424,640,56)\n end",
"def start_game\n puts 'GAME STARTED'\n until @is_game_over\n @count_turns += 1\n @board.draw_board\n @board.update_board(@controller.get_input)\n game_over?\n end\n puts @count_turns\n end_game\n end",
"def initialize fps, title\n # The sprite and sound managers.\n @spriteManager = SpriteManager.new\n @soundManager = SoundManager.new 3\n\n # Number of frames per second.\n @framesPerSecond = fps\n\n # Title in the application window.\n @windowTitle = title\n\n # create and set timeline for the game loop\n buildAndSetGameLoop\n end",
"def start()\n while true\n @room = @room.play()\n end\n end",
"def start!\n puts intro\n get_name\n player.enter_room\n loop {get_option}\n end",
"def startup\n end",
"def starting\n log(\"GlobalChat2 Server Running\")\n start_pong_loop\n end",
"def initialize\n puts \"Welcome to Mastermind!\" \n start\n end",
"def start\n\t\tputs \"Welcome to Mastermind!\"\n\t\tputs \"What is your name?\"\n\t\tname = gets.chomp.capitalize\n\t\tputs \"Welcome #{name}! Here are the instructions for Mastermind\"\n\t\tputs \"---------------------------- \"\n\t\tputs \"-----------------------------\"\n\t\tinstructions\n\t\tplay_game\n\tend",
"def main\n create_graphics\n curr_scene = $scene\n check_up\n while @running && curr_scene == $scene\n Graphics.update\n update\n end\n dispose\n # Unload title related pictures\n RPG::Cache.load_title(true)\n RPG::Cache.load_interface(true)\n ::Scheduler.start(:on_scene_switch, ::Scene_Title) if !@running && $scene.is_a?(Scene_Map)\n end"
] |
[
"0.7944154",
"0.7541788",
"0.7485979",
"0.74028623",
"0.7390051",
"0.7365701",
"0.73612267",
"0.7321418",
"0.72948456",
"0.7286699",
"0.72639126",
"0.7132753",
"0.7120022",
"0.7079249",
"0.7069635",
"0.7034763",
"0.70211715",
"0.70211715",
"0.70211715",
"0.70211715",
"0.70211715",
"0.70211715",
"0.70211715",
"0.70211715",
"0.7006366",
"0.6983896",
"0.6974711",
"0.697241",
"0.6971714",
"0.6971714",
"0.6971714",
"0.6971714",
"0.6962669",
"0.69539094",
"0.69438976",
"0.69385695",
"0.6937985",
"0.6923196",
"0.69007885",
"0.68897146",
"0.68897146",
"0.6873309",
"0.68707967",
"0.68692255",
"0.686877",
"0.6863965",
"0.68552405",
"0.6847957",
"0.68457556",
"0.68424976",
"0.68408257",
"0.68353564",
"0.6829084",
"0.6827632",
"0.6806695",
"0.6782703",
"0.6776216",
"0.6774573",
"0.677049",
"0.67672324",
"0.67578864",
"0.67530346",
"0.6743379",
"0.67244905",
"0.67130405",
"0.67113346",
"0.6703544",
"0.66877234",
"0.6683982",
"0.6675532",
"0.66714054",
"0.66711086",
"0.6670606",
"0.6664834",
"0.6659359",
"0.66577184",
"0.66550016",
"0.6637449",
"0.6633432",
"0.6632386",
"0.6622675",
"0.6620299",
"0.6612463",
"0.6612451",
"0.6612451",
"0.6612451",
"0.6606274",
"0.6602576",
"0.6602344",
"0.6601564",
"0.66008663",
"0.6599544",
"0.65923333",
"0.6574046",
"0.6562893",
"0.655911",
"0.65548563",
"0.65522295",
"0.65462065",
"0.6524272",
"0.65235084"
] |
0.0
|
-1
|
This is the game's set up. We'll be calling this method when we start the game, after the user has made their first decision.
|
def game(chosen_door)
if chosen_door
puts "You have entered the #{chosen_door[:name]}"
puts "You now have to face #{chosen_door[:character]}"
puts "#{chosen_door[:character_action]}"
puts "What are you going to do?"
puts "1. #{chosen_door[:decision_one].upcase}"
puts "2. #{chosen_door[:decision_two].upcase}"
print "> "
decision = $stdin.gets.chomp
puts "_________________________"
if decision == "1"
puts chosen_door[:outcome_one].upcase
elsif decision == "2"
puts chosen_door[:outcome_two].upcase
else
handle_typos(chosen_door)
end
else
handle_typos(chosen_door)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def game_setup\n end",
"def game_set_up\n if mode == HUMAN\n disp_game_instructions\n # get computer generated solution\n @solution_obj.solution\n else\n # get solution player enters if valid\n @human_solution_obj.human_solution(@turn_obj)\n end\n end",
"def game_setup\n\t\t\tputs \"Would you like to play? [yes|no] \"\n\n\t\t\tinput = gets.chomp.downcase\n\n\t\t\tif input == \"yes\"\n\t\t\t\tname = @ui.get_name()\n\t\t\t\tmark = @ui.get_mark(name)\n\n\t\t\t\t@player = Player.new(name, mark)\n\n\t\t\t\tmark == 'X' ? @ai = AI.new('O', @player, @board) : @ai = AI.new('X',\n\t\t\t\t@player, @board)\n\t\n\t\t\t\tputs \"\\nTo play, you will need to input a number between 1 and 9\"\n\t\t\t\tputs \"representing to locations on the grid with 1 being the\"\n\t\t\t\tputs \"top-left corner and 9 being the bottom right corner,\"\n\t\t\t\tputs \"decreasing from left to right\\n\"\n\t\n\t\t\t\tself.run()\n\n\t\t\telse\n\t\t\t\tputs \"Have a nice day and come play next time.\"\n\t\t\t\texit\n\t\t\tend\n\t\tend",
"def game_setup\n cls\n print \"----------------\\n\"\n print \"Cinnabar - A Game Of Rocks and Minerals\\n\"\n print \"----------------\\n\\n\"\n\n print \"DISCLAIMER\\n\"\n print \" Cinnabar (c) 1966, 1972, 1980 is a trademark of Naturegraph Publishers, Inc.\\n\"\n print \" No copyright or trademark infringement is intended in using Cinnabar.\\n\\n\"\n\n print \"Welcome to Cinnabar, a digital version of the 1966 card game by Vinson Brown.\\n\"\n print \"Rules can be found in RULES.md, and info can be found in README.md.\\n\"\n print \"Source code can be found at https://www.github.com/Pokeconomist/cinnabar.\\n\\n\"\n end",
"def start\n DataManager.create_game_objects\n $game_party.setup_starting_members\n $game_map.setup(Config::Starting_Map_ID)\n $game_player.moveto(Config::X_Pos, Config::Y_Pos)\n $game_player.followers.visible = false\n $game_player.refresh\n $game_player.make_encounter_count\n\n @character_name = $game_player.character_name\n @character_index = $game_player.character_index\n $game_player.set_graphic('', 0)\n\n $game_system.menu_disabled = true\n Graphics.frame_count = 0\n\n super\n create_foreground\n create_background\n create_command_window\n play_title_music\n end",
"def setup\n return unless game_path?\n\n Wars.initialize!(session)\n # unless we're trying to log in\n unless request.post? && request.path == '/login'\n redirect url_for('/login') if Wars.player.nil?\n @player = Wars.player\n end\n check_game_conditions\n end",
"def setup (game)\n\t\t# #@height = hgt\n\t\t# #@width = wdth\n\t\t# flash[:notice] = \"hello world\"\n\t\t#super.initialize(game)\n\t\trequire 'Time'\n\t\tt = Time.utc(nil,nil,days,hours,minutes,nil)\n\t\t@turn_speed = t\n\tend",
"def initialize\n Game.engine.draw(Game.engine.markdown.parse('# Bandit Mayhem'))\n selection = Game.engine.prompt.select('Select an option', 'New game', 'Load game', 'Quit')\n\n case selection\n when 'New game'\n save_name = Game.engine.prompt.ask('Enter save name:', default: 'bandit-mayhem')\n\n Game.player = Player.new(name: 'Nigel', health: 30, x: 1, y: 5, map: BanditMayhem::Map::Map.new('lynwood/strick_household'))\n\n # intro\n Cinematic.new('intro').play\n\n @quit = false\n when 'Load game'\n Game.load_save if File.exist?(DEFAULT_SAVE)\n # TODO fix\n # Game.player = Player.new(name: 'Nigel', health: 30, x: 1, y: 5, map: BanditMayhem::Map::Map.new('lynwood/strick_household'))\n @quit = false\n when 'Quit'\n @quit = true\n end\n end",
"def gameplay_setup\n game_status = :new_game\n\n loop do\n print_player_turn(@board_turn.player.name)\n\n print \"Introduce your shoot - x, y: \".blue\n shoot = $stdin.gets.chomp.split(\",\").map(&:to_i)\n game_shoot = set_shoot(shoot)\n\n case game_shoot\n when :finished, :finished_game_of3\n break\n when :new_game\n game_status = :play_again\n break\n end\n end\n\n if game_status == :play_again\n setup(5, true, @best_of3)\n play\n end\n end",
"def setup\n @potential_plays = [\"rock\", \"paper\", \"scissors\"]\n @win_counter = Hash[\"P1\",0, \"P2\",0]\n end",
"def initialize_game\n setup_boards\n end",
"def setupgamemode(&b)\r\n\t\t\t@setup = b\r\n\t\tend",
"def setup_game(guess_total, pegs, user)\n new_screen\n @game_board = GameBoard.new(guess_total, pegs)\n @code_maker = CodeMaker.new(pegs, user)\n @game_board.secret_code = @code_maker.maker_code\n @code_breaker = user == 'human' ? Human.new(pegs) : Computer.new(pegs)\n end",
"def setup\n super\n @background = Image['Bg level1.png']\n viewport.lag = 0\n viewport.game_area = [0, 0, 3000, 1000]\n @gilbert = Gilbert.create(x: 50, y: 900, limited: viewport.game_area.width)\n @level = File.join(ROOT, 'levels', self.filename + '.yml')\n load_game_objects(file: @level)\n\n @plataformas = Plataforma2.all\n @music = Song.new('media/Songs/Music Level1.mp3')\n @loser_song = Song.new('media/Songs/gameover.ogg')\n\n @moneda = Moneda.all.first\n\n @meta_on = false\n\n @marco_name = Image['MarcoName.png']\n @marco_score = Image['MarcoPoint.png']\n\n @score = 0\n @msj_name = Chingu::Text.new(@player_name, x: 85, y: 25, size: 30, color: Gosu::Color::WHITE)\n @msj_score = Chingu::Text.new(@score.to_s, x: $window.width - 130, y: 30, size: 35)\n @mensaje = Chingu::Text.new('Has encontrado todas las monedas', x: 320, y: 20, size: 25, color: Gosu::Color::GREEN)\n @mensaje2 = Chingu::Text.new('Encuentra la Meta', x: @msj_name.x, y: 45, size: 30, color: Gosu::Color::YELLOW)\n\n @music.play(true) if @sonido\n end",
"def play\n board_setup\n gameplay_setup\n end",
"def start_game\n @new_prompt.title_screen\n @new_commands.create_new_board(5)\n select_mode\n end",
"def initialize\n @game_settings = GameSettings.new\n super 920, 480\n self.caption = GAME_TITLE\n @settings_hovered = Options::START_SCREEN[0]\n @title_font, @subtitle_font = Gosu::Font.new(50), Gosu::Font.new(20)\n @background_image = Gosu::Image.new(\"media/background1.jpg\", :tileable => true)\n @blank_card = Gosu::Image.new(\"media/card.png\", :tileable => true)\n @button_option = Gosu::Image.new(\"media/button.png\", :tileable => true)\n @deck = Deck.new\n @playing_cards = Array.new\n @computer_signal = ComputerTimer.new\n @players_created, @mes, @false_mes, @true_mes, @trying_mes = false, false, false, false, false\n @hint = []\n #players\n @pressed, @p1, @p2 = nil, nil, nil\n @game_timer = Timers.new\n end",
"def game_init\r\n state(0)\r\n @game_deck.create_new_deck\r\n @player_deck = {}\r\n @dealer_deck = {}\r\n @player.points = 0\r\n @dealer.points = 0\r\n end",
"def setup_game\n\t\t@word = get_word.upcase\n\t\t@misses = []\n\t\t@hits = []\n\t\t@guesses_left = 10\n\tend",
"def start\n # start a new game using @config\n end",
"def setup\n setup_major_pieces\n setup_pawns\n end",
"def start_game\n game_logo\n game_start_screen\n game_rules\n last_rules\n choice = maker_breaker\n game_maker if choice == 'm'\n game_breaker if choice == 'b'\n end",
"def player_set_up\n\n if @debug == false\n system('clear')\n slow_type(\"Please enter your name and hit enter:\")\n @new_player_name = gets.chomp\n slow_type(\"\\nThank you, #{@new_player_name}\")\n slow_type(\"\\nTime to start the game...\\n\")\n end\n \n end",
"def playerSetup\n\t\t@players = Array.new\n\t\t@playerOne = Player.new\n\t\t@playerTwo = Player.new\n\t\t@playerOneReady = false\n\t\t@playerTwoReady = false\n\t\t\n\t\tPerson.clearPeople\n\t\t\n\t\tdef setPlayerReady(playerNumber, status)\n\t\t\tif playerNumber == 1\n\t\t\t\t@playerOne.saveInfo\n\t\t\t\t@playerOne.calculateAge\n\t\t\t\t@playerOneReady = status\n\t\t\t\t@uiManager.setupPlayerSetupBox(@playerTwo,2,\n\t\t\t\t\tmethod(:setPlayerReady), method(:playerSetup))\n\t\t\telse\n\t\t\t\t@playerTwo.saveInfo\n\t\t\t\t@playerTwo.calculateAge\n\t\t\t\t@playerTwoReady = status\n\t\t\t\tfinalizePlayerSetup = \"\"\n\t\t\t\tif (@playerOneReady && @playerTwoReady)\n\t\t\t\t\tif (@playerOne.age > @playerTwo.age)\n\t\t\t\t\t\t@players.push(@playerTwo).push(@playerOne)\n\t\t\t\t\t\tfinalizeSetupLabelText = \n\t\t\t\t\t\t\t@playerTwo.name+\" is youngest and goes first. \"+\n\t\t\t\t\t\t\t@playerOne.name+\" gets to choose their color \"\\\n\t\t\t\t\t\t\t\"(yellow or red)\"\n\t\t\t\t\telse\n\t\t\t\t\t\t@players.push(@playerOne).push(@playerTwo)\n\t\t\t\t\t\tfinalizeSetupLabelText = \n\t\t\t\t\t\t\t@playerOne.name+\" is youngest and goes first. \"+\n\t\t\t\t\t\t\t@playerTwo.name+\" gets to choose their color \"\\\n\t\t\t\t\t\t\t\"(yellow or red)\"\n\t\t\t\t\t\t\t\n\t\t\t\t\tend\n\t\t\t\t\t@uiManager.finalizePlayerSetup(\n\t\t\t\t\t\tfinalizeSetupLabelText,\n\t\t\t\t\t\t@colors,\n\t\t\t\t\t\t@players\n\t\t\t\t\t)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t\n\t\t#restart = self.playerSetup\n\t\t\n\t\t@uiManager.setupPlayerSetupBox(@playerOne,1,\n\t\t\tmethod(:setPlayerReady), method(:playerSetup))\n\t\t#chooseColor\n\tend",
"def board_setup\n puts \"\"\n puts \"**********************\".green\n puts \"1st step - Board setup\".green\n puts \"**********************\".green\n puts \"\"\n\n player1_title = @best_of3 ? \"#{@board_player1.player.wins} wins\" : \"\"\n puts \"Player #{@board_player1.player.name} #{player1_title}\".blue\n @board_player1.set_board\n\n player2_title = @best_of3 ? \"#{@board_player2.player.wins} wins\" : \"\"\n puts \"Player #{@board_player2.player.name} #{player2_title}\".blue\n @board_player2.set_board\n end",
"def game_start\n game_setup\n @console_delegate.show\n end",
"def game_setup\n @human_score= 0\n @computer_score= 0\n\n # Instructions\n puts \"Welcome to the game of pig\", \"\"\n puts \"This program allows you to play the Game of Pig against the computer.\", \"\"\n\n # Ask for user name and stores the name in an instance variable \n print \"What is your name? \"\n\n @name= gets.chomp # store user input into the instance variable\n\n print \"\\nThe game has two players and uses one six sided die. \\nWhen it is your turn, you have two choices: roll or hold. \\nIf you roll and get 2-6 your \\'turn total\\' increases by the \\namount on the die. But, if you roll a 1, your turn's score is zero, \\nand it becomes the computer\\'s turn. \\nIf you hold, your turn total is added to your total score, \\nand it becomes the computer\\'s turn. \\n\"\n\n # Ask for the end score and stores the score in an instance variable\n puts \"\",\"Traditionally, the first player to reach 100 wins\", \"\"\n puts \"At what score do you want to play to? \"\n @target_score= gets.chomp # stores user input into the instance variable\n\n\n puts \"Okay, we'll play to #{target_score}.\", \"\"\n puts \"We'll let you go first.\",\"\"\n puts \"Okay #{name}, let's play!\", \"\"\n end",
"def start\n @win_state = CHECK # clear out win_state for new games\n get_player_name\n deck.deal_hand(players)\n show_flops\n player_turn\n dealer_turn\n check_winner\n play_again?\n end",
"def start_game\n set_game_state 'play'\n @deck = Deck.new\n @deck.shuffle\n @deck.deal @players\n @hand_played = []\n @cards_on_table = []\n @war_is_on = false\n nil\n end",
"def set_ready!\n puts \"game #{state_name}\"\n if created?\n puts \"call confirmation methods\"\n confirm1\n confirm2\n end\n end",
"def game_engine\n\t\tif @ai_on == true\n\t\t\tgame_with_ai\n\t\telse\n\t\t\t@player_two = 'black'\n\t\t\tgame_with_two_players\n\t\tend\n\t\tannounce_winner\n\t\tend_of_game\n\tend",
"def setup_session\n\t\tbegin\n\t\t\t#Gets number of guesses from player.\n\t\t\tputs \"\\n/////////////////////////////////////////////////////////////////////////////////\"\n\t\t\tputs \"//////////////////////////////////GAME SETUP/////////////////////////////////////\"\n\t\t\tputs \"//\"\n\t\t\tputs \"// How many guesses do you want for each game?\"\n\t\t\tprint \"// > Enter number of guesses here: \"\n\t\t\t@guesses_allowed = Integer(gets.chomp)\n\t\t\tputs \"//\"\n\n\t\t\t#Gets secret number range from player.\n\t\t\tlower_limit = 0\n\t\t\tupper_limit = 0\n\n\t\t\t#error checks that range is valid and doesn't continue until valid range\n\t\t\t#...input by user\n\t\t\t#while range is invalid\n\t\t\twhile lower_limit >= upper_limit\n\t\t\t\tbegin\n\t\t\t\t\tputs \"// What range do you want to guess within? (you're going to enter two\"\n\t\t\t\t\tputs \"// numbers, the lower and upper limits of the range. So if you want to\"\n\t\t\t\t\tputs \"// guess between 1-10, enter a '1' then a '10')\"\n\t\t\t\t\tprint \"// > Enter lower limit of the range here: \"\n\t\t\t\t\t#check input is an integer (rescued in larger code block below)\n\t\t\t\t\tlower_limit = Integer(gets.chomp)\n\t\t\t\t\tprint \"// > Enter upper limit of the range here: \"\n\t\t\t\t\t#check input is an integer (rescued in larger code block below)\n\t\t\t\t\tupper_limit = Integer(gets.chomp)\n\t\t\t\t\t#throw error is range is invalid\n\t\t\t\t\tif lower_limit >= upper_limit\n\t\t\t\t\t\traise InvalidRange\n\t\t\t\t\tend\n\t\t\t\t\tputs \"//\"\n\t\t\t\trescue InvalidRange\n\t\t\t\t\tputs \"That was an invalid range. Try again.\"\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t#contactinates upper and lower limits into a string\n\t\t\tstring_range = \"#{lower_limit}..#{upper_limit}\"\n\n\t\t\t#Uses custom #to_range method of String to convert string into range\n\t\t\t@secret_number_range = string_range.to_range\n\n\t\t\t#gets user name\n\t\t\tputs \"// What is your name?\"\n\t\t\tprint \"// > Enter your name here: \"\n\t\t\t@player_name = String(gets.chomp.capitalize)\n\t\t\tputs \"//\"\n\t\t\tputs \"// Thank you! Now that we're all setup, it's time to play!\"\n\t\t\tputs \"//\"\n\t\t\tputs \"//////////////////////////////////END OF SETUP///////////////////////////////////\"\n\t\t#rescue exeception anytime user inputs a non-integer and quits program\n\t\trescue ArgumentError\n\t\t\t#program will close if user provides blank or non-integer input\n\t\t\tputs \"Sorry, your input was invalid. That usually means you accidentally entered a\n\t\t\tnon-integer or left the field blank. Please restart the program and try again.\"\n\t\t\texit\n\t\tend\n\tend",
"def setup(params)\n self.game_type = params[:game_type]\n self.difficulty_level = params[:level]\n self.board_id = params[:board_id]\n self.player_setup(params[:player1], params[:player2], params[:names], params[:symbols])\n end",
"def start\r\n\t\t\t@output.puts \"Welcome to Deal or No Deal!\"\r\n\t\t\t@output.puts \"Designed by: #{created_by}\"\r\n\t\t\t@output.puts \"StudentID: #{student_id}\"\r\n\t\t\t@output.puts \"Starting game...\"\r\n\t\tend",
"def setup_game(p1_mark='X',p2_mark='O',player_turn_start=1)\n @player_mark=Array.new(2)\n @player_mark[0]=p1_mark\n @player_mark[1]=p2_mark\n setup_board\n self.player_turn = player_turn_start\n end",
"def initialize\n puts 'Welcome to the Casino'.colorize(:blue)\n @player = Player.new #seeing new here so it means its going to the class listed and runs the initi method\n puts \"what game do you want to play #{player.name}?\"\n #show a casino game menu\n #let the player choose a game\n # initialize the new game, passing the player as a parameter\n end",
"def battletest_setup\r\n # Set up party for battle test\r\n $game_party.setup_battle_test_members\r\n # Set troop ID, can escape flag, and battleback\r\n $game_temp.battle_troop_id = $data_system.test_troop_id\r\n $game_temp.battle_can_escape = true\r\n $game_map.battleback_name = $data_system.battleback_name\r\n end",
"def main_begin\n create_spriteset\n # When comming back from battle we ensure that we don't have a weird transition by warping immediately\n if $game_temp.player_transferring\n transfer_player\n else\n $wild_battle.reset\n $wild_battle.load_groups\n end\n fade_in(@mbf_type || DEFAULT_TRANSITION, @mbf_param || DEFAULT_TRANSITION_PARAMETER)\n $quests.check_up_signal\n end",
"def setup(numPlayers, myIndex, suspects, locations, weapons)\n @@numPlayers = numPlayers\n @myIndex = myIndex\n @suspects = suspects.clone\n @locations = locations.clone\n @weapons = weapons.clone\n @cards = Array.new\n @inGame = true\n end",
"def start\n setPlayers\n question\nend",
"def init\n\t\t@state = NewGame.new(self)\n\t\t# Deck.create({:game => self})\n\tend",
"def setup\n # setup records starting timestamp\n start_time = Time.new\n # creates a super secret code from the seed array\n secret_code = 4.times.map{seed_array.sample}\n #tells user to guess\n puts \"I have generated a beginner sequence with four elements made up of: (r)ed,\n # (g)reen, (b)lue, and (y)ellow. Use (q)uit at any time to end the game.\\n What's your guess?\"\n #aquires guess string and splits into array\n\n @guess = gets.chomp.split(//)\n\n guess_checker\n end",
"def setup\n\t\tsuper\n\t\t@x = 400\n\t\t@y = 300\n\t\t#@image = Gosu::Image[\"Ship.png\"]\n\t\t self.input = {\n\t\t \tholding_left: :left,\n\t\t \tholding_right: :right,\n\t\t \tholding_up: :up,\n\t\t \tholding_down: :down,\n\t\t \tspace: :fire\n\t\t }\n\t\t@speed = 10\n\t\t@angle = 0\n\t\t@animation = Chingu::Animation.new(:file => \"flame_48x48.bmp\")\n\t\t@animation.frame_names = { :still =>0..1, :up =>2..5, :fire =>6..7}\n# :still =>0..1, :fire =>6..7, :up =>2..5\n\t\t@frame_name = :still\n\t\t@last_x, @last_y = @x, @y\n\tend",
"def setup_game\n begin\n @game = @cache.fetch(@key, expires_in: 24.hours) do\n get_random_user_list \n get_prizes\n set_prizes\n end\n rescue => e\n puts \"e: #{e.inspect}\"\n @failed = true\n end \n end",
"def start_game\n begin\n @game_text.intro\n\n # Run the tutorial\n ActionDirector.new(@world, @player).call({command: :talk, target: :jerry})\n\n # The main game\n while @player.alive? && @world.has_hostiles?\n @player.in_battle? ? battle_loop : game_loop\n end\n\n @player.alive? ? @player.win : @player.defeat\n rescue SystemExit, Interrupt # Catpure ctrl+c exit, end gracefully\n @game_text.exit\n end\n end",
"def begin_game\n\t\t#Does this need really to be stored in a variable?\n\t\tg = Game.new(@name)\n\tend",
"def initialize\n @name_boy = default_male_name\n @name_girl = default_female_name\n $game_switches[Yuki::Sw::Gender] = @playing_girl = false\n $game_variables[Yuki::Var::Player_ID] = @id_boy = rand(0x3FFFFFFF)\n @id_girl = (@id_boy ^ 0x28F4AB4C)\n @start_time = Time.new.to_i\n @play_time = 0\n @badges = Array.new(6 * 8, false)\n @region = 0\n @game_version = PSDK_CONFIG.game_version\n @current_version = PSDK_Version rescue 0\n @time_counter = 0\n load_time\n end",
"def start\n set_player_name\n deal_cards\n show_flop\n player_turn\n dealer_turn\n end",
"def start\r\n initialize_game\r\n until @game.over?\r\n take_turn\r\n end\r\n print_outcome\r\n end",
"def init_game\n @io.welcome_msg\n @num_decks = @io.get_num_decks \n @player_cnt = @io.get_player_cnt(@max_players)\n players_names = @io.get_players_names\n\n # Initialize player objects\n 0.upto(players_names.length - 1) do |x|\n @players[x] = Player.new(players_names[x], @bankroll)\n end\n\n # Create the dealer and add as a player\n @dealer = Dealer.new\n @dealer.hit_soft_17 = @hit_soft_17\n @players[@players.length] = @dealer\n end",
"def setup\n # Build the portfolio\n self.portfolio = Portfolio.new(:login => self.login)\n self.portfolio.save\n \n # Build the design editor\n self.design = Design.new\n self.design.save\n \n # Set the plan at level 1\n self.plan = Plan.new(:level => 1)\n self.plan.save\n \n # Activate\n self.activate!\n \n # Save the user at the end.\n self.save\n end",
"def start \n puts \"Welcome to \" + blue(\"Apeture Science TicTacToe\") + \", were we screen the test \" + blue(\"test subjects\") + \" from the \" + pink(\"cake ingredients\") \n # Get input from player on game mode\n valid = false\n until valid == true\n puts \"To play against another pathetic test \\\"participant\\\", \" + blue(\"press P\") + \". If you dare challenge a cyber god, \" + blue(\"press A\") + \". On a relevant note, \" + pink(\"please don't spill tears into any Apeture Science equipement.\")\n @input = STDIN.gets.chomp.downcase\n\n valid = \"pa\".split(\"\")\n if valid.include?(@input)\n valid = true\n else\n puts \"Seems you could not manage that simple task. Well at least you can rest assured that \" + pink(\"you will burn well.\")\n end\n end\n # Set game mode\n if @input == \"p\"\n @game_mark = \"player\"\n elsif @input == \"a\"\n @AI = AI.new(@game, self) \n @game_mark = \"AI\" \n if @game.current_player == \"X\" \n @AI.make_move\n end\n end\n start_turn \n end",
"def start_game(user = nil)\n super\n # ...\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def initial_setup_pause\n puts\n say \"Thanks, #{human.name}, I have everything I need to get started.\\n\" \\\n \"Please hit any key when you are ready to begin.\"\n getchar\n end",
"def process_initial_commands\n #in the game class\n case \n when play?\n game = Game.new(instream, outstream, display)\n game.start\n \n when instructions?\n display.game_objective1 # give the user instructions\n display.game_objective2\n\n when quit? # run the loop below until the user says to quit\n outstream.puts display.quit.magenta\n\n else # for anything else\n outstream.puts display.invalid_option\n end\n end",
"def initialize!\n $sfxengine = SoundEngine.new\n\n GameMode.enter_name_input =\n Text.new(\n Settings.winX/2,\n Settings.winY/2,\n Settings.fontsize,\n Color.new(0, 255, 0, 0.8),\n Settings.fontfile,\n \"\")\n GameMode.enter_name_headline =\n Text.new(\n Settings.winX/2,\n Settings.winY*0.35,\n Settings.fontsize,\n Color.new(0, 255, 0, 0.8),\n Settings.fontfile,\n \"enter name\")\n\n GameMode.fader = Rect.new(0, 0, Settings.winX, Settings.winY)\n GameMode.fader.colors = ColorList.new(4) { |i| Color.new(0, 0, 0, 0.8) }\n\n @ingame_timer = Timer.new\n @external_timer = Timer.new\n @engine_running = true\n @score_object = Score.new\n\n $gfxengine.prepare # TODO put to end, remove things mouse depends on!\n @mouse = Mouse.new(100, 100, Settings.mousedef)\n @score_object.cur_level = 0\n start_level @score_object.cur_level\n @textbuffer = \"\"\n GameMode.set_mode(GameMode::NORMAL)\n end",
"def ready\r\n playbook.freeze\r\n @running = true\r\n # Call the initial state to make sure it's set\r\n initial_state\r\n call_ready\r\n call_player_ready\r\n p_subplots.each { |s| s.ready }\r\n end",
"def setup(args)\n # Camera\n position = Engine3D::Vector.new 0.0, 0.0, 0.0, 1.0\n direction = Engine3D::Vector.new 0.0, 0.0,-1.0, 1.0\n args.state.camera = Engine3D::Camera.new position, direction\n \n # Renderer :\n args.state.renderer = Engine3D::Render.new 1280, 720, # viewport size \n args.state.camera, # camera\n 1.0, 300.0 # near and far planes\n\n # Scene :\n args.state.scene = Engine3D::Scene.load args,\n 'data/scenes/scene1.rb',\n SPRITE_SCALE\n\n # Miscellenaous :\n args.state.angle = 0.01\n\n\n args.state.setup_done = true\nend",
"def main\n # Class Instances\n game = Game.new\n player1 = Player.new(1)\n player2 = Player.new(2)\n # Start of main engine\n #player1.name = prompt_UI.name.....\n player1.get_name\n player2.get_name\n game.display_welcome(player1, player2)\n # Sets the current turn order\n current_player = player1\n # Start of main game loop\n continue = true\n while continue\n # go to game to get, go to UI to present\n game.display_question(current_player)\n current_player.display_score\n if current_player.game_over?\n game.final_score(player1, player2)\n continue = false\n end\n if current_player == player1\n current_player = player2\n else\n current_player = player1\n end\n end\nend",
"def setup(&b)\r\n\t$game.setup(&b)\r\nend",
"def initialise(loadfile)\n\n # Initialise steps\n\n phases = Phases.new\n $commands = Commands.new\n \n if $testing == 1\n require_relative 'Testing.rb'\n require_relative '../Extra/Parser.rb'\n end\n \n if $debugplay == 1\n $debug.debugplay\n end\n \n # Initialise graphics if graphics mode is on\n #if $graphics == 1\n #require 'RMagick'\n require_relative '../Graphics/GraphicsHandler.rb'\n #graphicsinit\n #end\n \n #system(\"unzip ../Resources/Images.zip\")\n \n \n # Load game\n if $loadgame == true\n loadgame(loadfile)\n end\n \n # Set command authentication levels\n IO.foreach(\"cards.txt\") { |line| puts line }\n \nend",
"def setup_game\n @deck.shuffle!\n end",
"def start \n\t @output.puts \"Welcome to Noughts and Crosses!\"\n\t @output.puts \"Created by:#{created_by}\"\n\t @output.puts \"StudentID: #{student_id}\"\n\t @output.puts \"Starting game...\"\n\t @output.puts \"Player 1: 0 and Player 2: 1\"\n\n\t\n\tend",
"def setup(args)\n position = Engine3D::Vector.new 0.0, 0.0, 0.0, 1.0\n direction = Engine3D::Vector.new 0.0, 0.0,-1.0, 1.0\n args.state.camera = Engine3D::Camera.new position, direction\n args.state.renderer = Engine3D::Render.new 1280, 720, args.state.camera, 1.0, 300.0\n\n #args.state.scene = Engine3D::Scene.load 'sprite3dengine/data/scenes/debug.rb'\n #args.state.scene = Engine3D::Scene.load 'sprite3dengine/data/scenes/scene1.rb'\n args.state.scene = Engine3D::Scene.load 'sprite3dengine/data/scenes/demo.rb'\n\n #args.state.angle = 0.01\n #args.state.camera_angle = 0.001\n\n # DEBUG :\n #args.state.frame_counter = 0\n\n args.state.setup_done = true\n\n puts \"setup finished!!!\"\nend",
"def start_round\n super\n @game_options_array = ['Skip', 'Take card', 'Open up']\n end",
"def set_game_info(core_name_class, alg_name_class, opt_game_keysym, nalgfx_name, bot_name)\n @core_name_class = core_name_class\n @alg_name_class = alg_name_class\n @opt_game_keysym = opt_game_keysym\n @nal_client_gfx_name = nalgfx_name\n @robot_name = bot_name\n end",
"def viewDidLoad \n super\n self.new_game \n self.init_views\n\n end",
"def initialize_current_gfx(game_type)\r\n @last_selected_gametype = game_type\r\n # reset the title\r\n initial_board_text\r\n \r\n ##initialize a current local game\r\n init_local_game(game_type)\r\n end",
"def playGame\n #start the opening of the game\n #introduce the rules, ask for human or computer etc\n self.opening()\n\n end",
"def setup\n\t\ttext_font create_font(\"SanSerif\",10);\n\t\tscreen = [1920,1040] #JackRabbit\n\t\t# product[1920,1040] = 1996800\n\n\t\t# screen = [1500,900] #HOME\n\t\t# product[1500,900] = 1350000\n\n\t\t@it = 0\n\n\t\tsize(*screen)\n\t\t@w,@h = screen.map{|d| d/2}\n\t\t@i, @t = [0] * 2 ; background(0)\n\t\t@colors = (0..3).map{|i|rand(255)}\n\t\tframe_rate 2.5 ; colorMode(HSB,360,100,100)\n\t\tno_fill() ; no_stroke ; @xy = [0,0]\n\t\t\t\n\t\tcl = VERTS.map{|c| rand(30) }\n\t\t@cc = VERTS.map{|r| [(20 + rand(@w)) * 1.9,\n\t\t\t\t\t\t\t\t\t\t\t\t (20 + rand(@h)) * 1.9] }.zip(cl)\n\tend",
"def setup\n set_name(ask_name)\n set_word\n set_guess\n end",
"def init(msg)\n msg.reply('Game starting! You have 5 tries! Submit an answer by using $game guess followed by a number!'.freeze)\n @started = true\n @random_number = rand(100)\n @tries = 0\n end",
"def run\n welcome\n main_menu_selection #choose to create a character or login to pre-existing character\n player_options #a list of options the selected player from 'selection_menu' can accomplish\nend",
"def setup!\n if @options.has_key?(:home)\n @home = Pathname.new(@options[:home])\n elsif not ENV['COMMITSU_HOME'].nil?\n @home = Pathname.new(ENV['COMMITSU_HOME'])\n else\n @home = Environment.default_home\n end\n load_config!\n @gui = @options.has_key?('gui')\n if @options.has_key?('issuetracker')\n begin\n @tracker = Commitsu::Trackers.get(@options['issuetracker'],self)\n rescue LoadError => le\n puts \"Unable to load tracker. Gem not found: #{le}\"\n @tracker = Commitsu::Trackers.none\n end\n else\n @tracker = Commitsu::Trackers.none\n end\n end",
"def setup\n print 'Enter the number of players for this game -> '\n t = Util.get_i()\n if t >= 6\n abort('can only have less than 6 players, program aborting')\n end\n t.times do |index|\n @players << Player.new(index, @@INIT_DOLLAR)\n end\n end",
"def post_setup\n end",
"def start_game(game_config)\n # start a new game\nend",
"def start\n super\n create_menu_background()\n if MENU_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(MENU_CONFIG::IMAGE_BG)\n @bg.opacity = MENU_CONFIG::IMAGE_BG_OPACITY\n end\n \n create_command_window()\n @status_window = Window_Party_Status.new(0, 0, 480,424, $game_party.members)\n @menu_info_window = Window_Menu_Info.new(0,424,640,56)\n end",
"def start\n load\n until @computer.round_finished\n save\n @computer.respond_to_guess(@player.prompt)\n end\n\n if @computer.guessed\n puts \"You won!\"\n else\n puts \"You lost!\"\n end\n end",
"def setup\n @event = Event.create(eventName: \"socialLogin\")\n @referral = Referral.create(referredBy: \"http://www.jumpstartlabs.com\")\n @request = Request.create(requestType: \"GET\")\n @resolution = Resolution.create(resolutionWidth: \"1920\", resolutionHeight: \"1280\")\n @url = Url.create(url: \"http://www.jumpstartlabs.com\")\n @user_agent = UserAgent.create(userAgent: \"Mozilla/5.0 (Macintosh%3B Intel Mac OS X 10_8_2) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1309.0 Safari/537.17\")\n @user = User.create(identifier: \"jumpstartlab\", rootUrl: \"hweoaw;eofiawofhawef\")\n end",
"def initialize_game\n @winner = false\n @players = DiceGame::Players.new\n @score_table = DiceGame::ScoreTable.new\n @dice = DiceGame::Dice.new\n\n count ||= ask('Please enter number of players, max 3'.yellow)\n @score_table.initialize_scores(@players.number_of_players(count.to_i))\n start_game\n end",
"def initialize \n super(ScreenWidth, ScreenHeight, false)\n self.caption = \"Mad Pokemon\"\n $window = self\n\n @@images = Hash.new\n @@fonts = Hash.new \n load_images\n load_fonts\n\n @@fading_off = false\n @@fading_on = false\n @@end_fade = 0\n @@start_fade = 0\n\n @@change_game_state = nil\n\n @@game_state = MenuState.new\n end",
"def setup\n true\n end",
"def finish_prep\n @windows[Win_Help].hide\n if @ATB_Active\n setup_start_atb\n else\n choose_team_start\n end\n end",
"def start\n\t\t\t@output.puts(\"Welcome to Mastermind!\")\n\t\t\t@output.puts(\"Created by: #{created_by} (#{student_id})\")\n\t\t\t@output.puts(\"Starting game...\")\n\t\t\t@output.puts(\"The game has 12 turns!\")\n\t\t\t@secret = \"XXXX\"\n\t\t\tvalid1 = checksecret(secret)\n\t\tend",
"def startup\n end",
"def start_game!\n @started = true\n @deck = build_starting_deck\n\n self.players.shuffle!.rotate!(rand(MAX_PLAYERS)) # shuffle seats\n\n self.next_turn\n\n # Do this after #next_turn since next_turn rotates the players!\n if self.has_factions?\n faction = 0\n self.players.each { |p|\n p.faction = faction\n faction = 1 - faction\n }\n end\n\n self.pass_out_characters_and_coins\n end",
"def setup\n add_standard_properties\n #\n create_banner\n create_standard_options\n create_advanced_options\n create_mode_options\n create_application_options\n create_feature_options\n create_tail_options\n #\n parse_options\n load_config_configuration\n create_result_directory\n load_results_archive\n end",
"def new_game\n\t\tclear\n\t\tget_username\n\t\tselect_level\n\t\tget_deck\n\t\tshuffle\n\t\tget_hand\n\t\tcontinue_game\n\tend",
"def initialize(*args)\n super\n @game = Game.new\n\n @changelog = self.load_changelog\n\n @mods = config[:mods]\n @channel_name = config[:channel]\n @settings_file = config[:settings]\n @games_dir = config[:games_dir]\n\n @idle_timer_length = config[:allowed_idle]\n @invite_timer_length = config[:invite_reset]\n\n @idle_timer = self.start_idle_timer\n\n @game_timer_minutes = nil\n @game_timer = nil\n end",
"def start_game\n\t\tself.game_is_started = true\n send_update\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def start_game\n self.deal_tiles\n self.make_stock_card_deck\n self.assign_order\n self.bank = 100000 - (self.game_players.length*6000)\n self.deal_cash\n self.initialize_hotels\n self.save\n end",
"def new_game\n set_player\n\n if human_player?\n start_message(:welcome)\n\n set_grid\n puts\n set_bombs\n\n else #non-human\n start_message(:robot_game)\n @robot = Robot.new()\n @grid_size = @robot.grid_size\n @num_bombs = @robot.num_bombs\n end\n @play_again = true\nend",
"def setup(numPlayers, myIndex, suspects, locations, weapons)\n\t\t@numplayers = numPlayers\n\t\t@myIndex = myIndex\n\t\t@suspects = suspects\n\t\t@locations = locations\n\t\t@weapons = weapons\n\n\t\t#set the cards that have not been seen\n\t\t#In this case it will be every card\n\t\tsetNotSeen\n\n\tend"
] |
[
"0.82782227",
"0.74895287",
"0.74733734",
"0.7144431",
"0.698938",
"0.6906279",
"0.6761768",
"0.6755468",
"0.67312187",
"0.6729468",
"0.6684074",
"0.66727537",
"0.66326344",
"0.6575657",
"0.6544687",
"0.6525043",
"0.65006346",
"0.64955086",
"0.64681125",
"0.6453982",
"0.6410813",
"0.6386724",
"0.63818395",
"0.6375638",
"0.6353866",
"0.6345543",
"0.63402665",
"0.63314533",
"0.6264505",
"0.62243724",
"0.62219644",
"0.6213214",
"0.6193511",
"0.6188229",
"0.6158528",
"0.6155695",
"0.61496663",
"0.6139561",
"0.6137863",
"0.6120237",
"0.6081333",
"0.6079097",
"0.60787356",
"0.6066285",
"0.60539377",
"0.6051113",
"0.60446566",
"0.6035589",
"0.60249346",
"0.6011626",
"0.60103446",
"0.59998447",
"0.59967315",
"0.5995279",
"0.5995279",
"0.5988066",
"0.59763086",
"0.59737265",
"0.5973",
"0.59706485",
"0.59679407",
"0.596664",
"0.5964621",
"0.596323",
"0.5960608",
"0.5942016",
"0.5938007",
"0.5917868",
"0.5913791",
"0.589847",
"0.58957154",
"0.5895332",
"0.5895133",
"0.5891825",
"0.58833504",
"0.58787024",
"0.5876916",
"0.58608127",
"0.58568555",
"0.58564866",
"0.58515096",
"0.58502334",
"0.5848857",
"0.5841955",
"0.58346",
"0.5831806",
"0.5825125",
"0.5824907",
"0.5822161",
"0.58190477",
"0.5818828",
"0.5818335",
"0.5815699",
"0.58104676",
"0.58104676",
"0.58104676",
"0.58104676",
"0.58104676",
"0.58050084",
"0.58013916",
"0.5799863"
] |
0.0
|
-1
|
We'll use this method to handle any answers that are not "1" or "2"
|
def handle_typos(chosen_door)
puts "Man you should take a proper decision or learn how to type!"
puts "If you want to restart the game, press 1"
puts "If you want to try again, press 2"
puts "If you happen to be a coward, press 3 and quit this stupid game now. No regrets"
decision = $stdin.gets.chomp
if decision == "1"
puts "Hooray! Let's start from scratch"
start_greetings
start_game
elsif decision == "2"
puts "OK, let's try again. You can do this!"
# Skipping the greetings
start_game
elsif decision == "3"
puts "Quiting is sad man. But, hey, your game, your rules! Bye bye"
else
handle_typos(chosen_door)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def questionOne(frustration)\n if frustration == \"Yes\"\n return 3\n end \n \n if frustration == \"Not at all\"\n return 1\n end \n \n if frustration == \"I can't tell\"\n return 2\n end\nend",
"def question_and_answer(with_error, zero_or_one, mistery_num)\n message = \"Do you see your number here: (y)(n). To exit the game enter the letter e.\".colorize(:blue)\n if with_error == true\n puts \"\\nIncorrect Answer. \" + message\n else \n puts \"\\n#{message}\"\n end \n answer = gets.chomp.upcase\n case answer\n when \"Y\", \"YES\"\n if zero_or_one % 2 == 0\n mistery_num +=\"0\"\n else\n mistery_num +=\"1\"\n end\n return mistery_num\n when \"N\", \"NO\"\n if zero_or_one % 2 == 0\n mistery_num +=\"1\"\n else\n mistery_num +=\"0\"\n end\n return mistery_num\n when \"E\"\n return \"break\"\n else\n question_and_answer(true, zero_or_one, mistery_num)\n end \nend",
"def verify_user_answer(user_answer)\n until user_answer == \"1\" || user_answer == \"2\" || user_answer == \"3\"\n puts \"That's not a valid answer. Please enter 1, 2, or 3\"\n user_answer = gets.chomp.to_s\n end\n return user_answer\n end",
"def check_answer(answer, real_answer)\n modified_real_answer = (real_answer.to_i != 0 && real_answer.to_s != '0') ? real_answer.to_i.to_words.downcase : real_answer\n modified_answer = (answer.to_i != 0 && answer.to_s != '0') ? answer.to_i.to_words.downcase : answer\n modified_real_answer.gsub!(/ and /,'')\n modified_real_answer.gsub!(/[ ,]*/,'')\n modified_answer.gsub!(/ and /,'')\n modified_answer.gsub!(/[ ,]*/,'')\n modified_answer == modified_real_answer ? true : false\n end",
"def act_on_question_types\n case question_type\n when 'yes_no_question' then handle_yes_no_question\n when 'or_question' then handle_or_question\n else\n handle_not_a_question\n end\n end",
"def validate_answer(answer)\n end",
"def getYesOrNo ( question )\n response = getInput(\"#{question} (y/n)\")\n\n if response.downcase == \"y\"\n true\n elsif response.downcase == \"n\"\n false\n else\n puts \"Invalid response\\n\"\n getYesOrNo( question )\n end\nend",
"def multiple_choice_answers\r\n answer.blank? and return []\r\n answer.strip.split(/\\s+/).map(&:to_i).compact\r\n end",
"def food_question3(food_answer3)\n if food_answer3 == \"none\"\n @food_score3 = 0\n elsif food_answer3 == \"1 meal\"\n @food_score3 = 1\n elsif food_answer3 == \"2+ meals\"\n @food_score3 = 2\n end\n @food_score3\nend",
"def again_or_exit?(crate)\n puts \"\\n\\nWhat would you like to do now?\\n1. View another genre.\\n2. Exit\"\n input = gets.strip\n input_i = input.to_i\n acceptable_answers = (1..2).to_a\n while acceptable_answers.none? { |answer| answer == input_i }\n puts \"\\nI'm sorry, that's not a valid option.\"\n puts \"Please enter 1 or 2.\"\n input_i = gets.strip.to_i\n end \n\n if input_i == 1\n self.start(crate)\n else\n puts \"Have a good one!\"\n end\n end",
"def verify_answer?(question, answer)\n case question[:type]\n when :add\n question[:first_num] + question[:second_num] == answer\n when :subtract\n question[:first_num] - question[:second_num] == answer\n when :multiply\n question[:first_num] * question[:second_num] == answer\n when :divide\n question[:first_num] / question[:second_num] == answer\n end\nend",
"def answers\n [answer_1, answer_2]\n end",
"def is_yesno(answer)\n [answer.downcase == \"y\", \"\"]\nend",
"def result(answer)\n @answer == answer.to_i \n end",
"def food_question2(food_answer2)\n if food_answer2 == \"never\"\n @food_score2 = 0\n elsif food_answer2 == \"1 - 3 days per week\"\n @food_score2 = 1\n elsif food_answer2 == \"4 or more days per week\"\n @food_score2 = 2\n end\n @food_score2\nend",
"def yourAnswer()\n if $strAnswer.length == 1\n $arrUserAnswers[$intQuestionOnScreen - 1, 1] = $radioChoice\n else\n $arrUserAnswers[$intQuestionOnScreen - 1] = ($option_one.to_s + $option_two.to_s + $option_three.to_s + $option_four.to_s).gsub(\"0\", \"\")\n end\nend",
"def food_question1(food_answer1)\n if food_answer1 == \"never\"\n @food_score1 = 0\n elsif food_answer1 == \"1 - 3 days per week\"\n @food_score1 = 1\n elsif food_answer1 == \"4 or more days per week\"\n @food_score1 = 2\n end\n @food_score1\nend",
"def ask question\r\n\twhile true\r\n\t\tputs question\r\n\t\treply = gets.chomp.downcase\r\n\t\tif reply == 'yes'\r\n\t\t\t\treturn true\r\n\t\t\t\tbreak\r\n\t\tend\r\n\t\tif reply == 'no'\r\n\t\t\t\treturn false\r\n\t\t\t\tbreak\r\n\t\tend\r\n\t\t#else - I had an \"else\" in here, which doesn't belong. Need to remove and just 'Puts' if neither of the two above are included.\r\n\r\n\t\t\tputs 'Please answer \"yes\" or \"no\".'\r\n\t\tend\r\n\t\r\nend",
"def ask\n\t\tbegin\n\t\t\tputs self\n\t\t\tprint \"Su respuesta: \" \n\t\t\tanswerno = gets.to_i - 1\n\t\tend while (answerno < 0 or answerno >= @answers.length)\n\t\t#Comprobamos si es correcta la respuesta\n\t\t@answers[answerno].is_right? \n\tend",
"def check_for_answers(questions)\r\n @possible_questions = []\r\n questions.each do |question| \r\n unless question.answers.length < 2 \r\n @possible_questions << question \r\n end \r\n @possible_questions\r\n end \r\n end",
"def get_correct_answer(question_prompt, answers)\n question_prompt = question_prompt.downcase\n answer = nil\n case question_prompt\n when /which number goes with your street on/\n answer = answers[answers.index('3612') || answers.index('5555') || answers.index('None of the above')]\n when /which street have you lived on/\n answer = answers[answers.index('BEACH') || answers.index('None of the above') || 0]\n when /in which city is/\n answer = answers[answers.index('ATLANTA') || answers.index('None of the above')]\n when /in which county was your/\n answer = answers[answers.index('FULTON') || answers.index('None of the above')]\n when /what year is your/\n answer = answers[answers.index('2005')]\n when /which of the following people do you know/\n answer = answers[answers.index('ANTHONY BROWN') || answers.index('None of the above')]\n when /in wich year were you born/\n answer = answers[answers.index('1975')]\n when /what type of residence is/\n answer = answers[answers.index('Single Family Residence')]\n when /in which month month were you born/\n answer = answers[answers.index('FEBRUARY')]\n when /in which county have you lived/\n answer = answers[answers.index('FULTON') || answers.index('None of the above')]\n when /what are the last two digits of your social security number/\n answer = answers[answers.index('33')]\n when /at which of the following addresses have you lived/\n answer = answers[answers.index('None of the above')]\n when /which person is not a relative or someone that you know/\n answer = answers.grep(/SMITH/).first\n when /with which name are you associated/\n answer = answers[answers.index('None of the above')]\n when /what are the first two digits of your social security number/\n answer = answers[answers.index('11') || answers.index('None of the above')]\n when /which of the following phone numbers is related to you/\n answer = answers[answers.index('None of the above')]\n when /from whom did you purchase the property at/\n answer = answers[answers.index('JOE ANDERSON') || answers.index('None of the above')]\n when /how long have you been associated with the property at/\n answer = answers[answers.index('Over 5 years')]\n when /what is the approximate square footage of the property at/\n answer = answers[answers.index('Over 2,500')]\n when /when did you purchase the property at/\n answer = answers[answers.index('August 1999') || answers.index('None of the above')]\n when /between/ && /in which state did you live/\n answer = answers[answers.index('NEW YORK')]\n when /when did you purchase or lease your/\n answer = answers[answers.index('December 2006')]\n when /with which name are you associated/\n answer = answers[answers.index('None of the above')]\n end\n answer\n end",
"def validate_answer(answer)\n (answer.match(/a|b/) && answer.length == 1) || answer.match(/--quit|-q/)\n end",
"def knowTheGameTrick\n\tputs \"Do you wanna know the trick of this game?\"\n\tputs \"If YES then type 1 and if NO then type 2.\"\n\tuserAnswer = gets\n\n\tif userAnswer.to_i == 1\n\t\tputs \"This game is designed according to halving technique (can also be called as Binary Search) where you are given only certain chances.\"\n\t\tputs \"Since computer says you whether the guessed number was high or low, you have to always guess the middle number and go on guessing the middle number everytime the range changes.\"\n\telse\n\t\tputs \"I guess, you probably knew the trick of the game. Thanks for playing. Enjoy!\"\n\tend\n\nend",
"def decide\n input = '0'\n puts \"What would you like to do? 1) hit 2) stay\"\n loop do\n input = gets.chomp\n if !['1', '2'].include?(input)\n puts \"Error: you must enter 1 or 2\"\n else\n break\n end\n end\n puts \"Hit me!\" if input == '1'\n puts \"Stay!\" if input == '2'\n input \n end",
"def right_answer\n \t\tif !(answer.downcase == $answer.downcase) && \n !(answer.downcase == $word_answer.downcase)\n \t\t\terrors.add(:answer, \"\")\n \t\tend\n \tend",
"def answer_present\n if self.question.qtype == 'one_response' && self.response_id.nil?\n errors.add(:base, 'Please fill in an answer before leaving this page.' )\n return false\n elsif self.question.qtype == 'likert_scale' && self.response_id.nil?\n errors.add(:base, 'Please fill in an answer before leaving this page.' )\n return false\n\n elsif self.question.qtype == 'rank_three' \n responses = self.multianswers.map( &:rank ).compact\n if responses.length == 3 \n array_wanted = [1, 2, 3]\n if array_wanted == responses.sort\n return true\n else \n errors.add(:base, 'Please ensure all items are unique.' )\n return false\n end \n else \n errors.add(:base, 'Please ensure 3 items are ranked.' )\n return false\n end\n\n elsif self.question.qtype == 'rank_five' \n responses = self.multianswers.map( &:rank ).compact\n if responses.length == 5 \n array_wanted = [1, 2, 3, 4, 5]\n if array_wanted == responses.sort\n return true\n else \n errors.add(:base, 'Please ensure all items are unique.' )\n return false\n end \n else \n errors.add(:base, 'Please ensure 5 items are ranked.' )\n return false\n end\n end\n end",
"def validate_answer(answer)\n answer == @result\n end",
"def yes_no reply\n\tif reply == 'yes'\n\t\treturn true\t\n\telsif reply == 'no'\n\t\treturn false\n\telse\n\t\tputs \"Please answer yes or no\"\n\t\treturn nil\n\tend\nend",
"def multiple?; end",
"def wrong_and_option(wrong, option) #function to take input of wrong word and number of options.\n $wrong_word = wrong\n $no_option = option\n end",
"def check_answer(answer)\n # if answer == self.select(:answer)\n if answer == self.answer\n return true\n else\n return false\n end\n end",
"def yes_no_q(question)\n\tresponse = \"\"\n\tloop do\n\t\tp question + \" (y/n)\"\n \t\tresponse = gets.chomp\n \t\tresponse = yn_booleen(response)\n \t\tbreak if response == true || response == false\n \tend #loop\n \tresponse\nend",
"def prompt_hit_or_stay\n puts \"\\nWould you like to (1) hit or (2) stay?\"\n response = gets.chomp\n while response != \"1\" && response != \"2\"\n puts \"Please choose either (1) for hit or (2) for stay.\"\n response = gets.chomp\n end\n return response\n end",
"def quiz(num, lang1, lang2)\n num.times do\n model.random_pair.map do |pair|\n puts pair[lang1]\n print \"> \"\n user_answer = STDIN.gets.chomp\n puts pair[lang2] unless pair[lang2] == user_answer\n end\n end\n end",
"def check_repeated_choice guess\r\n\t\t\t\t\t@resultb.include? guess\r\n\t\t\t\tend",
"def validate_choices\n\t\tunless (self.choice1 != self.choice2) && (self.choice1 != self.choice3) && (self.choice2 != self.choice3)\n\t\t\terrors.add(:Choices, 'must have different answers for each')\n\t\tend\n\tend",
"def another_calculation?\n answer = ' '\n loop do\n prompt(MESSAGES['another_loan'])\n answer = Kernel.gets().chomp().downcase()\n if YES_ANSWERS.include?(answer)\n answer = 1\n break\n elsif NO_ANSWERS.include?(answer)\n answer = 2\n break\n else\n prompt(MESSAGES['exit_error'])\n end\n end\n answer\nend",
"def answer_validation(name)\n puts \"\\nHello, #{name}! What would you like to do today?\\n\n [1] Check allergy score.\n [2] Check allergies based on score.\n [3] Check if allergic to.\n [4] See allergy score table\n [5] Exit\"\n answer_keys = [*1..5]\n ans = gets.chomp.to_i\n while !answer_keys.include?(ans)\n puts \"Please navigate through the options using the numbers given.\"\n ans = gets.chomp.to_i\n end\n ans\nend",
"def handle_yes_no_question\n answer = %w[Yes No].sample\n @user.session[:last_answer] = answer\n say answer\n end",
"def true_false_answer(answer)\n answer.upcase=~/t/i ? index = 0 : index = 1\n frm.radio(:name=>/deliverTrueFalse/, :index=>index).set\n end",
"def correct_answer?(a, b, player_input, operation)\n case operation\n when 'add'\n result = add(a,b)\n when 'subtract'\n result = subtract(a,b)\n when 'multiply'\n result = multiply(a,b)\n end\n player_input == result\nend",
"def nochoice?\n multi? ? (@value.empty?) : (@value == 0)\n end",
"def processed_or_not(answer)\n if answer == false\n puts \"The loop wasn't processed!\"\n elsif answer == true\n puts 'The loop was processed!'\n end\nend",
"def result(hand)\n v = value(hand)\n case v\n when 21 then hand.size == 2 && :natural || 21\n when 17..20 then v\n when 0..16 then raise \"error, illegal resulting hand value\"\n else :bust\n end\nend",
"def display_multi_or_range_answer answer_type, answer, fields, short_version\n if !short_version && (answer_type.is_a?(MultiAnswer) && answer_type.single) || answer_type.is_a?(RangeAnswer)\n text \"Please select only one option\", :size => 8, :style => :italic\n end\n #get all the options ids from the answer's answer_parts\n if answer.present?\n options_selected = answer.answer_parts.map{ |a| a.field_type_id }\n else\n options_selected = []\n end\n answer_type.send(answer_type.class.to_s.underscore.downcase+\"_options\").sort.each do |mao|\n if !short_version || options_selected.include?(mao.id)\n text \"#{options_selected.include?(mao.id) ? FILLED_CHECK_BOX : CHECK_BOX} #{fields[(answer_type.class.to_s.underscore.downcase+\"_option_field\").to_sym][mao.id.to_s]}\"\n #display any details if it's a MultiAnswerOption in which the user added details\n if mao.is_a?(MultiAnswerOption) && mao.details_field? && (!short_version || answer.answer_parts.find_by_field_type_id(mao.id).details_text.present?)\n move_down 5\n text_field 500, 40, options_selected.include?(mao.id) ? answer.answer_parts.find_by_field_type_id(mao.id).details_text : ''\n end\n end\n end\n if answer_type.is_a?(MultiAnswer) && answer_type.other_required && (!short_version || (answer.present? && answer.other_text.present?))\n text \"#{(answer.present? && answer.other_text.present?) ? FILLED_CHECK_BOX : CHECK_BOX} #{ fields[:other_text_fields][answer_type.id.to_s]}\"#Other:\"\n move_down 5\n text_field 500, 40, answer.try(:other_text)\n end\n move_down 5\n end",
"def basic_choice\n\tavailable_opt2_basic = [\"a\", \"s\", \"m\", \"d\"]\n\n\tresponse = read_choice\n\n\tif response == \"q\"\n\t\tquit\n\tend\n\n\tuntil available_opt2_basic.include? response\n\t\tputs \"Please type in valid response.\"\n\t\tresponse = read_choice\n\tend\n\n\tcase response\n\t\twhen \"a\"\n\t\t\tputs \"ADD: Enter first integer\"\n\t\t\tnum1 = input_to_i\n\t\t\tputs \"Enter second integer\"\n\t\t\tnum2 = input_to_i\n\t\t\tputs \"ANSWER: #{num1} + #{num2} = #{add(num1,num2)}.\"\n\t\t\trepeat\n\t\twhen \"s\"\n\t\t\tputs \"SUBTRACT: Enter first integer\"\n\t\t\tnum1 = input_to_i\n\t\t\tputs \"Enter second integer\"\n\t\t\tnum2 = input_to_i\n\t\t\tputs \"ANSWER: #{num1} - #{num2} = #{subtract(num1,num2)}.\"\n\t\t\trepeat\n\t\twhen \"m\"\n\t\t\tputs \"MULTIPLY: Enter first integer\"\n\t\t\tnum1 = input_to_i\n\t\t\tputs \"Enter second integer to multiplnum2\"\n\t\t\tnum2 = input_to_i\n\t\t\tputs \"ANSWER: #{num1} * #{num2} = #{multiplnum2(num1,num2)}.\"\n\t\t\trepeat\n\t\twhen \"d\"\n\t\t\tputs \"DIVIDE: Enter first integer\"\n\t\t\tnum1 = input_to_i\n\t\t\tputs \"Enter second integer to divide\"\n\t\t\tnum2 = input_to_i\n\t\t\tputs \"ANSWER: #{num1} / #{num2} = #{divide(num1,num2)}.\"\n\t\t\trepeat\n\t\telse\n\t\t\tputs \"Please enter a valid letter.\"\n\t\tend\nend",
"def response_equal_answer?\n @response.to_i == eval(@question)\n end",
"def answers\n %w{Yes No Maybe Ask\\ again\\ later}\nend",
"def undistinguish\n distinguish(:no)\n end",
"def my_solution\n res = \"\"\n choices.each do |k, v|\n res << \" * #{k}\\n\" if v\n end\n return \"(no correct answer)\" if res.blank?\n res\n end",
"def questionAnswer(question)\n answer = questionAnswerRaw(question)\n \n answer = \"No Answer\" if answer == nil\n return answer\nend",
"def unanswered\n answers.blank?\n end",
"def reason\n res = \"Selected correctly:\\n\\n\"\n res << make_list(@correct_choices, @points_per_choice.round(1))\n res << \"\\n\"\n res << \"Selected incorrectly:\\n\\n\"\n res << make_list(@incorrect_choices, -@points_per_choice.round(1))\n end",
"def create_answers_if\n if self.type.name == 'satisfaction-100'\n 5.times do |n|\n Answer.create(question: self, value: (n*25).to_s + \"%\")\n end\n end\n if self.type.name == 'free-text'\n Answer.create(question: self, value: \"textarea\")\n end\n end",
"def no?\r\n input.to_s[0,1].downcase == 'n' or input.to_i == 2\r\n end",
"def corr_input_play_again?(input)\n if input == 3\n return FALSE, input\n else\n return TRUE, input\n end\nend",
"def q1_sequence_ok?(answer, order)\r\n # check (i) format of answer. assumption: order is always correct\r\n if answer == nil\r\n return \"Proposed seqence is nil. Proposed sequence should be a 1D array of items (strings).\"\r\n elsif !answer.is_a?(Array)\r\n return \"Proposed sequence is not an array. Proposed sequence should be a 1D array of items (strings).\"\r\n end\r\n answer.each{|x| if !x.is_a?(String)\r\n return \"Proposed sequence contains an element which is not a string. Proposed sequence should be a 1D array containing only strings.\"\r\n end}\r\n \r\n # check (ii) contents of answer; is it same as order?\r\n if answer.sort == order.sort\r\n return true # ok\r\n end\r\n\r\n # construct error message for returning\r\n missing_items = order - answer\r\n additional_items = answer - order\r\n \r\n error_msg = \"The items in order are different from the items in your proposed sequence. They must contain identical items! \"\r\n if missing_items.length>0\r\n error_msg += \"These items are missing from your sequence :#{missing_items}.\"\r\n end\r\n if additional_items.length>0\r\n error_msg += \"These items should not be in your sequence :#{additional_items}.\"\r\n end \r\n return error_msg\r\nend",
"def boolean_answers_person(player, player_result, right_result, dsp_result)\n # condition matching the player result with right result\n if player_result == right_result\n system(\"clear\")\n view_current\n puts \"You picked: \\n#{dsp_result}\"\n puts Paint[\"Woo! Correct!\" + \" \\u{2705}\" + \" \" + \"\\u{1f600}\", :green]\n system (\"say yay\")\n player.increase_score\n @player_correct << true\n else\n system(\"clear\")\n view_current\n puts \"You picked: \\n#{dsp_result}\"\n puts Paint[\"Fail bro.\" + \" \\u{274c}\" + \" \" + \"\\u{1f625}\", :red]\n system (\"say damn\")\n @player_correct << false\n end\n end",
"def is_int(answer)\n int_answer = answer.to_i\n if int_answer == 0\n int_answer = nil\n end\n [int_answer, \"#{answer} must be a valid integer.\"]\nend",
"def fashion_question1(fashion_answer1)\n if fashion_answer1 == \"I don't shop.\"\n @fashion_score1 = 0\n elsif fashion_answer1 == \"thrift stores/second hand\"\n @fashion_score1 = 1\n elsif fashion_answer1 == \"Forever 21, H&M, Zara, Urban Outfitters, GAP, Wet Seal\"\n @fashion_score1 = 2\n end\n @fashion_score1\nend",
"def check_answers(answer1, answer2)\n return answer1.downcase.split.join(' ') == answer2.downcase.split.join(' ')\n end",
"def answered?\n\n if answers.length == 0 \n return false\n end\n\n if answers.last.rationale_choices.size > 0\n\n #\n # The last answer is a list containing only one item, and it\n # does not contain a key for :choice_id. This is the answer we\n # generated in the case of unselecting a previous selection.\n # I.e. user is resetting to the default unselected state.\n # {:answer=>\"not answered\"}\n #\n\n return true\n end\n\n return false\n\n end",
"def compare_answers(user_res, machine_res)\n\tresult =\"\"\n\tif user_res == machine_res\n\t\tresult << \"Empate!!\"\n\telse\n\t\tif user_res = \"piedra\" && machine_res = \"papel\"\n\t\t\tresult << \"Gana el segundo jugador!!\"\n\n\t\telsif user_res = \"piedra\" && machine_res = \"tijeras\"\n\t\t\tresult << \"Gana el primer jugador!!\"\n\n\t\telsif user_res = \"papel\" && machine_res = \"piedra\"\n\t\t\tresult << \"Gana el primer jugador!!\"\n\n\t\telsif user_res = \"papel\" && machine_res = \"tijeras\"\n\t\t\tresult << \"Gana el segundo jugador!!\"\n\n\t\telsif user_res = \"tijeras\" && machine_res = \"piedra\"\n\t\t\tresult << \"Gana el segundo jugador!!\"\n\n\t\telsif user_res = \"tijeras\" && machine_res = \"papel\"\n\t\t\tresult << \"Gana el primer jugador!!\"\n\t\tend\n\tend\n\tputs result\nend",
"def play_again\n puts (\"Do you want to play another game ? Yes / No\").red\n print \">\"\n decision = gets.chomp\n while decision != \"Yes\" && decision != \"No\"\n puts \"Invalid answer. Do you want to play again ? Please, type 'Yes' or 'No'\"\n print \">\"\n decision = gets.chomp\n end\n return decision\n end",
"def check_selection(id_a,id_b)\n # check system for wrong choices\n if ( id_a == false || id_b == false ) then\n puts \"Your choice is wrong!\"\n $id = 'No!'\n else\n $id = id_a + id_b.to_s\n end\nend",
"def ask_the_question(question, valid_response)\n loop do\n answer = ask(question + \"? [Y/N] \") { |yn| yn.limit = 1, yn.validate = /[yn]/i }\n return answer if answer.downcase == valid_response.downcase || valid_response == ''\n end\nend",
"def fitness_question1(fitness_answer1)\n if fitness_answer1 == \"3 or more times per week\"\n @fitness_score1 = 0\n elsif fitness_answer1 == \"1 - 2 times per week\"\n @fitness_score1 = 1\n elsif fitness_answer1 == \"never\"\n @fitness_score1 = 2\n end\n @fitness_score1\nend",
"def option_to_skip_case(num)\n case option_to_skip\n when 1\n print \"> \"\n response = gets.strip\n @user_answers[num] = response\n when 2\n @user_answers[num] = 'no answer'\n end\n end",
"def solution() \n case @answer.type\n when String\n solution= @answer.downcase \n default \n solution= @answer\n end\n solution\n end",
"def choice_check\n begin\n choice = gets.chop.upcase\n if choice != \"GET\" && choice != \"POST\" && choice != \"EXIT\"\n raise \"Wrong input!\"\n end\n rescue StandardError => e\n puts \"#{e} You can choose between GET, POST and EXIT\"\n retry\n else\n choice\n end \n end",
"def printUsersChoiceOnScreen()\n $strAnswer = ($arrCorrectAnswers[$intQuestionOnScreen - 1].strip)\n if $strAnswer.length == 1\n case $arrUserAnswers[$intQuestionOnScreen - 1]\n when \"A\"\n $radioA.invoke()\n when \"B\"\n $radioB.invoke()\n when \"C\"\n $radioC.invoke()\n when \"D\"\n $radioD.invoke()\n end\n else\n case $arrUserAnswers[$intQuestionOnScreen - 1]\n when \"A\"\n checkInvoke(true, false, false, false)\n when \"B\"\n checkInvoke(false, true, false, false)\n when \"C\"\n checkInvoke(false, false, true, false)\n when \"D\"\n checkInvoke(false, false, false, true)\n when \"AB\"\n checkInvoke(true, true, false, false)\n when \"AC\"\n checkInvoke(true, false, true, false)\n when \"AD\"\n checkInvoke(true, false, false, true)\n when \"BC\"\n checkInvoke(false, true, true, false)\n when \"BD\"\n checkInvoke(false, true, false, true)\n when \"CD\"\n checkInvoke(false, false, true, true)\n when \"ABC\"\n checkInvoke(true, true, true, false)\n when \"ABD\"\n checkInvoke(true, true, false, true)\n when \"ACD\"\n checkInvoke(true, false, true, true)\n when \"BCD\"\n checkInvoke(false, true, true, true)\n when \"ABCD\"\n checkInvoke(true, true, true, true)\n end\n end\nend",
"def yes_or_no(question)\n loop do\n print \"#{question}\\nyes(y), no(n), quit(q): \"\n $stdout.flush # Clear buffer\n response = gets.chomp\n case response.downcase\n when 'y', 'yes' then return true\n when 'n', 'no' then return false\n when 'q', 'quit' then exit\n else $stderr.puts \"Please answer \\\"yes\\\", \\\"no\\\", or \\\"quit\\\".\"\n end\n end\nend",
"def answerQuestion()\n return if $intQuestionOnScreen == 0\n case $strAnswer\n when \"A\"\n $lblAnswerA['style'] = \"Correct.TLabel\"\n when \"B\"\n $lblAnswerB['style'] = \"Correct.TLabel\"\n when \"C\"\n $lblAnswerC['style'] = \"Correct.TLabel\"\n when \"D\"\n $lblAnswerD['style'] = \"Correct.TLabel\"\n when \"AB\"\n $lblAnswerA['style'] = \"Correct.TLabel\"\n $lblAnswerB['style'] = \"Correct.TLabel\"\n when \"AC\"\n $lblAnswerA['style'] = \"Correct.TLabel\"\n $lblAnswerC['style'] = \"Correct.TLabel\"\n when \"AD\"\n $lblAnswerA['style'] = \"Correct.TLabel\"\n $lblAnswerD['style'] = \"Correct.TLabel\"\n when \"BC\"\n $lblAnswerB['style'] = \"Correct.TLabel\"\n $lblAnswerC['style'] = \"Correct.TLabel\"\n when \"BD\"\n $lblAnswerB['style'] = \"Correct.TLabel\"\n $lblAnswerD['style'] = \"Correct.TLabel\"\n when \"CD\"\n $lblAnswerC['style'] = \"Correct.TLabel\"\n $lblAnswerD['style'] = \"Correct.TLabel\"\n when \"ABC\"\n $lblAnswerA['style'] = \"Correct.TLabel\"\n $lblAnswerB['style'] = \"Correct.TLabel\"\n $lblAnswerC['style'] = \"Correct.TLabel\"\n when \"ABD\"\n $lblAnswerA['style'] = \"Correct.TLabel\"\n $lblAnswerB['style'] = \"Correct.TLabel\"\n $lblAnswerC['style'] = \"Correct.TLabel\"\n when \"ACD\"\n $lblAnswerA['style'] = \"Correct.TLabel\"\n $lblAnswerC['style'] = \"Correct.TLabel\"\n $lblAnswerD['style'] = \"Correct.TLabel\"\n when \"BCD\"\n $lblAnswerB['style'] = \"Correct.TLabel\"\n $lblAnswerC['style'] = \"Correct.TLabel\"\n $lblAnswerD['style'] = \"Correct.TLabel\"\n else\n $lblAnswerA['style'] =\"Correct.TLabel\"\n $lblAnswerB['style'] =\"Correct.TLabel\"\n $lblAnswerC['style'] =\"Correct.TLabel\"\n $lblAnswerD['style'] =\"Correct.TLabel\"\n end\nend",
"def initialize answer; @answer = answer\n@solved = false\n# Validate input\n raise \"Answer must be between 1 and 100\" unless VALID_Numbers.include? @answer\n end",
"def check_answer_input(range) #this method both prints and checks the answer\r\n\r\n\tequation = new_equation(range)\r\n\tanswer = false\r\n\r\n\twhile answer == false\r\n\t\tputs equation\r\n\t\tresult = eval equation\r\n\t\tputs \"{answer: #{result}}\"\r\n\t\tanswer_user = gets.chomp\r\n\r\n\t\tif answer_user.downcase == \"q\" #make a new method for if ??? - yes, I would make a new method\r\n\t\t\texit\r\n\t\telsif answer_user.to_i == result\r\n\t\t\tputs \"Correct!\"\r\n\t\t\tcheck_answer_input(range)\r\n\t\telse\r\n\t\t\tputs \"Try again\"\r\n\t\tend\r\n\tend\r\nend",
"def no?(question)\r\n !yes?(question)\r\n end",
"def ungraded_answers(submission)\n submission.reload.current_answers.select { |a| a.attempting? || a.submitted? }\n end",
"def questionnaire(questions)\n answer = \"\"\n score = 0\n for question in questions\n puts question.question\n answer = gets.strip.downcase.to_s\n if answer == question.answer\n score += question.score\n elsif answer == question.incorrect \n score += 0\n else \n # method raises an error message if true or false input is entered\n invalid_input(answer)\n end \n end\n return score\nend",
"def verification_one(input)\n while input != \"1\" && input != \"2\" && input != \"3\"\n if input == \"exit\"\n return false\n else\n puts \"Please enter (1-3) or type exit.\"\n print \"> \"\n input = gets.strip.downcase\n end\n end\n\n case input\n when \"1\"\n input = \"Critically Endangered\"\n when \"2\"\n input = \"Endangered\"\n when \"3\"\n input = \"Vulnerable\"\n end\n input\n end",
"def antibody_test_result_prompt\n puts \"\\nIf you know the antibody test result, please enter if it was positive or negative by typing 'positive' or 'negative'.\"\n antibody_res_response = gets.strip.downcase\n return_to_menu(antibody_res_response)\n exit_anything(antibody_res_response)\n if antibody_res_response == \"positive\" \n anti_body_test_result = true\n elsif antibody_res_response == \"negative\"\n anti_body_test_result = false\n else puts \"\\nDid you mean to hit 'positive', 'negative', 'menu', or 'exit'?\"\n antibody_test_result_prompt\n end\n anti_body_test_result\nend",
"def quiz(tally)\n if tally > 0\n \"Based off of your answers, you should decide yes.\"\n elsif tally < 0\n \"Based off of your answers, you should decide no.\"\n elsif tally == 0\n \"You seem to feel pretty equal about your sides, so you should talk to someone and have them help you with your decision.\"\n end\n end",
"def calc_result(input1, input2)\n\n rpc = ['rock','paper','scissors']\n if rpc.include?(input1) && rpc.include?(input2)\n \n case input1\n when \"rock\"\n if input2 == \"paper\"\n \"Paper covers rock.\"\n elsif input2 == \"scissors\"\n \"Rock crushes scissors\"\n else \"Tie!\"\n end\n when \"paper\"\n if input2 == \"scissors\"\n \"Scissors cuts paper.\"\n elsif input2 == \"rock\"\n \"Paper covers rock.\"\n else \"Tie!\"\n end\n when \"scissors\"\n if input2 == \"paper\"\n \"Scissors cuts paper.\"\n elsif input2 == \"rock\"\n \"Rock crushes scissors\"\n else \"Tie!\"\n end\n end \n\n else \"No cheaters! Only Rock, Paper or Scissors are allowed.\"\n end\nend",
"def answer\n @question = params[:question]\n if @question == 'I am going to work' then @answer = 'Great!'\n elsif @question.include? '?'\n then @answer = 'Silly question, get dressed and go to work'\n else @answer = \"I don't care, get dressed and go to work!\"\n end\n end",
"def check_answer correct_answer\n user_answer = gets.chomp.downcase\n correct_answer.each do |x|\n if user_answer == x\n puts \"Correct Answer!!!\"\n return true\n end\n end\n puts \"Sorry, incorrect answer :(\"\n return false\nend",
"def fashion_question2(fashion_answer2)\n if fashion_answer2 == \"I throw it away. I don't need/want it anymore.\"\n @fashion_score2 = 2\n elsif fashion_answer2 == \"I donate what I can and reuse/recycle the rest.\"\n @fashion_score2 = 0\n elsif fashion_answer2 == \"I sell my clothes.\"\n @fashion_score2 = 0\n end\n @fashion_score2\nend",
"def ask_question(question, kind=\"String\")\n print question + \" \"\n answer = gets.chomp\n answer.to_i if kind == \"number\"\n return answer\nend",
"def ask_for_winner(flavors)\n if flavors.length > 2\n puts \"0. \"+flavors[0]\n puts \"1. \"+flavors[1]\n puts \"2. \"+flavors[2]\n puts \"3. \"+flavors[3]\n puts \"4. \"+flavors[4]\n while true\n answer = gets.chomp.downcase\n if (answer == \"0\" || answer == \"1\" || answer == \"2\" || answer == \"3\" || answer == \"4\")\n return flavors[answer.to_i]\n else\n puts \"Please answer '0' - '4'.\"\n end\n end\n else\n puts \"0. \"+flavors[0]\n puts \"1. \"+flavors[1]\n while true\n answer = gets.chomp.downcase\n if (answer == \"0\" || answer == \"1\")\n return flavors[answer.to_i]\n else\n puts \"Please answer '0' or '2'.\"\n end\n end\n end\nend",
"def yn_booleen(value)\n\tif value == \"y\"\n\t\treturn true\n\telsif value == \"n\"\n\t\treturn false\n\telse\n\t\tp \"Sorry, that response was not understood. Please use 'y' for yes and 'n' for no.\"\n\t\treturn value\n\tend #if\nend",
"def right_answer?(letter)\n if letter == :a || letter == :b || letter == :c\n return true\n else\n return false\n end\nend",
"def get_incresults(arr)\n # byebug\n if(arr.length == 0)\n 'no results available yet'\n else \n allIncorrect = arr.select do |ans|\n ans.is_right == false \n end\n end\nend",
"def check_answering_question(msg)\n msg.length == 1\nend",
"def ask(question, a, b)\n print \"#{question} (#{a}/#{b})> \"\n r = $stdin.gets.strip\n\n 4.times do\n unless r == a or r == b\n print \"\\nPlease type '#{a}' or '#{b}': \"\n r = $stdin.gets.strip\n end\n end\n\n unless r == a or r == b\n abort EXIT_MSG\n end\n\n r\nend",
"def is_right question_number, answer_number\n #puts \"is_right \" + question_number.to_s + \"-----\" + answer_number.to_s\n number_regexp = Regexp.new('^' + question_number.to_s)\n answer = @answer_file_lines.select {|el| el =~ number_regexp}.first.strip\n #puts \"#{answer_number} -- #{answer.split('-')[1].split(',')}\"\n answer.split('-')[1].split(',').include?(answer_number.to_s)\n end",
"def another\r\n loop do\r\n case gets.downcase.chomp #loops until user input is either yes or no; returns true or false respectively\r\n when 'no'\r\n return false\r\n when 'n'\r\n return false \r\n when 'yes'\r\n return true\r\n when 'y'\r\n return true\r\n else\r\n next\r\n end\r\n end\r\nend",
"def sit_or_quit\n puts \"Sit? or Quit?\"\n puts \"1--sit; 2--quit\"\n get_input = gets.chomp\n while (!is_int?(get_input)) || ((is_int?(get_input)) && !((1..2)===Integer(get_input))) \n puts \"Invalid input. Please re-input: 1--sit;2--quit\"\n get_input = gets.chomp\n end\n choice = Integer(get_input)\n case choice\n when 1\n @player_status = \"in\"\n when 2\n @player_status = \"out\"\n end\n end",
"def test_valid_choice_false_8\n\t\tgame = SetGame.new\n\t\tuser_input = \"b2b\"\n\t\tassert_equal false, game.valid_choice?(user_input, 8)\n\tend",
"def determine_correctness\n answer = self.question.answer\n \t#Upcase to take care of all capitalization issues\n \tresponse = self.content.upcase\n\n \tanswer = answer.split(', ')\n\n \t#Score Keeping\n \tscore = 0\n \tscore_incremental = 1.0/answer.length\n \t\n \t#Determining how many of keywords are in response\n \tanswer.each do |correct_word|\n \t\tcorrect_word = correct_word.upcase\n \t\tif response.include?(correct_word)\n \t\t\tscore += score_incremental\n \t\tend\n \tend\n \tself.correctness = score\n end",
"def evaluate_q42_data(data)\n\tcase\n\twhen data <= 2\n\t\t:yes\n\twhen data <= 4\n\t\t:sometimes\n\twhen data == 5\n\t\t:never\n\telse\n\t\t:refuse_to_say\n\tend\nend",
"def validate_answer\n skip_authorization\n active_cell = @play.cell_active\n return unless active_cell\n\n if active_cell.npc.correct_answer?(params[:answer])\n @play.active_next_cell\n @play.check_if_game_over\n render json: { message: random_phrase_correct(@play), correct: true }\n else\n render json: { message: \"#{random_phrase_incorrect_and_tip(@play)}<br><br>#{active_cell.npc.question}\",\n correct: false }\n end\n end",
"def deck_options(deck_option)\n case deck_option\n when 1 \n result = []\n counter = 0\n answer1 = Question.find(1).answers[0]\n answer2 = Question.find(1).answers[1]\n answer3 = Question.find(1).answers[2]\n puts Deck.find(1).questions[0].question\n puts \"a) #{answer1.name}\"\n puts \"b) #{answer2.name}\"\n puts \"c) #{answer3.name}\"\n answer1_user = gets.chomp\n if answer1_user == \"a\"\n answer1_user = answer1\n elsif answer1_user == \"b\"\n answer1_user = answer2\n elsif answer1_user == \"c\"\n answer1_user = answer3\n end\n a = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[0].id, answer_id: answer1_user.id, correct: answer1_user.correct)\n result << a.correct\n #\n #\n answer4 = Question.find(2).answers[0]\n answer5 = Question.find(2).answers[1]\n answer6 = Question.find(2).answers[2]\n puts Deck.find(1).questions[1].question\n puts \"a) #{answer4.name}\"\n puts \"b) #{answer5.name}\"\n puts \"c) #{answer6.name}\"\n answer2_user = gets.chomp\n if answer2_user == \"a\"\n answer2_user = answer4\n elsif answer2_user == \"b\"\n answer2_user = answer5\n elsif answer2_user == \"c\"\n answer2_user = answer6\n end\n b = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[1].id, answer_id: answer2_user.id, correct: answer2_user.correct)\n result << b.correct\n #\n #\n answer7 = Question.find(3).answers[0]\n answer8 = Question.find(3).answers[1]\n answer9 = Question.find(3).answers[2]\n\n puts Deck.find(1).questions[2].question\n puts \"a) #{answer7.name}\"\n puts \"b) #{answer8.name}\"\n puts \"c) #{answer9.name}\"\n answer3_user = gets.chomp \n if answer3_user == \"a\"\n answer3_user = answer7\n elsif answer3_user == \"b\"\n answer3_user = answer8\n elsif answer3_user == \"c\"\n answer3_user = answer9\n end\n c = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[2].id, answer_id: answer3_user.id, correct: answer3_user.correct)\n result << c.correct\n #\n #\n answer10 = Question.find(4).answers[0]\n answer11 = Question.find(4).answers[1]\n answer12 = Question.find(4).answers[2]\n puts Deck.find(1).questions[3].question\n puts \"a) #{answer10.name}\"\n puts \"b) #{answer11.name}\"\n puts \"c) #{answer12.name}\"\n answer4_user = gets.chomp\n if answer4_user == \"a\"\n answer4_user = answer10\n elsif answer4_user == \"b\"\n answer4_user = answer11\n elsif answer4_user == \"c\"\n answer4_user = answer12\n end\n d = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[3].id, answer_id: answer4_user.id, correct: answer4_user.correct)\n result << d.correct\n #\n #\n answer13 = Question.find(5).answers[0]\n answer14 = Question.find(5).answers[1]\n answer15 = Question.find(5).answers[2]\n puts Deck.find(1).questions[4].question\n puts \"a) #{answer13.name}\"\n puts \"b) #{answer14.name}\"\n puts \"c) #{answer15.name}\"\n answer5_user = gets.chomp\n if answer5_user == \"a\"\n answer5_user = answer13\n elsif answer5_user == \"b\"\n answer5_user = answer14\n elsif answer5_user == \"c\"\n answer5_user = answer15\n end\n e = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[4].id, answer_id: answer5_user.id, correct: answer5_user.correct)\n result << e.correct\n #\n #\n answer16 = Question.find(6).answers[0]\n answer17 = Question.find(6).answers[1]\n answer18 = Question.find(6).answers[2]\n puts Deck.find(1).questions[5].question\n puts \"a) #{answer16.name}\"\n puts \"b) #{answer17.name}\"\n puts \"c) #{answer18.name}\"\n answer6_user = gets.chomp\n if answer6_user == \"a\"\n answer6_user = answer16\n elsif answer6_user == \"b\"\n answer6_user = answer17\n elsif answer6_user == \"c\"\n answer6_user = answer18\n end\n f = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[5].id, answer_id: answer6_user.id, correct: answer6_user.correct)\n result << f.correct\n #\n #\n answer19 = Question.find(7).answers[0]\n answer20 = Question.find(7).answers[1]\n answer21 = Question.find(7).answers[2]\n puts Deck.find(1).questions[6].question\n puts \"a) #{answer19.name}\"\n puts \"b) #{answer20.name}\"\n puts \"c) #{answer21.name}\"\n answer7_user = gets.chomp\n if answer7_user == \"a\"\n answer7_user = answer19\n elsif answer7_user == \"b\"\n answer7_user = answer20\n elsif answer7_user == \"c\"\n answer7_user = answer21\n end\n g = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[6].id, answer_id: answer7_user.id, correct: answer7_user.correct)\n result << g.correct\n #\n #\n answer22 = Question.find(8).answers[0]\n answer23 = Question.find(8).answers[1]\n answer24 = Question.find(8).answers[2]\n puts Deck.find(1).questions[7].question\n puts \"a) #{answer22.name}\"\n puts \"b) #{answer23.name}\"\n puts \"c) #{answer24.name}\"\n answer8_user = gets.chomp\n if answer8_user == \"a\"\n answer8_user = answer22\n elsif answer8_user == \"b\"\n answer8_user = answer23\n elsif answer8_user == \"c\"\n answer8_user = answer24\n end\n h = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[7].id, answer_id: answer8_user.id, correct: answer8_user.correct)\n result << h.correct\n #\n #\n answer25 = Question.find(9).answers[0]\n answer26 = Question.find(9).answers[1]\n answer27 = Question.find(9).answers[2]\n puts Deck.find(1).questions[8].question\n puts \"a) #{answer25.name}\"\n puts \"b) #{answer26.name}\"\n puts \"c) #{answer27.name}\"\n answer9_user = gets.chomp\n if answer9_user == \"a\"\n answer9_user = answer25\n elsif answer9_user == \"b\"\n answer9_user = answer26\n elsif answer9_user == \"c\"\n answer9_user = answer27\n end\n i = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[8].id, answer_id: answer9_user.id, correct: answer9_user.correct)\n result << i.correct\n #\n #\n answer28 = Question.find(10).answers[0]\n answer29 = Question.find(10).answers[1]\n answer30 = Question.find(10).answers[2]\n puts Deck.find(1).questions[9].question\n puts \"a) #{answer28.name}\"\n puts \"b) #{answer29.name}\"\n puts \"c) #{answer30.name}\"\n answer10_user = gets.chomp\n if answer10_user == \"a\"\n answer10_user = answer28\n elsif answer10_user == \"b\"\n answer10_user = answer29\n elsif answer10_user == \"c\"\n answer10_user = answer30\n end\n j = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[9].id, answer_id: answer10_user.id, correct: answer10_user.correct)\n result << j.correct\n pp Stat.where(game_id: @new_game.id)\n result.each do |answers_do|\n if answers_do == 1\n counter += 1\n end\n end\n puts \"----------------------------^^^^^^^^^^^^^^^^^^^^^^-----------------------------\"\n puts \"Yor result was: #{counter} correct answers and #{10-counter} incorrect answers\"\n puts \"----------------------------^^^^^^^^^^^^^^^^^^^^^^-----------------------------\"\n options(@view.menu)\n when 2 \n result_2 = []\n counter_2 = 0\n answer1_1 = Question.find(11).answers[0]\n answer2_1 = Question.find(11).answers[1]\n answer3_1 = Question.find(11).answers[2]\n puts Deck.find(2).questions[0].question\n puts \"a) #{answer1_1.name}\"\n puts \"b) #{answer2_1.name}\"\n puts \"c) #{answer3_1.name}\"\n answer1_1user = gets.chomp\n if answer1_1user == \"a\"\n answer1_1user = answer1_1\n elsif answer1_1user == \"b\"\n answer1_1user = answer2_1\n elsif answer1_1user == \"c\"\n answer1_1user = answer3_1\n end\n k = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[0].id, answer_id: answer1_1user.id, correct: answer1_1user.correct)\n result_2 << k.correct\n #\n #\n answer4_1 = Question.find(12).answers[0]\n answer5_1 = Question.find(12).answers[1]\n answer6_1 = Question.find(12).answers[2]\n puts Deck.find(2).questions[1].question\n puts \"a) #{answer4_1.name}\"\n puts \"b) #{answer5_1.name}\"\n puts \"c) #{answer6_1.name}\"\n answer2_1user = gets.chomp\n if answer2_1user == \"a\"\n answer2_1user = answer4_1\n elsif answer2_1user == \"b\"\n answer2_1user = answer5_1\n elsif answer2_1user == \"c\"\n answer2_1user = answer6_1\n end\n m = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[1].id, answer_id: answer2_1user.id, correct: answer2_1user.correct)\n result_2 << m.correct\n #\n #\n answer7_1 = Question.find(13).answers[0]\n answer8_1 = Question.find(13).answers[1]\n answer9_1 = Question.find(13).answers[2]\n\n puts Deck.find(2).questions[2].question\n puts \"a) #{answer7_1.name}\"\n puts \"b) #{answer8_1.name}\"\n puts \"c) #{answer9_1.name}\"\n answer3_1user = gets.chomp \n if answer3_1user == \"a\"\n answer3_1user = answer7_1\n elsif answer3_1user == \"b\"\n answer3_1user = answer8_1\n elsif answer3_1user == \"c\"\n answer3_1user = answer9_1\n end\n n = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[2].id, answer_id: answer3_1user.id, correct: answer3_1user.correct)\n result_2 << n.correct\n #\n #\n answer10_1 = Question.find(14).answers[0]\n answer11_1 = Question.find(14).answers[1]\n answer12_1 = Question.find(14).answers[2]\n puts Deck.find(2).questions[3].question\n puts \"a) #{answer10_1.name}\"\n puts \"b) #{answer11_1.name}\"\n puts \"c) #{answer12_1.name}\"\n answer4_1user = gets.chomp\n if answer4_1user == \"a\"\n answer4_1user = answer10_1\n elsif answer4_1user == \"b\"\n answer4_1user = answer11_1\n elsif answer4_1user == \"c\"\n answer4_1user = answer12_1\n end\n l = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[3].id, answer_id: answer4_1user.id, correct: answer4_1user.correct)\n result_2 << l.correct\n #\n #\n answer13_1 = Question.find(15).answers[0]\n answer14_1 = Question.find(15).answers[1]\n answer15_1 = Question.find(15).answers[2]\n puts Deck.find(2).questions[4].question\n puts \"a) #{answer13_1.name}\"\n puts \"b) #{answer14_1.name}\"\n puts \"c) #{answer15_1.name}\"\n answer5_1user = gets.chomp\n if answer5_1user == \"a\"\n answer5_1user = answer13_1\n elsif answer5_1user == \"b\"\n answer5_1user = answer14_1\n elsif answer5_1user == \"c\"\n answer5_1user = answer15_1\n end\n o = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[4].id, answer_id: answer5_1user.id, correct: answer5_1user.correct)\n result_2 << o.correct\n #\n #\n answer16_1 = Question.find(16).answers[0]\n answer17_1 = Question.find(16).answers[1]\n answer18_1 = Question.find(16).answers[2]\n puts Deck.find(2).questions[5].question\n puts \"a) #{answer16_1.name}\"\n puts \"b) #{answer17_1.name}\"\n puts \"c) #{answer18_1.name}\"\n answer6_1user = gets.chomp\n if answer6_1user == \"a\"\n answer6_1user = answer16_1\n elsif answer6_1user == \"b\"\n answer6_1user = answer17_1\n elsif answer6_1user == \"c\"\n answer6_1user = answer18_1\n end\n p = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[5].id, answer_id: answer6_1user.id, correct: answer6_1user.correct)\n result_2 << p.correct\n #\n #\n answer19_1 = Question.find(17).answers[0]\n answer20_1 = Question.find(17).answers[1]\n answer21_1 = Question.find(17).answers[2]\n puts Deck.find(2).questions[6].question\n puts \"a) #{answer19_1.name}\"\n puts \"b) #{answer20_1.name}\"\n puts \"c) #{answer21_1.name}\"\n answer7_1user = gets.chomp\n if answer7_1user == \"a\"\n answer7_1user = answer19_1\n elsif answer7_1user == \"b\"\n answer7_1user = answer20_1\n elsif answer7_1user == \"c\"\n answer7_1user = answer21_1\n end\n q = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[6].id, answer_id: answer7_1user.id, correct: answer7_1user.correct)\n result_2 << q.correct\n #\n #\n answer22_1 = Question.find(18).answers[0]\n answer23_1 = Question.find(18).answers[1]\n answer24_1 = Question.find(18).answers[2]\n puts Deck.find(2).questions[7].question\n puts \"a) #{answer22_1.name}\"\n puts \"b) #{answer23_1.name}\"\n puts \"c) #{answer24_1.name}\"\n answer8_1user = gets.chomp\n if answer8_1user == \"a\"\n answer8_1user = answer22_1\n elsif answer8_1user == \"b\"\n answer8_1user = answer23_1\n elsif answer8_1user == \"c\"\n answer8_1user = answer24_1\n end\n r = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[7].id, answer_id: answer8_1user.id, correct: answer8_1user.correct)\n result_2 << r.correct\n #\n #\n answer25_1 = Question.find(19).answers[0]\n answer26_1 = Question.find(19).answers[1]\n answer27_1 = Question.find(19).answers[2]\n puts Deck.find(2).questions[8].question\n puts \"a) #{answer25_1.name}\"\n puts \"b) #{answer26_1.name}\"\n puts \"c) #{answer27_1.name}\"\n answer9_1user = gets.chomp\n if answer9_1user == \"a\"\n answer9_1user = answer25_1\n elsif answer9_1user == \"b\"\n answer9_1user = answer26_1\n elsif answer9_1user == \"c\"\n answer9_1user = answer27_1\n end\n s = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[8].id, answer_id: answer9_1user.id, correct: answer9_1user.correct)\n result_2 << s.correct\n #\n #\n answer28_1 = Question.find(20).answers[0]\n answer29_1 = Question.find(20).answers[1]\n answer30_1 = Question.find(20).answers[2]\n puts Deck.find(2).questions[9].question\n puts \"a) #{answer28_1.name}\"\n puts \"b) #{answer29_1.name}\"\n puts \"c) #{answer30_1.name}\"\n answer10_1user = gets.chomp\n if answer10_1user == \"a\"\n answer10_1user = answer28_1\n elsif answer10_1user == \"b\"\n answer10_1user = answer29_1\n elsif answer10_1user == \"c\"\n answer10_1user = answer30_1\n end\n y = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[9].id, answer_id: answer10_1user.id, correct: answer10_1user.correct)\n result_2 << y.correct\n result_2\n result_2.each do |answers_do|\n if answers_do == 1\n counter_2 += 1\n end\n end\n pp Stat.where(game_id: @new_game.id)\n puts \"----------------------------^^^^^^^^^^^^^^^^^^^^^^-----------------------------\"\n puts \"Yor result was: #{counter_2} correct answers and #{10-counter_2} incorrect answers\"\n puts \"----------------------------^^^^^^^^^^^^^^^^^^^^^^-----------------------------\"\n options(@view.menu)\n when 3 \n counter_3 = 0\n result_3 = []\n answer1_2 = Question.find(21).answers[0]\n answer2_2 = Question.find(21).answers[1]\n answer3_2 = Question.find(21).answers[2]\n puts Deck.find(3).questions[0].question\n puts \"a) #{answer1_2.name}\"\n puts \"b) #{answer2_2.name}\"\n puts \"c) #{answer3_2.name}\"\n answer1_2user = gets.chomp\n if answer1_2user == \"a\"\n answer1_2user = answer1_2\n elsif answer1_2user == \"b\"\n answer1_2user = answer2_2\n elsif answer1_2user == \"c\"\n answer1_2user = answer3_2\n end\n a_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[0].id, answer_id: answer1_2user.id, correct: answer1_2user.correct)\n result_3 << a_1.correct\n #\n #\n answer4_2 = Question.find(22).answers[0]\n answer5_2 = Question.find(22).answers[1]\n answer6_2 = Question.find(22).answers[2]\n puts Deck.find(3).questions[1].question\n puts \"a) #{answer4_2.name}\"\n puts \"b) #{answer5_2.name}\"\n puts \"c) #{answer6_2.name}\"\n answer2_2user = gets.chomp\n if answer2_2user == \"a\"\n answer2_2user = answer4_2\n elsif answer2_2user == \"b\"\n answer2_2user = answer5_2\n elsif answer2_2user == \"c\"\n answer2_2user = answer6_2\n end\n b_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[1].id, answer_id: answer2_2user.id, correct: answer2_2user.correct)\n result_3 << b_1.correct\n #\n #\n answer7_2 = Question.find(23).answers[0]\n answer8_2 = Question.find(23).answers[1]\n answer9_2 = Question.find(23).answers[2]\n\n puts Deck.find(3).questions[2].question\n puts \"a) #{answer7_2.name}\"\n puts \"b) #{answer8_2.name}\"\n puts \"c) #{answer9_2.name}\"\n answer3_2user = gets.chomp \n if answer3_2user == \"a\"\n answer3_2user = answer7_2\n elsif answer3_2user == \"b\"\n answer3_2user = answer8_2\n elsif answer3_2user == \"c\"\n answer3_2user = answer9_2\n end\n c_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[2].id, answer_id: answer3_2user.id, correct: answer3_2user.correct)\n result_3 << c_1.correct\n #\n #\n answer10_2 = Question.find(24).answers[0]\n answer11_2 = Question.find(24).answers[1]\n answer12_2 = Question.find(24).answers[2]\n puts Deck.find(3).questions[3].question\n puts \"a) #{answer10_2.name}\"\n puts \"b) #{answer11_2.name}\"\n puts \"c) #{answer12_2.name}\"\n answer4_2user = gets.chomp\n if answer4_2user == \"a\"\n answer4_2user = answer10_2\n elsif answer4_2user == \"b\"\n answer4_2user = answer11_2\n elsif answer4_2user == \"c\"\n answer4_2user = answer12_2\n end\n d_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[3].id, answer_id: answer4_2user.id, correct: answer4_2user.correct)\n result_3 << d_1.correct\n #\n #\n answer13_2 = Question.find(25).answers[0]\n answer14_2 = Question.find(25).answers[1]\n answer15_2 = Question.find(25).answers[2]\n puts Deck.find(3).questions[4].question\n puts \"a) #{answer13_2.name}\"\n puts \"b) #{answer14_2.name}\"\n puts \"c) #{answer15_2.name}\"\n answer5_2user = gets.chomp\n if answer5_2user == \"a\"\n answer5_2user = answer13_2\n elsif answer5_2user == \"b\"\n answer5_2user = answer14_2\n elsif answer5_2user == \"c\"\n answer5_2user = answer15_2\n end\n f_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[4].id, answer_id: answer5_2user.id, correct: answer5_2user.correct)\n result_3 << f_1.correct\n #\n #\n answer16_2 = Question.find(26).answers[0]\n answer17_2 = Question.find(26).answers[1]\n answer18_2 = Question.find(26).answers[2]\n puts Deck.find(3).questions[5].question\n puts \"a) #{answer16_2.name}\"\n puts \"b) #{answer17_2.name}\"\n puts \"c) #{answer18_2.name}\"\n answer6_2user = gets.chomp\n if answer6_2user == \"a\"\n answer6_2user = answer16_2\n elsif answer6_2user == \"b\"\n answer6_2user = answer17_2\n elsif answer6_2user == \"c\"\n answer6_2user = answer18_2\n end\n g_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[5].id, answer_id: answer6_2user.id, correct: answer6_2user.correct)\n result_3 << g_1.correct\n #\n #\n answer19_2 = Question.find(27).answers[0]\n answer20_2 = Question.find(27).answers[1]\n answer21_2 = Question.find(27).answers[2]\n puts Deck.find(3).questions[6].question\n puts \"a) #{answer19_2.name}\"\n puts \"b) #{answer20_2.name}\"\n puts \"c) #{answer21_2.name}\"\n answer7_2user = gets.chomp\n if answer7_2user == \"a\"\n answer7_2user = answer19_2\n elsif answer7_2user == \"b\"\n answer7_2user = answer20_2\n elsif answer7_2user == \"c\"\n answer7_2user = answer21_2\n end\n h_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[6].id, answer_id: answer7_2user.id, correct: answer7_2user.correct)\n result_3 << h_1.correct\n #\n #\n answer22_2 = Question.find(28).answers[0]\n answer23_2 = Question.find(28).answers[1]\n answer24_2 = Question.find(28).answers[2]\n puts Deck.find(3).questions[7].question\n puts \"a) #{answer22_2.name}\"\n puts \"b) #{answer23_2.name}\"\n puts \"c) #{answer24_2.name}\"\n answer8_2user = gets.chomp\n if answer8_2user == \"a\"\n answer8_2user = answer22_2\n elsif answer8_2user == \"b\"\n answer8_2user = answer23_2\n elsif answer8_2user == \"c\"\n answer8_2user = answer24_2\n end\n i_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[7].id, answer_id: answer8_2user.id, correct: answer8_2user.correct)\n result_3 << i_1.correct\n #\n #\n answer25_2 = Question.find(29).answers[0]\n answer26_2 = Question.find(29).answers[1]\n answer27_2 = Question.find(29).answers[2]\n puts Deck.find(3).questions[8].question\n puts \"a) #{answer25_2.name}\"\n puts \"b) #{answer26_2.name}\"\n puts \"c) #{answer27_2.name}\"\n answer9_2user = gets.chomp\n if answer9_2user == \"a\"\n answer9_2user = answer25_2\n elsif answer9_2user == \"b\"\n answer9_2user = answer26_2\n elsif answer9_2user == \"c\"\n answer9_2user = answer27_2\n end\n j_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[8].id, answer_id: answer9_2user.id, correct: answer9_2user.correct)\n result_3 << j_1.correct\n #\n #\n answer28_2 = Question.find(30).answers[0]\n answer29_2 = Question.find(30).answers[1]\n answer30_2 = Question.find(30).answers[2]\n puts Deck.find(3).questions[9].question\n puts \"a) #{answer28_2.name}\"\n puts \"b) #{answer29_2.name}\"\n puts \"c) #{answer30_2.name}\"\n answer10_2user = gets.chomp\n if answer10_2user == \"a\"\n answer10_2user = answer28_2\n elsif answer10_2user == \"b\"\n answer10_2user = answer29_2\n elsif answer10_2user == \"c\"\n answer10_2user = answer30_2\n end\n k_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[9].id, answer_id: answer10_2user.id, correct: answer10_2user.correct)\n result_3 << k_1.correct\n pp Stat.where(game_id: @new_game.id)\n result_3\n result_3.each do |answers_do|\n if answers_do == 1\n counter_3 += 1\n end\n end\n puts \"----------------------------^^^^^^^^^^^^^^^^^^^^^^-----------------------------\"\n puts \"Yor result was: #{counter_3} correct answers and #{10-counter_3} incorrect answers\"\n puts \"----------------------------^^^^^^^^^^^^^^^^^^^^^^-----------------------------\"\n options(@view.menu)\n end\nend",
"def other_options\n puts \"\\nWould you like to see another recipe?\\nPlease enter 'Yes' or 'No':\"\n\n input = \"\"\n while input\n input = gets.strip.upcase\n case input\n when \"YES\"\n return true\n when \"NO\"\n puts \"\\nEnjoy your meal!\"\n return false\n else\n puts \"\\nPlease enter 'Yes' or 'No'.\"\n end\n end\n end"
] |
[
"0.6275669",
"0.62343705",
"0.6145033",
"0.61047614",
"0.6084657",
"0.6076481",
"0.6065198",
"0.60359216",
"0.594145",
"0.59165066",
"0.5896758",
"0.5877638",
"0.58671016",
"0.58657104",
"0.58563393",
"0.5799323",
"0.5789484",
"0.5787912",
"0.5787571",
"0.5784834",
"0.5765741",
"0.57572764",
"0.5750085",
"0.5746793",
"0.5703364",
"0.5696769",
"0.56902987",
"0.56719214",
"0.5656408",
"0.564524",
"0.5630267",
"0.56256187",
"0.561832",
"0.5608798",
"0.5605353",
"0.5593023",
"0.556012",
"0.55574715",
"0.5547321",
"0.5541936",
"0.5541323",
"0.5520413",
"0.5518638",
"0.5515316",
"0.55027235",
"0.55018795",
"0.549934",
"0.54991394",
"0.54926866",
"0.5488224",
"0.54863364",
"0.54829717",
"0.547769",
"0.5476162",
"0.54761547",
"0.5464087",
"0.54565656",
"0.5452273",
"0.5450997",
"0.5446177",
"0.54416317",
"0.54349285",
"0.54084873",
"0.5404065",
"0.5401975",
"0.5389717",
"0.5385146",
"0.538208",
"0.53793794",
"0.5377075",
"0.53767306",
"0.53653336",
"0.5357864",
"0.53576976",
"0.5350591",
"0.5341417",
"0.5334284",
"0.53307706",
"0.5328272",
"0.53270537",
"0.5325434",
"0.5322381",
"0.5317201",
"0.53112906",
"0.53103083",
"0.5306853",
"0.5293404",
"0.5290228",
"0.5287494",
"0.5287429",
"0.52820474",
"0.52793056",
"0.52786833",
"0.52764565",
"0.52674526",
"0.5265769",
"0.5263663",
"0.52577555",
"0.5252668",
"0.5252439",
"0.52506876"
] |
0.0
|
-1
|
GET /portfolio_sections or /portfolio_sections.json
|
def index
@portfolio_sections = PortfolioSection.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @sections = params[:path].nil? ? Section.all : Section.where(path: params[:path])\n\n respond_to do |format|\n format.html { render html: @sections }\n format.json { render json: @sections }\n end\n end",
"def index\n @sections = Section.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sections }\n end\n end",
"def sections\n respond_with @page.sections\n end",
"def sections\n respond_with @page.sections\n end",
"def show\n render json: @portfolio\n end",
"def scubooks\n sections = Section.all\n render json: sections\n end",
"def get_page\n render_page_sections_json\n end",
"def show\n @portfolio = Portfolio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @portfolio }\n end\n end",
"def index\n course = Course.find(params[:course_id])\n sections = course.sections.all\n render json: sections.order(:id)\n end",
"def get_sections_with_http_info(name, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.get_sections ...'\n end\n\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling SlidesApi.get_sections\"\n end\n # resource path\n local_var_path = '/slides/{name}/sections'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n\n # query parameters\n query_params = {}\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = nil\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'Sections')\n return data, status_code, headers\n end",
"def index\n @sections = case current_user.rc\n when 'EA'\n Section.includes(:profile).order('profiles.firstname').page(params[:page])\n when 'IA','EO'\n current_user.sections.includes(:profile).order('profiles.firstname').page(params[:page])\n when 'MOE'\n current_user.sections.includes(:profile).order('profiles.firstname').page(params[:page])\n when 'CR'\n current_user.sections.includes(:profile).order('profiles.firstname').page(params[:page])\n when 'ET'\n current_user.center.sections.includes(:profile).order('profiles.firstname').page(params[:page])\n end\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sections }\n end\n end",
"def index\n # TODO: ideally instead of eager loading sells, we could just include\n # quantity_sold in the eager_lod for lots.\n @portfolios = Portfolio.eager_graph(lots: :sells).eager_graph(allocations: {:asset_class => :funds}).all\n\n render json: @portfolios\n end",
"def index\n @portfolio_sections = PortfolioSection.all\n @sub_categories = SubCategory.all\n respond_to do |format|\n format.html {render :layout => 'admin'}\n end\n end",
"def index\n @menu = Menu.find(params[:menu_id])\n @sections = @menu.sections\n render json: SectionSerializer.new(@sections)\n end",
"def index\n #@portfolio = Portfolio.find(params[:portfolio_id])\n\n @opinionable = find_opinionable\n\n @opinion = @opinionable.opinions.all\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @opinions }\n end\n end",
"def index\n @shop_sections = ShopSection.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shop_sections }\n end\n end",
"def index\n @section_categories = SectionCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @section_categories }\n end\n end",
"def index\n @sections = Section.all\n end",
"def index\n @sections = Section.all\n end",
"def index\n @sections = Section.all\n end",
"def index\n @sections = Section.all\n end",
"def index\n @sections = Section.all\n end",
"def index\n @sections = Section.all\n end",
"def index\n @sections = Section.all\n end",
"def index\n @sections = Section.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sections }\n end\n end",
"def show\n @section = Section.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section }\n end\n end",
"def show\n @section = Section.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section }\n end\n end",
"def show\n @section = Section.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section }\n end\n end",
"def index\n \tif params[:category] == \"METRO\"\n \trender :json => Interest.stops.to_json\n elsif params[:category] == \"Photos\"\n render :json => Interest.panoramio\n \telsif params[:category]\n \t\tcategory_id = Category.find_by_name(params[:category]).id\n \t\trender :json => Interest.find_all_by_category_id(category_id).to_json(:methods => :category_name)\n \telse\n \t\trender :json => Interest.all\n \tend\n\n end",
"def index\n @project_id = params[:project_id]\n @sprints = Sprint.joins(:stories).where(:stories => {:project_id => @project_id})\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sprints }\n end\n end",
"def index\n\n\n #if params[:tag]\n # #@sources = Source.tagged_with(params[:tag])\n # @portfolios = Portfolio.all\n if params[:srchquery]\n @portfolios = Portfolio.search_by_basic(params[:srchquery])\n #@portfolios = Portfolio.search_by_link(params[:srchquery])\n else\n @portfolios = Portfolio.all\n end\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @portfolios }\n end\n end",
"def index\n @sections = Section.all.paginate(:page => params[:page], :per_page => 100)\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @service_pricing_schemes }\n end\n end",
"def set_portfolio_section\n @portfolio_section = PortfolioSection.find(params[:id])\n end",
"def index\n @page_sections = PageSection.all\n end",
"def show\n respond_to do |format|\n format.html { render html: @section }\n format.json { render json: @section }\n end\n end",
"def index\n @divisions = Division.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @divisions }\n end\n end",
"def sections(project_id, suite_id)\n get(\"get_sections/#{project_id}&suite_id=#{suite_id}\")\n end",
"def show\n @section_heading = SectionHeading.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section_heading }\n end\n end",
"def index\r\n @current_section = params[:category] || ''\r\n\r\n # for the carousel\r\n @most_recent = Post.published.where(category: @current_section).recent.first\r\n\r\n # bulid posts query, for current section\r\n @posts = Post.published.where(category: @current_section).recent\r\n # not including the first one \r\n @posts = @posts.where( \"id != #{@most_recent.id}\" ) if @most_recent # and (@current_section == 'traininggear')\r\n # paginate the posts\r\n @posts = @posts.page(params[:page]).per(9)\r\n \r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @posts }\r\n end\r\n end",
"def index\n @pricing_sections = PricingSection.all\n end",
"def index\n @lab_sections = LabSection.all\n end",
"def list_sections\n \n end",
"def get_portfolio\n @portfolio = Portfolio.find(params[:portfolio_id])\n end",
"def index\n @employer_studies = @university.employer_studies.page(params[:page])\n @studies = @employer_studies\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employer_studies }\n end\n end",
"def index\n @section = Section.find(params[:section_id])\n @items = @section.items\n render json: ItemSerializer.new(@items)\n end",
"def show\n @encyclopaedia = Encyclopaedia.find(params[:id])\n @sections = @encyclopaedia.sections.all\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @encyclopaedia}\n end\n end",
"def index\n authorize! :read, Course\n\n if is_student?\n @course_sections = Course.find_student_courses(current_user.id)\n else\n @course_sections = Course.find_professor_courses(current_user.id)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n end",
"def index\n @other_studies = @university.other_studies.page(params[:page])\n @studies = @other_studies\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @other_studies }\n end\n end",
"def index\n @sprints = Sprint.find_all_by_project_id(@project_id)\n @current_submenu = \"sprints\"\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sprints }\n end\n end",
"def index\n @srsaas = Srsaa.all\n @srsaas = Srsaa.where(:section => 'A').order(\"id\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @srsaas }\n end\n end",
"def index\n @sprintstories = Sprintstory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sprintstories }\n end\n end",
"def index\n @portfolios = Portfolio.all\n end",
"def index\n @portfolios = Portfolio.all\n end",
"def index\n @socioeconomic_studies = SocioeconomicStudy.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @socioeconomic_studies }\n end\n end",
"def index\n @title = \"Studies\"\n\n respond_to do |format|\n format.html do\n @my_studies = Study.with_user(current_user.netid)\n end\n format.json do\n render :json => Study.with_user(current_user.netid).to_json\n end\n end\n end",
"def index\n @per_page_options = %w{ 21 51 99 }\n respond_to do |format|\n format.html # index.html.erb\n format.xml # index.xml.builder\n format.atom # index.atom.builder\n format.json { render :json => ServiceCatalographer::Api::Json.index(\"services\", json_api_params, @services).to_json }\n format.bljson { render :json => ServiceCatalographer::Api::Bljson.index(\"services\", @services).to_json }\n end\n end",
"def index\n @post = find_post\n @post_sections = @post.sections\n end",
"def index\n @sections=Section.all\n end",
"def show\n @section_category = SectionCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section_category }\n end\n end",
"def index\n @solutions = @idea.solutions.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @solutions }\n end\n end",
"def index\n if (params[:subcategory_id])\n render json: Item.where(subcategory_id: params[:subcategory_id]).as_json(:include => :photos)\n elsif (params[:category_id])\n render json: Item.find_by_category_id(params[:category_id]).as_json(:include => :photos)\n else\n render json: Item.search(params).as_json(:include => :photos)\n end\n end",
"def show\n\n\n @opinionable = find_opinionable\n\n @opinion = @opinionable.opinions.find(params[:id])\n\n #@portfolio = Portfolio.find(params[:portfolio_id])\n\n\n #@opinion = @portfolio.opinions.find(params[:id])\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @opinion }\n end\n end",
"def show\n @sections = Section.find(params[:id])\n end",
"def index\n #@instruments = current_user.portfolios.first.instruments\n #if params[:portfolio_id]\n\n # @instruments = current_user.portfolios.find(params[:portfolio_id]).instruments\n #else\n @portfolios = current_user.portfolios\n #end\n\n\n\n #current_user.portfolios.find(:all,\n #:joins => :portfolios_instruments,\n #:conditions => ['profile.age = ?', 33]).instruments# User.joins(:portfolios).where('portfolio.user_id = ?', 2).instruments.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @portfolios }\n end\n end",
"def index\n @srsas = Srsa.all\n @srsas = Srsa.where(:section => 'A').order(\"id\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @srsas }\n end\n end",
"def division\n @divisions = @company.divisions\n respond_to do |format|\n format.json { render json: @divisions}\n end\n end",
"def index\n\n get_collections\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @deities }\n format.js {}\n end\n end",
"def index\n @post_sections = PostSection.all\n end",
"def index\n @survey_sections = SurveySection.page(params[:page]).per(100)\n end",
"def show\n @menu_section = MenuSection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @menu_section }\n end\n end",
"def index\n @projects = case params[\"mode\"]\r\n when \"all\" then Project.fetch_ordered\r\n when \"paginated\" then Project.fetch_ordered_by_page(params[\"page\"], %i(categories media))\r\n else Project.fetch_ordered\r\n end\n end",
"def index\n @portfolios = Portfolio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @portfolios }\n end\n end",
"def index\n @form_sections = FormSection.all\n respond_with( @form_sections )\n end",
"def index_section\n cache_for 10.minutes\n\n @presenter = ReaderAidsPresenter::IndexSectionPresenter.new(\n section_identifier: params[:section]\n )\n\n render locals: {presenter: @presenter}\n end",
"def index\n @assessment_olympiads = AssessmentOlympiad.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json:@assessment_olympiads }\n end\n end",
"def sections\n result = @nsx_client.get(@url_sections)\n result['results']\n end",
"def update\n respond_to do |format|\n if @portfolio_section.update(portfolio_section_params)\n format.html { redirect_to @portfolio_section, notice: \"Portfolio section was successfully updated.\" }\n format.json { render :show, status: :ok, location: @portfolio_section }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @portfolio_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_part_by_category\n @categorys = PartsController::PartService.get_part_by_category(params[:param]);\n respond_to do |format|\n format.json { render json: @categorys }\n end \n end",
"def show\n \n begin\n @section = @account.sections.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n @section = @account.sections.find_by_name(params[:id]) \n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @section }\n end\n end",
"def index\n\n get_collections\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @temples }\n format.js {}\n end\n end",
"def index\n @questions = @subsection.questions.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questions }\n end\n end",
"def index\n @sections = @page.sections.sorted\n end",
"def index\n @partial = {\n name: 'categories'\n }\n @partial = partial_by_category unless @category.nil?\n @partial = partial_by_site_storage unless @json_data[:site_storage].nil?\n end",
"def show\r\n @section = Section.find_by_id(params[:id])\r\n @lesson = @section.lesson\r\n @activities = @section.activities\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @section }\r\n end\r\n end",
"def index\n @services = @page.services.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @services }\n end\n end",
"def index\n @collections = @institution.collections.order(:name)\n\n respond_to do |format|\n format.html { render layout: 'fluid' }# index.html.erb\n format.json { render json: @collections }\n end\n end",
"def overview\n authorize! :show, @pool\n (@response, @document_list) = get_search_results(rows:0)\n respond_to do |format|\n format.json { render :json=>{id:@pool.id, models:@pool.models.as_json, perspectives:@pool.exhibits.as_json, facets:@response[\"facet_counts\"][\"facet_fields\"], numFound:@response[\"response\"][\"numFound\"] } } \n end\n end",
"def index\n respond_with(@collection) do |format|\n format.html\n format.json { render :json => json_data }\n end\n end",
"def index\n @team = Team.find(params[:team_id])\n @sprints = @team.sprints.find(:all)\n\n respond_to do |format|\n format.html\n format.json\n end\n end",
"def show\n @section_test = SectionTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section_test }\n end\n end",
"def index\n @sprojects = current_user.sprojects.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sprojects }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @financials }\n end\n end",
"def index\n @page_title = 'Projects'\n respond_to do |format|\n format.html { render :all } \n format.json { render :load }\n end\n end",
"def detail\n if params[:category] == \"materials\"\n sections_detail\n elsif current_user.try(:admin?) || @api_user.try(:admin?) \n if params[:category] == \"jobs\"\n jobs_detail\n elsif params[:category] == \"fabrication_orders\"\n forders_detail\n elsif params[:category] == \"tasks\"\n products_detail\n elsif params[:category] == \"rooms\"\n rooms_detail \n end\n else\n render json: api_response(:failed, \"you are not authorized to access this page\", nil) and return\n end\n \n end",
"def index\n @product_sections = ProductSection.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @product_sections }\n end\n end",
"def index\n @community_sections = CommunitySection.all\n end",
"def show\n @portfolio = Portfolio.find(params[:id])\n end",
"def index\n plan = Plan.find_by(url:params[:plan_id])\n stories = plan.stories\n render json: stories\n end",
"def index\n @resumes = Resume.all\n render json: @resumes, include: %i[headers educations work_experiences skills]\n end"
] |
[
"0.7078329",
"0.6507914",
"0.6155657",
"0.6155657",
"0.6141313",
"0.61217445",
"0.60782117",
"0.6019916",
"0.59749746",
"0.59729964",
"0.59427726",
"0.5920429",
"0.59004426",
"0.58665156",
"0.5824857",
"0.5822177",
"0.57960844",
"0.57933074",
"0.57933074",
"0.57933074",
"0.57933074",
"0.57933074",
"0.57933074",
"0.57933074",
"0.57439655",
"0.57106966",
"0.57106966",
"0.57106966",
"0.5692705",
"0.568133",
"0.5671139",
"0.56652653",
"0.56491745",
"0.56422395",
"0.56345993",
"0.5629642",
"0.5618264",
"0.56157005",
"0.5607924",
"0.5581702",
"0.5556642",
"0.55395013",
"0.5534622",
"0.5511384",
"0.5511257",
"0.55081666",
"0.5498185",
"0.5492839",
"0.54906416",
"0.54890174",
"0.54717195",
"0.5471602",
"0.54699785",
"0.54699785",
"0.54646766",
"0.5456114",
"0.5443211",
"0.54372233",
"0.54336584",
"0.543168",
"0.5431603",
"0.5431258",
"0.5429567",
"0.5427752",
"0.5407181",
"0.54059386",
"0.5403403",
"0.5402768",
"0.54023534",
"0.53825474",
"0.5382269",
"0.53779906",
"0.5374642",
"0.5369591",
"0.5367232",
"0.5360116",
"0.5359506",
"0.53576803",
"0.53539157",
"0.5351111",
"0.5345299",
"0.5340225",
"0.53402233",
"0.5331332",
"0.532729",
"0.53234226",
"0.53228474",
"0.5314202",
"0.52971566",
"0.52948713",
"0.52923954",
"0.52841103",
"0.5280187",
"0.5277409",
"0.5277105",
"0.5276737",
"0.5271794",
"0.5270764",
"0.526716",
"0.5264212"
] |
0.6794938
|
1
|
GET /portfolio_sections/1 or /portfolio_sections/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @sections = params[:path].nil? ? Section.all : Section.where(path: params[:path])\n\n respond_to do |format|\n format.html { render html: @sections }\n format.json { render json: @sections }\n end\n end",
"def index\n @portfolio_sections = PortfolioSection.all\n end",
"def index\n @sections = Section.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sections }\n end\n end",
"def show\n @portfolio = Portfolio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @portfolio }\n end\n end",
"def show\n render json: @portfolio\n end",
"def scubooks\n sections = Section.all\n render json: sections\n end",
"def index\n # TODO: ideally instead of eager loading sells, we could just include\n # quantity_sold in the eager_lod for lots.\n @portfolios = Portfolio.eager_graph(lots: :sells).eager_graph(allocations: {:asset_class => :funds}).all\n\n render json: @portfolios\n end",
"def get_portfolio\n @portfolio = Portfolio.find(params[:portfolio_id])\n end",
"def index\n course = Course.find(params[:course_id])\n sections = course.sections.all\n render json: sections.order(:id)\n end",
"def index\n #@portfolio = Portfolio.find(params[:portfolio_id])\n\n @opinionable = find_opinionable\n\n @opinion = @opinionable.opinions.all\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @opinions }\n end\n end",
"def set_portfolio_section\n @portfolio_section = PortfolioSection.find(params[:id])\n end",
"def get_page\n render_page_sections_json\n end",
"def show\n @section_heading = SectionHeading.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section_heading }\n end\n end",
"def index\n @project_id = params[:project_id]\n @sprints = Sprint.joins(:stories).where(:stories => {:project_id => @project_id})\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sprints }\n end\n end",
"def show\n @section = Section.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section }\n end\n end",
"def show\n @section = Section.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section }\n end\n end",
"def show\n @section = Section.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section }\n end\n end",
"def get_sections_with_http_info(name, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.get_sections ...'\n end\n\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling SlidesApi.get_sections\"\n end\n # resource path\n local_var_path = '/slides/{name}/sections'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n\n # query parameters\n query_params = {}\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = nil\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'Sections')\n return data, status_code, headers\n end",
"def index\n @portfolio_sections = PortfolioSection.all\n @sub_categories = SubCategory.all\n respond_to do |format|\n format.html {render :layout => 'admin'}\n end\n end",
"def index\n \tif params[:category] == \"METRO\"\n \trender :json => Interest.stops.to_json\n elsif params[:category] == \"Photos\"\n render :json => Interest.panoramio\n \telsif params[:category]\n \t\tcategory_id = Category.find_by_name(params[:category]).id\n \t\trender :json => Interest.find_all_by_category_id(category_id).to_json(:methods => :category_name)\n \telse\n \t\trender :json => Interest.all\n \tend\n\n end",
"def sections\n respond_with @page.sections\n end",
"def sections\n respond_with @page.sections\n end",
"def index\n @section_categories = SectionCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @section_categories }\n end\n end",
"def index\n @sections = case current_user.rc\n when 'EA'\n Section.includes(:profile).order('profiles.firstname').page(params[:page])\n when 'IA','EO'\n current_user.sections.includes(:profile).order('profiles.firstname').page(params[:page])\n when 'MOE'\n current_user.sections.includes(:profile).order('profiles.firstname').page(params[:page])\n when 'CR'\n current_user.sections.includes(:profile).order('profiles.firstname').page(params[:page])\n when 'ET'\n current_user.center.sections.includes(:profile).order('profiles.firstname').page(params[:page])\n end\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sections }\n end\n end",
"def index\n @shop_sections = ShopSection.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shop_sections }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @service_pricing_schemes }\n end\n end",
"def index\n @menu = Menu.find(params[:menu_id])\n @sections = @menu.sections\n render json: SectionSerializer.new(@sections)\n end",
"def show\n @portfolio = Portfolio.find(params[:id])\n end",
"def show\n\n\n @opinionable = find_opinionable\n\n @opinion = @opinionable.opinions.find(params[:id])\n\n #@portfolio = Portfolio.find(params[:portfolio_id])\n\n\n #@opinion = @portfolio.opinions.find(params[:id])\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @opinion }\n end\n end",
"def index\r\n @current_section = params[:category] || ''\r\n\r\n # for the carousel\r\n @most_recent = Post.published.where(category: @current_section).recent.first\r\n\r\n # bulid posts query, for current section\r\n @posts = Post.published.where(category: @current_section).recent\r\n # not including the first one \r\n @posts = @posts.where( \"id != #{@most_recent.id}\" ) if @most_recent # and (@current_section == 'traininggear')\r\n # paginate the posts\r\n @posts = @posts.page(params[:page]).per(9)\r\n \r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @posts }\r\n end\r\n end",
"def index\n #@instruments = current_user.portfolios.first.instruments\n #if params[:portfolio_id]\n\n # @instruments = current_user.portfolios.find(params[:portfolio_id]).instruments\n #else\n @portfolios = current_user.portfolios\n #end\n\n\n\n #current_user.portfolios.find(:all,\n #:joins => :portfolios_instruments,\n #:conditions => ['profile.age = ?', 33]).instruments# User.joins(:portfolios).where('portfolio.user_id = ?', 2).instruments.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @portfolios }\n end\n end",
"def index\n\n\n #if params[:tag]\n # #@sources = Source.tagged_with(params[:tag])\n # @portfolios = Portfolio.all\n if params[:srchquery]\n @portfolios = Portfolio.search_by_basic(params[:srchquery])\n #@portfolios = Portfolio.search_by_link(params[:srchquery])\n else\n @portfolios = Portfolio.all\n end\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @portfolios }\n end\n end",
"def update\n respond_to do |format|\n if @portfolio_section.update(portfolio_section_params)\n format.html { redirect_to @portfolio_section, notice: \"Portfolio section was successfully updated.\" }\n format.json { render :show, status: :ok, location: @portfolio_section }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @portfolio_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @divisions = Division.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @divisions }\n end\n end",
"def show\n @section_category = SectionCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section_category }\n end\n end",
"def show\n respond_to do |format|\n format.html { render html: @section }\n format.json { render json: @section }\n end\n end",
"def show\n @instrument = current_user.portfolios.find(params[:portfolio_id]).instruments.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @instrument }\n end\n end",
"def index\n @sections = Section.all\n end",
"def index\n @sections = Section.all\n end",
"def index\n @sections = Section.all\n end",
"def index\n @sections = Section.all\n end",
"def index\n @sections = Section.all\n end",
"def index\n @sections = Section.all\n end",
"def index\n @sections = Section.all\n end",
"def portfolio\n @portfolio = Portfolio.find_by(id: params[:portfolio_id])\n end",
"def portfolio\n @portfolio = Portfolio.find(params[:id])\n end",
"def index\n @portfolios = Portfolio.all\n end",
"def index\n @portfolios = Portfolio.all\n end",
"def show_portfolio_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PortfolioApi.show_portfolio ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling PortfolioApi.show_portfolio\"\n end\n pattern = Regexp.new(/^\\d+$/)\n if @api_client.config.client_side_validation && id !~ pattern\n fail ArgumentError, \"invalid value for 'id' when calling PortfolioApi.show_portfolio, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/portfolios/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Portfolio' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PortfolioApi#show_portfolio\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @sections = Section.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sections }\n end\n end",
"def index\n @srsaas = Srsaa.all\n @srsaas = Srsaa.where(:section => 'A').order(\"id\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @srsaas }\n end\n end",
"def index\n @lab_sections = LabSection.all\n end",
"def find\n @portfolio_items = Portfolio.find(params[:id])\n end",
"def index\n @section = Section.find(params[:section_id])\n @items = @section.items\n render json: ItemSerializer.new(@items)\n end",
"def index\n @solutions = @idea.solutions.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @solutions }\n end\n end",
"def index\n @employer_studies = @university.employer_studies.page(params[:page])\n @studies = @employer_studies\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employer_studies }\n end\n end",
"def index\n @other_studies = @university.other_studies.page(params[:page])\n @studies = @other_studies\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @other_studies }\n end\n end",
"def get_part_by_category\n @categorys = PartsController::PartService.get_part_by_category(params[:param]);\n respond_to do |format|\n format.json { render json: @categorys }\n end \n end",
"def index\n @pricing_sections = PricingSection.all\n end",
"def index\n @sprints = Sprint.find_all_by_project_id(@project_id)\n @current_submenu = \"sprints\"\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sprints }\n end\n end",
"def load_portfolio\n @portfolio = Portfolio.find(params[:id])\n end",
"def find_portfolio\n @portfolio = Portfolio.find params[:id]\n end",
"def index\n @projects = case params[\"mode\"]\r\n when \"all\" then Project.fetch_ordered\r\n when \"paginated\" then Project.fetch_ordered_by_page(params[\"page\"], %i(categories media))\r\n else Project.fetch_ordered\r\n end\n end",
"def index\n @sprintstories = Sprintstory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sprintstories }\n end\n end",
"def index\n @sections = Section.all.paginate(:page => params[:page], :per_page => 100)\n end",
"def index_section\n cache_for 10.minutes\n\n @presenter = ReaderAidsPresenter::IndexSectionPresenter.new(\n section_identifier: params[:section]\n )\n\n render locals: {presenter: @presenter}\n end",
"def index\n @srsas = Srsa.all\n @srsas = Srsa.where(:section => 'A').order(\"id\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @srsas }\n end\n end",
"def index\n @assessment_olympiads = AssessmentOlympiad.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json:@assessment_olympiads }\n end\n end",
"def index\n @socioeconomic_studies = SocioeconomicStudy.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @socioeconomic_studies }\n end\n end",
"def index\n @collections = @institution.collections.order(:name)\n\n respond_to do |format|\n format.html { render layout: 'fluid' }# index.html.erb\n format.json { render json: @collections }\n end\n end",
"def show\r\n @section = Section.find_by_id(params[:id])\r\n @lesson = @section.lesson\r\n @activities = @section.activities\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @section }\r\n end\r\n end",
"def show\n @portfolio_item = Portfolio.find(params[:id])\n end",
"def show\n render :json => @slab_project\n end",
"def show\n @section_test = SectionTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section_test }\n end\n end",
"def index\n @title = \"Studies\"\n\n respond_to do |format|\n format.html do\n @my_studies = Study.with_user(current_user.netid)\n end\n format.json do\n render :json => Study.with_user(current_user.netid).to_json\n end\n end\n end",
"def index\n @portfolios = Portfolio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @portfolios }\n end\n end",
"def index\n @projectportfolios = Projectportfolio.all\n end",
"def show\n @sections = Section.find(params[:id])\n end",
"def show\n \n begin\n @section = @account.sections.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n @section = @account.sections.find_by_name(params[:id]) \n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @section }\n end\n end",
"def index\n if (params[:subcategory_id])\n render json: Item.where(subcategory_id: params[:subcategory_id]).as_json(:include => :photos)\n elsif (params[:category_id])\n render json: Item.find_by_category_id(params[:category_id]).as_json(:include => :photos)\n else\n render json: Item.search(params).as_json(:include => :photos)\n end\n end",
"def show\n @menu_section = MenuSection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @menu_section }\n end\n end",
"def section\n return @section if @section\n\n resp = HTTP\n .headers(authorization: \"Bearer #{access_token[:access_token]}\")\n .get(LIST_SECTIONS_ENDPOINT % notebook[:id], params: {\n select: 'id,name',\n filter: \"name eq '#{Config[:section]}'\"\n })\n if resp.code.to_s.start_with? '2'\n json = response_body(resp)\n @section = JSON.parse(json, symbolize_names: true)[:value].first\n end\n return @section\n end",
"def index\n @portfolio_items = Portfolio.all\n end",
"def index\n @page_sections = PageSection.all\n end",
"def division\n @divisions = @company.divisions\n respond_to do |format|\n format.json { render json: @divisions}\n end\n end",
"def show\n @portfolio = Portfolio.find( params[:portfolio_id] )\n @showCollections = @portfolio.portfolio_collections\n @portfolio_collection = PortfolioCollection.find( params[:id] )\n\n if @portfolio_collection.default_show_view_id\n showView = ImageShowView.find( @portfolio_collection.default_show_view_id )\n @mainImageVariant = ImageVariant.find showView.show_variant_id\n else\n @mainImageVariant = nil\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @portfolio_collection }\n end\n end",
"def show\n @part_company = PartCompany.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @part_company }\n end\n end",
"def show\n @portfolio = Portfolio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @portfolio }\n end\n end",
"def index\n plan = Plan.find_by(url:params[:plan_id])\n stories = plan.stories\n render json: stories\n end",
"def show\n @encyclopaedia = Encyclopaedia.find(params[:id])\n @sections = @encyclopaedia.sections.all\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @encyclopaedia}\n end\n end",
"def index\n @sprojects = current_user.sprojects.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sprojects }\n end\n end",
"def index\n @job_folios = JobFolio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @job_folios }\n end\n end",
"def index\n @survey_sections = SurveySection.page(params[:page]).per(100)\n end",
"def get_company_by_company_part\n @parts = CompaniesController::CompanyService.get_company_by_company_part(params[:param_part])\n if !@parts.nil?\n respond_to do |format|\n format.json{ render json: @parts}\n end \n else\n #não foi encontrado as informacoes\n end\n\tend",
"def index\n @projects = Project.visible\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @portfolio_entry.ajax_attrs(@role) }\n end\n end",
"def index\n @dev_folios = DevFolio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dev_folios }\n end\n end",
"def overview\n authorize! :show, @pool\n (@response, @document_list) = get_search_results(rows:0)\n respond_to do |format|\n format.json { render :json=>{id:@pool.id, models:@pool.models.as_json, perspectives:@pool.exhibits.as_json, facets:@response[\"facet_counts\"][\"facet_fields\"], numFound:@response[\"response\"][\"numFound\"] } } \n end\n end",
"def index\n @per_page_options = %w{ 21 51 99 }\n respond_to do |format|\n format.html # index.html.erb\n format.xml # index.xml.builder\n format.atom # index.atom.builder\n format.json { render :json => ServiceCatalographer::Api::Json.index(\"services\", json_api_params, @services).to_json }\n format.bljson { render :json => ServiceCatalographer::Api::Bljson.index(\"services\", @services).to_json }\n end\n end",
"def index\n respond_with(@collection) do |format|\n format.html\n format.json { render :json => json_data }\n end\n end",
"def index\n\n get_collections\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @deities }\n format.js {}\n end\n end"
] |
[
"0.6827582",
"0.68197966",
"0.6416012",
"0.6389479",
"0.6385065",
"0.6010069",
"0.5974914",
"0.59709513",
"0.5967757",
"0.59487927",
"0.5946998",
"0.5943211",
"0.58570683",
"0.58529305",
"0.5842768",
"0.5842768",
"0.5842768",
"0.5816457",
"0.57705015",
"0.57692367",
"0.57618225",
"0.57618225",
"0.5759367",
"0.57590747",
"0.5759029",
"0.57246065",
"0.57243884",
"0.57125014",
"0.5707157",
"0.56800944",
"0.5667319",
"0.56538415",
"0.5646977",
"0.5632828",
"0.5627079",
"0.5625071",
"0.5624416",
"0.56241065",
"0.56241065",
"0.56241065",
"0.56241065",
"0.56241065",
"0.56241065",
"0.56241065",
"0.5615195",
"0.56076294",
"0.5595863",
"0.5595863",
"0.5589033",
"0.5576096",
"0.5574061",
"0.5570522",
"0.5565904",
"0.5560643",
"0.55557936",
"0.5553671",
"0.55406284",
"0.5538367",
"0.5532293",
"0.55251586",
"0.5515451",
"0.5512168",
"0.55021316",
"0.5489823",
"0.54862833",
"0.5484874",
"0.54842997",
"0.548147",
"0.54803294",
"0.54735935",
"0.54712033",
"0.5470251",
"0.54681706",
"0.5466693",
"0.5463975",
"0.54571867",
"0.54570884",
"0.5457076",
"0.5455872",
"0.54502314",
"0.5447024",
"0.5444685",
"0.542045",
"0.5402137",
"0.54014534",
"0.5399684",
"0.53980637",
"0.5397941",
"0.5397082",
"0.5390384",
"0.53866345",
"0.53860664",
"0.53853124",
"0.5377021",
"0.537588",
"0.53739834",
"0.5373815",
"0.5373094",
"0.53729624",
"0.53716046",
"0.53656226"
] |
0.0
|
-1
|
POST /portfolio_sections or /portfolio_sections.json
|
def create
@portfolio_section = PortfolioSection.new(portfolio_section_params)
respond_to do |format|
if @portfolio_section.save
format.html { redirect_to @portfolio_section, notice: "Portfolio section was successfully created." }
format.json { render :show, status: :created, location: @portfolio_section }
else
format.html { render :new, status: :unprocessable_entity }
format.json { render json: @portfolio_section.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def portfolio_section_params\n params.require(:portfolio_section).permit(:section_id, :description)\n end",
"def update\n respond_to do |format|\n if @portfolio_section.update(portfolio_section_params)\n format.html { redirect_to @portfolio_section, notice: \"Portfolio section was successfully updated.\" }\n format.json { render :show, status: :ok, location: @portfolio_section }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @portfolio_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @portfolio_sections = PortfolioSection.all\n end",
"def create\n @section = Section.new(:name => params[:value])\n @section.resume_id = params[:pk]\n\n if @section.save\n render json: { :results => true }\n else\n render json: { :results => false }\n end\n end",
"def set_portfolio_section\n @portfolio_section = PortfolioSection.find(params[:id])\n end",
"def create\n @section = Section.new(section_params)\n if @section.save\n render json: SectionSerializer.new(@section)\n else\n render json: @section.errors, status: :unprocessable_entity\n end\n end",
"def create\n @portfolio = Portfolio.new(portfolio_params)\n\n if @portfolio.save\n render json: @portfolio, status: :created, location: @portfolio\n else\n render json: @portfolio.errors, status: :unprocessable_entity\n end\n end",
"def create\n @post_section = PostSection.new(post_section_params)\n\n respond_to do |format|\n if @post_section.save\n format.html { redirect_to @post_section, notice: 'Post section was successfully created.' }\n format.json { render :show, status: :created, location: @post_section }\n else\n format.html { render :new }\n format.json { render json: @post_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @section = Section.new(params[:section])\n @section.page = @page\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @page, :notice => 'Section was successfully created.' }\n format.json { render :json => @section, :status => :created, :location => @section }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n # @portfolio_item = Portfolio.mew(portfolio_params)\n @portfolio_item = Portfolio.new(params.require(:portfolio).permit(:title, :subtitle, :body))\n \n respond_to do |format|\n if @portfolio_item.save\n format.html { redirect_to portfolios_path, notice: 'Portfolio item was created.' }\n # form.json { render :show, status: :created, location: @portfolio_items }\n else\n format.html {render :new }\n # format.json { render json: @portfolio_items.errors, status: :unprocessable_entry }\n end\n end\n end",
"def create\n @section = Section.new(section_params)\n\n if @section.save\n render :show, status: :created, location: @section\n else\n render json: @section.errors, status: :unprocessable_entity\n end\n end",
"def set_sections_with_http_info(name, sections, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.set_sections ...'\n end\n\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling SlidesApi.set_sections\"\n end\n # verify the required parameter 'sections' is set\n if @api_client.config.client_side_validation && sections.nil?\n fail ArgumentError, \"Missing the required parameter 'sections' when calling SlidesApi.set_sections\"\n end\n # resource path\n local_var_path = '/slides/{name}/sections'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n\n # query parameters\n query_params = {}\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = @api_client.object_to_http_body(sections)\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'Sections')\n return data, status_code, headers\n end",
"def index\n @sections = params[:path].nil? ? Section.all : Section.where(path: params[:path])\n\n respond_to do |format|\n format.html { render html: @sections }\n format.json { render json: @sections }\n end\n end",
"def create\n #@initiative = Initiative.new(params[:initiative])\n @initiative = Initiative.new\n @initiative.title=params[:initiative][:title]\n @initiative.description=params[:initiative][:description]\n @initiative.start=params[:initiative][:start]\n @initiative.end=params[:initiative][:end]\n @initiative.portfolio_id=params[:portfolio_id]\n @initiative.phase_id=params[:phase_id]\n @initiative.completionDegree=params[:initiative][:completionDegree]\n\n\n\n #\n # Default to the first phase in the chosen portfolio\n\n\n\n\n respond_to do |format|\n if @initiative.save\n #format.js\n format.html { render partial: 'success' }\n format.json { render json: @initiative, status: :created, location: @initiative }\n else\n #format.js\n format.html { render partial: 'fail' }\n format.json { render json: @initiative.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = find_post\n @post_section = @post.sections.build(post_section_params)\n\n respond_to do |format|\n if @post_section.save\n format.html { redirect_to admin_post_section_url(@post, @post_section), notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: admin_post_section_url(@post, @post_section) }\n else\n format.html { render :new }\n format.json { render json: @post_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @section = Section.new(params[:section])\n @section.account = @account\n \n # This serves to retreive any article attached to this new section so we can access that article's apge\n @article = find_article if params[:article_id]\n\n respond_to do |format|\n if @section.save\n flash[:notice] = 'Section was successfully created.'\n format.js { redirect_to(account_article_sortings_url(@account, @article, :format=>:js)) if @article}\n format.html { redirect_to(account_sections_url(@account)) }\n format.xml { render :xml => [@account, @section], :status => :created, :location =>[@account, @section] }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @section = Section.new(section_params)\n @section.title = @section.title || \"\"\n\n document = @section.document\n @section.order = 1\n unless document.sections.blank?\n @section.order = document.sections.last.order + 1\n end\n\n @section.visibility = document.visibility\n @section.status = document.status\n\n update_user_attribution @section, true\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.any(:json, :js) { render :show, status: :created, location: @section }\n else\n puts @section.errors.full_messages\n format.html { render :new }\n format.any(:json, :js) { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @portfolio_section.destroy\n respond_to do |format|\n format.html { redirect_to portfolio_sections_url, notice: \"Portfolio section was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def create\n @form_section = FormSection.new(form_section_params)\n @form_section.save\n respond_with( [ :admin, @form_section] )\n end",
"def create_section_with_http_info(name, section_name, slide_index, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.create_section ...'\n end\n\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling SlidesApi.create_section\"\n end\n # verify the required parameter 'section_name' is set\n if @api_client.config.client_side_validation && section_name.nil?\n fail ArgumentError, \"Missing the required parameter 'section_name' when calling SlidesApi.create_section\"\n end\n # verify the required parameter 'slide_index' is set\n if @api_client.config.client_side_validation && slide_index.nil?\n fail ArgumentError, \"Missing the required parameter 'slide_index' when calling SlidesApi.create_section\"\n end\n # resource path\n local_var_path = '/slides/{name}/sections'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n\n # query parameters\n query_params = {}\n query_params[:'sectionName'] = @api_client.prepare_for_query(section_name) unless section_name.nil?\n query_params[:'slideIndex'] = @api_client.prepare_for_query(slide_index) unless slide_index.nil?\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = nil\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'Sections')\n return data, status_code, headers\n end",
"def index\n @sections = Section.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sections }\n end\n end",
"def create\n @section = Section.new(params[:section])\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render json: @section, status: :created, location: @section }\n else\n format.html { render action: \"new\" }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @portfolio = current_user.portfolios.new(params[:portfolio])\n\n\n respond_to do |format|\n if @portfolio.save\n format.html { redirect_to @portfolio, notice: 'Portfolio was successfully created.' }\n format.json { render json: @portfolio, status: :created, location: @portfolio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @portfolio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @page_section = PageSection.new(page_section_params)\n\n respond_to do |format|\n if @page_section.save\n format.html { redirect_to @page_section,\n notice: t('shared.msgs.success_created',\n obj: t('activerecord.models.page_section', count: 1)) }\n format.json { render :show, status: :created, location: @page_section }\n else\n format.html { render :new }\n format.json { render json: @page_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @section = Section.new(params[:section])\r\n\r\n respond_to do |format|\r\n if @section.save\r\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\r\n format.json { render json: @section, status: :created, location: @section }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @section.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def add_element_to_section(section,type,data)\n url = @base + \"/api/v1/elements.json\"\n params = {\"item\"=>{\"element_type\"=> type, \"data\"=>data, \"container_type\"=>\"ExperimentProcedure\", \"container_id\"=>section[\"id\"], \"field_name\"=>section[\"section_type\"]},token: @token}\n response = JSON.parse(RestClient.post(url,params))\nend",
"def create\n @pricing_section = PricingSection.new(pricing_section_params)\n\n respond_to do |format|\n if @pricing_section.save\n format.html { redirect_to @pricing_section, notice: \"Pricing section was successfully created.\" }\n format.json { render :show, status: :created, location: @pricing_section }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @pricing_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sections\n respond_with @page.sections\n end",
"def sections\n respond_with @page.sections\n end",
"def create\n @section = Section.new(params[:section])\n\n Course.find(params[:section][:add_section]).sections << @section if params[:section][:add_section]\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render json: @section, status: :created, location: @section }\n else\n format.html { render action: \"new\" }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n portfolio = Portfolio.new(user_id: current_user.id)\n if portfolio.update_attributes(portfolio_params)\n render json: portfolio, status: :created\n else\n render json: portfolio.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def add_element_to_section(section,type,data)\n url = @base + \"elements.json\"\n params = {\"item\"=>{\"element_type\"=> type, \"data\"=>data, \"container_type\"=>\"ExperimentProcedure\", \"container_id\"=>section[\"id\"], \"field_name\"=>section[\"section_type\"]},token: @token}\n response = JSON.parse(RestClient.post(url,params))\nend",
"def createSection(section)\r\n uri = sprintf(\"/api/v1/courses/%d/sections/\", $tocid) \r\n \r\n dbg(\"POST #{uri}\")\r\n dbg(\"course_section[name]=#{section[\"name\"]}\")\r\n newSection = $canvas.post(uri, {'course_section[name]' => section[\"name\"]})\r\n dbg(newSection)\r\n return newSection\r\nend",
"def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n @section.check_index()\n form_wrapper = FormWrapper.find(@section.form_wrapper_id)\n format.html { redirect_to sections_section_path(form_wrapper), alert: I18n.t('activerecord.models.section.single') + I18n.t('helpers_locale.models.created') }\n format.json { render action: 'show', status: :created, location: @section }\n else\n format.html { render action: 'new' }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_section(project_id, data = {})\n post(\"add_section/#{project_id}\", body: data.to_json)\n end",
"def create\n @portfolio = Portfolio.new(portfolio_params)\n\n respond_to do |format|\n if @portfolio.save\n format.html { redirect_to @portfolio, notice: 'Portfolio was successfully created.' }\n format.json { render :show, status: :created, location: @portfolio }\n else\n format.html { render :new }\n format.json { render json: @portfolio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @survey_section = SurveySection.new(survey_section_params)\n\n respond_to do |format|\n if @survey_section.save\n format.html { redirect_to @survey_section, notice: 'Survey section was successfully created.' }\n format.json { render :show, status: :created, location: @survey_section }\n else\n format.html { render :new }\n format.json { render json: @survey_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @home = Home.first\n @about = About.first\n\n @section = Section.new(section_params)\n @section.order = Section.all.count+1\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to [:admin, @section], notice: 'Section was successfully created.' }\n format.json { render action: 'show', status: :created, location: @section }\n else\n format.html { render action: 'new' }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: @section }\n else\n format.html { render :new }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: @section }\n else\n format.html { render :new }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: @section }\n else\n format.html { render :new }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: @section }\n else\n format.html { render :new }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section,\n notice: 'Section was successfully created.' }\n format.json { render :show,\n status: :created, location: @section }\n else\n format.html { render :new }\n format.json { render json: @section.errors,\n status: :unprocessable_entity }\n end\n end\n end",
"def create_portfolio_with_http_info(portfolio, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PortfolioApi.create_portfolio ...'\n end\n # verify the required parameter 'portfolio' is set\n if @api_client.config.client_side_validation && portfolio.nil?\n fail ArgumentError, \"Missing the required parameter 'portfolio' when calling PortfolioApi.create_portfolio\"\n end\n # resource path\n local_var_path = '/portfolios'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(portfolio) \n\n # return_type\n return_type = opts[:return_type] || 'Portfolio' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PortfolioApi#create_portfolio\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n if @portfolio.update(portfolio_params)\n render json: @portfolio\n else\n render json: @portfolio.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def sell_shop_section_create (section_name, params={})\r\n url = api_url \"/sell/shop/sections\"\r\n req = request_params(params)\r\n load = MultiJson.dump name: section_name\r\n\r\n feed_or_retry do\r\n RestClient.post url, load, req\r\n end \r\n end",
"def scubooks\n sections = Section.all\n render json: sections\n end",
"def create\r\n @gallery_activity = GalleryActivity.new(params[:gallery_activity])\r\n @gallery_activity.sections << Section.find(params[:section_id])\r\n \r\n respond_to do |format|\r\n if (@gallery_activity.save)\r\n format.html { redirect_to Section.find_by_id(params[:section_id]), notice: 'Gallery activity was successfully created.' }\r\n format.json { render json: Section.find_by_id(params[:section_id]), status: :created, location: Section.find_by_id(params[:section_id]) }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @gallery_activity.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @shareportfolio = Shareportfolio.new(shareportfolio_params)\n\n respond_to do |format|\n if @shareportfolio.save\n format.html { redirect_to @shareportfolio, notice: 'Shareportfolio was successfully created.' }\n format.json { render :show, status: :created, location: @shareportfolio }\n else\n format.html { render :new }\n format.json { render json: @shareportfolio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @manage_section = Manage::Section.new(manage_section_params)\n\n respond_to do |format|\n if @manage_section.save\n format.html { redirect_to manage_compete_url(@compete), notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: @manage_section }\n else\n format.html { render :new }\n format.json { render json: @manage_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if !has_right?(:create)\n redirect_to :unauthorized\n return\n end\n @section_preview = SectionPreview.new(params[:section_preview])\n create_new_objects(:property => params[:property],\n \t\t\t\t\t\t\t\t\t :image_storage => params[:image_storage],\n \t\t\t\t\t\t\t\t\t :asset => params[:asset],\n \t\t\t\t\t\t\t\t\t :resource => @section_preview) ### Add to all resources\n end",
"def show\n render json: @portfolio\n end",
"def create\n @cms_page_section = Cms::PageSection.new(cms_page_section_params)\n\n respond_to do |format|\n if @cms_page_section.save\n format.html { redirect_to :controller => \"/pages\", :action => \"show\", :id => @cms_page_section.page_id, notice: 'Page section was successfully created.' }\n format.json { render :show, status: :created, location: @cms_page_section }\n else\n format.html { render :new }\n format.json { render json: @cms_page_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n # Add section to course.\n if params.has_key?('course_id')\n course_id = params['course_id']\n add_section_to_course(@section, course_id)\n end\n \n format.js { render \"\", json: @section }\n else\n format.js { render json: @section.errors, status: :unprocessable_entity }\n end\n # if add_section_to_course(@section, course_id)\n # # Use the sections helper to create the relation between the section and its course.\n # format.html { redirect_to Course.find(course_id), notice: 'Section was successfully created.' }\n # format.json { render :show, status: :created, location: @section }\n # else\n # format.html { render :new }\n # format.json { render json: @section.errors, status: :unprocessable_entity }\n # end\n end\n end",
"def create\n uri_obj = URI\n respond_to do |format|\n @portfolio_entry.assign_attributes(params, :as=>@role)\n if @portfolio_entry.save\n\t format.html { redirect_to @portfolio_entry, :notice => 'Portfolio Entry was successfully updated.' }\n format.json { render :json => @portfolio_entry.ajax_attrs(@role) }\n else\n\t format.html { redirect_to @portfolio_entry, :notice => 'Failure updating Portfolio Entry.' }\n format.json { render :json=>report_error(@portfolio_entry)}\n\tend\n end\n end",
"def create\n @lab_section = LabSection.new(lab_section_params)\n\n respond_to do |format|\n if @lab_section.save\n format.html { redirect_to @lab_section, notice: 'Lab section was successfully created.' }\n format.json { render :show, status: :created, location: @lab_section }\n else\n format.html { render :new }\n format.json { render json: @lab_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @menu = Menu.find(params[:menu_id])\n @sections = @menu.sections\n render json: SectionSerializer.new(@sections)\n end",
"def create\n @sections = Section.find(:all)\n @section = Section.new(params[:section])\n\n respond_to do |format|\n if @section.save\n flash[:notice] = 'Section was successfully created.'\n format.html { redirect_to(@section) }\n format.xml { render :xml => @section, :status => :created, :location => @section }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render json: @section }\n else\n format.html { render action: 'new' }\n format.json { render json: ErrorSerializer.serialize(@section.errors), status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n params[:event][:sections].shift\n sections = params[:event][:sections]\n event_id = params[:event][:id]\n params[:event].delete \"sections\"\n\n \n @event = Event.new(params[:event])\n \n respond_to do |format|\n if @event.save\n sections.each do |section_id|\n @section = SectionEvent.new({:event_id => @event.id, :section_id => section_id})\n @section.save\n end \n if request.xhr?\n flash[:notice] = \"Event was successfully created.\"\n format.html #{ redirect_to events_url, notice: 'Event was successfully created.' }\n # format.json { render json: @event, status: :created, location: @event }\n format.js\n @events = Event.by_date(params[:date_query])\n else\n flash[:notice] = \"Event was successfully created.\"\n format.html { redirect_to events_url, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n format.js\n end\n else\n if request.xhr?\n format.html #{ render action: \"new\" }\n # format.json { render json: @event.errors, status: :unprocessable_entity }\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n format.js\n end\n\n end\n # if @event.save\n # format.html { redirect_to @event, notice: 'Event was successfully created.' }\n # format.json { render json: @event, status: :created, location: @event }\n # format.js\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @event.errors, status: :unprocessable_entity }\n # format.js\n\n end\n end",
"def show_add_section_to_item\n @item = Item.find(params[:id])\n @section = Section.new(\n :item_id => params[:id],\n :publish => true\n )\n respond_to do |format|\n format.html { render :action => \"show\", :id => @item }\n format.js\n end\n end",
"def portfolio_params\n params.require(:portfolio).permit(:gender, :about, :experience, :education, :avatar, :city_id, :service_id, {documents: []}, {images: []})\n end",
"def create\n if asset_manager_signed_in?\n portfolio = current_asset_manager.portfolios.new(portfolio_params)\n if portfolio.save\n render_json_message(:ok, message: 'New portfolio created', data: portfolio)\n else\n render_json_message(:forbidden, data: portfolio, errors: portfolio.errors.full_messages)\n end\n else\n render_json_message(:forbidden, message: 'No asset manager is currently signed in')\n end\n end",
"def create\n @projectportfolio = Projectportfolio.new(projectportfolio_params)\n\n respond_to do |format|\n if @projectportfolio.save\n format.html { redirect_to @projectportfolio, notice: 'Projectportfolio was successfully created.' }\n format.json { render :show, status: :created, location: @projectportfolio }\n else\n format.html { render :new }\n format.json { render json: @projectportfolio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @section = Section.new(:name => params[:value])\n @section.resume_id = params[:pk]\n\n if @section.save\n render json: { :results => true }\n else\n render json: { :results => false }\n end\n end",
"def create\n @section = Section.new(section_params.merge!({ document: Document.find(params[:document_id]) }))\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: @section }\n else\n format.html { render :new }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def section_params\n params.require(:section).permit(:name, :description, :slug, :parent_id, :rank)\n end",
"def create\n @portfolio = Portfolio.new(:name => params[:portfolio][:name], :user_id => session[:user_id])\n\n respond_to do |format|\n if @portfolio.save\n session[:portfolio_id] = @portfolio.id #mine\n format.html { redirect_to @portfolio, notice: 'Portfolio was successfully created.' }\n format.json { render json: @portfolio, status: :created, location: @portfolio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @portfolio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def section_params\n params.fetch(:section, {}).permit(:title, :headless)\n end",
"def index\n @form_sections = FormSection.all\n respond_with( @form_sections )\n end",
"def create\n @idea = current_member.ideas.new(idea_params) \n respond_to do |format|\n sectors_params.delete(\"\")\n if @idea.save\n sectors_params.each do |k|\n @idea.sectors << Sector.find_by(id:k)\n end\n format.json { head :no_content }\n format.js\n else\n\n format.json { render :json => { :error => @idea.errors.full_messages }, :status => 422 }\n end\n \n end\n end",
"def create_sections\n @sections = if @options.configure_sections?\n parse_sections(@options[:configure_sections])\n elsif @options.add_sections?\n default_sections.concat parse_sections(@options[:add_sections])\n else\n default_sections\n end\n nil\n end",
"def create_division\n \t@division = @company.divisions.create(name: params[:division][:name])\n respond_to do |format|\n format.json { render json: @division }\n end\n end",
"def create\n @portfolio = Portfolio.new(portfolio_params.merge!(user_id: current_user.id))\n if @portfolio.save\n save_pictures\n render json: { message: \"success\", portfolioId: @portfolio.id }, status: 200\n else\n render json: { error: @portfolio.errors.values.join(\",\")}, status: 400\n end\n end",
"def index\n @section = Section.find(params[:section_id])\n @items = @section.items\n render json: ItemSerializer.new(@items)\n end",
"def new\n @portfolio = Portfolio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @portfolio }\n end\n end",
"def create_new_section(title, options={})\n send_request('create_new_section', normalize_options(title, options))\n end",
"def suites\n @portfolio = @portfolio_collection\n if request.xhr?\n render :update do |page|\n if params[:suite_filter].present?\n page.replace_html \"suite_filter_display\",:partial =>\"/lease/partial_suite\",:locals => {:note_collection => @note, :portfolio_collection => @portfolio_collection}\n else\n page.replace_html \"lease_container\", :partial => \"/lease/suites_form\", :locals => {:rent_roll_swig => @rent_roll_swig, :note_collection => @note, :portfolio_collection => @portfolio_collection}\n end\n end\n end\n #~ respond_to do |format|\n #~ format.js {\n #~ render :update do |page|\n #~ if params[:suite_filter].present?\n #~ page.replace_html \"suite_filter_display\",:partial =>\"/lease/partial_suite\",:locals => {:note_collection => @note, :portfolio_collection => @portfolio_collection}\n #~ else\n #~ page.replace_html \"lease_container\", :partial => \"/lease/suites_form\", :locals => {:rent_roll_swig => @rent_roll_swig, :note_collection => @note, :portfolio_collection => @portfolio_collection}\n #~ end\n #~ replace_navigation_bar(page,@portfolio_collection,@note)\n #~ end\n #~ }\n #~ end\n end",
"def create\n @section = Section.new(params[:section])\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to(admin_sections_path, :notice => 'Section was successfully created.') }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def portfolio_params\n params.require(:portfolio).permit(:title, :subtitle, :body, :main_image, :thumb_image)\n end",
"def create\n @section_heading = SectionHeading.new(params[:section_heading])\n\n respond_to do |format|\n if @section_heading.save\n format.html { redirect_to @section_heading, notice: 'Section heading was successfully created.' }\n format.json { render json: @section_heading, status: :created, location: @section_heading }\n else\n format.html { render action: \"new\" }\n format.json { render json: @section_heading.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #Takes the form parameters\n # added technologies_attributes\n @portfolio_item = Portfolio.new(params.require(:portfolio).permit(:title, :subtitle, :body, technologies_attributes: [:name]))\n # permit -> this are strong parameters\n\n respond_to do |format|\n #Si es valido\n if @portfolio_item.save\n #Formatea el html y redirreciona al usuario (show page)\n #notice -> muestra el mensaje en la vista\n # portfolios_path redirect to the full list \n format.html { redirect_to portfolios_path, notice: 'Your portfolio item is now live.' }\n #json no se usa, se puede borrar\n format.json { render :show, status: :created, location: @portfolio_item }\n else\n format.html { render :new }\n format.json { render json: @portfolio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n respond_to do |format|\n if Portfolio.create(portfolio_params)\n flash[:success] = 'Portfolio Item successfully created!'\n format.html { redirect_to portfolios_path, notice: 'Portfolio Item was successfully created!' }\n else\n flash[:error] = portfolio_item.errors.full_messages\n format.html { render :new }\n end\n end\n end",
"def update\n respond_to do |format|\n if @extractions_extraction_forms_projects_section.update(extractions_extraction_forms_projects_section_params)\n format.html { redirect_to work_extraction_path(@extractions_extraction_forms_projects_section.extraction,\n anchor: \"panel-tab-#{ @extractions_extraction_forms_projects_section.id.to_s }\"),\n notice: t('success') }\n format.json { render :show, status: :ok, location: @extractions_extraction_forms_projects_section }\n else\n format.html { redirect_to work_extraction_path(@extractions_extraction_forms_projects_section.extraction,\n anchor: \"panel-tab-#{ @extractions_extraction_forms_projects_section.id.to_s }\"),\n alert: t('failure') }\n format.json { render json: @extractions_extraction_forms_projects_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @community_section = CommunitySection.new(community_section_params)\n\n respond_to do |format|\n if @community_section.save\n format.html { redirect_to @community_section, notice: 'Community section was successfully created.' }\n format.json { render :show, status: :created, location: @community_section }\n else\n format.html { render :new }\n format.json { render json: @community_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @section_heading = SectionHeading.new(section_heading_params)\n\n respond_to do |format|\n if @section_heading.save\n format.html { redirect_to @section_heading, notice: 'Section heading was successfully created.' }\n format.json { render :show, status: :created, location: @section_heading }\n else\n format.html { render :new }\n format.json { render json: @section_heading.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_page\n render_page_sections_json\n end",
"def portfolio_param\n params.require(:portfolio).permit(:title,:subtitle,:body)\n end",
"def new\n @section = Section.new\n\n # If the new section is requested from an existing article page then we have to retain that article for \n # reloading that article's sortings list to include the new section.\n @article = find_article if params[:article_id]\n\n respond_to do |format|\n format.html # new.html.erb\n format.js\n format.xml { render :xml => @section }\n end\n end",
"def create\n @portfolio = Portfolio.new(params[:portfolio])\n\n respond_to do |format|\n if @portfolio.save\n format.html { redirect_to(@portfolio, :notice => 'Portfolio was successfully created.') }\n format.xml { render :xml => @portfolio, :status => :created, :location => @portfolio }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @portfolio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n # Instantiate new object using form params\n @section = Section.new(section_params) #use private method below to get permited data for mass assignment\n @section.page = @page\n # Save object\n if @section.save\n # If successful, redirect to index action\n flash[:notice] = \"Section created successfully.\"\n redirect_to(sections_path(:page_id => @page.id))\n else\n # Else, redisplay form so user can fix problems\n render('new') # renders form template with original user data pre-populated\n end\n end",
"def update\n authorize(@extractions_extraction_forms_projects_section)\n respond_to do |format|\n if @extractions_extraction_forms_projects_section.update(extractions_extraction_forms_projects_section_params)\n format.html do\n if params[:extractions_extraction_forms_projects_section].has_key? :extraction_ids\n redirect_to consolidate_project_extractions_path(@extractions_extraction_forms_projects_section.project,\n extraction_ids: params[:extractions_extraction_forms_projects_section][:extraction_ids],\n 'panel-tab': @extractions_extraction_forms_projects_section.extraction_forms_projects_section.id.to_s),\n notice: t('success')\n else\n redirect_to work_extraction_path(\n @extractions_extraction_forms_projects_section.extraction,\n \"panel-tab\": @extractions_extraction_forms_projects_section.extraction_forms_projects_section.id.to_s\n ),\n notice: t('success')\n end\n end\n format.json do\n type1_params = extractions_extraction_forms_projects_section_params[:extractions_extraction_forms_projects_sections_type1s_attributes]\n type1_params = type1_params['0']['type1_attributes']\n type1 = Type1.find_by(name: type1_params['name'], description: type1_params['description'])\n eefpst1 = ExtractionsExtractionFormsProjectsSectionsType1\n .find_by(\n extractions_extraction_forms_projects_section: @extractions_extraction_forms_projects_section,\n type1:\n )\n render json: { extractions_extraction_forms_projects_sections_type1_id: eefpst1.id }\n end\n format.js do\n if params[:extractions_extraction_forms_projects_section][:action] == 'work'\n @consolidated_extraction = @extractions_extraction_forms_projects_section.extraction\n render '/extractions_extraction_forms_projects_sections/work_update'\n else\n @action = params[:extractions_extraction_forms_projects_section][:action]\n @extraction = @extractions_extraction_forms_projects_section.extraction\n @linked_type2_sections = @extractions_extraction_forms_projects_section.link_to_type2s\n @results_eefps = @extraction.find_eefps_by_section_type('Results')\n end\n end\n else\n format.html do\n redirect_to work_extraction_path(\n @extractions_extraction_forms_projects_section.extraction,\n \"panel-tab\": @extractions_extraction_forms_projects_section.extraction_forms_projects_section.id.to_s\n ),\n alert: t('failure')\n end\n format.json do\n render json: @extractions_extraction_forms_projects_section.errors, status: :unprocessable_entity\n end\n format.js do\n end\n end\n end\n end",
"def index\n @post_sections = PostSection.all\n end",
"def index\n @portfolio_sections = PortfolioSection.all\n @sub_categories = SubCategory.all\n respond_to do |format|\n format.html {render :layout => 'admin'}\n end\n end",
"def new\n @section = Section.new\n @section.page = @page\n\n respond_to do |format|\n format.html # new.html.erb\n format.js\n format.json { render :json => @section }\n end\n end",
"def new\n @section_heading = SectionHeading.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @section_heading }\n end\n end",
"def create\n @menu_section = MenuSection.new(params[:menu_section])\n\n respond_to do |format|\n if @menu_section.save\n format.html { redirect_to @menu_section, notice: 'Menu section was successfully created.' }\n format.json { render json: @menu_section, status: :created, location: @menu_section }\n else\n format.html { render action: \"new\" }\n format.json { render json: @menu_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def portfolio_params\n params.require(:portfolio).permit(:investor)\n end",
"def create\n @section = Section.new(section_params)\n\n if @section.save\n redirect_to sections_path, primary: 'Section was successfully created.'\n else\n render :new\n end\n end",
"def post_section_params\n params[:post_section].permit(:title, :icon, :summary, :additional_text, :post_id, :priority)\n end"
] |
[
"0.60431874",
"0.5990474",
"0.5899722",
"0.57596093",
"0.5750639",
"0.5725831",
"0.57105815",
"0.56725",
"0.56526077",
"0.5643183",
"0.56402206",
"0.5634459",
"0.5610074",
"0.5608394",
"0.5567733",
"0.55623496",
"0.5501148",
"0.54992104",
"0.5463102",
"0.5457635",
"0.5453343",
"0.5443046",
"0.5433656",
"0.5427508",
"0.54140455",
"0.5405987",
"0.539915",
"0.5397937",
"0.5397937",
"0.53867793",
"0.5385405",
"0.5384166",
"0.5382287",
"0.5372148",
"0.5367528",
"0.5366322",
"0.5359119",
"0.5333375",
"0.5331981",
"0.5331981",
"0.5331981",
"0.5331981",
"0.53269553",
"0.53234047",
"0.5310405",
"0.529056",
"0.5269441",
"0.5267863",
"0.52654827",
"0.52579635",
"0.52572227",
"0.5243189",
"0.5227587",
"0.52151996",
"0.5199842",
"0.51952386",
"0.5191941",
"0.5180878",
"0.5177046",
"0.51477057",
"0.51421595",
"0.51365125",
"0.5132975",
"0.51235753",
"0.51166415",
"0.5115886",
"0.5101923",
"0.50983655",
"0.5089275",
"0.5086683",
"0.50762767",
"0.50470865",
"0.5046722",
"0.5038348",
"0.5038329",
"0.5033951",
"0.50318307",
"0.50312275",
"0.50297374",
"0.5027202",
"0.5021992",
"0.50177985",
"0.5016183",
"0.50132823",
"0.5011932",
"0.49967846",
"0.49941385",
"0.49904847",
"0.49877852",
"0.498746",
"0.4986337",
"0.49862272",
"0.4983308",
"0.4971005",
"0.4966848",
"0.4965726",
"0.4964508",
"0.49603018",
"0.49586904",
"0.49581954"
] |
0.67352015
|
0
|
PATCH/PUT /portfolio_sections/1 or /portfolio_sections/1.json
|
def update
respond_to do |format|
if @portfolio_section.update(portfolio_section_params)
format.html { redirect_to @portfolio_section, notice: "Portfolio section was successfully updated." }
format.json { render :show, status: :ok, location: @portfolio_section }
else
format.html { render :edit, status: :unprocessable_entity }
format.json { render json: @portfolio_section.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n respond_to do |format|\n if @portfolio.update(portfolio_params)\n format.html { redirect_to portfolios_path, notice: 'Portfolio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @portfolio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @portfolio.update(portfolio_params)\n render json: @portfolio\n else\n render json: @portfolio.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def update\n @portfolio = Portfolio.find(params[:id])\n \n @portfolio.secondary_specializations_2 = params[:portfolio][:specialization].split(\"_\")[1]\n\n logger.info \"IN Edit and @portfolios : #{params[:portfolio][:specialization].split(\"_\")[0]}\"\n respond_to do |format|\n if @portfolio.update_attributes(params[:portfolio])\n if params[:portfolio][:specialization].split(\"_\")[0] == 'Other' then\n logger.info \"IN Edit and @portfolios : #{params[:portfolio][:specialization].split(\"_\")[0]}\"\n logger.info \"IN Edit and @portfolios : #{params['secondary_specilizations_text']}\"\n @portfolio.update_attribute(:secondary_specializations_2, params['secondary_specilizations_text'])\n flash[:notice5] = 'Portfolio was successfully updated.'\n else\n @portfolio.update_attribute(:specialization, params[:portfolio][:specialization].split(\"_\")[0])\n end\n flash[:notice5] = 'Portfolio was successfully updated.'\n logger.info \"Updated portfolio with ID : #{@portfolio.id}\"\n format.html { redirect_to(\"/portfolios/edit/#{@portfolio.id}\") }\n format.xml { head :ok }\n else\n format.html { render :action => \"/portfolios/edit/#{@portfolio.id}\" }\n format.xml { render :xml => @portfolio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @portfolio.update(portfolio_params)\n format.html { redirect_to @portfolio, notice: 'Portfolio was successfully updated.' }\n format.json { render :show, status: :ok, location: @portfolio }\n else\n format.html { render :edit }\n format.json { render json: @portfolio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @portfolio.update(portfolio_params)\n format.html { redirect_to partner_portfolio_path(@portfolio), notice: 'Portfolio was successfully updated.' }\n format.json { render :show, status: :ok, location: @portfolio }\n else\n format.html { render :edit }\n format.json { render json: @portfolio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @portfolio = Portfolio.find(params[:id])\n\n respond_to do |format|\n if @portfolio.update_attributes(params[:portfolio])\n format.html { redirect_to @portfolio, notice: 'Portfolio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @portfolio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_portfolio_section\n @portfolio_section = PortfolioSection.find(params[:id])\n end",
"def update\n # need to call the find\n @portfolio_item = Portfolio.find(params[:id])\n\n respond_to do |format|\n if @portfolio_item.update(params.require(:portfolio).permit(:title, :subtitle, :body))\n format.html { redirect_to portfolios_path, notice: 'The record was successfully updated.' }\n format.json { render :show, status: :ok, location: @blog }\n else\n format.html { render :edit }\n format.json { render json: @portfolio_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @portfolio_item = Portfolio.find(params[:id])\n respond_to do |format|\n if @portfolio_item .update(params.require(:portfolio).permit(:title, :subtitle, :body))\n format.html { redirect_to portfolios_path, notice: 'Cambios del articulo guardados' }\n format.json { render :show, status: :ok, location: @blog }\n else\n format.html { render :edit }\n #format.json { render json: @portfolio_item .errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @lab_section.update(lab_section_params)\n format.html { redirect_to @lab_section, notice: 'Lab section was successfully updated.' }\n format.json { render :show, status: :ok, location: @lab_section }\n else\n format.html { render :edit }\n format.json { render json: @lab_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @home = Home.first\n @about = About.first\n\n @section = Section.find(params[:id])\n\n respond_to do |format|\n if @section.update(section_params)\n format.html { redirect_to admin_section_path(@section), notice: 'Section was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @projectportfolio.update(projectportfolio_params)\n format.html { redirect_to @projectportfolio, notice: 'Projectportfolio was successfully updated.' }\n format.json { render :show, status: :ok, location: @projectportfolio }\n else\n format.html { render :edit }\n format.json { render json: @projectportfolio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @section = Section.find(params[:id])\n\n respond_to do |format|\n if @section.update_attributes(params[:section])\n format.html { redirect_to @section, notice: 'Section was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @section = Section.find(params[:id])\n\n respond_to do |format|\n if @section.update_attributes(params[:section])\n format.html { redirect_to @section, notice: 'Section was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @section = Section.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @section.update_attributes(params[:section])\r\n format.html { redirect_to @section, notice: 'Section was successfully updated.' }\r\n format.json { head :ok }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @section.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @section_heading = SectionHeading.find(params[:id])\n\n respond_to do |format|\n if @section_heading.update_attributes(params[:section_heading])\n format.html { redirect_to @section_heading, notice: 'Section heading was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @section_heading.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @section = Section.find(params[:pk])\n @section.update_attributes( params[:name] => params[:value] )\n \n if @section.save\n render json: { :results => true }\n else\n render json: { :results => false }\n end\n \n end",
"def update\n respond_to do |format|\n if @individual_portfolio_invesetment.update(individual_portfolio_invesetment_params)\n format.html { redirect_to @individual_portfolio_invesetment, notice: 'Individual portfolio invesetment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @individual_portfolio_invesetment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @section.update(section_params)\n @section.check_index()\n form_wrapper = FormWrapper.find(@section.form_wrapper_id)\n format.html { redirect_to sections_section_path(form_wrapper), alert: I18n.t('activerecord.models.section.single') + I18n.t('helpers_locale.models.created') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n section_chunks = get_chunks(params)\n\n puts params\n redirect_to @course\n\n return\n\n sections = params['sections']\n if sections.nil?\n # Loop through course's existing sections.\n @course.sections.each do |section|\n\n end\n end\n \n respond_to do |format|\n # Update subcontents\n if update_section_chunks(section_chunks)\n format.html { redirect_to @course }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @section.update(section_params)\n render :show, status: :ok, location: @section\n else\n render json: @section.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @section_heading.update(section_heading_params)\n format.html { redirect_to @section_heading, notice: 'Section heading was successfully updated.' }\n format.json { render :show, status: :ok, location: @section_heading }\n else\n format.html { render :edit }\n format.json { render json: @section_heading.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @portfolio_counter.update(portfolio_counter_params)\n format.html { redirect_to @portfolio_counter, notice: 'Portfolio counter was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @portfolio_counter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if !has_right?(:edit)\n redirect_to :unauthorized\n return\n end\n @section_preview = SectionPreview.find(params[:id])\n update_objects(@section_preview, params[:section_preview]) ### Add to all resources\n end",
"def update\n @portfolio = Portfolio.new(portfolio_params)\n authorize @portfolio\n respond_to do |format|\n if @portfolio.update(portfolio_params)\n format.html { redirect_to @portfolio, notice: 'Portfolio was successfully updated.' }\n format.json { render :show, status: :ok, location: @portfolio }\n else\n format.html { render :edit }\n format.json { render json: @portfolio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @portfolio = Portfolio.find(params[:id])\n\n respond_to do |format|\n if @portfolio.update_attributes(params[:portfolio])\n format.html { redirect_to(@portfolio, :notice => 'Portfolio was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @portfolio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pricing_section.update(pricing_section_params)\n format.html { redirect_to @pricing_section, notice: \"Pricing section was successfully updated.\" }\n format.json { render :show, status: :ok, location: @pricing_section }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @pricing_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # { subsection:\n # {\n # \"id\" : id\n # \"subsection_datum_id\":references\n # }\n # }\n if @subsection.update_attributes(params[:module])\n head :no_content\n else\n render json: @subsection.errors.full_messages,\n status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @soa_section.update(soa_section_params.merge({serial_number: @soa_section.serial_number += 1, revision: @soa_section.revision += 1 }))\n format.html { redirect_to domain_dns_zone_path(@soa_section.dns_zone.domain, @soa_section.dns_zone), notice: 'Soa section was successfully updated.' }\n format.json { head :no_content }\n else\n format.html do\n flash[:alert] = \"SoaSection validation failed: #{@soa_section.errors.messages}\"\n render action: :edit\n end\n format.json { render json: @soa_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @dj_portfolio.update(dj_portfolio_params)\n format.html { redirect_to @dj_portfolio, notice: 'Dj portfolio was successfully updated.' }\n format.json { render :show, status: :ok, location: @dj_portfolio }\n else\n format.html { render :edit }\n format.json { render json: @dj_portfolio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @shareportfolio.update(shareportfolio_params)\n format.html { redirect_to @shareportfolio, notice: 'Shareportfolio was successfully updated.' }\n format.json { render :show, status: :ok, location: @shareportfolio }\n else\n format.html { render :edit }\n format.json { render json: @shareportfolio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @portfolio_item.update(portfolio_item_params)\n format.html { redirect_to @portfolio_item, notice: 'Portfolio item was successfully updated.' }\n format.json { render :show, status: :ok, location: @portfolio_item }\n else\n format.html { render :edit }\n format.json { render json: @portfolio_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @section.update(section_params)\n format.html { redirect_to @section, notice: 'Section was successfully updated.' }\n format.json { render :show, status: :ok, location: @section }\n else\n format.html { render :edit }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @section.update(section_params)\n format.html { redirect_to @section, notice: 'Section was successfully updated.' }\n format.json { render :show, status: :ok, location: @section }\n else\n format.html { render :edit }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @section.update(section_params)\n format.html { redirect_to @section, notice: 'Section was successfully updated.' }\n format.json { render :show, status: :ok, location: @section }\n else\n format.html { render :edit }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @section.update(section_params)\n format.html { redirect_to @section, notice: 'Section was successfully updated.' }\n format.json { render :show, status: :ok, location: @section }\n else\n format.html { render :edit }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @section.update(section_params)\n format.html { redirect_to @section, notice: 'Section was successfully updated.' }\n format.json { render :show, status: :ok, location: @section }\n else\n format.html { render :edit }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @section.update(section_params)\n format.html { redirect_to @section, notice: 'Section was successfully updated.' }\n format.json { render :show, status: :ok, location: @section }\n else\n format.html { render :edit }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @section.update(section_params)\n format.html { redirect_to @section,\n notice: 'Section was successfully updated.' }\n format.json { render :show, status: :ok, location: @section }\n else\n format.html { render :edit }\n format.json { render json: @section.errors,\n status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n if @portfolio.update(portfolio_params)\n save_pictures\n render json: { message: \"success\", portfolioId: @portfolio.id }, status: 200\n else\n render json: { error: @portfolio.errors.values.join(\",\")}, status: 400\n end\n\n end",
"def update\n respond_to do |format|\n if @section.update(section_params)\n format.html { redirect_to @section, notice: 'Section was successfully updated.' }\n format.json { render json: @section }\n else\n format.html { render action: 'edit' }\n format.json { render json: ErrorSerializer.serialize(@section.errors), status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @survey_section.update(survey_section_params)\n format.html { redirect_to @survey_section, notice: 'Survey section was successfully updated.' }\n format.json { render :show, status: :ok, location: @survey_section }\n else\n format.html { render :edit }\n format.json { render json: @survey_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # The before_filter find_slice is run beforehand\n\n respond_to do |format|\n if @slice.update_attributes(params[:slice])\n flash[:notice] = 'Slice was successfully updated.'\n format.html { redirect_to(@slice) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @slice.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n render :text => \"The update action is not implemented as of yet!\"\n # @minimal_risk_portfolio = MinimalRiskPortfolio.find(params[:id])\n #\n # respond_to do |format|\n # if @minimal_risk_portfolio.update_attributes(params[:minimal_risk_portfolio])\n # flash[:notice] = 'MinimalRiskPortfolio was successfully updated.'\n # format.html { redirect_to(@minimal_risk_portfolio) }\n # format.xml { head :ok }\n # else\n # format.html { render :action => \"edit\" }\n # format.xml { render :xml => @minimal_risk_portfolio.errors, :status => :unprocessable_entity }\n # end\n # end\n end",
"def update\n @section = @account.sections.find(params[:id])\n @section.account = @account\n\n respond_to do |format|\n if @section.update_attributes(params[:section])\n flash[:notice] = 'Section updated'\n format.js\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n authorize(@extractions_extraction_forms_projects_section)\n respond_to do |format|\n if @extractions_extraction_forms_projects_section.update(extractions_extraction_forms_projects_section_params)\n format.html do\n if params[:extractions_extraction_forms_projects_section].has_key? :extraction_ids\n redirect_to consolidate_project_extractions_path(@extractions_extraction_forms_projects_section.project,\n extraction_ids: params[:extractions_extraction_forms_projects_section][:extraction_ids],\n 'panel-tab': @extractions_extraction_forms_projects_section.extraction_forms_projects_section.id.to_s),\n notice: t('success')\n else\n redirect_to work_extraction_path(\n @extractions_extraction_forms_projects_section.extraction,\n \"panel-tab\": @extractions_extraction_forms_projects_section.extraction_forms_projects_section.id.to_s\n ),\n notice: t('success')\n end\n end\n format.json do\n type1_params = extractions_extraction_forms_projects_section_params[:extractions_extraction_forms_projects_sections_type1s_attributes]\n type1_params = type1_params['0']['type1_attributes']\n type1 = Type1.find_by(name: type1_params['name'], description: type1_params['description'])\n eefpst1 = ExtractionsExtractionFormsProjectsSectionsType1\n .find_by(\n extractions_extraction_forms_projects_section: @extractions_extraction_forms_projects_section,\n type1:\n )\n render json: { extractions_extraction_forms_projects_sections_type1_id: eefpst1.id }\n end\n format.js do\n if params[:extractions_extraction_forms_projects_section][:action] == 'work'\n @consolidated_extraction = @extractions_extraction_forms_projects_section.extraction\n render '/extractions_extraction_forms_projects_sections/work_update'\n else\n @action = params[:extractions_extraction_forms_projects_section][:action]\n @extraction = @extractions_extraction_forms_projects_section.extraction\n @linked_type2_sections = @extractions_extraction_forms_projects_section.link_to_type2s\n @results_eefps = @extraction.find_eefps_by_section_type('Results')\n end\n end\n else\n format.html do\n redirect_to work_extraction_path(\n @extractions_extraction_forms_projects_section.extraction,\n \"panel-tab\": @extractions_extraction_forms_projects_section.extraction_forms_projects_section.id.to_s\n ),\n alert: t('failure')\n end\n format.json do\n render json: @extractions_extraction_forms_projects_section.errors, status: :unprocessable_entity\n end\n format.js do\n end\n end\n end\n end",
"def update\n @play = Play.find(params[:play_id])\n @section = Section.find(params[:id])\n\n respond_to do |format|\n if @section.update_attributes(params[:section])\n format.html { redirect_to edit_play_url(@play), notice: 'section was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { redirect_to edit_play_url(@play) }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @subsection.update(subsection_params)\n format.html { redirect_to @subsection, notice: 'Subsection was successfully updated.' }\n format.json { render :show, status: :ok, location: @subsection }\n else\n format.html { render :edit }\n format.json { render json: @subsection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize Section\n\n respond_to do |format|\n if @section.update(section_params)\n format.html { redirect_to @section.article, notice: 'Section was successfully updated.' }\n format.json { render :show, status: :ok, location: @section }\n else\n @section_count = article.sections.count\n format.html { render :edit }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if section.update_attributes(params[:section_datum])\n head :no_content\n else\n render json: section.errors.full_messages,\n status: :unprocessable_entity\n end\n end",
"def portfolio_section_params\n params.require(:portfolio_section).permit(:section_id, :description)\n end",
"def update\n respond_to do |format|\n if @extractions_extraction_forms_projects_sections_type1.update(extractions_extraction_forms_projects_sections_type1_params)\n format.html { redirect_to work_extraction_path(@extractions_extraction_forms_projects_sections_type1\n .extractions_extraction_forms_projects_section\n .extraction,\n anchor: \"panel-tab-#{ @extractions_extraction_forms_projects_sections_type1\n .extractions_extraction_forms_projects_section.id }\"),\n notice: t('success') }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @extractions_extraction_forms_projects_sections_type1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #@portfolio_item = Portfolio.find(params[:id])\n respond_to do |format|\n if @portfolio_item.update( portfolio_params)\n format.html { redirect_to portfolios_path, notice: 'Portfolio record was updated!' }\n else\n format.html { render :edit }\n end\n end\n end",
"def update_portfolio_with_http_info(id, portfolio, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PortfolioApi.update_portfolio ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling PortfolioApi.update_portfolio\"\n end\n pattern = Regexp.new(/^\\d+$/)\n if @api_client.config.client_side_validation && id !~ pattern\n fail ArgumentError, \"invalid value for 'id' when calling PortfolioApi.update_portfolio, must conform to the pattern #{pattern}.\"\n end\n\n # verify the required parameter 'portfolio' is set\n if @api_client.config.client_side_validation && portfolio.nil?\n fail ArgumentError, \"Missing the required parameter 'portfolio' when calling PortfolioApi.update_portfolio\"\n end\n # resource path\n local_var_path = '/portfolios/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(portfolio) \n\n # return_type\n return_type = opts[:return_type] || 'Portfolio' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PortfolioApi#update_portfolio\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n @sections = Section.find(:all)\n @section = Section.find(params[:section_id])\n\n respond_to do |format|\n if @section.update_attributes(params[:section])\n flash[:notice] = 'Section was successfully updated.'\n format.html { redirect_to(@section) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @company_part.update(company_part_params)\n format.html { redirect_to company_parts_path, notice: 'Company part was successfully updated.' }\n format.json { render :show, status: :ok, location: @company_part }\n else\n format.html { render :edit }\n format.json { render json: @company_part.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @section.update(section_params)\n render json: SectionSerializer.new(@section)\n else\n render json: @menu.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @post_section.update(post_section_params)\n format.html { redirect_to admin_post_section_url(@post, @post_section), notice: 'Section was successfully updated.' }\n format.json { render :show, status: :ok, location: admin_post_section_url(@post, @post_section) }\n else\n format.html { render :edit }\n format.json { render json: @post_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @section = Section.find(params[:id])\n @page = @section.page\n\n respond_to do |format|\n if @section.update_attributes(params[:section])\n format.html { redirect_to @page, :notice => 'Section was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n # render json:params\n # return \n\n\n respond_to do |format|\n if @manage_section.update(manage_section_params)\n format.html { redirect_to manage_compete_url(@compete), notice: 'Section was successfully updated.' }\n format.json { render :show, status: :ok, location: @manage_section }\n else\n format.html { render :edit }\n format.json { render json: @manage_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @homepage_section_content.update(homepage_section_content_params)\n format.html { redirect_to homepage_index_path, notice: 'Homepage section content was successfully updated.' }\n format.json { render :show, status: :ok, location: @homepage_section_content }\n else\n format.html { render :edit }\n format.json { render json: homepage_index_path.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @extractions_extraction_forms_projects_section.update(extractions_extraction_forms_projects_section_params)\n format.html { redirect_to work_extraction_path(@extractions_extraction_forms_projects_section.extraction,\n anchor: \"panel-tab-#{ @extractions_extraction_forms_projects_section.id.to_s }\"),\n notice: t('success') }\n format.json { render :show, status: :ok, location: @extractions_extraction_forms_projects_section }\n else\n format.html { redirect_to work_extraction_path(@extractions_extraction_forms_projects_section.extraction,\n anchor: \"panel-tab-#{ @extractions_extraction_forms_projects_section.id.to_s }\"),\n alert: t('failure') }\n format.json { render json: @extractions_extraction_forms_projects_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @section.update(admin_section_params)\n format.html { redirect_to admin_sections_path, notice: 'Section was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_section }\n else\n format.html { render :edit }\n format.json { render json: @admin_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @portfolio = current_user.portfolios.find(params[:portfolio_id])\n @instrument = @portfolio.instruments.find(params[:id])\n\n respond_to do |format|\n if @instrument.update_attributes(params[:instrument])\n format.html { redirect_to portfolios_path, notice: 'Instrument was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @instrument.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @section = Section.find(params[:id])\n\n respond_to do |format|\n if @section.update_attributes(params[:section])\n format.html { redirect_to(admin_sections_path, :notice => 'Section was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @portfolio.update(portfolio_params)\n redirect_to @portfolio\n end",
"def update\n respond_to do |format|\n if @sectionalization.update(sectionalization_params)\n format.html { redirect_to @sectionalization, notice: 'Sectionalization was successfully updated.' }\n format.json { render :show, status: :ok, location: @sectionalization }\n else\n format.html { render :edit }\n format.json { render json: @sectionalization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @portfolio = Portfolio.find(params[:id])\n\n\n respond_to do |format|\n if @portfolio.update_attributes(params[:portfolio])\n\n #if @portfolio.save\n if @portfolio.updater current_user\n format.html { redirect_to @portfolio, notice: 'Portfolio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @portfolio.errors, status: :unprocessable_entity }\n\n end\n else\n format.html { render action: \"edit\" }\n format.json { render json: @portfolio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @opinionable = find_opinionable\n #@portfolio = Portfolio.find(params[:portfolio_id])\n @opinion = @opinionable.opinions.find(params[:id])\n\n\n\n respond_to do |format|\n if @opinion.update_attributes(params[:opinion])\n format.html { redirect_to [@opinionable,@opinion], notice: 'Opinion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @opinion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @section_test = SectionTest.find(params[:id])\n\n respond_to do |format|\n if @section_test.update_attributes(params[:section_test])\n format.html { redirect_to @section_test, notice: 'Section test was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @section_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end",
"def update\n respond_to do |format|\n @portfolio_entry.assign_attributes(params, :as=>@role)\n if @portfolio_entry.save\n format.html { redirect_to @portfolio_entry, :notice => 'Portfolio entry was successfully updated.' }\n format.json { render :json => @portfolio_entry.ajax_attrs(@role) }\n else\n\t format.html { redirect_to @portfolio_entry, :notice => 'Failure updating Portfolio entry.' }\n format.json { render :json=>report_error(@portfolio_entry)}\n end\n end\n end",
"def update\n respond_to do |format|\n if @cms_page_section.update(cms_page_section_params)\n format.html { redirect_to @cms_page_section, notice: 'Page section was successfully updated.' }\n format.json { render :show, status: :ok, location: @cms_page_section }\n else\n format.html { render :edit }\n format.json { render json: @cms_page_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n @section = Section.find(params[:id])\n\n respond_to do |format|\n if @section.update_attributes(params[:section])\n format.html { redirect_to(@section, :notice => 'Section was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @section = Section.find(params[:id])\n\n respond_to do |format|\n if @section.update_attributes(params[:section])\n format.html { redirect_to(@section, :notice => 'Section was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @store_section = StoreSection.find(params[:id])\n\n respond_to do |format|\n if @store_section.update_attributes(params[:store_section])\n format.html { redirect_to @store_section, notice: 'Store section was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @store_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @portfoliolog.update(portfoliolog_params)\n format.html { redirect_to @portfoliolog, notice: 'Portfoliolog was successfully updated.' }\n format.json { render :show, status: :ok, location: @portfoliolog }\n else\n format.html { render :edit }\n format.json { render json: @portfoliolog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_sections_with_http_info(name, sections, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.set_sections ...'\n end\n\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling SlidesApi.set_sections\"\n end\n # verify the required parameter 'sections' is set\n if @api_client.config.client_side_validation && sections.nil?\n fail ArgumentError, \"Missing the required parameter 'sections' when calling SlidesApi.set_sections\"\n end\n # resource path\n local_var_path = '/slides/{name}/sections'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n\n # query parameters\n query_params = {}\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = @api_client.object_to_http_body(sections)\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'Sections')\n return data, status_code, headers\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tif @portfolio_item.update(portfolio_item_params)\n\t\t\t\tformat.html { redirect_to @portfolio_item, notice: 'Item was successfully updated.' }\n\t\t\t\tformat.json { render :show, status: :ok, location: @portfolio_item }\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @portfolio_item.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n respond_to do |format|\n if @headline.update(headline_params)\n format.html { redirect_to @headline, notice: 'Headline was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @headline.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @specialization\n\n respond_to do |format|\n if @specialization.update(specialization_update_params)\n format.html { redirect_to @specialization, notice: I18n.t(\"activerecord.notice.specialization.success_update\") }\n format.json { render :show, status: :ok, location: @specialization }\n else\n format.html { render :edit }\n format.json { render json: @specialization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @capitol.update(capitol_params)\n format.html { redirect_to root_path, notice: 'Capitol was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @capitol.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @page = Page.find(params[:id])\n @page.section_id = params[:section_id] unless params[:section_id].nil? \n @page.title = params[:title] unless params[:title].nil? \n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n #ormat.json { head :no_content }\n format.js\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def update\n update_user_attribution @section, false, true\n respond_to do |format|\n if @section.update(section_params)\n format.js do\n flash[:notice] = \"Section was successfully updated\"\n render layout: false\n end\n format.html { redirect_to edit_document_path(@section.document), notice: 'Section was successfully updated.' }\n format.json { render :show, status: :ok, location: @section }\n else\n format.html { redirect_to edit_document_path(@section.document), notice: 'Failed to update section.' }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @story_modality.update(story_modality_params)\n format.html { redirect_to @story_modality, notice: 'Story modality was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @story_modality.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @section_configuration.update(section_configuration_params)\n format.html { redirect_to @section_configuration, notice: 'Section configuration was successfully updated.' }\n format.json { render :show, status: :ok, location: @section_configuration }\n else\n format.html { render :edit }\n format.json { render json: @section_configuration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @menu_section = MenuSection.find(params[:id])\n\n respond_to do |format|\n if @menu_section.update_attributes(params[:menu_section])\n format.html { redirect_to @menu_section, notice: 'Menu section was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @menu_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @page_section.update(page_section_params)\n format.html { redirect_to @page_section,\n notice: t('shared.msgs.success_updated',\n obj: t('activerecord.models.page_section', count: 1)) }\n format.json { render :show, status: :ok, location: @page_section }\n else\n format.html { render :edit }\n format.json { render json: @page_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cash_collection.update(cash_collection_params)\n format.html { redirect_to @cash_collection, notice: 'Cash collection was successfully updated.' }\n format.json { render :show, status: :ok, location: @cash_collection }\n else\n format.html { render :edit }\n format.json { render json: @cash_collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course_section.update(course_section_params)\n format.html { redirect_to @course_section, notice: 'Course section was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @course_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @collection = Atrium::Exhibit.find(params[:id])\n @collection.facet_order = params[:collection]\n\n respond_to do |format|\n format.json { render :json => @collection.facet_order }\n end\n end",
"def update\r\n @theoretical_part = TheoreticalPart.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @theoretical_part.update_attributes(params[:theoretical_part])\r\n format.html { redirect_to @theoretical_part, notice: 'Theoretical part was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @theoretical_part.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n # A bit of security here to ensure we get values we expected:\n # - 'false'\n # - 'citations'\n # - 'project'\n propagation_scope = { 'false' => false, 'citations' => :citations,\n 'project' => :project }[extractions_extraction_forms_projects_sections_type1_params.dig(\n :should, :propagate\n )]\n\n # If we want to propagate then do it now.\n if propagation_scope\n @extractions_extraction_forms_projects_sections_type1.propagate_type1_change(propagation_scope,\n extractions_extraction_forms_projects_sections_type1_params)\n end\n\n respond_to do |format|\n if @extractions_extraction_forms_projects_sections_type1.update(extractions_extraction_forms_projects_sections_type1_params)\n format.html do\n redirect_to work_extraction_path(@extractions_extraction_forms_projects_sections_type1.extraction,\n 'panel-tab': @extractions_extraction_forms_projects_sections_type1\n .extractions_extraction_forms_projects_section\n .extraction_forms_projects_section.id),\n notice: t('success')\n end\n format.json { render json: {} }\n format.js {}\n else\n format.html do\n flash[:alert] = @extractions_extraction_forms_projects_sections_type1.errors.messages.values.dig(0, 0)\n render :edit\n end\n format.json do\n render json: @extractions_extraction_forms_projects_sections_type1.errors, status: :unprocessable_entity\n end\n format.js {}\n end\n end\n end",
"def update\n respond_to do |format|\n if @stock_collection.update(stock_collection_params)\n format.html { redirect_to @stock_collection, notice: 'Stock collection was successfully updated.' }\n format.json { render :show, status: :ok, location: @stock_collection }\n else\n format.html { render :edit }\n format.json { render json: @stock_collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @resume_collection.update(resume_collection_params)\n format.html { redirect_to @resume_collection, notice: 'Resume collection was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @resume_collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @community_section.update(community_section_params)\n format.html { redirect_to @community_section, notice: 'Community section was successfully updated.' }\n format.json { render :show, status: :ok, location: @community_section }\n else\n format.html { render :edit }\n format.json { render json: @community_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @section_row.update(section_row_params)\n flash[:success] = \"Section row was successfully updated.\"\n format.html { redirect_to @section_row }\n format.json { render :show, status: :ok, location: @section_row }\n else\n format.html { render :edit }\n format.json { render json: @section_row.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6760475",
"0.6745794",
"0.6541424",
"0.65223616",
"0.6522224",
"0.6475697",
"0.647009",
"0.6319075",
"0.6313279",
"0.6299481",
"0.6241893",
"0.6223241",
"0.6188944",
"0.6185844",
"0.6148391",
"0.6128615",
"0.6113522",
"0.61014324",
"0.60972816",
"0.6095056",
"0.6086648",
"0.6081322",
"0.6073101",
"0.6044629",
"0.60428566",
"0.603276",
"0.6004957",
"0.59978974",
"0.5993506",
"0.5991726",
"0.5986005",
"0.5985884",
"0.59755427",
"0.59755427",
"0.59755427",
"0.59755427",
"0.59755427",
"0.59755427",
"0.5953062",
"0.595285",
"0.59402066",
"0.5934756",
"0.59258085",
"0.5921522",
"0.5917102",
"0.5915788",
"0.59111524",
"0.59101254",
"0.5901585",
"0.58885497",
"0.58863163",
"0.5884637",
"0.5883568",
"0.5879174",
"0.5876958",
"0.5864125",
"0.58530915",
"0.5824032",
"0.5813405",
"0.5808728",
"0.58042383",
"0.58022404",
"0.58010715",
"0.5795094",
"0.57769465",
"0.57496077",
"0.57495695",
"0.57484925",
"0.57474416",
"0.5746891",
"0.57457346",
"0.57452774",
"0.5738157",
"0.5730048",
"0.57276887",
"0.572468",
"0.572468",
"0.5716211",
"0.5711578",
"0.57111186",
"0.5709935",
"0.57071507",
"0.5707018",
"0.5703594",
"0.5695966",
"0.56753236",
"0.56727207",
"0.5671904",
"0.5669565",
"0.5668039",
"0.5662552",
"0.56576335",
"0.5654081",
"0.56539977",
"0.56514156",
"0.5642819",
"0.56419736",
"0.56384075",
"0.5633744",
"0.56262517"
] |
0.75231564
|
0
|
DELETE /portfolio_sections/1 or /portfolio_sections/1.json
|
def destroy
@portfolio_section.destroy
respond_to do |format|
format.html { redirect_to portfolio_sections_url, notice: "Portfolio section was successfully destroyed." }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @portfolio.destroy\n respond_to do |format|\n format.html { redirect_to portfolios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @portfolio = Portfolio.find(params[:id])\n @portfolio.destroy\n\n respond_to do |format|\n format.html { redirect_to portfolios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @portfolio = Portfolio.find(params[:id])\n @portfolio.destroy\n\n respond_to do |format|\n format.html { redirect_to portfolios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @portfolio.destroy\n\n head :no_content\n end",
"def destroy\n @section_heading = SectionHeading.find(params[:id])\n @section_heading.destroy\n\n respond_to do |format|\n format.html { redirect_to section_headings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @home = Home.first\n @about = About.first\n \n @section = Section.find(params[:id])\n \n @section.destroy\n respond_to do |format|\n format.html { redirect_to admin_sections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @portfolio.destroy\n respond_to do |format|\n format.html { redirect_to portfolios_url, notice: 'Portfolio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @portfolio.destroy\n respond_to do |format|\n format.html { redirect_to portfolios_url, notice: 'Portfolio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @portfolio.destroy\n respond_to do |format|\n format.html { redirect_to portfolios_url, notice: 'Portfolio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @portfolio.destroy\n respond_to do |format|\n format.html { redirect_to portfolios_url, notice: 'Portfolio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @individual_portfolio_invesetment.destroy\n respond_to do |format|\n format.html { redirect_to individual_portfolio_invesetments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section.destroy\n respond_to do |format|\n format.html { redirect_to sections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section.destroy\n respond_to do |format|\n format.html { redirect_to sections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section = Section.find(params[:id])\n @section.destroy\n\n respond_to do |format|\n format.html { redirect_to sections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section = Section.find(params[:id])\n @section.destroy\n\n respond_to do |format|\n format.html { redirect_to sections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @extractions_extraction_forms_projects_sections_type1.destroy\n respond_to do |format|\n format.html { redirect_to work_extraction_path(@extractions_extraction_forms_projects_sections_type1\n .extractions_extraction_forms_projects_section\n .extraction,\n anchor: \"panel-tab-#{ @extractions_extraction_forms_projects_sections_type1\n .extractions_extraction_forms_projects_section.id }\"),\n notice: t('removed') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @extractions_extraction_forms_projects_sections_type1.destroy\n respond_to do |format|\n format.html do\n redirect_to work_extraction_path(@extractions_extraction_forms_projects_sections_type1\n .extractions_extraction_forms_projects_section\n .extraction,\n 'panel-tab': @extractions_extraction_forms_projects_sections_type1\n .extractions_extraction_forms_projects_section\n .extraction_forms_projects_section\n .id),\n notice: t('removed')\n end\n format.json { head :no_content }\n end\n end",
"def destroy\n @sections = Section.find(:all)\n @section = Section.find(params[:section_id])\n @section.destroy\n\n respond_to do |format|\n format.html { redirect_to(sections_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n #Realiza la busqueda\n @portfolio_item = Portfolio.find(params[:id])\n #Elimina o destruye el articulo\n @portfolio_item.destroy\n #Redirecciona la pagina\n respond_to do |format|\n format.html { redirect_to portfolios_url, notice: 'El articulo ha sido eliminado' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lab_section.destroy\n respond_to do |format|\n format.html { redirect_to lab_sections_url, notice: 'Lab section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shareportfolio.destroy\n respond_to do |format|\n format.html { redirect_to shareportfolios_url, notice: 'Shareportfolio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @section = Section.find(params[:id])\r\n @section.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to :back }\r\n format.json { head :ok }\r\n end\r\n end",
"def destroy\n @menu_section = MenuSection.find(params[:id])\n @menu_section.destroy\n\n respond_to do |format|\n format.html { redirect_to menu_sections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @portfolio = Portfolio.find(params[:id])\n @portfolio.destroy\n\n respond_to do |format|\n format.html { redirect_to(portfolios_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @portfolio = Portfolio.find(params[:id])\n @portfolio.destroy\n\n respond_to do |format|\n format.html { redirect_to(portfolios_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @dj_portfolio.destroy\n respond_to do |format|\n format.html { redirect_to dj_portfolios_url, notice: 'Dj portfolio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section_heading.destroy\n respond_to do |format|\n format.html { redirect_to section_headings_url, notice: 'Section heading was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @projectportfolio.destroy\n respond_to do |format|\n format.html { redirect_to projectportfolios_url, notice: 'Projectportfolio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section = Section.find(params[:id])\n @section.destroy\n\n render nothing: true\n end",
"def destroy\n @section = Section.find(params[:id])\n @section.destroy\n\n respond_to do |format|\n format.html { redirect_to(sections_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @section = Section.find(params[:id])\n @section.destroy\n\n respond_to do |format|\n format.html { redirect_to(sections_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @portfolio.destroy\n redirect_to portfolios_url\n end",
"def destroy\n @portfolio_counter.destroy\n respond_to do |format|\n format.html { redirect_to portfolio_counters_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section_category = SectionCategory.find(params[:id])\n @section_category.destroy\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end",
"def destroy \n section = SectionDatum.find(params[:id])\n if section.destroy\n head :no_content\n else\n render json: section.errors.full_messages,\n status: :unprocessable_entity\n end\n end",
"def destroy\n @portfolio = current_user.portfolios.find(params[:portfolio_id])\n @instrument = @portfolio.instruments.find(params[:id])\n @instrument.destroy\n respond_to do |format|\n format.html { redirect_to portfolios_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n respond_to do |format|\n if !@portfolio_entry.destroy\n format.json { render :json=>report_error(@portfolio_entry)}\n else\n format.json { render :json=>{}}\n end\n end\n end",
"def destroy\n @headline.destroy\n respond_to do |format|\n format.html { redirect_to headlines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @headline.destroy\n respond_to do |format|\n format.html { redirect_to headlines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @homepage_section_content.destroy\n respond_to do |format|\n format.html { redirect_to homepage_index_path, notice: 'Homepage section content was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n # Test this query on rail console for menu section that has food\n ActiveRecord::Base.connection.exec_query(\n \"DELETE FROM menu_sections\n WHERE url_id = #{params[:id]}\n AND NOT EXISTS (\n SELECT 1\n FROM Foods\n WHERE ms_url_id = #{params[:id]}\n );\"\n ) \n\n menu_section = ActiveRecord::Base.connection.exec_query(\n \"SELECT 1\n FROM menu_sections\n WHERE url_id = #{params[:id]}\"\n )\n\n if (!menu_section.empty?)\n render json: {errors: \"Cannot delete menu section that has dish in it!\"}, status: 500\n end\n end",
"def destroy\n @portion = Portion.find(params[:id])\n @portion.destroy\n\n respond_to do |format|\n format.html { redirect_to portions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @portfolio_item.destroy\n respond_to do |format|\n format.html { redirect_to portfolio_items_url, notice: 'Portfolio item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section.destroy\n respond_to do |format|\n format.html { redirect_to sections_url, notice: 'Section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section.destroy\n respond_to do |format|\n format.html { redirect_to sections_url, notice: 'Section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section.destroy\n respond_to do |format|\n format.html { redirect_to sections_url, notice: 'Section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section.destroy\n respond_to do |format|\n format.html { redirect_to sections_url, notice: 'Section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section.destroy\n respond_to do |format|\n format.html { redirect_to sections_url, notice: 'Section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section.destroy\n respond_to do |format|\n format.html { redirect_to sections_url, notice: 'Section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_section = TimeSection.find(params[:id])\n @time_section.destroy\n\n respond_to do |format|\n format.html { redirect_to time_sections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @survey_section.destroy\n respond_to do |format|\n format.html { redirect_to survey_sections_url, notice: 'Survey section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section.destroy\n respond_to do |format|\n format.html { redirect_to sections_url,\n notice: 'Section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section = @account.sections.find(params[:id])\n @section.destroy\n\n respond_to do |format|\n format.html { redirect_to(account_sections_url(@account)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @image_section = ImageSection.find(params[:id])\n @image_section.destroy\n\n respond_to do |format|\n format.html { redirect_to image_sections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @three60.destroy\n respond_to do |format|\n format.html { redirect_to edit_admin_good_url(@good, anchor: \"three60\") }\n format.json { head :no_content }\n end\n end",
"def destroy\n @portfolio_finance.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Portfolio finance was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @domicile_type_section = DomicileTypeSection.find(params[:id])\n @domicile_type_section.destroy\n\n respond_to do |format|\n format.html { redirect_to(domicile_type_sections_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @store_section = StoreSection.find(params[:id])\n @store_section.destroy\n\n respond_to do |format|\n format.html { redirect_to store_sections_url }\n format.json { head :no_content }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @cms_page_section.destroy\n respond_to do |format|\n format.html { redirect_to cms_page_sections_url, notice: 'Page section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_from_entzumena\n headline = Headline.where({:source_item_type => params[:source_item_type], :source_item_id => params[:source_item_id]}).first\n if headline.destroy\n render :json => true, :status => 200\n else\n render :json => false, :status => :error\n end\n end",
"def destroy\n @section_test = SectionTest.find(params[:id])\n @section_test.destroy\n\n respond_to do |format|\n format.html { redirect_to section_tests_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @pricing_section.destroy\n respond_to do |format|\n format.html { redirect_to pricing_sections_url, notice: \"Pricing section was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section.destroy\n render json: SectionSerializer.new(@section)\n end",
"def destroy\n @example_section = ExampleSection.find(params[:id])\n @example_section.destroy\n\n respond_to do |format|\n format.html { redirect_to(example_sections_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @sectionalization.destroy\n respond_to do |format|\n format.html { redirect_to sectionalizations_url, notice: 'Sectionalization was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @portfoliolog.destroy\n respond_to do |format|\n format.html { redirect_to portfoliologs_url, notice: 'Portfoliolog was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n render :text => \"The destroy action is not implemented as of yet!\"\n # @minimal_risk_portfolio = MinimalRiskPortfolio.find(params[:id])\n # @minimal_risk_portfolio.destroy\n #\n # respond_to do |format|\n # format.html { redirect_to(minimal_risk_portfolios_url) }\n # format.xml { head :ok }\n # end\n end",
"def destroy\n @section = Section.find(params[:id])\n @page = @section.page\n @section.destroy\n\n respond_to do |format|\n format.html { redirect_to @page, :notice => 'Section was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @make_section = MakeSection.find(params[:id])\n @make_section.destroy\n\n respond_to do |format|\n format.html { redirect_to(make_sections_url) }\n format.xml { head :ok }\n end\n \n end",
"def destroy\n @storyline = Storyline.find(params[:id])\n @storyline.destroy\n\n respond_to do |format|\n format.html { redirect_to storylines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @research.destroy\n respond_to do |format|\n format.html { redirect_to menu_investigacion_3_path, notice: 'La actividad se elimino con exito.' }\n format.json { head :no_content }\n end\n\n end",
"def destroy\n authorize Section\n \n @section.destroy\n respond_to do |format|\n format.html { redirect_to @section.article, notice: 'Section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stuff = Stuff.find(params[:id])\n @stuff.destroy\n\n respond_to do |format|\n format.html { redirect_to stuff_index_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ruby.destroy\n respond_to do |format|\n format.html { redirect_to rubies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @story.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @socioeconomic_study = SocioeconomicStudy.find(params[:id])\n @socioeconomic_study.destroy\n\n respond_to do |format|\n format.html { redirect_to socioeconomic_studies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # The before_filter find_slice is run beforehand\n @slice.destroy\n\n respond_to do |format|\n format.html { redirect_to(:back) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @admin_section.destroy\n respond_to do |format|\n format.html { redirect_to admin_sections_url, notice: 'Section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page_section.destroy\n respond_to do |format|\n format.html { redirect_to page_sections_url,\n notice: t('shared.msgs.success_destroyed',\n obj: t('activerecord.models.page_section', count: 1)) }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @theoretical_part = TheoreticalPart.find(params[:id])\r\n @theoretical_part.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to theoretical_parts_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def delete\n render json: Company.delete(params[\"id\"])\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def destroy\n @shop_section = ShopSection.find(params[:id])\n @shop_section.destroy\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @manage_section.destroy\n respond_to do |format|\n format.html { redirect_to manage_compete_url(@compete), notice: 'Section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @play = Play.find(params[:play_id])\n @section = Section.find(params[:id])\n @section.destroy\n\n respond_to do |format|\n format.html { redirect_to edit_play_url(@play) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @major.destroy\n respond_to do |format|\n format.html { redirect_to majors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @portfolio_item = PortfolioItem.find(params[:id])\n @portfolio_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(portfolio_items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @featured_project.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @solution.destroy\n respond_to do |format|\n format.html { redirect_to solutions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tutorial_section.destroy\n respond_to do |format|\n format.html { redirect_to tutorial_sections_url, notice: 'Tutorial section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @so_header = SoHeader.find(params[:so_header_id])\n @so_line = @so_header.so_lines.find(params[:id])\n @so_line.destroy\n\n respond_to do |format|\n format.html { redirect_to so_header_so_lines_url(@so_header) }\n format.json { head :ok }\n end\n end",
"def destroy\n @study = Study.find(params[:id])\n @study.destroy\n\n respond_to do |format|\n format.html { redirect_to studies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @interview = Interview.find_by_slug(params[:id])\n @interview.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_interviews_path, notice: 'Interview was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @navigation_solution = NavigationSolution.find(params[:id])\n @navigation_solution.destroy\n\n respond_to do |format|\n format.html { redirect_to navigation_solutions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fascicle.destroy\n respond_to do |format|\n format.html { redirect_to fascicles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @institution_app_pages_section.destroy\n respond_to do |format|\n format.html { redirect_to institution_app_pages_sections_url }\n format.json { head :no_content }\n end\n end",
"def delete_section_with_http_info(name, section_index, with_slides = nil, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.delete_section ...'\n end\n\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling SlidesApi.delete_section\"\n end\n # verify the required parameter 'section_index' is set\n if @api_client.config.client_side_validation && section_index.nil?\n fail ArgumentError, \"Missing the required parameter 'section_index' when calling SlidesApi.delete_section\"\n end\n # resource path\n local_var_path = '/slides/{name}/sections/{sectionIndex}'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'sectionIndex', section_index)\n\n # query parameters\n query_params = {}\n query_params[:'withSlides'] = @api_client.prepare_for_query(with_slides) unless with_slides.nil?\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = nil\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'Sections')\n return data, status_code, headers\n end",
"def destroy\r\n @disciplines_study = DisciplinesStudy.find(params[:id])\r\n @disciplines_study.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to disciplines_studies_url }\r\n format.json { head :no_content }\r\n end\r\n end"
] |
[
"0.7024811",
"0.68701804",
"0.68602204",
"0.68602204",
"0.68563086",
"0.6772851",
"0.6762478",
"0.6718766",
"0.6718766",
"0.6718766",
"0.6718766",
"0.67173123",
"0.6711294",
"0.6711294",
"0.6698228",
"0.6698228",
"0.66063607",
"0.6601907",
"0.65477306",
"0.65272635",
"0.6522436",
"0.6507569",
"0.6490755",
"0.6475934",
"0.64642406",
"0.64642406",
"0.6427692",
"0.642685",
"0.6420923",
"0.6418071",
"0.6408295",
"0.6408295",
"0.63865757",
"0.6383761",
"0.63821125",
"0.6380089",
"0.63757265",
"0.6375654",
"0.63737595",
"0.63737595",
"0.63670343",
"0.6362759",
"0.6337616",
"0.63331944",
"0.63308126",
"0.63308126",
"0.63308126",
"0.63308126",
"0.63308126",
"0.63308126",
"0.63231367",
"0.63196087",
"0.6319183",
"0.63184834",
"0.631461",
"0.6312064",
"0.6300544",
"0.629878",
"0.6297209",
"0.6291365",
"0.6278802",
"0.6278166",
"0.6278069",
"0.62774795",
"0.6276855",
"0.6251191",
"0.6248755",
"0.62465",
"0.62444013",
"0.6241812",
"0.623069",
"0.6227201",
"0.62271893",
"0.62210196",
"0.6211417",
"0.62030125",
"0.620233",
"0.6192865",
"0.618903",
"0.61848444",
"0.61820143",
"0.61772466",
"0.61756724",
"0.61744547",
"0.6167841",
"0.6163923",
"0.61516213",
"0.61502236",
"0.6149873",
"0.61478966",
"0.61418027",
"0.61389285",
"0.6136967",
"0.61364275",
"0.61356103",
"0.61322385",
"0.6129514",
"0.6128077",
"0.6119729",
"0.61157036"
] |
0.7480284
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_portfolio_section
@portfolio_section = PortfolioSection.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
Only allow a list of trusted parameters through.
|
def portfolio_section_params
params.require(:portfolio_section).permit(:section_id, :description)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def allow_params_authentication!; end",
"def whitelisted_args\n args.select &:allowed\n end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def filtered_parameters; end",
"def sanitize_params_for user, params, allowed_params\n params.each do |key, val|\n #if allowed_params.include?(key)\n #sanitize!(user, params, key) if key =~ /_attributes|_ids$/\n #else\n #params.delete(key)\n #end\n params.delete(key) unless allowed_params.include?(key.to_sym)\n end\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def expected_permitted_parameter_names; end",
"def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindata_default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n bindata_mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n # ensure mutual exclusion\n bindata_mutually_exclusive_parameters.each do |param1, param2|\n if params.has_key?(param1) and params.has_key?(param2)\n raise ArgumentError, \"params #{param1} and #{param2} \" +\n \"are mutually exclusive\"\n end\n end\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def check_params; true; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def allowed?(*_)\n true\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def secure_params\n return @secure_params if @secure_params\n\n defn = implementation_class.definition\n field_list = [:master_id] + defn.field_list_array\n\n res = params.require(controller_name.singularize.to_sym).permit(field_list)\n res[implementation_class.external_id_attribute.to_sym] = nil if implementation_class.allow_to_generate_ids?\n @secure_params = res\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permit( params, whitelist, name = nil )\n raise 'Parametrization not yet configured' unless @configured\n whitelist ||= []\n px = params.respond_to?( :permit ) ? params : ActionController::Parameters.new( params )\n px = dig(px, name)\n px.permit( *whitelist )\n end",
"def valid_params?; end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def url_allowlist=(_arg0); end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def list_params\n params.permit(:list_name)\n end",
"def valid_params_request?; end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def param_list(param_type, name, type, required, description = nil, allowed_values = [], hash = {})\n hash.merge!({allowable_values: {value_type: \"LIST\", values: allowed_values}})\n param(param_type, name, type, required, description, hash)\n end",
"def safelists; end",
"def authorize_own_lists\n authorize_lists current_user.lists\n end",
"def listed_params\n params.permit(:listed, :list_id, :listable_id, :listable_type, :campsite_id)\n end",
"def lists_params\n params.require(:list).permit(:name)\n\n end",
"def list_params\n params.require(:list).permit(:name, :user_id)\n end",
"def list_params\n params.require(:list).permit(:name, :description, :type, :privacy, :allow_edit, :rating, :votes_count, :user_id)\n end",
"def check_params\n true\n end",
"def authorize_own_or_shared_lists\n authorize_lists current_user.all_lists\n end",
"def user_pref_list_params\n\t\tparams.require(:user).permit(:preference_list)\n\tend",
"def may_contain!(*keys)\n self.allow_only_permitted = true\n self.permitted_keys = [*permitted_keys, *keys].uniq\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def whitelist; end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.permit(:name)\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :list, :references)\n end",
"def cancan_parameter_sanitizer\n resource = controller_name.singularize.to_sym\n method = \"#{resource}_params\"\n params[resource] &&= send(method) if respond_to?(method, true)\n end",
"def list_params\n params.require(:list).permit(:name).merge(user_id: current_user.id)\n end",
"def whitelist_place_params\n params.require(:place).permit(:place_name, :unlock, :auth, :is_deep_checked, :parent_ADM4, :parent_ADM3, :parent_ADM2, :parent_ADM1, :parent_country, feature_code: [], same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def list_params\n params.fetch(:list, {}).permit(:user_id, :name, :active)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def permitted_params\n []\n end",
"def price_list_params\n params.fetch(:price_list, {}).permit(:name, :valid_from, :valid_to, :active,\n :all_warehouses, :all_users, :all_contact_groups,\n warehouse_ids: [], price_lists_user_ids: [], contact_group_ids: [])\n end",
"def params(list)\n @declared_params = list\n end",
"def admin_review_params\n params.fetch(:review, {}).permit(whitelisted_params)\n end",
"def saved_list_params\n params.require(:saved_list).permit(:user_id)\n end",
"def allow(ids); end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def filter_params(param_set, **kwargs)\r\n begin\r\n key = kwargs[:key]\r\n params.require(key).permit(*param_set)\r\n rescue Exception\r\n params.permit(*param_set)\r\n end\r\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def validate_paramified_params\n self.class.paramify_methods.each do |method|\n params = send(method)\n transfer_errors_from(params, TermMapper.scope(params.group)) if !params.valid?\n end\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def secure_params\n return @secure_params if @secure_params\n\n @implementation_class = implementation_class\n resname = @implementation_class.name.ns_underscore.gsub('__', '_').singularize.to_sym\n @secure_params = params.require(resname).permit(*permitted_params)\n end",
"def refine_permitted_params(param_list)\n res = param_list.dup\n\n ms_keys = res.select { |a| columns_hash[a.to_s]&.array }\n ms_keys.each do |k|\n res.delete(k)\n res << { k => [] }\n end\n\n res\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :description, recipient_id_array: [])\n end",
"def safelist; end",
"def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"def valid_for_params_auth?; end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def shopping_list_params\n params.require(:shopping_list).permit!\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def permitters\n @_parametrizr_permitters || {}\n end",
"def allow_params(action, keys: nil, except: nil, &blk)\n keys &&= Array.wrap(keys)\n keys ||= User.field_names\n except &&= Array.wrap(except)\n except ||= %i[id email]\n devise_parameter_sanitizer.permit(action, keys: keys, except: except, &blk)\n end",
"def list_params\n if current_user && current_user.role == 'admin'\n params.require(:list).permit(:name, :url, :description, :user_id,\n ideas_attributes: [:id, :list_id, :body, :due_date, :completion_status, :_destroy])\n else\n params.require(:list).permit(:name, :description,\n ideas_attributes: [:body, :due_date, :completion_status]) \n end\n end",
"def whitelist(params)\n send_request_of_type(GlobalConstant::PrivateOpsApi.private_ops_api_type, 'post', '/token-sale/whitelist', params)\n end",
"def valid_access_params\n params.require(:valid_access).permit(:wish_list_id, :user_id)\n end",
"def url_allowlist; end",
"def ensure_redirected_params_are_safe!(passed_params)\n unless passed_params.is_a?(ActionController::Parameters) && passed_params.permitted?\n error_message = if passed_params.is_a?(ActionController::Parameters)\n unsafe_parameters = passed_params.send(:unpermitted_keys, params)\n \"[Rails::Prg] Error - Must use permitted strong parameters. Unsafe: #{unsafe_parameters.join(', ')}\"\n else\n \"[Rails::Prg] Error - Must pass strong parameters.\"\n end\n raise error_message\n end\n end",
"def data_collection_params\n allow = [:name,:description,:institution,:collection_name,:country_id,:province_id,:city_id]\n params.require(:data_collection).permit(allow)\n end",
"def quote_params\n params.permit!\n end"
] |
[
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.6326454",
"0.63140553",
"0.6299814",
"0.62642586",
"0.626006",
"0.62578833",
"0.6236823",
"0.6227561",
"0.6221758",
"0.62200165",
"0.620879",
"0.61983657",
"0.6195055",
"0.6172993",
"0.6156856",
"0.61558664",
"0.61521494",
"0.6135789",
"0.6121145",
"0.61118174",
"0.60736513",
"0.6071645",
"0.60632104",
"0.60549796",
"0.6043906",
"0.6034662",
"0.60207325",
"0.6018568",
"0.6016575",
"0.60103434",
"0.60084206",
"0.600763",
"0.6007443",
"0.6003619",
"0.6003619",
"0.5995791",
"0.5993301",
"0.5993231",
"0.5984926",
"0.597122",
"0.5968121",
"0.5965808",
"0.59640145",
"0.59632224",
"0.59602356",
"0.59332967",
"0.5927556",
"0.5922805",
"0.5909745",
"0.5905083",
"0.5904304",
"0.5893434",
"0.58888215",
"0.58823985",
"0.58823985",
"0.58823985",
"0.5873434",
"0.58619875",
"0.58533794",
"0.5845531",
"0.58426666",
"0.58360124",
"0.583218",
"0.5828041",
"0.5827927",
"0.5816121",
"0.5814705",
"0.5812719",
"0.581121",
"0.5803423",
"0.5803423",
"0.57995003",
"0.5794207",
"0.5784923",
"0.5781365",
"0.5776385",
"0.5774859",
"0.57671493",
"0.5766998",
"0.57618684",
"0.5758038"
] |
0.0
|
-1
|
Provides for mapping model attributes to attributes of the returned amazonecs result object. An optional parameter allows for certain attributes which may occur multiple times (eg. the authors of a book) to be returned as a single string joined with a provided parameter eg. maps_to_amazon_attribute :authorlist => 'authors', :combine => ';' maps_to_amazon_attribute :title => 'product_name' maps_to_amazon_attribute :isbn => 'asin'
|
def maps_to_amazon_attribute(args = {})
if @amazon_mappings.nil?
@amazon_mappings = Hash.new
@amazon_join_mappings = Hash.new
end
joiner = args.delete(:combine) if args[:combine]
args.each do |key, value|
if joiner
@amazon_join_mappings[key] = [value, joiner]
else
@amazon_mappings[key] = value
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def attributor(attributes)\n inject_s(attributes) {|key, value| \" #{key.to_s}=\\\"#{value.to_s}\\\"\"}\n end",
"def attribute(*args)\n if args.first.is_a?(Hash)\n args.first.each_pair { |k,v| self.attribute(k, :as => v) }\n else # array of attributes\n options = args.extract_options!\n @_options[:attributes] ||= {}\n args.each { |name| @_options[:attributes][name] = options[:as] || name }\n end\n end",
"def parse_attributes! #:nodoc:\n self.attributes = (attributes || []).map do |attr|\n Barbecue::Generators::GeneratedAttribute.parse(attr)\n end\n end",
"def associate_attributes(attributes)\n return attributes.each_with_object({}) do |pair, hash|\n hash[pair[0]] = pair[1]\n end\n end",
"def get_attributes(row, given_attrs)\n given_attrs.collect do |x|\n row[x] = serialized_attributes[x].dump(row[x]) if @serialized_attributes_keys.include? x\n row[x]\n end\n end",
"def combine_string_fields(attribute_list, options)\n combined_attribute = CombinedStringField.new(attribute_list.map { |a| [a].flatten.first }, options[:store_on])\n\n attribute_list.each do |attribute_name|\n attribute_manager = nil\n if attribute_name.is_a?(Array)\n attribute_name, attribute_type = attribute_name\n attribute_manager = Aggregate::AttributeHandler.factory(\"\", attribute_type, {})\n end\n\n define_method(attribute_name) do\n combined_attribute.read(self, attribute_name, attribute_manager)\n end\n\n define_method(\"#{attribute_name}=\") do |value|\n combined_attribute.write(self, attribute_name, value, attribute_manager)\n end\n\n define_method(\"#{attribute_name}_changed?\") do\n combined_attribute.changed?(self, attribute_name, attribute_manager)\n end\n end\n # rubocop:enable Metrics/MethodLength\n # rubocop:enable Metrics/AbcSize\n\n %w[read_attribute _read_attribute].each do |method_name|\n define_method(method_name) do |name|\n if name.in?(attribute_list.map { |a| [a].flatten.first.to_s })\n send(name)\n else\n super(name)\n end\n end\n end\n\n define_method(\"write_attribute\") do |name, value|\n if name.in?(attribute_list.map { |a| [a].flatten.first.to_s })\n send(\"#{name}=\", value)\n else\n super(name, value)\n end\n end\n end",
"def attributes(*args)\n args.each do |attr|\n attribute(attr)\n end\n end",
"def process_attribute_map( dataset_conf )\n attribute_map = dataset_conf[\"indexing\"][\"attribute_map\"]\n \n map = {}\n primary_attribute = nil\n map_to_index_field = nil\n \n # Extract all of the needed index mapping data from the \"attribute_map\"\n # - The \"attribute_map\" defines how the biomart attributes relate to the index \"fields\"\n # - The \"primary_attribute\" is the biomart attribute used to associate a set of biomart \n # results to an index \"doc\" - using the \"map_to_index_field\" field as the link.\n attribute_map.each do |mapping_obj|\n if mapping_obj[\"use_to_map\"]\n if primary_attribute\n raise StandardError \"You have defined more than one attribute to map to the index with! Please check your config...\"\n else\n primary_attribute = mapping_obj[\"attr\"]\n map_to_index_field = mapping_obj[\"idx\"].to_sym\n end\n end\n \n map[ mapping_obj[\"attr\"] ] = mapping_obj\n map[ mapping_obj[\"attr\"] ][\"idx\"] = map[ mapping_obj[\"attr\"] ][\"idx\"].to_sym\n end\n \n unless primary_attribute\n raise StandardError \"You have not specified an attribute to map to the index with in #{dataset_conf[\"internal_name\"]}!\"\n end\n \n return {\n :attribute_map => map,\n :primary_attribute => primary_attribute,\n :map_to_index_field => map_to_index_field\n }\n end",
"def parse_attributes! #:nodoc:\n self.attributes = (attributes || []).map do |key_value|\n name, type = key_value.split(':')\n Rails::Generators::GeneratedAttribute.new(name, type)\n end\n end",
"def attributes= attributes\n attributes.except('id', :id).map do |key_value|\n __send__ \"#{key_value.first}=\", key_value.last\n end\n\n self.attributes\n end",
"def parse_attributes!\n self.attributes = (attributes || []).map do |key_value|\n name, type, index, default = key_value.split(/:/)\n opts = {}\n if default\n opts[:default] = default\n end\n if index\n index_type, constraint = index.split(/,/)\n if constraint == 'not_null'\n opts[:null] = false\n end\n end\n create_attribute(name, type, index_type, opts)\n end\n end",
"def attributes(*args)\n args.each { |attr| attribute(attr) }\n end",
"def klass_attribute_to_metadata_attribute_map\n {\n :avalon_uploader => :creator,\n :avalon_publisher => :publisher,\n :title => :main_title,\n :alternative_title => :alternative_title,\n :translated_title => :translated_title,\n :uniform_title => :uniform_title,\n :statement_of_responsibility => :statement_of_responsibility,\n :creator => :creator,\n :date_created => :date_created,\n :date_issued => :date_issued,\n :copyright_date => :copyright_date,\n :abstract => :abstract,\n :note => :note,\n :format => :media_type,\n :contributor => :contributor,\n :publisher => :publisher,\n :genre => :genre,\n :subject => :topical_subject,\n :related_item => :related_item_id,\n :collection => :collection,\n :geographic_subject => :geographic_subject,\n :temporal_subject => :temporal_subject,\n :topical_subject => :topical_subject,\n :collection => :collection\n }\n end",
"def model_attributes(setters_list)\n attributes = {}\n setters_list.each do |setter|\n attribute = setter.to_s[0..-2] # get rid of =\n value = send(attribute)\n attributes[attribute.to_sym] = value\n end\n attributes\n end",
"def attributes\n @attributes = Hash[attrs.map { |a| [a.to_sym, send(\"#{a}\")] }]\n end",
"def attr(name, params = {})\n defaults = {\n :columns => [],\n :associations => [],\n :default => false,\n :include => false,\n :order => nil,\n :proc => nil\n }\n if self.columns.include? name\n defaults[:columns] = [name]\n end\n\n params = defaults.merge params\n\n setup_attrs\n\n # Make sure columns are absolutely qualified, in case we do wacky\n # joins\n params[:columns].map! do |column|\n \"#{self.table_name}__#{column}\".to_sym\n end\n\n @attrs << name unless @attrs.include? name\n @attr_strings << name.to_s unless @attr_strings.include? name.to_s\n @attr_columns[name.to_s] = params[:columns]\n @attr_associations[name.to_s] = params[:associations]\n @default_attrs << name if params[:default] unless @default_attrs.include? name\n @include_attrs << name if params[:include] unless @include_attrs.include? name\n @procs[name] = params[:proc] if params[:proc]\n \n if params[:order]\n @attr_orders << name\n end\n end",
"def apply_attributes(attributes)\n attributes.each { |k, v| self[k] = v }\n return self\n end",
"def column_attrs\n attrs = {}\n\n if params[:institution_id]\n attrs[Institution] = [params[:institution_id], :abbreviation]\n end\n\n if params[:provider_id]\n attrs[Provider] = [params[:provider_id], :abbreviation]\n end\n\n if params[:program_id]\n attrs[Program] = [params[:program_id], :abbreviation]\n end\n\n if params[:core_id]\n attrs[Core] = [params[:core_id], :abbreviation]\n end\n\n attrs[\"Unique PI Last Name\"] = :last_name\n attrs[\"Unique PI First Name\"] = :first_name\n attrs[\"Email\"] = :email\n attrs[\"Institution\"] = \"try(:professional_org_lookup, 'institution')\"\n attrs[\"College\"] = \"try(:professional_org_lookup, 'college')\"\n attrs[\"Department\"] = \"try(:professional_org_lookup, 'department')\"\n attrs[\"Division\"] = \"try(:professional_org_lookup, 'division')\"\n attrs[\"ERA Commons Name\"] = :era_commons_name\n attrs[\"ORCID\"] = :orcid\n\n if Setting.get_value(\"displayed_demographics_fields\").include?(\"gender\")\n attrs[\"Gender\"] = \"self.display_gender\"\n end\n\n if Setting.get_value(\"displayed_demographics_fields\").include?(\"age_group\")\n attrs[\"Age Group\"] = \"self.display_age_group\"\n end\n\n if Setting.get_value(\"displayed_demographics_fields\").include?(\"ethnicity\")\n attrs[\"Hispanic/Latino?\"] = \"self.display_ethnicity\"\n end\n\n if Setting.get_value(\"displayed_demographics_fields\").include?(\"race\")\n attrs[\"Race\"] = \"self.display_races\"\n end\n attrs\n end",
"def attributs()\n if block_given?\n rados_getxattrs.each { |key,value| \n yield key,value\n }\n else\n return rados_getxattrs\n end\n \n end",
"def map_attributes(&block)\n if !block_given? || block.arity != 1\n raise InvalidBlockSpecification, \"after proc should have an arity of 1 (Hash|Array: values)\"\n end \n @options[:map_attributes] = block\n end",
"def result_attrs\n main_result[\"@attr\"] rescue {}\n end",
"def transform_attr(key, value); end",
"def attributes(attributes)\n @attributes = attributes.to_a.map do |k, v|\n { :name => k,\n :type => v,\n :length => Tem::Abi.send(:\"#{v}_length\") \n }\n end\n end",
"def mva_attributes(index, record)\n attrs = {}\n\n index.mva_sources.each do |name, mva_proc|\n attrs[name] = mva_proc.call(record)\n end if index.mva_sources\n\n attrs\n end",
"def add_attributes(out, attrs, well_known_map)\n if attrs.include?(:name)\n wk = well_known_map[attrs[:name]]\n raise RuntimeError, \"unknown name: #{attrs[:name]}\" unless wk\n attrs = attrs.merge(wk)\n end\n attrs.each {|attr, val| out << ' %s=\"%s\"' % [attr, val] if attr.is_a?(String)}\nend",
"def map_attributes(mapping, attributes)\n attributes = mapping.inject(attributes) do |hash, (from, to)|\n hash[to.to_s] = hash.delete(from.to_s)\n\n hash\n end\n end",
"def annotations_with_attribute(attrib, include_values = false)\n return [] if attrib.blank?\n\n obj_type = self.class.base_class.name\n\n options = {\n joins: :annotation_attribute,\n conditions: { annotatable_type: obj_type,\n annotatable_id: id,\n annotation_attributes: { name: attrib.strip.downcase } },\n order: 'updated_at DESC'\n }\n\n options[:include] = [:value] if include_values\n\n fetch_annotations(options)\n end",
"def attributes(object)\n attributes = {}\n @mapping.each do |key, method|\n attributes[key.to_sym] = chain_methods(object, method, {method_separator: @method_separator, force_method_calls: @force_method_calls}) # unless key.to_sym == :uid\n end\n attributes\n end",
"def attributes(attrs)\n\t\t\tattrs.each do |k,v|\n\t\t\t\tsetter = \"#{k}=\".to_sym\n\t\t\t\tself.send(setter, v)\n\t\t\tend\n\t\t\t\n\t\t\tyield self if block_given?\n\t\t\t\n\t\t\treturn self\n\t\tend",
"def mva_attributes(index, record)\n return {} if index.mva_sources.blank?\n\n index.mva_sources.each_with_object({}) do |(name, mva_proc), attrs|\n attrs[name] = mva_proc.call(record)\n end\n end",
"def to_params\n Hash[* @result_attributes.collect{|k| \n v = self.send(k)\n (v) ? [k,self.send(k)] : nil\n }.compact.flatten]\n end",
"def attributes=(_arg0); end",
"def convert_attributes attributes, dropped_attributes_count,\n include_agent_attribute: false\n attribute_map = {}\n if include_agent_attribute\n attribute_map[AGENT_KEY] = convert_attribute_value AGENT_VALUE\n end\n attributes.each do |k, v|\n attribute_map[convert_attribute_name k] =\n convert_attribute_value v\n end\n TraceProtos::Span::Attributes.new \\\n attribute_map: attribute_map,\n dropped_attributes_count: dropped_attributes_count\n end",
"def create_attribute options\n attributes = options[ :attributes ]\n attr_value = options[ :value ]\n attributes.each do | attr_name |\n self.class.class_eval do\n define_method attr_name do\n instance_variable_get \"@#{ attr_name }\"\n end\n define_method \"#{ attr_name }=\" do | value |\n instance_variable_set( \"@#{ attr_name }\", value )\n end\n end\n self.public_send( \"#{ attr_name }=\", attr_value )\n end\n end",
"def export_attributes(hash = nil, options = {})\n attribute_map.assign_context = self\n\n hash ||= attributes\n attribute_map.map_attributes(hash, options)\n end",
"def format_attributes(attributes)\n if attributes.size > 0\n \" \" + attributes.map{ |k, v, attr| format_attribute(k, v, attr)}.join(\" \")\n else\n \"\"\n end\n end",
"def initialize(attributes)\n @name = attributes.fetch(:name)\n @id = attributes.fetch(:id)\n # @artist = attributes.fetch(:artist)\n # @genre = attributes.fetch(:genre)\n # @year = attributes.fetch(:year)\n # @in_inventory = attributes.fetch(:in_inventory, true) \n end",
"def attributes_mapping\n common = {\n :hourly_billing_flag => :hourlyBillingFlag,\n :os_code => :operatingSystemReferenceCode,\n :vlan => :primaryNetworkComponent,\n :private_vlan => :primaryBackendNetworkComponent,\n :key_pairs => :sshKeys,\n :private_network_only => :privateNetworkOnlyFlag,\n :user_data => :userData,\n :provision_script => :postInstallScriptUri,\n :network_components => :networkComponents,\n }\n\n conditional = if bare_metal?\n {\n :cpu => :processorCoreAmount,\n :ram => :memoryCapacity,\n :disk => :hardDrives,\n :bare_metal => :bareMetalInstanceFlag\n }\n else\n {\n :cpu => :startCpus,\n :ram => :maxMemory,\n :disk => :blockDevices,\n :image_id => :blockDeviceTemplateGroup,\n :ephemeral_storage => :localDiskFlag,\n }\n end\n common.merge(conditional)\n end",
"def attributes\n {\n cards_attributes: cards.map(&:attributes), # { |card| card.attributes },\n wallet_token: wallet_token,\n first_name: first_name,\n last_name: last_name,\n email: email,\n age: age,\n account_number: account_number\n }\n end",
"def convert_attrs(str, attrs, exclusive = false)\n convert_attrs_matching_word_pairs(str, attrs, exclusive)\n convert_attrs_word_pair_map(str, attrs, exclusive)\n end",
"def map(attribute_name, options={})\n fauxsql_options[attribute_name] = normalize_options!(options)\n class_eval <<EORUBY, __FILE__, __LINE__\n def #{attribute_name}\n get_fauxsql_map(:#{attribute_name})\n end\nEORUBY\n\n if options[:nest]\n class_eval <<EORUBY, __FILE__, __LINE__\n def #{attribute_name}=(attrs)\n deletes = []\n attrs.each do |index, vals|\n vals = Fauxsql::DSL.normalize_nested_vals!(vals)\n key = #{attribute_name}.get_nested_record(vals)\n #{attribute_name}[key] = vals[:value]\n deletes << key if vals[:_delete]\n end\n deletes.each{ |key| #{attribute_name}.delete(key) }\n end\nEORUBY\n end\n end",
"def process_attributes(attributes = nil)\n return attributes if attributes.blank?\n multi_parameter_attributes = {}\n new_attributes = {}\n attributes.each_pair do |key, value|\n if key.match(DATE_KEY_REGEX)\n match = key.to_s.match(DATE_KEY_REGEX)\n found_key = match[1]\n index = match[2].to_i\n (multi_parameter_attributes[found_key] ||= {})[index] = value.empty? ? nil : value.send(\"to_#{$3}\")\n else\n new_attributes[key] = value\n end\n end\n\n multi_parameter_attributes.empty? ? new_attributes : process_multiparameter_attributes(multi_parameter_attributes, new_attributes)\n end",
"def attributes\n final_class_names = css_class_names\n final_styles = css_styles\n\n ret = @attributes.map do |key,value|\n\n # if the css class or css style is declared, replace the current\n # set coming from the view_helper\n if key.to_sym == :class && value\n final_class_names = value\n nil\n elsif key.to_sym == :style && value\n final_styles = value\n nil\n else\n value ? %(#{key}=\"#{value}\") : nil\n end\n end\n\n # add in class names\n final_class_names = [final_class_names].flatten\n final_class_names << @item_id\n final_class_names.compact!\n unless final_class_names.empty?\n ret << %(class=\"#{final_class_names.uniq * ' '}\")\n end\n\n # add in styles\n unless final_styles.nil?\n final_styles = [final_styles].flatten\n final_styles.compact!\n ret << %(style=\"#{final_styles.uniq * ' '}\") unless final_styles.empty?\n end\n\n ret.compact * ' '\n end",
"def create_attrs hash\n r = hash.map { |k,v| \"#{k}=\\\"#{escape_attr v.to_s}\\\"\" }.join(' ')\n \" #{r}\" unless r.empty?\n end",
"def rails_attributes\n [\"id\", \"param\", \"team1tot\",\"team2tot\"]\n end",
"def attributes(record)\n {\n # attributes of product\n name: record['name'],\n description: record['description'],\n slug: record['slug'],\n available_on: parse_datetime(record['availability_date']),\n shipping_category: default_shipping_category,\n price: parse_float(record['price']),\n # stock quantity\n master_attributes: stock_attributes(record['stock_total'])\n }.merge(classifications(record['category']))\n end",
"def attrs(*args)\n options = args.last.is_a?(Hash) ? args.pop : { localized: false }\n\n @attributes ||= []\n\n args.each do |name|\n @attributes << define_attribute(name, options[:localized])\n\n if options[:localized]\n @attributes << define_attribute(:\"#{name}_translations\")\n end\n end\n end",
"def display_book_attributes\n [@title, @type, @author, @price]\n end",
"def fetch_attributes(obj:)\n attrs = {}\n attrs[:fixed_by] = obj[\"FixedBy\"] if obj[\"FixedBy\"].present?\n attrs[:link] = obj[\"Link\"] if obj[\"Link\"].present?\n attrs[:metadata] = obj[\"Metadata\"] if obj[\"Metadata\"].present?\n attrs[:severity] = obj[\"Severity\"] if obj[\"Severity\"].present?\n attrs[:description] = obj[\"Description\"] if obj[\"Description\"].present?\n attrs\n end",
"def extract_attributes!(attributes)\n active_source_attributes = attributes.inject({}) do |active_source_attributes, column_values|\n active_source_attributes[column_values.first] = attributes.delete(column_values.first) if self.class.column_names.include? column_values.first\n active_source_attributes\n end\n\n [ active_source_attributes, attributes ]\n end",
"def aliases_for attributes\n attributes.each do |attr, nicks|\n [nicks].flatten.each do |nick|\n self.class_eval(\"alias #{nick} #{attr}\n alias #{nick}= #{attr}=\")\n end\n end\n end",
"def attribute_pairs\n raise \"Must implement attribute_pairs\"\n end",
"def params_to_attributes(params, **extra_params)\n put = self.params[:action] == 'update'\n \n attributes = {}\n attributes.merge!(extra_params) if extra_params\n\n self.class::PARAM_TO_MODEL.each do |f, v|\n if put && !params[f]\n attributes[v] = ''\n elsif params[f]\n attributes[v] = params[f]\n end\n end\n attributes\n end",
"def attributes\n Hash[attribute_pairs].\n merge(media_attributes)\n end",
"def attributes= attributes = {}\n return if attributes.nil?\n attributes.each_pair { |k, v|\n # Parse the nested attributed to instantiate the right model, is applicable\n value = FlightStats::Resource.from_parsed_json(v, k)\n send(\"#{underscore_with_caching(k)}=\", value) rescue nil\n }\n end",
"def assign_meta_search\n\t\t\tassign_attributes meta_search_1: \"#{display_id} #{title} #{description}\"\n\t\t\t\n\t\t\t# tempLocale = I18n.locale\n\t\t\t# I18n.locale = 'vi'\n\n\t\t\t# assign_attributes meta_search_1: \"#{display_id} #{id} #{street.name if street.present?} #{district.name.gsub('Quận', '') if district.present?} #{I18n.t('real_estate_type.name.' + real_estate_type.name) if real_estate_type.present?}\", meta_search_2: \"#{I18n.t('real_estate.attribute.' + (is_alley ? 'alley' : 'facade'))} #{province.name if province.present?}\", meta_search_3: \"#{user_type == 'user' ? \"#{user.full_name} #{user.email} #{user.phone_number}\" : \"#{contact_user.name} #{contact_user.email} #{contact_user.phone_number}\"} #{title.gsub('Quận', '').gsub('quận', '')}\"\n\n\t\t\t# I18n.locale = tempLocale\n\t\tend",
"def attributes\n @attributes ||= @args.collect do |attribute|\n Neo4jrGen::GeneratedAttribute.new(*attribute.split(\":\"))\n end\n end",
"def lively_attributes(*args)\n self._active_attributes += args.collect(&:to_s)\n end",
"def attributes\n {\n cards_attributes: cards.map(&:attributes),\n wallet_token: wallet_token,\n first_name: first_name,\n last_name: last_name,\n email: email,\n age: age,\n account_number: account_number\n }\n end",
"def merge( attributes )\n\t\tattributes.each do |attrname, value|\n\t\t\tself[ attrname ] = value\n\t\tend\n\tend",
"def artist_attributes(issue_id:)\n artists.attributes_by_issue(issue_id: issue_id).map do |record|\n person = record[:person_id] ? \"person-#{record[:person_id]}\" : nil\n record[:person_id] = valkyrie_id(value: person, model: Numismatics::Person)\n record.to_h\n end\n end",
"def model_attrs(except: [])\n attrs = %i(\n name starts_at duration budget fb_ad_account_id interests location\n age_min age_max\n )\n attrs << :publication_id unless [except].flatten.include?(:publication_id)\n attributes.slice(*attrs)\n end",
"def attribute(show_attribute)\n case show_attribute\n when 'deadline'\n return self.deadline\n when 'renter_id'\n return self.renter.surname if self.renter_id > 0\n when 'property_id'\n return self.property.name if self.property_id > 0\n when 'object'\n return self.object.downcase\n when 'price'\n return self.price\n when 'category'\n return self.category\n when 'groupp'\n return self.groupp\n when 'paid'\n return self.paid\n else \n return ''\n end\n end",
"def initialize(attributes)\n @name = attributes.fetch(:name)\n @id = attributes.fetch(:id)\n @release_year = attributes.fetch(:release_year).to_i\n @genre = attributes.fetch(:genre)\n @artist = attributes.fetch(:artist).gsub(\"'\", \"''\")\n end",
"def process_attributes(params, attributes)\n # Get the id of the section corresponding to :section_name\n unless params[:section_name].blank?\n section = Section.find_by_name(params[:section_name])\n unless section.blank?\n attributes[:section_id] = section.id\n end\n end\n\n parameters = [:last_name, :first_name, :type, :grace_credits, :email, :id_number, :hidden]\n parameters.each do |key|\n unless params[key].blank?\n attributes[key] = params[key]\n end\n end\n\n attributes\n end",
"def load_mixed(mixed_results)\n # Reload the name, if needs be...\n @place.name = nil\n\n @attributes = Hash.new { |hash, key| hash[key] = {} }\n @attributes[@current_language] ||= {}\n \n mixed_results.each do |attribute_value|\n @attributes[attribute_value['attribute_language']] ||= {}\n\n unless attribute_value['attribute_source_data_set_id']\n a = PublicEarth::Db::Attribute.find_by_name(attribute_value['attribute_definition_name'])\n if a\n attribute_value['attribute_is_readonly'] = a.readonly\n attribute_value['attribute_allow_many'] = a.allow_many\n attribute_value['attribute_source_data_set_id'] = 'READ_ONLY'\n attribute_value['attribute_definition_type'] = a.data_type\n end\n end\n \n attribute_definition = PublicEarth::Db::Details::Attribute.new(\n self,\n attribute_value['attribute_value_id'],\n attribute_value['attribute_definition_name'],\n attribute_value['attribute_value'],\n attribute_value['attribute_comments'],\n attribute_value['attribute_language'],\n attribute_value['attribute_source_data_set_id'],\n attribute_value['attribute_is_readonly'] == 't',\n attribute_value['attribute_priority'],\n attribute_value['attribute_is_local'] == 't',\n attribute_value['attribute_is_required'] == 't',\n attribute_value['attribute_allow_many'] == 't',\n attribute_value['attribute_definition_type'] \n )\n\n # Since we're getting all the possible attributes, whether or not they have values yet, we \n # need to test to make sure it doesn't exist, i.e. the value from the database should be NULL.\n attribute_definition.exists = true unless attribute_value['attribute_value'].blank?\n\n # Is this a many values attribute?\n if attribute_value['attribute_allow_many'] == 't'\n @attributes[attribute_value['attribute_language']][attribute_value['attribute_definition_name'].to_sym] ||= \n ManyValues.new(self, attribute_definition)\n @attributes[attribute_value['attribute_language']][attribute_value['attribute_definition_name'].to_sym] << \n attribute_definition\n else\n @attributes[attribute_value['attribute_language']][attribute_value['attribute_definition_name'].to_sym] = \n attribute_definition\n end\n end\n @attributes\n end",
"def attribute_and_parameter_values\n attribute_value_pairs = attributes.inject({}) do |h, attr| \n # Attributes may be not synced with db so updating them with attr.update_attribute_value!\n h.merge(attr.display_name => attr.update_attribute_value!)\n end\n params.merge(attribute_value_pairs)\n end",
"def ams_attributes(*method_names, **options)\n method_names.each do |method_name|\n define_method(method_name) { @object.read_attribute_for_serialization(method_name) } unless method_defined?(method_name)\n end\n add_attributes(method_names, **options, strategy: :write_value_using_serializer_strategy)\n end",
"def helper_attr(*attrs); end",
"def attributes(*attrs)\n return '' if attrs.empty?\n attrs.inject({}) { |attrs,hash| attrs.merge(hash) }.\n reject { |k,v| v.nil? }.\n collect { |k,v| \"#{k}='#{h(v)}'\" }.\n join(' ')\n end",
"def attributes(*attrs)\n return '' if attrs.empty?\n attrs.inject({}) { |attrs,hash| attrs.merge(hash) }.\n reject { |k,v| v.nil? }.\n collect { |k,v| \"#{k}='#{h(v)}'\" }.\n join(' ')\n end",
"def mk_attr_str **attr_map\n attr_map.map{|k,v|\" #{k}='#{v}'\"}.join\n end",
"def attributes(options={:strip => true, :null_if_blank => true})\n\t\t\treturn @attributes if @attributes\n\t\t\t@attributes = {}\n\t\t\t@node.attributes.each do |value|\n\t\t\t\t@attributes[value[:name]] = value.evaluate(@node, :attrs => true)\n\t\t\t\t@attributes[value[:name]].strip! if options[:strip]\n\t\t\t\t@attributes[value[:name]] = nil if @attributes[value[:name]].blank? && options[:null_if_blank]\n\t\t\tend\n\t\t\t@attributes\n\t\tend",
"def attributes\n _fast_attributes\n\n rescue NameError\n\n method = \"def _fast_attributes\\n\"\n method << \" @_attributes ||=\\n\"\n method << \" begin\\n\"\n method << \" h = {}\\n\"\n\n self.class.attributes.each do |name|\n method << \" h[:\\\"#{name}\\\"] = send(:\\\"#{name}\\\") if include_#{name}?\\n\"\n end\n\n method << \" h\\n\"\n method << \" end\\n\"\n method << \"end\"\n\n self.class.class_eval method\n\n _fast_attributes\n end",
"def init_attributes(attributes)\n self.attributes = attributes.symbolize_keys\n end",
"def generate_attributes(name = default_fauxture_name)\n Sweatshop.attributes(self, name)\n end",
"def attributes_from_row(params = {})\n # Try to do as much as possible automated\n params.each do |key, val|\n key = key.to_s.underscore\n if respond_to?(:\"#{key}=\")\n send(:\"#{key}=\", val)\n end\n end\n end",
"def _mapper(offer)\n mapped_keys = {\n 'link-id' => 'id', \n 'description' => 'description', \n 'link-name' => 'title', \n 'destination' => 'url', \n 'promotion-end-date'=> 'expires_at',\n 'advertiser-id' => 'merchant_id'\n }\n\n result = {}\n mapped_keys.each do |k,el|\n result[el] = offer[k]\n end\n result\nend",
"def get_attributes(column, column_type, klass, options); end",
"def attributes\n [@attribute,@value].inject(Hash.new([])) do |memo,c|\n case c \n when Sower::Relation::Statement, Sower::Relation::Attribute, Sower::Relation::Value::Base\n memo.merge!(c.attributes){|k,v,n| v | n}\n end\n memo\n end\n end",
"def apply_attributes(string)\n string.gsub ATTRIBUTE_REGEXP do |match|\n key, value = match.match(ATTRIBUTE_REGEXP).to_a[1..2]\n self[key] = value\n ''\n end\n end",
"def search_attributes\n {:title => self.name, :description => self.bio.present? ? self.bio[0..100] : \"\", :image => self.portrait(:thumb)}\n end",
"def attributes(*args)\n attr_accessor(*args)\n end",
"def define_attributes(*args)\n options = args.extract_options!\n options[:access_level] ||= :public\n # Initialize each attribute\n args.each do |arg|\n self.initialize_attribute(\n Array.wrap(arg),\n options[:access_level]\n )\n end\n\n self.define_attribute_methods(\n args,\n options[:access_level]\n )\n end",
"def define_nested_attribute_methods(attribute, nested_form_class)\n # Equivalent of \"address_attributes=\" for \"address\" attribute\n define_method(:\"#{attribute}_attributes=\") do |params|\n build_models_from_param_count(attribute, params)\n\n self.send(:\"#{attribute}\").zip(params).each do |model, params_array|\n identifier = params_array[0]\n attributes = params_array[1]\n #TODO: Check the key against id?\n model.fill(attributes)\n end\n end\n end",
"def attr_map \n h = {\n 'data-id' => id,\n 'data-posters' => (@posters || []).map do |p|\n p.attributes.merge(:web_location => p.href)\n end.to_json,\n 'data-year' => @year,\n 'class' => (thumbnail() ? 'withPoster lazyLoadNeeded' : 'noPoster')\n }\n h['data-thumb-src'] = thumbnail.href if thumbnail\n genres.split(',').reduce(h){ |ha, g| ha[\"data-category-#{g.downcase.gsub(' ', '_')}\"] = true; ha }\n end",
"def attributes\n query[ model_name ]\n end",
"def attributes(*attrs)\n if attrs.size > 0\n attrs.each{|attr| attribute attr}\n end\n @attributes ||= []\n end",
"def annotations_with_attribute_and_by_source(attrib, source, include_values = false)\n return [] if attrib.blank? || source.nil?\n\n obj_type = self.class.base_class.name\n\n options = {\n joins: :annotation_attribute,\n conditions: { annotatable_type: obj_type,\n annotatable_id: id,\n source_type: source.class.name,\n source_id: source.id,\n annotation_attributes: { name: attrib.strip.downcase } },\n order: 'updated_at DESC'\n }\n\n options[:include] = [:value] if include_values\n\n fetch_annotations(options)\n end",
"def method_missing method_name,*method_args, &method_block\n if method_name.end_with?('_name') || method_name.end_with?('_names')\n attribute = method_name.to_s.gsub(/_name(s)?$/,'')\n args.fetch(attribute)\n elsif method_name.end_with?('_value')\n attribute = method_name.to_s.gsub('_value','')\n attribute_name = send(\"#{attribute}_name\")\n item.send attribute_name\n elsif method_name.end_with?('_values')\n attribute = method_name.to_s.gsub('_values','')\n attribute_names = send(\"#{attribute}_names\")\n attribute_names.map{|attribute_name| item.send(attribute_name) }\n else\n super\n end\n end",
"def fetch_all_with_attributes(data, options ={}, &block)\n data.map do |attrs|\n item = self.new\n item.fetch_with_attributes(attrs)\n item\n end\n end",
"def to_hash(options = {})\n attributes_hash = {}\n self.each do |attribute|\n \n if(attribute.name == \"description\" && !attribute.value.blank?)\n summary = RedCloth.new(attribute.value).to(RedCloth::Formatters::Summary)\n attributes_hash['summary'] = summary\n end\n \n if options[:include_comments]\n if attribute.allow_many?\n attributes_hash[attribute.name] = attribute.values.map { |a| { :value => apply_formatting(a.value), :comments => a.comments } }\n else\n attributes_hash[attribute.name] = { :value => apply_formatting(attribute.value), :comments => attribute.comments }\n end\n else\n if attribute.allow_many?\n attributes_hash[attribute.name] = attribute.values.map { |a| apply_formatting(a.value) }\n else\n attributes_hash[attribute.name] = apply_formatting(attribute.value)\n end\n end\n end\n attributes_hash\n end",
"def attributes\n attrs = Hash.new\n attribute_list.each do |attribute|\n value = self.send(attribute)\n attrs[attribute] = value unless value.nil?\n end\n attrs\n end",
"def maxwell_model_attributes\n attrs = basic_attributes\n\n if attrs[:client_type] == :person\n attrs.merge!(names_from_social_reason)\n else\n attrs[:company_name] = self.RazonSocial\n end\n\n attrs\n end",
"def add_additional_attributes\n\n\t\t#gets an array of scraped attributes from the Scraper Class method #scrape_specific_concert\n\t\tattribute_array = SfBayAreaConcertsCliApp::Scraper.scrape_specific_concert(self.url)\n\t\n\t\t#assigns the attributes to the concert instance based on the array index\n\t\tself.ticket_price = attribute_array[0]\n\t\tself.bio = attribute_array[1]\n\t\tself.artist_website = attribute_array[2]\n\t\tself.where_to_find_music = attribute_array[3]\n\t\tself.facebook = attribute_array[4]\n\t\tself.twitter = attribute_array[5]\n\t\tself.instagram = attribute_array[6]\n\t\tself.youtube = attribute_array[7]\n\t\tself.buy_tickets_link = attribute_array[8]\n\t\t\n\tend",
"def apply\n scalar_attrs.each { |m| applicator(m) { |r| send(m, r) } }\n list_attrs.each { |m| applicator(m) { |r| send(m, *r) } }\n hash_attrs.each { |m| applicator(m) { |r| send(m).merge!(r) } }\n path_attrs.each { |m| applicator(m) { |r| send(\"#{m}=\", r) } }\n end",
"def encoded_attributes\n encoded = {}\n attributes.each do |k,v|\n has_transform = Hash===configuration.transforms && configuration.transforms[k]\n encoded[k.to_s] = has_transform ? configuration.transforms[k].encode(v) : v\n end\n encoded\n end",
"def collect(*args) # :nodoc:\n args.inject({}) do |buffer, attr_name|\n value = send(attr_name)\n buffer[attr_name] = value if value\n buffer\n end\n end",
"def attribute_list_value(params)\n column = param(params, :name)\n item = param(params, :item)\n\n if column && item\n type = param(params,:type,(item.attributes.include?(column.to_s) ? item.column_for_attribute(column).type : \"other\").to_s).to_s\n type = \"other_record\" if type == \"other\" && item.respond_to?(column.to_s + \"_id\")\n value = case type\n when 'string' then (item_raw_value(item, params) || \"\")\n when 'boolean' then item.send(attribute_name(params)) ? image_tag(\"/autocrud/images/tick.png\", :alt => t('true'), :title => t('true')) : image_tag(\"/autocrud/images/cross.png\", :alt => t('false'), :title => t('false'))\n when 'custom' then send(@singular.underscore+\"_\"+column.to_s+\"_list_value\".to_s, item)\n when 'other_record' then item.send(column).to_s\n when 'date' then item.send(attribute_name(params)) ? item.send(attribute_name(params)).strftime(\"%d-%m-%Y\") : \"\"\n when 'time' then item.send(attribute_name(params)) ? item.send(attribute_name(params)).strftime(\"%H:%M\") : \"\"\n when 'datetime' then item.send(attribute_name(params)) ? l(item.send(attribute_name(params))) : \"\"\n when 'paperclip' then item.send(column.to_s+'?') ? image_tag(item.send(column.to_s, param(params, :size))) : \"\"\n when 'currency' then number_to_currency(item.send(attribute_name(params)).to_f, :format => \"<span class='currency_show_symbol'>%u</span><span class='currency_show_value'>%n</span>\")\n when 'percentage' then number_to_percentage(item.send(attribute_name(params)).to_f)\n when 'select' then \n values = param(params,:select).collect{|element| element.is_a?(Array) && element.length == 2 ? element : [element.to_s, element.to_s]}.collect{|element| element[1] == item.send(attribute_name(params)).to_s ? element[0] : nil}.compact\n values.length > 0 ? values.first : item.send(attribute_name(params)).to_s\n else class_exists?('Lico::AutoCrud::Types::' + type.classify) ? get_class('Lico::AutoCrud::Types::' + type.classify).to_list_value(item, attribute_name(params)) : (item_raw_value(item, params) || \"\")\n end\n if display_link_to?(:show)\n return link_to(value, { :action => 'show', :id => item }, :class => 'dummy')\n else\n return value\n end\n else\n \treturn ''\n\t\t\t\tend\n end",
"def cache_attributes(*attribute_names)\n attribute_names.each {|attr| cached_attributes << attr.to_s}\n end"
] |
[
"0.58226246",
"0.57816154",
"0.5633592",
"0.5604154",
"0.55828434",
"0.554471",
"0.5435935",
"0.5433353",
"0.5425095",
"0.53514314",
"0.53451556",
"0.5337609",
"0.5330308",
"0.5328944",
"0.530573",
"0.5286945",
"0.5262937",
"0.52565056",
"0.52436113",
"0.5238925",
"0.523477",
"0.52256215",
"0.5222727",
"0.52003527",
"0.51997554",
"0.5183246",
"0.51708144",
"0.51688963",
"0.5162806",
"0.5152461",
"0.51352954",
"0.51253873",
"0.51154447",
"0.5109662",
"0.510651",
"0.51044637",
"0.50916874",
"0.50842047",
"0.5077398",
"0.5074924",
"0.5069841",
"0.50675464",
"0.50627816",
"0.5061327",
"0.5059345",
"0.505308",
"0.5051133",
"0.504648",
"0.5045303",
"0.504506",
"0.50425225",
"0.5040872",
"0.50392896",
"0.5037909",
"0.50374407",
"0.5034945",
"0.50325555",
"0.502638",
"0.5022047",
"0.50200635",
"0.50191873",
"0.50141144",
"0.5001484",
"0.4997878",
"0.4994354",
"0.49906632",
"0.49891195",
"0.49800026",
"0.49792156",
"0.49791667",
"0.49791667",
"0.4976289",
"0.49744117",
"0.49731463",
"0.49720597",
"0.49643135",
"0.49614236",
"0.4944808",
"0.49442863",
"0.49361533",
"0.4934995",
"0.49335784",
"0.49322927",
"0.49299332",
"0.4926107",
"0.49258414",
"0.49252346",
"0.49228644",
"0.49220014",
"0.4919828",
"0.49164557",
"0.4915777",
"0.4915741",
"0.49125025",
"0.4907508",
"0.49042454",
"0.4899427",
"0.48988393",
"0.48946083",
"0.4890498"
] |
0.6848314
|
0
|
Model.load_from_amazon!(asin_value, dev_key, associates_id) will load the model from an amazon result (or return empty if the product couldn't be found) and call the save method on the model object.
|
def load_from_amazon!(asin_value, dev_key = '1MZTQGBA4YWAFHSTG4R2', associates_id = 'thirddayweb-20')
result = self.load_from_amazon(asin_value, dev_key, associates_id)
if result
result.save
return result
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def save_to_spree\n ::Product.save_from_amazon({\n :attributes =>{\n :amazon_id => self.id,\n :sku => self.id,\n :name => self.name,\n :count_on_hand => 10,\n :available_on => 1.day.ago,\n :description => self.description,\n :price => self.price.to_f\n },\n\n :price => self.price.to_f,\n :images => self.images\n\n })\n end",
"def store_or_lookup(item)\n if asin = amazon_asin(item)\n returning AmazonItem.find_or_create_by_asin(asin) do |amazon_item|\n amazon_item.update_from_amazon(item)\n end\n end\n end",
"def find_or_create_product(asin)\n Product.first(asin: asin) || Product.create(lookup_product(asin))\n end",
"def create\n # @book = Book.new(book_params)\n\n # respond_to do |format|\n # if @book.save\n # format.html { redirect_to @book, notice: 'Book was successfully created.' }\n # format.json { render action: 'show', status: :created, location: @book }\n # else\n # format.html { render action: 'new' }\n # format.json { render json: @book.errors, status: :unprocessable_entity }\n # end\n # end\n\n\n\n @isbn = params[:book][:ISBN]\n search_term = params[:search] || \"#{@isbn}\"\n @res = Amazon::Ecs.item_lookup(search_term, { :search_index => 'Books', :id_type => \"ISBN\", :response_group => \"ItemAttributes\"})\n @imgs = Amazon::Ecs.item_lookup(search_term, { :search_index => 'Books', :id_type => \"ISBN\", :response_group => 'Images',\n :search_index => 'Books',\n :sort => 'relevancerank' })\n puts @imgs.items.first.get_element('MediumImage').get('URL')\n # need to save author, title, publisher of first returned item\n @new_book = @res.items.first\n @book = Book.new\n @book.title = @res.items.first.get_element('ItemAttributes').get('Title')\n @book.author = @res.items.first.get_element('ItemAttributes').get('Author')\n @book.publisher = @res.items.first.get_element('ItemAttributes').get('Publisher')\n @book.url = @imgs.items.first.get_element('MediumImage').get('URL')\n @book.save\n\n\n end",
"def find(product_asin)\n new( SpreeEcs::Product.find(product_asin, { :response_group => \"Large, Variations\" }))\n end",
"def product_data\n AsinOMator::Product.new(asin: @asin).data\n end",
"def update_price\n req = Vacuum.new \n req.configure(\n aws_access_key_id: ENV['ACCESS_KEY_ID'],\n aws_secret_access_key: ENV['SECRET_KEY'],\n associate_tag: ENV['ASSOCIATES_ID']\n )\n\n req.associate_tag = 'shop1410f-20'\n\n sleep(1.seconds)\n\n item_id = self.item_id\n\n params = {\n 'IdType' => 'ASIN',\n 'ItemId' => item_id,\n 'ResponseGroup' => 'Offers, Images'\n }\n \n #For Product Price \n res = req.item_lookup(params)\n\n hash = res.to_h\n self.price = hash[\"ItemLookupResponse\"][\"Items\"][\"Item\"][\"Offers\"][\"Offer\"][\"OfferListing\"][\"Price\"][\"FormattedPrice\"]\n self.save\n end",
"def index\n @book = Book.find_by_asin(params[:id]) || AmazonCatalog.asinLookup(params[:id])\n end",
"def create\n\n if Product.unscoped.find_by_asin(params[:asin]).present?\n redirect_to new_product_review_path(Product.unscoped.find_by_asin(params[:asin]))\n else\n\n # If ASIN not found in Product DB, it's new. Fetch info from Amazon,\n # and re-render new if result is blank, otherwise build / save product,\n # and redirect to new_review_path\n\n @result = fetch_by_asin(params[:asin])\n if @result.blank?\n render action: \"new\", notice: \"Oops, we couldn't find that product. Try searching instead.\"\n else\n @product = Product.new(:asin => params[:asin],\n :amazon_url => @result.first.raw.DetailPageURL,\n :picture_url => @result.first.raw.LargeImage.present? ? @result.first.raw.LargeImage.URL : '',\n :name => @result.first.title,\n :price => fetch_price_for_price(@result),\n :price_too_low => fetch_price_for_too_low(@result),\n :amazon_last_updated => Time.now,\n :product_group => @result.first.raw.ItemAttributes.ProductGroup.present? ? @result.first.raw.ItemAttributes.ProductGroup : '',\n :description => fetch_desc(@result))\n end\n end\n\n respond_to do |format|\n if @product.save\n build_similars(@result, @product)\n\n format.html do\n if params[:review_button]\n redirect_to new_product_review_path(@product)\n else\n redirect_to new_product_question_path(@product)\n end\n end\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def lookup(asin)\n xml = nil\n begin\n File.open(\"#{asin}.xml\") do |f|\n f.flock(File::LOCK_SH)\n xml = f.read\n end\n rescue Errno::ENOENT\n url = ENDPOINTS[\"ja\"].dup\n url << \"?Service=AWSECommerceService\"\n url << \"&AWSAccessKeyId=#{@access_key}\"\n url << \"&AssociateTag=#{@associate_tag}\"\n url << \"&Operation=ItemLookup\"\n url << \"&ItemId=#{asin}\"\n url << \"&IdType=ASIN\" # ASIN, ISBN, EAN\n url << \"&ResponseGroup=Medium\"\n url << \"&Version=2011-08-01\"\n xml = fetch(url)\n File.open(\"#{asin}.xml\", \"w\") do |f|\n f.flock(File::LOCK_EX)\n f.write(xml)\n end\n end\n doc = Nokogiri::XML(xml)\n Item.new(doc.css('Items Item')[0])\n end",
"def amazon_marketplace\n self.in(AmazonMarketplace)\n end",
"def new\n if params[:aq].present?\n @results = amazon_product_search(params[:aq])\n end\n end",
"def import\n ProductImportController.new.import_amazon \n redirect_to \"/admin/products\" \n end",
"def at_amazon\n RTurk::Assignment.new(@id)\n end",
"def load_product\n @product = Product.find(params[:product_id])\n end",
"def fetch_attr\n return if @attr_loaded\n response = nil\n Net::HTTP.start(\"www.amazon.co.jp\") do |http|\n response = http.get(\"/gp/aw/d.html?a=#{@asin}\")\n end\n page = Nokogiri::HTML.parse(response.body, nil, \"SJIS\")\n @attr[:smallimage] = page.xpath(\"//img[contains(@src, '.jpg')]/@src\").to_s\n \n @attr_loaded = true\n end",
"def serialize\r\n {\r\n affiliate_url: \"https://www.amazon.com/dp/#{product.asin}?tag=#{ENV['AMAZON_AFFILIATE_TAG']}\",\r\n asin: product.asin,\r\n id: product.id,\r\n images: {\r\n thumbnail_url: product.image_src\r\n },\r\n name: product.name,\r\n price: product.amazon_price,\r\n # rating: {\r\n # percentage: 85,\r\n # words: 'Excellent'\r\n # },\r\n teaser: product.teaser\r\n }\r\n end",
"def lookup_product(asin)\n logger.info \"Looking up product #{asin}...\"\n\n # Look the product up in Amazon.\n response = settings.vacuum.get(query: {\n 'Operation' => 'ItemLookup',\n 'IdType' => 'ASIN',\n 'ItemId' => asin,\n 'ResponseGroup' => LOOKUP_GROUPS.join(',')\n })\n # Parse the XML and remove all those pesky namespaces.\n xml = Nokogiri::XML(response.body)\n xml.remove_namespaces!\n # Extract the attributes we need from the response.\n LOOKUP_XPATHS.merge(LOOKUP_XPATHS) do |key, value|\n node = xml.xpath(value)\n node.map(&:text).join(', ') unless node.empty?\n end\n end",
"def create_product(store:, name:, id_from_provider:, category:, url:)\n product = Product.find_by store: store, name: name\n\n return product if product\n\n Product.create store: store, name: name, id_from_provider: id_from_provider, category: category, url: url\nend",
"def set_saved_product\n @saved_product = SavedProduct.find(params[:id])\n end",
"def product_instance\n IMS::LTI::Models::ProductInstance.new.from_json(\n guid: 'be42ae52-23fe-48f5-a783-40ecc7ef6d5c',\n product_info: product_info\n )\n end",
"def save_product!\n product = nil\n if product_id.blank?\n product = Inventory::Product.new\n product.name = name\n product.sku = sku\n product.catalogue_id = catalogue_id\n product.facility_strain_id = facility_strain_id\n product.facility_id = facility_id\n product.transaction_limit = transaction_limit\n product.status = 'available'\n product.save!\n else\n product = Inventory::Product.find(product_id)\n end\n\n product\n end",
"def set_product_in_storehouse\n @product_in_storehouse = ProductInStorehouse.find(params[:id])\n end",
"def product=(input)\n @product = case input\n when Product\n input\n when String\n Product.find(input)\n when Hash\n @_product_id = input[:sku] if input[:sku]; nil\n end\n end",
"def run(category_name)\r\n category = Category.find_or_create_by(name: category_name)\r\n retailer = Retailer.find_or_create_by(name: Retailer::RETAILER_NAME_AMAZON)\r\n input = CSV.read(@input, headers: true)\r\n\r\n input.each do |row|\r\n non_recommended_asin = asin_from_url(row[AMAZON_URL_COLUMN_NAME])\r\n recommended_asins = ['#1', '#2', '#3'].map { |col| asin_from_url(row[col]) }\r\n\r\n if non_recommended_asin && recommended_asins.any?\r\n non_recommended_product = Amazon::RemoteProduct.find_by_asin(non_recommended_asin)\r\n recommended_products = recommended_asins.map { |asin| Amazon::RemoteProduct.find_by_asin(asin) }.compact\r\n\r\n if non_recommended_product && recommended_products.any?\r\n # Create retailer product (the non-recommended product)\r\n retailer_product = RetailerProduct.find_or_create_by(retailer: retailer, healthiest_category: category, external_id: non_recommended_asin, name: non_recommended_product.name)\r\n\r\n # Create our recommended products and link up\r\n recommended_products.each { |amazon_product| \r\n recommended_product = create_local_records(amazon_product)\r\n ProductCategory.find_or_create_by(category: category, product: recommended_product)\r\n if !retailer_product.recommended_products.include?(recommended_product)\r\n retailer_product.recommended_products << recommended_product\r\n end\r\n }\r\n status = STATUS_SUCCESS\r\n else\r\n status = STATUS_FAIL_PRODUCT_API\r\n end\r\n else\r\n status = STATUS_FAIL_ASIN\r\n end\r\n\r\n puts \"#{non_recommended_asin}: #{status}\"\r\n end\r\n end",
"def create_variant(attr_hash, headers, exception_hash)\n product_to_reference = Product.find_by_name(attr_hash[headers[1]])\n if product_to_reference.nil?\n product_to_reference = Product.find_by_id(attr_hash[headers[1]])\n end\n if not product_to_reference.nil?\n attr_hash[headers[1]] = product_to_reference[:id]\n else\n @failed_queries = @failed_queries +1\n return\n end\n handle_exceptions(exception_hash, attr_hash)\n new_variant = Variant.find_by_sku(attr_hash['sku'])\n if new_variant.nil?\n new_variant = Variant.new(attr_hash)\n @failed_queries += 1 if not new_variant.save\n end\n end",
"def set_product_item\n @product_item = @brand.items.find(params[:id])\n end",
"def put_vendor_contract(q)\n$LOG.info('put_vendor_contract');\n\n@VENDOR=q[\"VENDOR\"];\n@PRODUCT=q[\"PRODUCT\"];\n@VID=@VENDOR[\"VID\"];\n@PRODUCT[\"VID\"]=@VID;\n\n# CHECK IN CACHE VENDOR\n@vendor=$CACHE.get(\"VENDOR\",@VID)\n# IF NOT IN CACHE CHECK IN STORE \nif (@vendor == nil) \n# IF IN STORAGE RENEW IN CACHE\n@vendor=$STORAGE.get(\"VENDOR\",@VID)\nif (@vendor == nil) \n# IF NOT IN STORAGE - ADD NEW VENDOR AND PRODUCT OF ONE \n$STORAGE.put(\"VENDOR\",@VID,@VENDOR)\n@vendor=$STORAGE.get(\"VENDOR\",@VID)\nend\n\n\n# AND IF OK - PUT TO THE CACHE\nif (@vendor != nil) \n$CACHE.put(\"VENDOR\",@VID,@vendor)\nend\n\nend\n\n\nif (@vendor != nil) # IF VENDOR OK PUT NEW PRODUCT !!!!\n put_product(@PRODUCT)\nend\n\n\nend",
"def set_sku\n @sku = Sku.find(params[:id])\n @asin = Asin.find(params[:id])\n\n end",
"def get_product( row )\n puts \"get product row:\" + row.join(\"--\")\n pro = Variant.find_by_sku( at_in(:sku , row ) )\n if pro\n puts \"Found #{at_in(:sku,row)} \"\n pro.product \n else\n p = Product.create( :name => \"sku\" , :price => 5 , :sku => \"sku\")\n p.save!\n master = Variant.find_by_sku(\"sku\")\n master.product = Product.find_by_name(\"sku\")\n master.save\n Product.find_by_name(\"sku\")\n end\n end",
"def set_os_product\n @os_product = OsProduct.find(params[:id])\n end",
"def show\n\n p \"display suppliers\"\n @supplier = Supplier.find(params[:id])\n #AWS_ACCESS_KEY_ID = '0XQXXC6YV2C85DX1BF02'\n # AWS_SECRET_KEY = 'fwLOn0Y/IUXEM8Hk49o7QJV+ryOscbhXRb6CmA5l'\n #\n #raise \"Please specify set your AWS_ACCESS_KEY_ID\" if AWS_ACCESS_KEY_ID.empty?\n #raise \"Please specify set your AWS_SECRET_KEY\" if AWS_SECRET_KEY.empty?\n\n Amazon::Ecs.configure do |options|\n options[:response_group] = 'Large'\n options[:AWS_access_key_id] = '0XQXXC6YV2C85DX1BF02'\n options[:AWS_secret_key] = 'fwLOn0Y/IUXEM8Hk49o7QJV+ryOscbhXRb6CmA5l'\n options[:associate_tag] = 'bookjetty-20'\n end\n\n\n #options provided on method call will merge with the default options\n @res = Amazon::Ecs.item_search('ruby', {:response_group => 'Medium', :sort => 'salesrank'})\n\n # search amazon uk\n @res = Amazon::Ecs.item_search('ruby', :country => 'uk')\n\n # search all items, default search index is Books\n #@res = Amazon::Ecs.item_search('ruby', :search_index => 'All')\n\n #@res = Amazon::Ecs.item_search('GC23089', :search_index => 'All')\n\n @res = Amazon::Ecs.item_search('685387306008', {:type => 'UPC', :search_index => 'All' })\n\n #@res = Amazon::Ecs.item_search()\n # some common response object methods\n @res.is_valid_request? # return true if request is valid\n @res.has_error? # return true if there is an error\n @res.error # return error message if there is any\n @res.total_pages # return total pages\n @res.total_results # return total results\n @res.item_page # return current page no if :item_page option is provided\n @total = @res.items.count\n #p @res.items.count\n\n # traverse through each item (Amazon::Element)\n @res.items.each do |item|\n # retrieve string value using XML path\n item.get('ASIN')\n #p item.get_element('ItemAttributes')\n # p 'item'\n # p item\n # p 'sku'\n # p item.get_element('ItemAttributes').get('SKU')\n #p item.get_element('ItemAttributes').get('Model')\n #p item\n end\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @supplier }\n end\n end",
"def create\n @book = Book.new(params[:book])\n @book.user_id = current_user.id\n if @book.asin.blank? # if current_user didn't enter an ASIN, then look it up\n @book.asin = get_book_asin(@book.title + \" \" + @book.author) \n end\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to [current_user, @book], notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_product\n @product = Product.includes(:lotteries, :ranking_config_items).find(params[:id])\n end",
"def update\n self.class.update_product_by_id(self.id, self)\n end",
"def save_products\n self.products = @products_cache if @products_cache\n end",
"def update(options={})\n \t# get product with id #n# \t\n \tselected_product = Product.find(id) \n\t\n \t# update record with optional parameters\n \t# used parameters pass for updated record. Else used the original value\n \tupdated_brand = options[:brand] ? options[:brand] : selected_product.brand\n \tupdated_name = options[:name] ? options[:name] : selected_product.name\n \tupdated_price = options[:price] ? options[:price] : selected_product.price\n\n \t# delete record \n \tProduct.destroy(id)\n\n \tupdated_product = Product.create(id: selected_product.id, brand: updated_brand, name: updated_name, price: updated_price)\n \treturn updated_product\n end",
"def maps_to_amazon_attribute(args = {})\n if @amazon_mappings.nil?\n @amazon_mappings = Hash.new\n @amazon_join_mappings = Hash.new\n end\n\n joiner = args.delete(:combine) if args[:combine]\n args.each do |key, value|\n if joiner\n @amazon_join_mappings[key] = [value, joiner]\n else\n @amazon_mappings[key] = value\n end\n end\n end",
"def set_product\n @product = Product.with_default_includes.find(params[:id])\n end",
"def set_apple_model\n @apple_model = AppleModel.find(params[:id])\n end",
"def amazon_ec2_api\n @amazon_ec2_api ||= AmazonEc2Api.new\n end",
"def set_product\n #@product = Product.find params[:id]\n @product = Product.where(id: params[:id]).includes(\n {product_impact_line_items: [:impact_line_item, :impact_entries]}).first\n end",
"def set_product\n @product = Product.find_by!(code: params[:id])\n end",
"def set_availability_product\n @availability_product = AvailabilityProduct.friendly.find(params[:id])\n end",
"def set_product\n begin\n @product = Product.find(params[:id])\n rescue\n raise Cinema::NotFound \n end\n end",
"def update_from(row)\n product = store.products.where(code: row[:product_code]).first\n return nil if product.nil?\n\n begin\n if row[:trade_price].present?\n product.update!(trade_price: row[:trade_price].to_money)\n end\n if row[:retail_price].present?\n product.update!(retail_price: row[:retail_price].to_money)\n end\n if row[:inventory_amount].present?\n product.inventory_items.destroy_all\n amount = row[:inventory_amount].to_i\n amount = 0 if amount < 0\n product.restock!(@inventory, @lot_code, nil, amount)\n end\n rescue StandardError => e\n log_error(product)\n end\n end",
"def emit_amazon anElement, isbn\n href = \"http://www.amazon.com/gp/product/%s?ie=UTF8&tag=martinfowlerc-20&linkCode=as2&camp=1789&creative=9325&creativeASIN=%s\" % [isbn, isbn]\n @html.a_ref(href) {apply anElement}\n pixel_attrs = {:src => 'http://www.assoc-amazon.com/e/ir?t=martinfowlerc-20&l=as2&o=1&a=0321601912', \n :width=>'1', :height=>'1', :border=>'0', :alt=>'', \n :style=>'border:none !important; margin:0px !important;'}\n @html.element('img', pixel_attrs){}\n end",
"def product_from(sku)\n product = Product.find(:first, :conditions => { :sku => sku })\n end",
"def apply_option_to_product\n @product = Product.find(params[:product_id])\n \n @product_option = ProductOption.find(params[:product_option][:id])\n @product_option.update_attributes(params[:product_option])\n\n product_option_instance = ProductOptionInstance.new(:product => @product, \n :product_option => @product_option)\n \n product_option_instance.save\n\n @available_options = ProductOption.find(:all, :order => 'name')\n end",
"def save_products\n self.products = @products if @products\n end",
"def set_vendor_product\n @vendor_product = VendorProduct.find(params[:id])\n end",
"def handle; (ShopProduct.to_sku(slug) rescue nil); end",
"def for_core\n {\n order_id: order_data.fetch('AmazonOrderId'),\n purchased_at: order_data.fetch('PurchaseDate'),\n status: order_data.fetch('OrderStatus'),\n currency: order_lines_data.dig(0, 'ItemPrice', 'CurrencyCode'),\n shipping_method_id: shipping_method_id,\n shipping_carrier_id: shipping_carrier_id,\n\n shipping_address: {\n email: order_data.dig('BuyerEmail'),\n name: order_data.dig('ShippingAddress', 'Name'),\n phone: order_data.dig('ShippingAddress', 'Phone'),\n address1: (\n order_data.dig('ShippingAddress', 'AddressLine1') ||\n order_data.dig('ShippingAddress', 'AddressLine2')\n ),\n city: order_data.dig('ShippingAddress', 'City'),\n zip: order_data.dig('ShippingAddress', 'PostalCode'),\n country: order_data.dig('ShippingAddress', 'CountryCode'),\n },\n\n # Because Amazon doesn't expose the billing address, we use the same\n # information as for the shipping address.\n billing_address: {\n email: order_data.dig('BuyerEmail'),\n name: order_data.dig('ShippingAddress', 'Name'),\n phone: order_data.dig('ShippingAddress', 'Phone'),\n address1: (\n order_data.dig('ShippingAddress', 'AddressLine1') ||\n order_data.dig('ShippingAddress', 'AddressLine2')\n ),\n city: order_data.dig('ShippingAddress', 'City'),\n zip: order_data.dig('ShippingAddress', 'PostalCode'),\n country: order_data.dig('ShippingAddress', 'CountryCode'),\n },\n\n order_lines_attributes: order_lines_data.collect do |ol|\n {\n product_id: ol.fetch('SellerSKU'),\n quantity: ol.fetch('QuantityOrdered'),\n cents_with_vat: (ol.dig('ItemPrice', 'Amount').to_f * 100.0).round(2).to_s,\n }\n end,\n\n raw_data: order_data,\n }\n end",
"def set_product\n begin \n @product = Product.find(params[:id])\n rescue ActiveRecord::RecordNotFound => e\n puts e\n end\n end",
"def set_product\n @product = current_seller.product.find(params[:id])\n end",
"def from_qa_result(qa_result:)\n qa_result.dup\n model = new(qa_result.delete(:id))\n model.set_value(model.send(:default_labels).first,\n qa_result.delete(:label))\n\n model\n end",
"def process_row(row)\n puts row.to_hash.inspect\n row_hash = row.to_hash\n vendor = Vendor.find_by_code(row_hash[\"vendor\"])\n return unless !vendor.nil?\n purchaseorder = Purchaseorder.search(row_hash[\"purchaseorder\"], vendor.id)\n\n purchaseorder = vendor.purchaseorders.create!(\n :code => row_hash[\"purchaseorder\"],\n :condition=>'incomplete',\n :delivery_date=>Time.now,\n :marketplace=>'US',\n :status=>'pending_vendor_input'\n ) unless !purchaseorder.nil?\n\n asin = Asin.search(row_hash[\"asin\"], purchaseorder.id)\n\n asin = purchaseorder.asins.create!(\n :sku => row_hash[\"asin\"],\n :title => 'Missing Title',\n :srq_impact_source => 'default',\n :status=>'pending_vendor_input'\n ) unless !asin.nil? #TODO: Check if same ASIN can occur on same Purchase Order as a valid case\n\n end",
"def set_vendor_item\n @product = Product.find(params[:product_id])\n @vendor_item = @product.vendor_items.find(params[:id])\n end",
"def updateAppProdVersion(org_id, type, version)\n dynamodb = Aws::DynamoDB::Client.new(region: ENV.fetch(\"AWS_DEFAULT_REGION\", nil))\n\n begin\n # Making sure \"settings.apps is init correctly\"\n response = dynamodb.update_item(\n {\n table_name: \"Organizations\",\n key: {\n \"id\" => org_id\n },\n expression_attribute_names: {\n \"#SETTINGS\" => \"settings\",\n \"#APPS\" => \"apps\"\n },\n expression_attribute_values: {\n \":null\" => nil,\n \":empty\" => {}\n },\n update_expression: \"SET #SETTINGS.#APPS = :empty\",\n condition_expression: \"#SETTINGS.#APPS = :null\"\n }\n )\n rescue Aws::DynamoDB::Errors::ServiceError => e\n UI.important(\"Skipping setting 'settings.apps' in org object\")\n end\n\n begin\n # Making sure \"settings.apps.{type} is init correctly\"\n response = dynamodb.update_item(\n {\n table_name: \"Organizations\",\n key: {\n \"id\" => org_id\n },\n expression_attribute_names: {\n \"#SETTINGS\" => \"settings\",\n \"#APPS\" => \"apps\",\n \"#TYPE\" => type\n },\n expression_attribute_values: {\n \":empty\" => {}\n },\n update_expression: \"SET #SETTINGS.#APPS.#TYPE = if_not_exists(#SETTINGS.#APPS.#TYPE, :empty)\"\n }\n )\n rescue Aws::DynamoDB::Errors::ServiceError => e\n UI.important(\"Skipping setting 'settings.apps.#{type}' in org object\")\n end\n\n # Setting the dates\n response = dynamodb.update_item(\n {\n table_name: \"Organizations\",\n key: {\n \"id\" => org_id\n },\n expression_attribute_names: {\n \"#SETTINGS\" => \"settings\",\n \"#IN_STORE\" => \"in_stores\",\n \"#APPS\" => \"apps\",\n \"#TYPE\" => type,\n \"#ENV\" => \"prod\",\n \"#STORE_VERSION\" => \"store_version\",\n \"#STORE_DATE\" => \"store_version_date\",\n \"#VERSION_IN_REVIEW\" => \"version_in_review\",\n \"#VERSION_IN_REVIEW_DATE\" => \"version_in_review_date\"\n },\n expression_attribute_values: {\n \":env\" => true,\n \":store\" => true,\n \":version\" => version,\n \":date\" => Time.now.strftime(\"%d/%m/%Y\"),\n \":null\" => nil\n },\n update_expression: \"SET #SETTINGS.#IN_STORE = :store,\" \\\n \"#SETTINGS.#APPS.#TYPE.#ENV = :env,\" \\\n \"#SETTINGS.#APPS.#TYPE.#STORE_VERSION = :version,\" \\\n \"#SETTINGS.#APPS.#TYPE.#STORE_DATE = :date,\" \\\n \"#SETTINGS.#APPS.#TYPE.#VERSION_IN_REVIEW = :null,\" \\\n \"#SETTINGS.#APPS.#TYPE.#VERSION_IN_REVIEW_DATE = :null\"\n }\n )\n\n return true\nrescue Aws::DynamoDB::Errors::ServiceError => e\n UI.error(e.message)\n return false\nend",
"def updateAppStoreRatings(org_id, type, ratings)\n dynamodb = Aws::DynamoDB::Client.new(region: ENV.fetch(\"AWS_DEFAULT_REGION\", nil))\n\n begin\n # Making sure \"settings.apps is init correctly\"\n response = dynamodb.update_item(\n {\n table_name: \"Organizations\",\n key: {\n \"id\" => org_id\n },\n expression_attribute_names: {\n \"#SETTINGS\" => \"settings\",\n \"#APPS\" => \"apps\"\n },\n expression_attribute_values: {\n \":null\" => nil,\n \":empty\" => {}\n },\n update_expression: \"SET #SETTINGS.#APPS = :empty\",\n condition_expression: \"#SETTINGS.#APPS = :null\"\n }\n )\n rescue Aws::DynamoDB::Errors::ServiceError => e\n UI.important(\"Skipping setting 'settings.apps' in org object\")\n end\n\n begin\n # Making sure \"settings.apps.{type} is init correctly\"\n response = dynamodb.update_item(\n {\n table_name: \"Organizations\",\n key: {\n \"id\" => org_id\n },\n expression_attribute_names: {\n \"#SETTINGS\" => \"settings\",\n \"#APPS\" => \"apps\",\n \"#TYPE\" => type\n },\n expression_attribute_values: {\n \":empty\" => {}\n },\n update_expression: \"SET #SETTINGS.#APPS.#TYPE = if_not_exists(#SETTINGS.#APPS.#TYPE, :empty)\"\n }\n )\n rescue Aws::DynamoDB::Errors::ServiceError => e\n UI.important(\"Skipping setting 'settings.apps.#{type}' in org object\")\n end\n\n begin\n # Making sure \"settings.apps.{type}.ratings is init correctly\"\n response = dynamodb.update_item(\n {\n table_name: \"Organizations\",\n key: {\n \"id\" => org_id\n },\n expression_attribute_names: {\n \"#SETTINGS\" => \"settings\",\n \"#APPS\" => \"apps\",\n \"#TYPE\" => type,\n \"#RATINGS\" => \"ratings\"\n },\n expression_attribute_values: {\n \":empty\" => {}\n },\n update_expression: \"SET #SETTINGS.#APPS.#TYPE.#RATINGS = if_not_exists(#SETTINGS.#APPS.#TYPE.#RATINGS, :empty)\"\n }\n )\n rescue Aws::DynamoDB::Errors::ServiceError => e\n UI.important(\"Skipping setting 'settings.apps.#{type}.ratings' in org object\")\n end\n\n # Setting the reviews\n response = dynamodb.update_item(\n {\n table_name: \"Organizations\",\n key: {\n \"id\" => org_id\n },\n expression_attribute_names: {\n \"#SETTINGS\" => \"settings\",\n \"#APPS\" => \"apps\",\n \"#TYPE\" => type,\n \"#RATINGS\" => \"ratings\",\n \"#RATING_COUNT\" => \"rating_count\",\n \"#AVERAGE_RATING\" => \"average_rating\",\n \"#ONE_STAR_RATING_COUNT\" => \"one_star_rating_count\",\n \"#TWO_STAR_RATING_COUNT\" => \"two_star_rating_count\",\n \"#THREE_STAR_RATING_COUNT\" => \"three_star_rating_count\",\n \"#FOUR_STAR_RATING_COUNT\" => \"four_star_rating_count\",\n \"#FIVE_STAR_RATING_COUNT\" => \"five_star_rating_count\"\n },\n expression_attribute_values: {\n \":rating_count\" => ratings.rating_count,\n \":average_rating\" => ratings.average_rating,\n \":one_star_rating_count\" => ratings.one_star_rating_count,\n \":two_star_rating_count\" => ratings.two_star_rating_count,\n \":three_star_rating_count\" => ratings.three_star_rating_count,\n \":four_star_rating_count\" => ratings.four_star_rating_count,\n \":five_star_rating_count\" => ratings.five_star_rating_count\n },\n update_expression: \"SET \" \\\n \"#SETTINGS.#APPS.#TYPE.#RATINGS.#RATING_COUNT = :rating_count,\" \\\n \"#SETTINGS.#APPS.#TYPE.#RATINGS.#AVERAGE_RATING = :average_rating,\" \\\n \"#SETTINGS.#APPS.#TYPE.#RATINGS.#ONE_STAR_RATING_COUNT = :one_star_rating_count,\" \\\n \"#SETTINGS.#APPS.#TYPE.#RATINGS.#TWO_STAR_RATING_COUNT = :two_star_rating_count,\" \\\n \"#SETTINGS.#APPS.#TYPE.#RATINGS.#THREE_STAR_RATING_COUNT = :three_star_rating_count,\" \\\n \"#SETTINGS.#APPS.#TYPE.#RATINGS.#FOUR_STAR_RATING_COUNT = :four_star_rating_count,\" \\\n \"#SETTINGS.#APPS.#TYPE.#RATINGS.#FIVE_STAR_RATING_COUNT = :five_star_rating_count\"\n }\n )\n\n return true\nrescue Aws::DynamoDB::Errors::ServiceError => e\n UI.error(e.message)\n return false\nend",
"def create_variant_for(product, options = {:with => {}})\r\n return if options[:with].nil?\r\n\r\n # Just update variant if exists\r\n variant = Variant.find_by_sku(options[:with][:sku])\r\n raise SkuError, \"SKU #{variant.sku} should belongs to #{product.inspect} but was #{variant.product.inspect}\" if variant && variant.product != product\r\n if !variant\r\n variant = product.variants.new\r\n variant.id = options[:with][:id]\r\n else\r\n options[:with].delete(:id)\r\n end\r\n\r\n field = ProductImport.settings[:variant_comparator_field]\r\n log(\"VARIANT:: #{variant.inspect} /// #{options.inspect } /// #{options[:with][field]} /// #{field}\",:debug)\r\n\r\n options[:with].each do |field, value|\r\n variant.send(\"#{field}=\", value) if variant.respond_to?(\"#{field}=\")\r\n #We only applu OptionTypes if value is not null.\r\n if (value)\r\n applicable_option_type = OptionType.where(\r\n \"presentation = ? OR name = ?\",\r\n field.to_s, field.to_s).first\r\n if applicable_option_type.is_a?(OptionType)\r\n product.option_types << applicable_option_type unless product.option_types.include?(applicable_option_type)\r\n opt_value = applicable_option_type.option_values.where([\"presentation = ? OR name = ?\", value, value]).first\r\n opt_value = applicable_option_type.option_values.create(:presentation => value, :name => value) unless opt_value\r\n variant.option_values << opt_value unless variant.option_values.include?(opt_value)\r\n end\r\n end\r\n end\r\n\r\n log(\"VARIANT PRICE #{variant.inspect} /// #{variant.price}\",:debug)\r\n\r\n if variant.valid?\r\n variant.save\r\n\r\n #Finally, attach any images that have been specified\r\n ProductImport.settings[:image_fields_variants].each do |field|\r\n find_and_attach_image_to(variant, options[:with][field.to_sym], options[:with][ProductImport.settings[:image_text_variants].to_sym])\r\n end\r\n\r\n #Log a success message\r\n log(\"Variant of SKU #{variant.sku} successfully imported.\\n\")\r\n else\r\n log(\"A variant could not be imported - here is the information we have:\\n\" +\r\n \"#{pp options[:with]}, #{variant.errors.full_messages.join(', ')}\")\r\n return false\r\n end\r\n\r\n #Stock item\r\n source_location = Spree::StockLocation.find_by(default: true)\r\n log(\"SourceLocation: #{source_location.inspect}\",:debug)\r\n if source_location\r\n stock_item = variant.stock_items.where(stock_location_id: source_location.id).first_or_initialize\r\n log(\"StockItem: #{stock_item.inspect}\",:debug)\r\n log(\"OnHand: #{options[:with][:on_hand]}\",:debug)\r\n #We only update the stock if stock is not blank.\r\n if (options[:with][:on_hand])\r\n stock_item.set_count_on_hand(options[:with][:on_hand])\r\n end\r\n end\r\n\r\n variant\r\n end",
"def set_attributes\n self.web_name = AppConfig.cloud[:name]\n if self.custom_image_id\n ci = CustomImage.find_by_id!(custom_image_id)\n self.cost = ci.price\n self.region = ci.region\n self.image_id = ci.remote_image_id\n\n #Map product_type or size_type since that is being used across the app.\n if ci.hosting == \"AWS\"\n pt = ProductType.find_by_memory!(ci.ram)\n self.product_type = pt.name\n self.size_type = nil\n elsif ci.hosting == \"DigitalOcean\"\n st = SizeType.find_by_memory!(ci.ram)\n self.size_type = st.size_id\n self.product_type = nil\n end\n else\n if type == \"AWS\"\n self.cost = ProductType.find_by_name(params[:product][:product_type]).cost_per_month\n elsif type == \"DigitalOcean\"\n self.cost = SizeType.find_by_size_id(params[:product][:size_type]).cost_per_month\n end\n end\n\n self.status = 'pending'\n end",
"def populate(aws, domain)\n @name = aws.name.chomp(domain).chomp(\".\")\n @ttl = aws.ttl\n @type = aws.type\n if !aws.resource_records.nil?\n if @type == \"TXT\" or @type == \"SPF\"\n @value = aws.resource_records.map { |r| r.value[1..-2] }\n else\n @value = aws.resource_records.map(&:value)\n end\n end\n\n if !aws.alias_target.nil?\n if aws.alias_target.dns_name.include? \"elb\"\n @alias_target = AliasTarget.new(\n Cumulus::ELB::get_aws_by_dns_name(aws.alias_target.elb_dns_name).load_balancer_name,\n \"elb\",\n nil\n )\n elsif aws.alias_target.dns_name.include? \"s3\"\n @alias_target = AliasTarget.new(nil, \"s3\", nil)\n elsif aws.alias_target.dns_name.include? \"cloudfront\"\n @alias_target = AliasTarget.new(nil, \"cloudfront\", nil)\n else\n @alias_target = AliasTarget.new(aws.alias_target.dns_name.chomp(\".\"), \"record\", nil)\n end\n end\n end",
"def save\n return false unless valid?\n @product.name = @attributes['name']\n set_dynamic_fields\n @product.save\n end",
"def from_qa_result(qa_result:)\n qa_result.dup\n model = new(qa_result.delete(:id.to_s))\n model.set_value(model.send(:default_labels).first,\n qa_result.delete(:label.to_s))\n\n model\n end",
"def result_to_product(result)\n {\n id: result[\"Product_Id\"],\n merchant_id: result[\"Merchant_Id\"],\n merchant_name: result[\"Merchant_Name\"],\n data_feed_id: result[\"Datafeed_Id\"],\n external_id: result[\"Product_Id\"],\n subcategory: result[\"Subcategory_Name\"],\n category: result[\"Category_Name\"],\n group: result[\"Department_Name\"],\n sku: result[\"Product_SKU\"],\n name: result[\"Product_Name\"],\n brand_name: result[\"Brand_Name\"],\n retail_price: result[\"Retail_Price\"],\n sale_price: result[\"Sale_Price\"],\n price: result[\"Sale_Price\"],\n summary: result[\"Abbreviated_Description\"] || result[\"Short_Description\"],\n description: result[\"Description\"],\n thumb_url: result[\"Thumbnail_Image\"],\n image_url: result[\"Large_Image\"] || result[\"Medium_Image\"],\n buy_link: result[\"Buy_URL\"],\n commission: result[\"Commission\"]\n }\n end",
"def product\n id = self.product_id\n found_product = FarMar::Product.find(id)\n return found_product\n end",
"def amazon?(node = __getnode)\n node[\"platform_family\"] == \"amazon\"\n end",
"def create_product(attr_hash)\n product_already_exists = Product.find_by_name(attr_hash['name'])\n if product_already_exists\n @skipped_records += 1\n else\n new_product = Product.new(attr_hash)\n @failed_queries += 1 if not new_product.save\n end\n end",
"def set_product\n @product = Product.find_by_hashid(params[:id])\n end",
"def call!\n verify!\n if valid?\n CandyCheck::PlayStore::ProductPurchases::ProductPurchase.new(@response[:result])\n else\n CandyCheck::PlayStore::VerificationFailure.new(@response[:error])\n end\n end",
"def update\n product_params = params.require(:product).\n permit(:id, :value)\n\n if product = Product.find_by(external_id: product_params[:id])\n product.value = product_params[:value]\n product.save\n render json: {}, status: :ok\n else\n\n render json: {\n errors: {\n message: \"product not found\",\n product_id: product_params[:id]\n }\n }, status: :unprocessable_entity\n end\n end",
"def set_so_product\n @so_product = SoProduct.find(params[:id])\n end",
"def perform_csv_load(file_name, options = {})\n require \"csv\"\n @parsed_file = CSV.read(file_name)\n\n # Create a method_mapper which maps list of headers into suitable calls on the Active Record class\n # For example if model has an attribute 'price' will map columns called Price, price, PRICE etc to this attribute\n populate_method_mapper_from_headers( @parsed_file.shift, options)\n\n puts \"\\n\\n\\nLoading from CSV file: #{file_name}\"\n puts \"Processing #{@parsed_file.size} rows\"\n begin\n Spree::Product.transaction do\n @reporter.reset\n @parsed_file.each_with_index do |row, i|\n @current_row = row\n name_index = @headers.find_index(\"Name\")\n name = row[name_index]\n if options[\"match_by\"]\n name_index = @headers.find_index(options[\"match_by\"])\n name = row[name_index]\n condition_hash = {name: row[name_index]}\n object = find_or_new(Spree::Product, condition_hash)\n @product = object || new_product\n @reporter.reset\n end\n\n puts \"\"\n action = @product.persisted? ? 'Updating' : 'Creating'\n puts \"#{action} row #{i+2}: #{name}\"\n\n @reporter.processed_object_count += 1\n\n begin\n # First assign any default values for columns not included in parsed_file\n process_missing_columns_with_defaults\n\n # Iterate over the columns method_mapper found in Excel,\n # pulling data out of associated column\n @method_mapper.method_details.each_with_index do |method_detail, col|\n value = row[col]\n process(method_detail, value)\n end\n\n rescue => e\n failure( row, true )\n logger.error \"Failed to process row [#{i}] (#{@current_row})\"\n\n if verbose\n puts \"Failed to process row [#{i}] (#{@current_row})\"\n puts e.inspect\n end\n\n # don't forget to reset the load object\n new_product\n next\n end\n\n unless save_object(@product)\n failure\n puts \"Failed to save row [#{i}]\"\n puts @product.errors.inspect if(@product)\n else\n puts \"Row #{@current_row} succesfully SAVED : ID #{@product.id}\"\n @reporter.add_loaded_object(@product)\n end\n\n # don't forget to reset the object or we'll update rather than create\n new_product\n\n end\n\n raise ActiveRecord::Rollback if(options[:dummy]) # Don't actually create/upload to DB if we are doing dummy run\n end\n rescue => e\n puts \"CAUGHT \", e.backtrace, e.inspect\n if e.is_a?(ActiveRecord::Rollback) && options[:dummy]\n puts \"CSV loading stage complete - Dummy run so Rolling Back.\"\n else\n raise e\n end\n ensure\n report\n end\n end",
"def amazon_resource_id\n return @amazon_resource_id\n end",
"def set_product\n @product = LowestPrice.where(id: params[:id]).first\n end",
"def import_data\n begin\n #Get products *before* import - \n @products_before_import = Product.all\n\n #Setup HTML decoder\n coder = HTMLEntities.new\n\n columns = ImportProductSettings::COLUMN_MAPPINGS\n log(\"Import - Columns setting: #{columns.inspect}\")\n \n rows = FasterCSV.read(self.data_file.path)\n log(\"Importing products for #{self.data_file_file_name} began at #{Time.now}\")\n nameless_product_count = 0\n \n rows[ImportProductSettings::INITIAL_ROWS_TO_SKIP..-1].each do |row|\n \n log(\"Import - Current row: #{row.inspect}\")\n \n if product_obj = Product.find(:first, :include => [:product_properties, :properties], :conditions => ['properties.name LIKE ? && product_properties.value LIKE ?', \"XmlImportId\", row[columns['Id']]])\n create_variant(product_obj, row, columns)\n else\n #Create the product skeleton - should be valid\n product_obj = Product.new()\n \n #Easy ones first\n if row[columns['Name']].blank?\n log(\"Product with no name: #{row[columns['Description']]}\")\n product_obj.name = \"No-name product #{nameless_product_count}\"\n nameless_product_count += 1\n else\n #Decode HTML for names and/or descriptions if necessary\n if ImportProductSettings::HTML_DECODE_NAMES\n product_obj.name = coder.decode(row[columns['Name']])\n else\n product_obj.name = row[columns['Name']]\n end\n end\n #product_obj.sku = row[columns['SKU']] || product_obj.name.gsub(' ', '_')\n product_obj.price = row[columns['Master Price']] || 0.0\n #product_obj.cost_price = row[columns['Cost Price']]\n product_obj.available_on = DateTime.now - 1.day #Yesterday to make SURE it shows up\n product_obj.weight = columns['Weight'] ? row[columns['Weight']] : 0.0\n product_obj.height = columns['Height'] ? row[columns['Height']] : 0.0\n product_obj.depth = columns['Depth'] ? row[columns['Depth']] : 0.0\n product_obj.width = columns['Width'] ? row[columns['Width']] : 0.0\n #Decode HTML for descriptions if needed\n if ImportProductSettings::HTML_DECODE_DESCRIPTIONS\n product_obj.description = coder.decode(row[columns['Description']])\n else\n product_obj.description = row[columns['Description']]\n end\n \n \n #Assign a default shipping category\n product_obj.shipping_category = ShippingCategory.find_or_create_by_name(ImportProductSettings::DEFAULT_SHIPPING_CATEGORY)\n product_obj.tax_category = TaxCategory.find_or_create_by_name(ImportProductSettings::DEFAULT_TAX_CATEGORY)\n\n unless product_obj.valid?\n log(\"A product could not be imported - here is the information we have:\\n #{ pp product_obj.attributes}\", :error)\n next\n end\n \n #Save the object before creating asssociated objects\n product_obj.save!\n \n xml_import_id_prop = Property.find_or_create_by_name_and_presentation(\"XmlImportId\", \"XmlImportId\")\n ProductProperty.create :property => xml_import_id_prop, :product => product_obj, :value => row[columns['Id']]\n \n brand_prop = Property.find_or_create_by_name_and_presentation(\"Brand\", \"Marque\")\n ProductProperty.create :property => brand_prop, :product => product_obj, :value => row[columns['Brand']]\n \n unless product_obj.master\n log(\"[ERROR] No variant set for: #{product_obj.name}\")\n end\n \n #Now we have all but images and taxons loaded\n associate_taxon('Category', row[columns['Category']], product_obj)\n associate_taxon('Gender', row[columns['Gender']], product_obj)\n \n #Save master variant, for some reason saving product with price set above\n #doesn't create the master variant\n log(\"Master Variant saved for #{product_obj.sku}\") if product_obj.master.save!\n \n create_variant(product_obj, row, columns)\n \n find_and_attach_image(row[columns['Image Main']], product_obj) if row[columns['Image Main']]\n find_and_attach_image(row[columns['Image 2']], product_obj) if row[columns['Image 2']]\n find_and_attach_image(row[columns['Image 3']], product_obj) if row[columns['Image 3']]\n\n #Return a success message\n log(\"[#{product_obj.sku}] #{product_obj.name}($#{product_obj.master.price}) successfully imported.\\n\") if product_obj.save\n end\n \n end\n \n if ImportProductSettings::DESTROY_ORIGINAL_PRODUCTS_AFTER_IMPORT\n @products_before_import.each { |p| p.destroy }\n end\n \n log(\"Importing products for #{self.data_file_file_name} completed at #{DateTime.now}\")\n \n rescue Exception => exp\n log(\"An error occurred during import, please check file and try again. (#{exp.message})\\n#{exp.backtrace.join('\\n')}\", :error)\n return [:error, \"The file data could not be imported. Please check that the spreadsheet is a CSV file, and is correctly formatted.\"]\n end\n \n #All done!\n return [:notice, \"Product data was successfully imported.\"]\n end",
"def create_product(row)\n #create new product\n product = Product.new\n product.model = row['model']\n product.sku = ''\n product.upc = ''\n product.ean = ''\n product.jan = ''\n product.isbn = ''\n product.mpn = ''\n product.location = ''\n product.stock_status_id = 5\n product.manufacturer_id = 0\n product.shipping = true\n product.price = row['price']\n product.points = 0\n product.tax_class_id = 0\n product.date_available = DateTime.now\n product.weight = row['weight']\n product.weight_class_id =0\n product.length = 0\n product.width = 0\n product.height = 0\n product.length_class_id = 1\n product.subtract = 1\n product.sort_order = 0\n product.status = false\n product.date_added = DateTime.now -2\n product.date_modified = DateTime.now -2\n product.save\n\n #add product name\n productDescription = ProductDescription.new\n productDescription.product_id = product.product_id\n productDescription.language_id = 1\n productDescription.name = row['english']\n productDescription.description = ''\n productDescription.meta_description = ''\n productDescription.meta_keyword = ''\n productDescription.tag = ''\n\n\n productDescription.save\n\n pd = ProductDescription.new\n pd.product_id = product.product_id\n pd.language_id = 2\n pd.name = row['chinese']\n pd.description = ''\n pd.meta_description = ''\n pd.meta_keyword = ''\n pd.tag = ''\n\n pd.save \n\n #add product to store\n productStore = ProductStore.new\n productStore.product_id = product.product_id\n productStore.store_id = 0\n productStore.save\n\n \n\n end",
"def set_product\n @product = Product.find(params[:id])\n @item = Product.find(params[:id])\n end",
"def product\n Zapi::Models::Product.new\n end",
"def set_productitem\n @productitem = Productitem.find(params[:id])\n end",
"def set_product\r\n\t\t\t@product = @application.products.find(params[:id])\r\n\t\tend",
"def put_on_sale(value, params = {})\n all_variants = params[:all_variants] || true\n run_on_variants(all_variants) { |v| v.put_on_sale(value, params) }\n self.touch\n end",
"def lookup(batch)\n req = Vacuum.new key: 'AKIAJA2IADZPBGHJTZRQ',\n secret: '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',\n tag: @tag,\n locale: 'us'\n \n \n params = { 'Operation' => 'ItemLookup',\n 'SearchIndex' => 'Books',\n 'ItemLookup.Shared.IdType' => 'ISBN',\n 'ItemLookup.Shared.Condition' => 'All',\n 'ItemLookup.Shared.MerchantId' => 'All',\n 'ItemLookup.Shared.ResponseGroup' => 'OfferFull'}\n \n batch.each_with_index do |item,index|\n params['ItemLookup.'+(index+1).to_s+'.ItemId'] = item\n end\n req.build params\n \n res = req.get\n items = []\n if res.valid?\n res.to_hash['Items'].each do |item|\n prod = {}\n prod['ASIN'] = item['Item']['ASIN']\n prod['New Price'] = item['Item']['OfferSummary']['LowestNewPrice']['FormattedPrice']\n prod['Used Price'] = item['Item']['OfferSummary']['LowestUsedPrice']['FormattedPrice']\n prod['url'] = \"http://www.amazon.com/dp/\"+prod['ASIN']+'/?tag='+@tag\n items << prod\n end\n end\n #puts res.to_hash.to_json\n items\nend",
"def set_product\n\t\t@product = Item.find(params[:id])\n\tend",
"def set_product\n\n # @product = Product.find(params[:id])\n\n end",
"def ar_record\n self.class.scpr_class.constantize.where(\n self.class.xml_ar_map.first[1] => send(self.class.xml_ar_map.first[0])\n ).reload.first\n end",
"def set_product_application_buy\n @product_application_buy = ProductApplicationBuy.find(params[:id])\n end",
"def set_product_brand\n @product_brand = ProductBrand.find(params[:id])\n end",
"def it_update_from_product_store\n product = params[:product]\n store = params[:store]\n tbl = params[:tbl]\n initial_stock = 0\n current_stock = 0\n # company = nil\n # product_company_price = nil\n average_price = 0\n if product != '0' && store != '0'\n stock = Stock.find_by_product_and_store(product, store)\n # Stocks\n initial_stock = stock.initial rescue 0\n current_stock = stock.current rescue 0\n # WAP\n average_price = product_average_price(product, store)\n end\n # Format numbers\n initial_stock = number_with_precision(initial_stock.round(4), precision: 4)\n current_stock = number_with_precision(current_stock.round(4), precision: 4)\n average_price = number_with_precision(average_price.round(4), precision: 4)\n # Setup JSON hash\n @json_data = { \"initial\" => initial_stock.to_s, \"stock\" => current_stock.to_s,\n \"tbl\" => tbl.to_s, \"average_price\" => average_price.to_s }\n render json: @json_data\n end",
"def set_product\n@product = Product.find(params[:id])\nend",
"def load_model(mid)\n url = Configuration::PROPERTIES.get_property :url\n url_get_records = Configuration::PROPERTIES.get_property :url_get_model_info\n\n url_get_records = url_get_records.gsub '{csk}', URI::encode(@credential[:csk])\n url_get_records = url_get_records.gsub '{aci}', URI::encode(@credential[:aci])\n url_get_records = url_get_records.gsub '{mid}', mid.to_s\n\n response = DynamicService::ServiceCaller.call_service url + url_get_records, {}, 'get'\n\n json = JSON.parse(response)\n unless json['status'] == 200\n raise json['message']\n end\n\n model = Dynamicloud::API::Model::RecordModel.new mid\n model.name = json['name']\n model.description = json['description']\n\n model\n end",
"def set_product_bid\n @product_bid = Product::Bid.find(params[:id])\n end",
"def get_product_by_id(product_id)\n return Product.find(product_id)\n end",
"def set_vendor_record\n @vendor_record = VendorRecord.find(params[:id])\n end",
"def shopify_model=(model)\n self.shopify_model_type = model.class\n self.shopify_model_id = model.id\n end",
"def product\n FarMar::Product.find(self.product_id)\n end",
"def load_shopping_item_or_not\n @shopping_item_id = nil\n\n if si = params[:shopping_item]\n if si[:offer_id]\n # this is a shopping item that references an offer and cart\n @shopping_item_id = si[:offer_id]\n @admin_customer_offer = Admin::Customer::Offer.find(si[:offer_id])\n @cart = Shopping::Cart.find_by_id(si[:cart_id])\n session[:admin_customer_offer_id] = @admin_customer_offer.id\n raise \"cart offer email mismatch\" if (@cart.email.id != @admin_customer_offer.email.id)\n elsif si[:piece_id]\n @shopping_item_id = si[:piece_id]\n end\n end\n\n unless @shopping_item_id\n @admin_customer_offer = Admin::Customer::Offer.find(session[:admin_customer_offer_id]) if session[:admin_customer_offer_id]\n @shopping_item_id = @admin_customer_offer.id if @admin_customer_offer\n end\n\n end",
"def set_prod\n @product = Product.find(params[:id])\n end",
"def create\n @product = Product.new(product_params)\n @product.merchant = load_merchant\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.62749094",
"0.6029529",
"0.55829054",
"0.5578833",
"0.54520476",
"0.54130673",
"0.5380609",
"0.5309279",
"0.52557606",
"0.51518077",
"0.5074921",
"0.50407237",
"0.5018755",
"0.5006323",
"0.5001743",
"0.49675694",
"0.49513745",
"0.4931584",
"0.49025086",
"0.48906144",
"0.488178",
"0.48486185",
"0.48467776",
"0.48408282",
"0.48265994",
"0.47816393",
"0.4756522",
"0.47477683",
"0.4746792",
"0.47438213",
"0.47272372",
"0.47184974",
"0.4701441",
"0.4697945",
"0.4694215",
"0.467603",
"0.46715596",
"0.46695948",
"0.4658827",
"0.46429995",
"0.46424043",
"0.46408534",
"0.46382955",
"0.46293807",
"0.46271613",
"0.4622381",
"0.4611724",
"0.4602915",
"0.4596452",
"0.45878467",
"0.45858592",
"0.4583934",
"0.45607397",
"0.455256",
"0.4547775",
"0.45419928",
"0.4537675",
"0.4534463",
"0.45316535",
"0.45294592",
"0.45143577",
"0.45129517",
"0.45094126",
"0.4493716",
"0.4492818",
"0.44904608",
"0.4488271",
"0.44823563",
"0.44817573",
"0.44817013",
"0.44765058",
"0.44714332",
"0.4467314",
"0.44627744",
"0.4461528",
"0.44611338",
"0.44601136",
"0.44571427",
"0.4455925",
"0.44506368",
"0.44498244",
"0.44490904",
"0.44446492",
"0.44381642",
"0.44347724",
"0.44296235",
"0.4427079",
"0.44252098",
"0.44248623",
"0.44223404",
"0.44137335",
"0.44124737",
"0.44103923",
"0.4404247",
"0.4404128",
"0.4401935",
"0.44003096",
"0.4397968",
"0.43978724",
"0.43944678"
] |
0.8468291
|
0
|
Write an already marshalled sample. +data+ is supposed to be a typelibmarshalled value of the stream type
|
def write_raw(rt, lg, data)
logfile.write_data_block(self, rt, lg, data)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def write(data)\n end",
"def write(data); end",
"def write(data); end",
"def write(data); end",
"def write(data); end",
"def write(*data); end",
"def write(data)\n @handle.writeData(data)\n end",
"def write(data)\n @data << data\n end",
"def write(data)\n # black hole, because we don't actually care about what gets written\n end",
"def write(data, *args, **kwd); end",
"def write_to(stream)\n stream.write_int(TAG)\n @data.write_to(stream)\n end",
"def write data\n _data[:out].write data\n _data[:out].flush\n end",
"def write_snippet(file, sample_data)\n if @bits_per_sample == 8\n pack_code = \"C*\"\n elsif @bits_per_sample == 16\n pack_code = \"s*\"\n end\n \n if @num_channels == 1\n file.syswrite(sample_data.pack(pack_code))\n else\n file.syswrite(sample_data.flatten.pack(pack_code))\n end\n end",
"def write(data)\n `#@native.send(#{data.to_n})`\n end",
"def write(data)\n partial = @stream_cipher.update(data.to_s)\n @ios.write(partial) if partial.length > 0\n data.length\n end",
"def write(data)\r\n Win32API.new(\"msvcrt\", \"_write\", \"lpl\", \"l\").call(@fd, data, 1)\r\n end",
"def _serialize_write_data(data, slist)\n bytes = pickle.dumps(data)\n nbytes = len(bytes)\n if not nbytes\n raise Exception(\"write DataObject has no attachment\")\n end\n slist.set_nbytes(nbytes)\n slist.set_bytes(bytes)\n return\nend",
"def write\n open(@fname,\"wb\") do |file|\n Marshal.dump(@data,file)\n end\n end",
"def binwrite(data, *args, **kwd); end",
"def <<(data)\n write(data)\n self\n end",
"def write_to(stream)\n end",
"def write(handle, offset, data)\n send_request(FXP_WRITE, :string, handle, :int64, offset, :string, data)\n end",
"def write(s)\n @data += s\n end",
"def write(*args)\n case args.count\n when 0\n raise ArgumentError, \"missing arguments\"\n when 1\n data = args.first\n else\n data = args\n end\n\n enable do\n case data\n when Numeric\n Rpio.driver.spi_transfer(data)\n when Enumerable\n Rpio.driver.spi_transfer_bytes(data)\n else\n raise ArgumentError, \"#{data.class} is not valid data. Use Numeric or an Enumerable of numbers\"\n end\n end\n end",
"def marshal\n Marshal.dump(data)\n end",
"def io(data, io)\n io.write(obj)\n end",
"def write(io)\n io.write [@value].pack(format)\n end",
"def push(io, data)\n packet = Marshal.dump data\n lenbytes = [packet.bytesize].pack(LEN_PACK)\n io.write lenbytes\n io.write packet\n io.flush\n end",
"def write_to(stream)\n stream.write_int(TAG)\n end",
"def write_to(stream)\n stream.write_int(TAG)\n end",
"def write_to(stream)\n stream.write_int(TAG)\n end",
"def send_data( type, data )\n data = data.to_s\n\n msg = @buffers.writer\n msg.write_long data.length + 1\n msg.write_byte type\n msg.write data\n\n @channel.send_data msg\n end",
"def write(data)\n\n max_write = self.options['pipe_write_max_size'] || data.length\n min_write = self.options['pipe_write_min_size'] || max_write\n\n if(min_write > max_write)\n max_write = min_write\n end\n\n idx = 0\n\n if (self.socket.class == Rex::Proto::SMB::SimpleClient::OpenPipe)\n while(idx < data.length)\n bsize = (rand(max_write-min_write)+min_write).to_i\n len = self.socket.write(data[idx, bsize])\n idx += bsize\n end\n else\n self.socket.write(data)\n end\n\n data.length\n end",
"def write( object )\n if object.responds_to?(:write_to) then\n object.write_to(@stream)\n else\n @stream << object.to_s\n end\n end",
"def write(chunk)\n # dummy\n end",
"def marshal\n @data\n end",
"def to_file( f )\n buf = [@name, @ref.binary_role(), @ref.binary_type(), @ref.name,\n @type, TYPE_SIZES[@type], \n @data.length()].pack(PFORMAT)\n f.write(buf)\n\n fmt_str = \"%s%d\" % [TYPES[@type], data.length]\n buf = data.pack(fmt_str)\n f.write(buf)\n end",
"def store_field(data)\n @io.write [data.size].pack(\"V\") \n offset = @io.pos\n @io.write data\n @io.write \"\\0\"\n offset \n end",
"def write(p0) end",
"def write(p0) end",
"def write(p0) end",
"def write\n write_data\n end",
"def send_data p_data\n dump_object(p_data,@lifeline)\n end",
"def write_data(data)\n\n BinaryAccessor.write(calculate_length(data.length), @length_bit_offset, @length_bit_size, :UINT,\n data, @length_endianness, :ERROR)\n\n return data\n end",
"def write\n file = ::File.open(@file, 'w')\n file.write(Bencode.encode(@data))\n file.close\n end",
"def write_varint(i, data: nil, stream: nil)\n buf = encode_varint(i)\n data << buf if data\n stream.write(buf) if stream\n buf\n end",
"def marshal_dump\n data\n end",
"def write(bytes)\r\n end",
"def puts data\n\t\t@write_semaphore.synchronize do\n\t\t\t@write_data = data\n\t\t\t@write_cv.signal\n\t\tend\n\tend",
"def convertRawDataToStream(data, out_stream)\n @raw_data['file'] = data\n @helper.post(@fields, @files, @raw_data, out_stream)\n end",
"def convertRawDataToStream(data, out_stream)\n @raw_data['file'] = data\n @helper.post(@fields, @files, @raw_data, out_stream)\n end",
"def convertRawDataToStream(data, out_stream)\n @raw_data['file'] = data\n @helper.post(@fields, @files, @raw_data, out_stream)\n end",
"def convertRawDataToStream(data, out_stream)\n @raw_data['file'] = data\n @helper.post(@fields, @files, @raw_data, out_stream)\n end",
"def puts(handle, data)\n format = 'C' * data.size\n pointer = FFI::MemoryPointer.new(data.size)\n bytes = pointer.put_bytes(0, data.pack(format))\n\n API.snd_rawmidi_write(handle, bytes.to_i, data.size)\n API.snd_rawmidi_drain(handle)\n true\n end",
"def serialize(data)\n File.open(\"test/basic_complex_test/ruby_test/bin.babel.rb\", \"w+b\") do |f|\n f.write(data)\n end\n end",
"def write(data)\n @write_buffer << data\n post do\n begin\n @monitor&.interests = :rw\n rescue EOFError => e\n # Monitor is closed\n logger.error \"Error when writing: #{e.message}\"\n end\n end\n end",
"def write_binary(buf)\n raise NotImplementedError\n end",
"def send_data(s, data)\n\n if USE_MP3\n audio_data = `echo '#{data}' | base64 --decode | sox -r 8000 -c 1 -e mu-law -t raw - -r 48000 -c 1 -t mp3 -`\n else\n audio_data = `echo '#{data}' | base64 --decode | opusenc --quiet --raw --raw-bits 8 --raw-rate 8000 --raw-chan 1 --bitrate 96 - -`\n end\n m = ShoutMetadata.new\n m.add 'filename', \"e#{5}_#{SecureRandom.urlsafe_base64}.mp3\"\n m.add 'title', \"My episode\"\n m.add 'artist', \"Mo\"\n s.metadata = m\n s.send audio_data\n s.sync\n\nend",
"def writeRawBytes(mData = nil)\n#p 'writeRawBytes'\n\t\tif (self.disconnected?)\n\t\t\treturn nil;\n\t\tend # if not connected\n#p 'am connected'\n\t\t# TODO: allow arrays too\n\t\tif (String != mData.class)\n\t\t\treturn nil;\n\t\tend # if invalid dada format\n#p 'got string data'\n\t\tiCountSent = 0\n\t\tiDataLength = nil\n\t\tiFrameID = nil\n\t\tiCountExpected = -1\n\t\tiSenderID = nil\n\t\tiTargetID = nil\n\t\tbHeaderFound = NO\n\t\tsData = ''\n\n\t\tbegin\n\t\t\tmData.each_byte do |iByte|\n\n\t\t\t\tif (bHeaderFound)\n\t\t\t\t\tif (iTargetID.nil?)\n\t\t\t\t\t\tiTargetID = iByte.chr\n\t\t\t\t\telsif (iSenderID.nil?)\n\t\t\t\t\t\tiSenderID = iByte\n\t\t\t\t\telsif (iFrameID.nil?)\n\t\t\t\t\t\tiFrameID = iByte\n\t\t\t\t\telsif (iDataLength.nil?)\n\t\t\t\t\t\tiDataLength = iByte\n\t\t\t\t\t\tiCountExpected = 5 + iDataLength + 2\n\t\t\t\t\tend # if not yet read target ID\n\t\t\t\telse\n\n\t\t\t\t\t# ruby respects perl (next) over C (continue), and pearls are found under the sea ;)\n\t\t\t\t\tnext if 0x00 == iByte\n\n\t\t\t\t\tbHeaderFound = YES if 0xFF == iByte\n\n\t\t\t\tend # if no header found yet\n\n\t\t\t\tsData << iByte.chr\n\n\t\t\t\tiCountSent += 1\n\n\t\t\t\tbreak if (iCountSent == iCountExpected)\n\n\t\t\tend # loop each byte\n\n\t\trescue Exception => e\n\n\t\t\tp 'KO: error in frame'\np e\n\t\t\treturn 0\n\n\t\tend # try catch\np ' writeRawBytes to ID: ' << iTargetID.to_s\n\t\tsIP = SssSEMapp.oIOframeHandler.getIPstringForID(iTargetID)\n\t\t# sIP could be nil at this point\n\t\t# send the payload\n\t\tif (sIP.nil?)\n\t\t\tself.sendTo(iTargetID, sData)\n\t\telse\n\t\t\tself.sendTo(sIP, sData)\n\t\tend # if target has been 'seen' on Ethernet or not\n\n\t\tiCountSent\n\n\tend",
"def puts_bytes(*data)\r\n API::Output.puts(@resource, data)\r\n true\r\n end",
"def write_data(data)\n \n # need to zero the checksum field in case:\n # its not zero, which would affect the checksum, 0 ^ X = X so zero doesn't affect checksum\n # the checksum has already been set, which would result in zero checksum, X ^ X = 0\n BinaryAccessor.write(0, \n @checksum_byte_offset*8, \n 8, \n :UINT,\n data, \n @endianness, \n :ERROR)\n\n # write the value into the packet\n BinaryAccessor.write(calcChecksum(data), \n @checksum_byte_offset*8, \n 8, \n :UINT,\n data, \n @endianness, \n :ERROR)\n \n return data\n end",
"def write_binary(file:, data:, address: nil)\n File.open(file, 'wb') do |f|\n f.write Array(address).pack('S') if address\n f.write Array(data.flatten).pack('C*')\n end\n end",
"def write(data)\n ret = io.write data\n @receivers.each do |r|\n Fiber.new { r.call data }.resume\n end\n ret\n end",
"def dump_object(p_data,p_sock)\n object_dump = Marshal.dump(p_data)\n dump_length = object_dump.length.to_s\n length_str = dump_length.rjust(9,'0')\n final_data = length_str + object_dump\n outbound_data << final_data\n begin \n write_and_schedule(p_sock) \n rescue DisconnectError => sock\n close_connection(sock)\n end\n end",
"def perform( handle, data, offset=0 )\n @handle = handle\n @offset = offset\n @data = data\n @pos = 0\n\n @driver.write( nil, handle, offset, data[0,CHUNK_SIZE] )\n end",
"def write(buf); end",
"def save_data(data, filename)\n File.binwrite(filename, Marshal.dump(data))\n return nil\nend",
"def write(value)\n record.send(\"#{name}_data=\", value)\n end",
"def send_data(data)\n logdebug \"send_data:\", :data => data\n attempt_write(data)\n end",
"def <<(data)\r\n @data << data\r\n end",
"def write(data)\n @mutex.synchronize { @buffer = @buffer.dup.concat(data) }\n pump_buffer\n Reactor.selector.wakeup unless monitor.interests == :r\n end",
"def write(data)\n @output_row << data\n end",
"def write(data)\n generic_write(data, 2) { |data| Krypt::Hex.decode(data) }\n end",
"def write(io)\n wu32(io, MAGIC_NUMBER)\n wu16(io, VERSION_MAJOR)\n wu16(io, VERSION_MINOR)\n wi32(io, THIS_ZONE)\n wu32(io, sigfigs)\n wu32(io, snaplen)\n wu32(io, network)\n end",
"def write_raw(obj,encoding = 3)\n\t @stream = \"\" #new output stream\n\t RequestStore.amf_encoding = (encoding == 3) ? 'amf3' : 'amf0'\n\t reset_referencables\n\t write(obj)\n\t @stream\n\tend",
"def write(file)\n # write the length & header; always write length (int2) as network\n # order (as per GDSII spec)\n file.write [self.byte_size].pack('n')\n file.write [self.type].pack('c')\n file.write [self.data.type].pack('c')\n\n # now write the data...\n @data.write(file)\n end",
"def send_data data\n\t size = data.bytesize if data.respond_to?(:bytesize)\n\t size ||= data.size\n\t\tEventMachine::send_data @signature, data, size\n\tend",
"def write(data)\n generic_write(data, 1) { |data| Krypt::Hex.encode(data) }\n end",
"def _wire_write(sock, data)\n # p [ \"debug_01\", @protocol, @usecrlf ]\n if @protocol >= Stomp::SPL_12 && @usecrlf\n wiredata = \"#{data}#{Stomp::CR}#{Stomp::LF}\"\n # p [ \"wiredataout_01:\", wiredata ]\n sock.write(wiredata)\n else\n # p [ \"wiredataout_02:\", \"#{data}\\n\" ]\n sock.puts data\n end\n end",
"def send_data( data )\n\t\tjson = data.to_json\n\t\tbytes = json.bytesize\n\t\tputs \"SEND %3i bytes to %s: %s\" % [bytes,name,json] if $DEBUG\n\t\tunless @socket.closed?\n\t\t\t@socket.write [bytes].pack('n')\n\t\t\tunless @socket.closed?\n\t\t\t\t@socket.write(json) == bytes\n\t\t\tend\n\t\tend\n\tend",
"def output(name, data, undoc = T.unsafe(nil)); end",
"def send_raw(data)\n # puts \"Sending data\"\n # puts_data(data)\n write(data)\n end",
"def write_data_block(stream, rt, lg, data) # :nodoc:\n\t compress = 0\n\t if compress? && data.size > COMPRESSION_MIN_SIZE\n\t\tdata = Zlib::Deflate.deflate(data)\n\t\tcompress = 1\n\t end\n\n do_write do\n Logfiles.write_data_block(wio, stream.index, rt, lg, compress, data)\n end\n\tend",
"def write(value, timestamp = Time.now, direct: false)\n ensure_type_available\n value = Typelib.from_ruby(value, type)\n do_write(@orocos_type_name, value, direct: direct)\n log_value(value, timestamp)\n value\n end",
"def marshal_load(data)\n self.data = data\n end",
"def write_int(value, stream = @index)\n stream.write([value].pack('L'))\n end",
"def output data\n @out << data.to_s\n data\n end",
"def push_write_buffer data, frame\n @write_mutex.synchronize {\n update_last_write_activity if @write_buffer.empty?\n @write_buffer << [data, frame] unless @closing\n }\n end",
"def write!\n @dev = File.open(@device, \"w\") if (@dev.nil? || @dev.closed?)\n @dev.write @bytes.pack(\"c*\")\n @dev.flush\n end",
"def write(chunk, last_chunk = T.unsafe(nil)); end",
"def write(chunk, last_chunk = T.unsafe(nil)); end",
"def write(chunk, last_chunk = T.unsafe(nil)); end",
"def write(chunk, last_chunk = T.unsafe(nil)); end",
"def data=(v)\n Axlsx.validate_string(v)\n self.type = TYPES[:stream] unless @type\n @size = v.size\n @data = v.bytes.to_a\n end",
"def write(data)\n ssl_socket.puts(data)\n end",
"def write_file(data)\n\toutput_file = data.pack(\"C*\")\n\n\tbegin\n\t\tFile.open(\"stego_out.bmp\", \"w\") {|file| file.write(output_file)}\n\trescue\n\t\traise \"File's cooked\"\n\tend\nend",
"def write data # data == logevent\n msg = nil\n h = @hash_data.dup\n h.update(@formatter.hash_data) if @formatter.respond_to?(:hash_data)\n h[:log4r_level] = data.level\n case msg = data.data\n when ::String\n when ::Hash\n h.update(msg)\n msg = hash[:msg] || UNKNOWN_MSG\n when ::Exception\n msg = data.message\n else\n msg = msg.inspect\n end\n TAM::Record::Generic.new(msg, h).log!\n end",
"def serialize(object, data); end",
"def write(passed_data = nil)\n\t\t\tthis_data = passed_data || data\n\t\t\tFile.open(file_path+'/'+file_name, 'wb') do |file|\n\t\t\t\tfile.write( this_data.to_json )\n\t\t\tend\n\t\tend",
"def process_data(type, data)\n case type\n when :boolean\n MuseekBindings::BinUtils.pack_boolean(data)\n when :uint32\n MuseekBindings::BinUtils.pack_uint32(data)\n when :string\n MuseekBindings::BinUtils.pack_string(data)\n end\n end",
"def feed_data(data)\n \t\t@pipeline.play \t\t\n\t\tbuffer=Gst::Buffer.new\n\t\t\n\t \tbuffer.data = data\n\t \t@appsrc.push_buffer(buffer)\n\tend"
] |
[
"0.677972",
"0.6653572",
"0.6653572",
"0.6653572",
"0.6653572",
"0.65887475",
"0.6586595",
"0.6469189",
"0.62490296",
"0.62341",
"0.6225124",
"0.6205195",
"0.6116818",
"0.5838499",
"0.5817549",
"0.5816593",
"0.5802049",
"0.5759799",
"0.5749977",
"0.5745314",
"0.5707644",
"0.5696152",
"0.5669177",
"0.56283456",
"0.56266874",
"0.56106853",
"0.56026727",
"0.5577715",
"0.55616665",
"0.55616665",
"0.55616665",
"0.5550432",
"0.5543109",
"0.5520062",
"0.5515023",
"0.5501103",
"0.5496586",
"0.547527",
"0.54533464",
"0.54533464",
"0.5452832",
"0.54314655",
"0.54170436",
"0.5406404",
"0.5386799",
"0.53859186",
"0.5371203",
"0.53708845",
"0.53653127",
"0.53595895",
"0.53595895",
"0.5359411",
"0.5359411",
"0.5351438",
"0.534528",
"0.5344822",
"0.5328069",
"0.5324998",
"0.5318889",
"0.5312075",
"0.5307831",
"0.5297954",
"0.5291602",
"0.5280004",
"0.5275771",
"0.5269476",
"0.52688164",
"0.5258603",
"0.524378",
"0.5242575",
"0.52414775",
"0.5237471",
"0.52296484",
"0.5218112",
"0.52136713",
"0.5211977",
"0.5210943",
"0.5208185",
"0.5205177",
"0.5203374",
"0.5199514",
"0.51994485",
"0.5183238",
"0.517562",
"0.51616716",
"0.5159342",
"0.5158102",
"0.51521635",
"0.5152041",
"0.5137935",
"0.5137935",
"0.5137935",
"0.5137935",
"0.51364493",
"0.51363623",
"0.5124804",
"0.5089266",
"0.5080068",
"0.5076518",
"0.507533",
"0.5071661"
] |
0.0
|
-1
|
Short and quick log statistics Return list of selected files.
|
def selected_files
Dir["#{ARGV.first}*.log"]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def files\n page = get_page\n offset = PER_PAGE * page\n get_run_logs(:limit => PER_PAGE, :offset => offset)\n end",
"def index\n\n if current_user.is_admin?\n @search = LogFile.search(params[:q])\n @log_files = @search.result(distinct: true).includes(:runtime_statistics)\n else\n @search = LogFile.search(params[:q])\n @log_files = @search.result(distinct: true).where.not('access_type_id = ? and user_id != ?',\n get_access_type_id_by_name('private'),\n current_user.id).includes(:runtime_statistics)\n end\n end",
"def filenames\n file_stats.map(&:filename)\n end",
"def list\n BakFile.where('saved = ?', true).each do |file|\n Log.instance.info(\"#{file.fid},#{file.dkey},#{file.length},#{file.classname}\")\n break if SignalHandler.instance.should_quit\n end\n end",
"def info_files\n @queue << \"i f\"\n end",
"def file_stats\n @stats = @ff.get_stats\n end",
"def file_list(nginx_log_path)\n list=[]\n list.push(nginx_log_path)\n file_1hour_ago=\"#{nginx_log_path}.#{(Time.now-3600).strftime(\"%Y%m%d%H\").to_s}\"\n list.push(file_1hour_ago) if File.exist?(file_1hour_ago)\n list\n end",
"def command_showAll\n entries = @log.get_entries()\n entries.each { |i|\n puts i.to_s\n }\n end",
"def logs_of(selection, log: nil)\n if workspace_dir?(selection) || (pkg_set = find_package_set(selection))\n return [] if log && log != \"import\"\n\n name = if pkg_set then pkg_set.name\n else\n \"autoproj main configuration\"\n end\n\n import_log = File.join(ws.log_dir, \"#{name}-import.log\")\n if File.file?(import_log)\n [import_log]\n else\n []\n end\n else\n pkg = resolve_package(selection)\n Dir.enum_for(:glob, File.join(pkg.logdir, \"#{pkg.name}-#{log || '*'}.log\")).to_a\n end\n end",
"def select_all\n dir = Dir.pwd\n # check this out with visited_files TODO FIXME\n @selected_files = @view.map { |file| File.join(dir, file) }\n message \"#{@selected_files.count} files selected.\"\nend",
"def stats(filename,*args)\n fn = OptArg.quote(filename)\n opt = OptArg.parse(*args)\n puts send_cmd \"stats #{fn} #{opt}\"\n end",
"def file_list\n end",
"def files\n return get_result('files')\n end",
"def files( starts_with: )\n msg_handler.bold_debug [ msg_handler.here,\n msg_handler.called_from,\n \"starts_with=#{starts_with}\",\n \"\" ] if msg_handler.debug_verbose\n rv = Dir.glob( \"#{starts_with}*\", File::FNM_DOTMATCH )\n msg_handler.bold_debug [ msg_handler.here,\n msg_handler.called_from,\n \"files.size=#{rv.size}\",\n \"\" ] if msg_handler.debug_verbose\n return rv\n end",
"def added_files\n file_stats.count { |file| file.status == :added }\n end",
"def analyze\n log_files = FileGate.filter(:log, @file_names)\n\n if log_files.any?\n analysis_config = APP_CONFIG[:analysis_config]\n analysis_types = analysis_config[:import_defaults].gsub(' ', '').split(',')\n analysis_types.each do |type|\n AnalysisService.new(type: type).analyze\n end\n info = \"+analysis: #{analysis_types}\"\n else\n info = \".no analysis run (no logs included in import)\"\n end\n\n self.results << info\n logger.info info\n end",
"def get_run_logs(opts={})\n offset = opts[:offset] || 0\n limit = opts[:limit] || -1\n filename = opts[:filename] || \"\"\n glob = Deployinator::Helpers::RUN_LOG_PATH + \"*.html\"\n files = Dir.glob(glob)\n\n # filter for config files\n files.select! {|file| file.match(/^((?!web[-_]config_diff.html).)*$/) && file.match(/html/)}\n\n # filter for princess or production run_logs\n files.select! {|file| file.match(/#{filename}/)}\n\n # map files to hash with name and time keys\n files.map! do |file|\n { :name => File.basename(file), :time => Time.at(file[/(\\d{8,})/].to_i) }\n end\n\n # sort files chronologically,\n files.sort_by! {|file| file[:time]}.reverse!\n\n # select files within an index range\n files[offset...offset +limit]\n\n end",
"def index\n @title = \"User uploaded files\"\n get_files(params)\n end",
"def parse_files files\n file_list = gather_files files\n @stats = RDoc::Stats.new @store, file_list.length, @options.verbosity\n\n return [] if file_list.empty?\n\n original_options = @options.dup\n @stats.begin_adding\n\n file_info = file_list.map do |filename|\n @current = filename\n parse_file filename\n end.compact\n\n @stats.done_adding\n @options = original_options\n\n file_info\n end",
"def files\n info[\"Files\"].to_a\n end",
"def file_list\n @file_list\n end",
"def print_stat\n puts \"\\n\"\n puts \"********************\"\n puts \"Statistics:\"\n\n puts \"\\n\"\n puts \"Failed: #{$fail_uploaded_count}\"\n $not_uploaded_features_list.each do |feature|\n puts feature\n end\n\n puts \"\\n\"\n puts \"Success: #{$success_uploaded_count}\"\n $uploaded_features_list.each do |feature|\n puts feature\n end\n puts \"********************\"\n\n File.write('result.log', \"#{$updated_count},#{$created_count},#{$deleted_count}\")\nend",
"def find_logfiles\n require 'json'\n filepaths = Dir['**/*.log']\n File.write('C:/logfiles',JSON.pretty_generate(filepaths))\nend",
"def track_files(glob); end",
"def filelist\n puts_message \"filelist start\" \n\n user = current_user\n\n request = params[:request].force_encoding(\"UTF-8\")\n puts_message \"Requested Path: \" + params[:request]\n \n if user and check_existance_of_path(request) \n if request == nil\n @file_names = 'error'\n elsif request_is_directory?(request)\n fire_the_list(request)\n # @file_names = absolute_path(request)\n elsif request_is_file?(request)\n last = request.split('/').last\n path = absolute_path(request)\n send_file_info(last, request) \n else\n @file_names = 'error'\n end\n else \n @file_names = 'error'\n end\n\n puts_message \"filelist end\" \n \n @output = <<-END\n\n END\n \n if request == \"/images/\"\n @folders = Folder.all(:user_id => current_user.id)\n \n @output << \"photo\" + \"\\n\"\n \n @folders.each do |f|\n @output << f.name + \"\\n\"\n end\n \n @file_names = @output\n end\n \n return @file_names\n\n end",
"def all_files; end",
"def all_files; end",
"def list_files_from path,opts = {}\n unless Dir.exists? path\n Logger.<<(__FILE__,\"ERROR\",\"Local fetcher: path does not exists for listing... #{path} \")\n raise \"Error LocalFileFetcher !\"\n end\n if opts[:directories]\n cmd = \"ls -td #{path}/*/\"\n else\n cmd = \"ls #{path}\"\n cmd += \"/#{opts[:regexp]}\" if opts[:regexp]\n end\n out = `#{cmd}`\n return out.split(\"\\n\")\n end",
"def list(options={})\n Mailgun.submit(:get, log_url, options)\n end",
"def log_commits_by_files(logopts=nil)\n\t\t\tr={}\n\t\t\tfiles=run_simple(\"git log #{DefaultLogOptions} --name-only --format=\"\" #{logopts}\", chomp: :lines)\n\t\t\tuniq=files.uniq\n\t\t\tuniq.each do |file|\n\t\t\t\tr[file]=files.count(file)\n\t\t\tend\n\t\t\tr\n\t\tend",
"def all_files() = path.glob('**/*').select(&:file?).map(&:to_s)",
"def output_files\n get_info :output_files\n end",
"def ret_summary()\n [:renamed,:added,:deleted,:modified].inject(Summary.new) do |h,cnd|\n res = map{|diff|diff.send(\"file_#{cnd}\".to_sym)}.compact\n res.empty? ? h : h.merge(\"files_#{cnd}\".to_sym => res)\n end\n end",
"def all_files\n @files_hash.values\n end",
"def list_scan_files(options = {})\n subs = all_subjects\n filt_subs = looked_for(options[:subjects])\n filt_sess = looked_for(options[:sessions])\n filt_types = looked_for(options[:scan_type] || \"fMRI\") \n scans_list = all_scans(subs, filt_subs, filt_sess, filt_types) \n results = []\n scans_list.each do |scan_dir|\n resources_path = \"#{scan_dir}/Resources\"\n scanlist_type = list_files(\"#{resources_path}\", :directory).map { |e| Pathname.new(e.name).basename.to_s }\n scanlist_type.each do |scan_type|\n scanlist = list_files(\"#{resources_path}/#{scan_type}/Files\", :regular).map { |e| Pathname.new(e.name).basename.to_s }\n if (! options[:ext].blank?) && options[:ext].is_a?(Regexp)\n scanlist = scanlist.select { |scan| scan.match(options[:ext]) }\n end\n scanlist.each { |scan| results << \"#{resources_path}/#{scan_type}/Files/#{scan}\" }\n end \n end\n results\n end",
"def list\n @file_list.to_a\n end",
"def files() = files_path.glob('**/*')",
"def recent_files\n # print -rl -- **/*(Dom[1,10])\n @title = 'Recent files'\n # zsh D DOT_GLOB, show dot files\n # zsh om order on modification time\n @files = `zsh -c 'print -rl -- **/*(Dom[1,15])'`.split(\"\\n\").reject { |f| f[0] == '.' }\nend",
"def all\n @files\n end",
"def recents\n files = session[:user].x_files.all(:last_update.gte => (DateTime.now - 20.days), folder: false, limit: 20)\n files_list = []\n files.each do |file|\n files_list.push(file.description(session[:user])) if file.folder || (!file.folder && file.uploaded)\n end\n @result = { files: files_list, success: true }\n end",
"def parse_files(options)\n \n file_info = []\n\n files = options.files\n files = [\".\"] if files.empty?\n\n file_list = normalized_file_list(options, files, true)\n\n file_list.each do |fn|\n $stderr.printf(\"\\n%35s: \", File.basename(fn)) unless options.quiet\n \n content = File.open(fn, \"r\") {|f| f.read}\n\n top_level = TopLevel.new(fn)\n parser = ParserFactory.parser_for(top_level, fn, content, options, @stats)\n file_info << parser.scan\n @stats.num_files += 1\n end\n\n file_info\n end",
"def info(filename, nohash = nil)\n\tf = filename\n\tif test_file(f)\n\t\th = nohash ? (nil) : (Digest::SHA1.hexdigest(File.read(f)))\n\t\treturn [File.mtime(f), File.stat(f).mode.to_s(8).to_i, h]\n\tend\n\treturn []\nend",
"def files\n array = []\n @list.each do |k,v|\n array += v.filename\n end\n array\n end",
"def list_files\n source_dir = Path.new(params[:source_dir])\n if params.has_key?(:show_catalogues)\n show_catalogues = params[:show_catalogues]\n else\n show_catalogues = false\n end\n if params[:ext].present?\n file_type = params[:ext]\n else\n file_type = nil\n end\n render json: source_dir.files(file_type: file_type, show_catalogues: show_catalogues)\n end",
"def file_name_list\n @target.source_build_phase.file_display_names\n end",
"def list_anat_files(options = {}) \n subs = all_subjects\n filt_subs = looked_for(options[:subjects])\n filt_sess = looked_for(options[:sessions])\n filt_types = looked_for(options[:t_types] || [ \"T1\", \"T2\" ]) \n scans_list = all_scans(subs, filt_subs, filt_sess, filt_types) \n results = []\n scans_list.each do |scan_dir|\n resources_path = \"#{scan_dir}/Resources\"\n scanlist_type = list_files(\"#{resources_path}\", :directory).map { |e| Pathname.new(e.name).basename.to_s }\n scanlist_type.each do |scan_type|\n scanlist = list_files(\"#{resources_path}/#{scan_type}/Files\", :regular).map { |e| Pathname.new(e.name).basename.to_s }\n if (! options[:ext].blank?) && options[:ext].is_a?(Regexp)\n scanlist = scanlist.select { |scan| scan.match(options[:ext]) }\n end\n scanlist.each { |scan| results << \"#{resources_path}/#{scan_type}/Files/#{scan}\" }\n end \n end\n results\n end",
"def gather_files files\n files = [\".\"] if files.empty?\n\n file_list = normalized_file_list files, true, @options.exclude\n\n file_list = remove_unparseable(file_list)\n\n if file_list.count {|name, mtime|\n file_list[name] = @last_modified[name] unless mtime\n mtime\n } > 0\n @last_modified.replace file_list\n file_list.keys.sort\n else\n []\n end\n end",
"def summarize_file(path); end",
"def find_stats_files(s_dir)\n stats_files = []\n Dir[s_dir + \"/*stats*\"].each do |f|\n stats_files << f if f =~ %r{marked.stats[.F3|.R3]*.txt$}x and \n File.file?(f) and File.size?(f)\n end\n\n # Either 1 stats file\n # Or 2 stats file (R3|F3)\n if (stats_files.size == 1 and\n stats_files[0].split(\"/\")[-1] == \"marked.stats.txt\") or\n (stats_files.size == 2 and\n stats_files[0].split(\"/\")[-1] == \"marked.stats.R3.txt\" and\n stats_files[1].split(\"/\")[-1] == \"marked.stats.F3.txt\")\n stats_files\n else\n []\n end \nend",
"def files\n entries.map(&:filepath)\n end",
"def list_files(paths = T.unsafe(nil), options = T.unsafe(nil)); end",
"def list_files(paths = T.unsafe(nil), options = T.unsafe(nil)); end",
"def modified_files\n file_stats.count { |file| file.status == :modified }\n end",
"def report_st_ops_file_stats(options)\n latest_st_ops_file_path = Subtitle::OperationsFile.find_latest(\n config.base_dir(:subtitle_operations_dir)\n )\n st_ops_json_string = File.read(latest_st_ops_file_path)\n\n operations = Hash.new(0)\n # Match lines like ` \"operation_type\": \"content_change\",`\n st_ops_json_string.scan(/^\\s+\"operation_type\": \"([^\"]+)\"/) { |match|\n # match example: [\"insert\"]\n operations[match.first] += 1\n }\n\n l = ['']\n l << \"st-ops file stats\".color(:blue)\n l << (\"=\" * 24).color(:blue)\n l << \"File: #{ latest_st_ops_file_path }\"\n l << \"Size: #{ (File.size(latest_st_ops_file_path).to_f / 2**20).round } MB\"\n l << ''\n l << \"Operations:\"\n l << \"-\" * 24\n operations.to_a.sort { |(k_a, _v_a),(k_b, _v_b)|\n k_a <=> k_b\n }.each { |k,v|\n number_with_delimiter = v.to_s.reverse.gsub(/(\\d{3})(?=\\d)/, '\\\\1,').reverse\n l << \"#{ k.ljust(16) } #{ number_with_delimiter.rjust(7) }\"\n }\n l << \"-\" * 24\n total_ops_count = operations.values.inject(0) { |m,v| m += v; m }\n l << \"Total: #{ total_ops_count.to_s.reverse.gsub(/(\\d{3})(?=\\d)/, '\\\\1,').reverse.rjust(17) }\"\n l << ''\n\n l.each { |e| $stderr.puts e }\n end",
"def analyze_log_files(_log_file_paths, _start_time, _end_time)\n # override and do something appropriate\n end",
"def tracked_files; end",
"def files\n # list_of_filenames = Dir.entries(path)\n @list_of_filenames = Dir.glob(\"#{@path}/*.mp3\").collect! {|x| x.gsub(\"#{@path}/\", \"\") }\n # binding.pry\n end",
"def log_files\n files = []\n Find.find(File.join(Dir.pwd, 'features', 'logs')) do |p|\n next if FileTest.directory? p\n files << p\n end\n files\nend",
"def files\n @files.values\n end",
"def getFilesinDir(path, logkey='')\n\tfiles = Mcmlln::Tools.dirListFiles(path)\n\treturn files\nrescue => logstring\n\treturn []\nensure\n Mcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend",
"def statistics_by_file_extension(opts = {})\n data, _status_code, _headers = statistics_by_file_extension_with_http_info(opts)\n data\n end",
"def files; end",
"def files; end",
"def files; end",
"def files; end",
"def files; end",
"def files; end",
"def list_all_requests\n call(:get, upload_path)\n end",
"def list(client, current_path)\n\n\tfiles = Dir.glob(\"#{current_path}/files/*\")\n\tclient.puts \"\\nList of Files:\"\n\tfiles.each{ |file|\n\tfile.slice! \"#{current_path}/files/\"}\n\tclient.puts files\n\nend",
"def list_files\n User.sync_files!(@context)\n files = user_real_files(params, @context)\n\n if unsafe_params[:limit] && unsafe_params[:offset]\n files = files.limit(unsafe_params[:limit]).offset(unsafe_params[:offset])\n end\n\n search_string = params[:search_string].presence || \"\"\n\n result = files.eager_load(:license, user: :org).\n where(\"nodes.name LIKE ?\", \"%#{search_string}%\").\n order(id: :desc).map do |file|\n describe_for_api(file, unsafe_params[:describe])\n end.compact\n\n render json: unsafe_params[:offset]&.zero? ? { objects: result, count: result.length } : result\n end",
"def filestotal\r\n\t\t\t`#{BITS::BITSADMIN} /getfilestotal {#{@id}}`\r\n\t\tend",
"def list_files(configs, a)\n puts \"Files for #{a}:\"\n\n count = 0\n sum_fs = 0\n Dir.foreach(configs[a]).each{|f|\n if not IGNORE.include?(f) then\n full_path = File.join(configs[a], f)\n puts \" #{count+=1}. #{f}#{File.directory?(full_path)? '/':''}\"\n sum_fs += File.size(full_path)\n end\n }\n \n puts \"#{count} file#{(count==1)?'':'s'}, sum #{sum_fs}B.\"\nend",
"def getLogsByDate(path,start_file_name,from_date,asc_by_fname)\n require 'date'\n persist_from_date = Hash.new\n persist_start_file_name = start_file_name\n list_logs = Array.new\n if(asc_by_fname == nil)\n #Get logs from single file\n if(start_file_name == nil)\n puts \"[Logstat] : 'start_file_name' parameter must be required !\"\n return\n end\n list_logs = getLogsSingleFileByDate(path,start_file_name,from_date,asc_by_fname,persist_from_date)\n else\n #Get logs from multi files\n sorted_by_modified = Dir.entries(path).sort_by {|f| File.mtime(File.join(path,f))} .reject{|entry| entry == \".\" || entry == \"..\" || File.directory?(File.join(path,entry))}\n if(asc_by_fname)\n #File sorted ASC\n if(start_file_name == nil )\n start_file_name = sorted_by_modified.first\n end\n Dir.entries(path).sort.each do |log_file|\n\n if File.file?(File.join(path,log_file))\n if((start_file_name <=> log_file) <= 0)\n list_logs.concat(getLogsSingleFileByDate(path,log_file,from_date,asc_by_fname,persist_from_date))\n persist_start_file_name = log_file\n end\n end\n end\n else\n #File sorted DESC\n if(start_file_name == nil )\n start_file_name = sorted_by_modified.last\n end\n Dir.entries(path).sort.reverse.each do |log_file|\n if File.file?(File.join(path,log_file))\n if((start_file_name <=> log_file) >= 0)\n list_logs.concat(getLogsSingleFileByDate(path,log_file,from_date,asc_by_fname,persist_from_date))\n persist_start_file_name = log_file\n end\n end\n end\n end\n end\n finalData = Hash.new\n finalData[\"list_logs\"] = list_logs\n #Persistent data for next monitoring\n persist_data = Hash.new\n persist_data[\"start_file_name\"] = persist_start_file_name\n persist_data[\"from_date\"] = persist_from_date[\"persist_from_date\"]\n finalData[\"persistent_data\"] = persist_data\n return finalData\nend",
"def get_current_files\n get_files(OcflTools::Utils.version_string_to_int(@head))\n end",
"def file_listing(commit)\n # The only reason this doesn't work 100% of the time is because grit doesn't :/\n # if i find a fix, it'll go upstream :D\n count = 0\n out = commit.diffs.map do |diff|\n count = count + 1\n if diff.deleted_file\n %(<li class='file_rm'><a href='#file_#{count}'>#{diff.a_path}</a></li>)\n else\n cla = diff.new_file ? \"add\" : \"diff\"\n %(<li class='file_#{cla}'><a href='#file_#{count}'>#{diff.a_path}</a></li>)\n end\n end\n \"<ul id='files'>#{out.join}</ul>\"\n end",
"def gather_uploads(expected_num_uploads:, dirname:)\n num_uploads = -1\n attempt = 0\n while (attempt < 3) && (num_uploads != expected_num_uploads)\n # log_info 'attempt', attempt, 'num_uploads', num_uploads, 'expected_num_uploads', expected_num_uploads\n attempt += 1\n if attempt > 1\n show { \n warning 'Number of uploaded files was incorrect, please try again!'\n note \"You uploaded #{num_uploads} files, but the collection has #{expected_num_uploads} cultures.\"\n }\n end\n uploads_from_show = show do\n title \"Select and highlight all .fcs files in directory <b>#{dirname}</b>\"\n upload var: 'fcs_files'\n end\n if !uploads_from_show[:fcs_files].nil?\n num_uploads = uploads_from_show[:fcs_files].length\n end\n \n end\n upload_list = uploads_from_show_to_array(uploads_from_show, :fcs_files)\n return upload_list\n end",
"def takeFilesNames\nDir['result*.*'].each do |file_name|\n @files_names.push(file_name)\nend\nend",
"def get_file_listing\n execute!(drive.files.list).data\n end",
"def list_files\n fail('Requires implementation')\n end",
"def list_files(options = {}) \n options = DEFAULTS.merge(options)\n\n path = options[:path]\n all = options[:all]\n extension = options[:extension]\n\n extension = \".#{extension}\" unless extension == '' or extension.start_with?('.') \n file_wildcard = \"*#{extension}\"\n\n path = \"#{path}/\" unless path == '' or path.end_with?('/')\n path = path+'**/' if all \n\n Dir.glob(\"#{path}#{file_wildcard}\")\n end",
"def summary(recursive=false)\n failures = failures(recursive)\n successes = successes(recursive)\n newfiles = new_files(recursive)\n total = failures.size + successes.size + newfiles.size\n summary = \"#{@dir} #{recursive ? \" and sub-directories\" : \"\"} contains #{total} files: #{successes.size} stored, #{failures.size} failed, #{newfiles.size} new\"\n return summary \n end",
"def ls\n std_keys = [:class, :args, :arg_type, :start, :end, :result]\n extra_keys = key_counts.to_a.reject{|entry| std_keys.include?(entry[0])}\n extra_keys = extra_keys.sort_by{|entry| [-entry[-1], entry[0].to_s]}.map{|entry| entry[0]} # keys in descending order by frequency\n keys = std_keys + extra_keys\n table = []\n table << keys\n selected_log.each do |line|\n table << keys.map do |k|\n v = line[k]\n if k.to_s =~ /class/\n v\n elsif k == :args\n v.inspect[1...-1]\n elsif v.nil?\n ''\n else\n v.inspect\n end\n end\n end\n if table.size <= 1\n puts \"No matching data\"\n else\n puts table.justify_rows.map{|row| row.join(' ')}.join(\"\\n\")\n end\n end",
"def list\n FileOperations.find_all(self)\n end",
"def files\n result = []\n @my_files.each do |f|\n result << f.fname if FileTest.file?(f.fname)\n end\n result\n end",
"def formatted_file_list(title, source_files); end",
"def getResultFileNames()\n resultDir = File.dirname(File.dirname(File.expand_path(Dir.pwd)))\n @demuxBustardSummaryXML = resultDir + \"/DemultiplexedBustardSummary.xml\"\n\n baseCallsStatsDir = Dir[resultDir + \"/Basecall_Stats_*\"]\n @demuxStatsHTM = baseCallsStatsDir[0] + \"/Demultiplex_Stats.htm\"\n\n if !File::exist?(@demuxBustardSummaryXML)\n raise \"File \" + @demuxBustardSummaryXML + \" does not exist or is unreadable\"\n end\n\n if !File::exist?(@demuxStatsHTM)\n raise \"File \" + @demuxStatsHTM + \" does not exist or is unreadable\"\n end\n \n end",
"def report_results( timings )\n t = timings.first\n output.puts \n output.puts \" Total files read : #{\"%12d\" % t.value_stats.count}\"\n output.puts \" Total bytes read : #{\"%12d\" % t.value_stats.sum}\"\n output.puts \" Minimum filesize : #{\"%12d\" % t.value_stats.min}\"\n output.puts \" Average filesize : #{\"%16.3f\" % t.value_stats.mean}\"\n output.puts \" Maximum filesize : #{\"%12d\" % t.value_stats.max}\"\n output.puts \" Stddev of sizes : #{\"%16.3f\" % t.value_stats.stddev}\"\n output.puts\n\n output.puts [\"%28s\" % \"read order\", \"%20s\" % \"Elapsed time (sec)\", \"%22s\" % \"Read rate (bytes/sec)\" ].join(\" \")\n output.puts \"-\" * 72\n timings.each do |timing|\n p = [ ]\n p << \"%28s\" % timing.name\n p << \"%20.3f\" % timing.timed_stats.sum\n p << \"%22.3f\" % timing.rate\n output.puts p.join(\" \")\n end\n output.puts\n end",
"def filenames; end",
"def selected_files\n a = Array.new\n selected_iters do |iter|\n a.push(@current_dir+iter[LS_Name])\n end\n return a\n end",
"def get_scan_files(options)\n\n last_modified = DateTime.parse(options[:last_modified]).to_time.to_i\n\n query_params = URI.encode_www_form({:folder_id => options[:folder_id], :last_modification_date => last_modified}) if options[:folder_id]\n path = ['/scans', query_params].join(\"?\")\n \n scans = get_request(options, path)\n\n # loop through the scans and ask nessus to export the last scan result\n # it will return a file id that we can issue a GET on\n scans['scans'].each do | scan |\n\n #puts \"Name: #{scan['name']}\"\n #puts \"Last mod date: #{Time.at(scan['last_modification_date'])}\"\n \n path = \"/scans/#{scan['id']}/export\"\n file = post_request(options, path, \"format=csv\")\n\n # now grab the file and save it\n path = \"/scans/#{scan['id']}/export/#{file['file']}/download\"\n filename = \"#{scan['name'].gsub(/\\s/, '_')}_#{scan['last_modification_date']}.csv\"\n get_file(options, path, filename)\n \n end\n end",
"def find_files(location)\n @@logs = {:todo => File.join(location, \"todo.log\"), \n :metrics => File.join(location, \"metrics.log\"), \n\t:error => File.join(location, \"error.log\"),\n\t:working => File.join(location, \"working.log\")\n }\n end",
"def print_statistics(opts)\n puts \"-> statistics\"\n puts \" ----------\"\n printf(\"%7s: %4d\\n%7s: %4d\\n%7s: %4d\\n%7s: %4d\\n%7s: %4d\\n\",\n \" total\", opts[:valid_counter] + \n opts[:invalid_counter] +\n opts[:skip_counter] +\n opts[:double_counter],\n \" valid\", opts[:valid_counter],\n \" invalid\", opts[:invalid_counter],\n \" drop\", opts[:skip_counter],\n \" double\", opts[:double_counter])\n puts\n puts \"-> pattern: #{opts[:pattern].inspect}\"\n puts \"-> scan pattern: #{opts[:scan_pattern].inspect}\"\n puts\n puts \"-> files operated on\"\n puts \" -----------------\"\n puts \" values read from: #{opts[:infile]}\"\n puts \" valid values written to: #{opts[:valid_file]}\"\n puts \" invalid values written to: #{opts[:invalid_file]}\"\n if opts[:note]\n puts\n puts \"-> Note\"\n puts \" ----\"\n puts opts[:note]\n end\n end",
"def list_files(prefix=\"\")\n glob = if prefix.nil? || prefix.empty?\n \"media/**/*\"\n elsif prefix.end_with? '/'\n \"media/#{prefix}**/*\"\n else\n \"media/#{prefix}*\"\n end\n\n puts \"Listing local files matching #{glob}\"\n\n Dir[glob].select{|path| File.file? path }.map do |path|\n {\n path: path,\n size: File.size(path),\n md5: Digest::MD5.hexdigest(File.read(path))\n }\n end\nend",
"def list\n\t\t\tbegin\n\n\t\t\t\t# Prepare result, array of absolute paths for found files\n # within given directory. Also empty cache\n\t\t\t\tresult = []\n @scan_history = {}\n\n\t\t\t\t# Recursively scan current folder for files\n\t\t\t\tFind.find(@scan_path) do |current_full_path|\n\n\t\t\t\t\t# Get filename, prune if dot\n\t\t\t\t\tfilename = File.basename(current_full_path)\n Find.prune if filename[0] == ?.\n\n # Get extension\n extension = File.extname(current_full_path)\n\n\t\t\t\t\t# Check for file extension, if provided\n\t\t\t\t\tif @scan_extension && extension.eql?(@scan_extension)\n\n # Get foldername\n folder_name = File.dirname(current_full_path)\n\n # Get number of files parsed in current folder, default 0\n folder_depth = @scan_history.fetch(folder_name, nil) || 0\n Logging[self].debug \"At #{folder_name}\" if folder_depth == 0\n\n # If the desired depth hasn't been reached\n unless folder_depth == @scan_depth\n\n # Increase current depth\n folder_depth += 1\n\n # Add and log result\n Logging[self].warn \"Result: '#{current_full_path}'\"\n result << current_full_path\n\n # Update cache, proceed no further in this folder\n @scan_history[folder_name] = folder_depth\n Find.prune\n end\n\t\t\t\t\telse\n\t\t\t\t\t\n\t\t\t\t\t\t# Either move beyond this file, if we're searching\n\t\t\t\t\t\t# for specific files (filtered by extension), or add\n # the path to the result (since no filter applied)\n\t\t\t\t\t\t@scan_extension ? next : (result << current_full_path)\n\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\t\t\n end # find block\n\n # Log final result length\n Logging[self].info \"Retrieved #{result.length} results\"\n\n\t\t\t\t# Return result\n\t\t\t\tresult\n\n\t\t\t# Rescue any exceptions\n\t\t\trescue Exception => e\n\t\t\t\tLogging[self].error e\n nil\n\t\t\tend\n\t\tend",
"def list_files\n @synth_files = CreatedFile.find_all_by_content_type(\"synthesis\",\n :include => :researcher, \n :order => \"created_at DESC, created_file DESC\")\n end",
"def ls_report_dir(branch = proj_branch)\n files = proj.show(report_branch, report_path(branch)).split(\"\\n\")\n files.shift(2)\n files\n end",
"def display_files(pathname)\n # `find` doesn't follow symlinks, so we should instead\n realpath = ArduinoCI::Host.symlink?(pathname) ? ArduinoCI::Host.readlink(pathname) : pathname\n\n # suppress directories and dotfile-based things\n all_files = realpath.find.select(&:file?)\n non_hidden = all_files.reject { |path| file_is_hidden_somewhere?(path) }\n\n # print files with an indent\n puts \" Files (excluding hidden files): #{non_hidden.size}\"\n non_hidden.each { |p| puts \" #{p}\" }\nend",
"def output_details(files) \n @stdout.puts\n @stdout.puts \"Details\".bold\n files.each do |t|\n fname = t.path\n @stdout.puts \"File: %s\" % [((t.status == FileData::STATUS_OK) ? fname : fname.red)]\n @stdout.puts \"Includes: %s\" % [format_fds(t.includes)] unless t.includes.empty?\n @stdout.puts \"Included by: %s\" % [format_fds(t.included_by)] unless t.included_by.empty?\n @stdout.puts \"References: %s\" % [format_fds(t.references)] unless t.references.empty?\n @stdout.puts \"Referenced by: %s\" % [format_fds(t.referenced_by)] unless t.referenced_by.empty?\n unless t.status == FileData::STATUS_NOT_FOUND\n # show that part only if file exists\n @stdout.puts \"Size: %s (%d)\" % [format_size(t.size),t.size]\n if (t.docbook)\n @stdout.puts \"Type: DocBook, Version #{t.version}, Tag: #{t.tag}\"\n else\n @stdout.puts \"MIME: #{val_s(t.mime)}\"\n end\n @stdout.puts \"Timestamp: %s\" % [t.ts]\n @stdout.puts \"SHA1: %s\" % [t.checksum]\n end\n @stdout.puts \"Error: %s\" % [t.error_string.to_s.red] unless (t.error_string.nil?) \n @stdout.puts\n end\n end",
"def stats_before_compil\n # Readme available?\n if File.exists?('readme.txt')\n @log_file.puts \"\\nLe fichier README existe !\\n\"\n @log_file.puts IO.read('readme.txt')\n end\n\n # Stats on files\n files_before_compil = Dir::entries('.') - ['.', '..', @results_file_dir]\n @log_file.puts \"\\nLe projet est composé des fichiers suivants :\"\n files_before_compil.each { |e| @log_file.puts \"\\t-#{e}\" }\n\n # Stats on number of lines\n nb_lines = `wc -l *.h *.c`\n @log_file.puts \"\\nStatistiques :\\n #{nb_lines}\"\n\n files_before_compil\n end",
"def files\n @files ||= FILE_RANGE.map(&:to_sym)\n end"
] |
[
"0.6985811",
"0.6693486",
"0.64204526",
"0.638672",
"0.6271665",
"0.62374353",
"0.61918247",
"0.615548",
"0.6149364",
"0.6007789",
"0.591411",
"0.58968085",
"0.58726776",
"0.5870168",
"0.5833882",
"0.58304113",
"0.5830102",
"0.5822955",
"0.58196354",
"0.5801161",
"0.5774163",
"0.57701236",
"0.5756886",
"0.5749622",
"0.57228845",
"0.5719196",
"0.5719196",
"0.5712772",
"0.57007504",
"0.56654125",
"0.56533116",
"0.56411093",
"0.5626763",
"0.562652",
"0.56240755",
"0.561883",
"0.5601273",
"0.55952936",
"0.5594426",
"0.55912286",
"0.5589493",
"0.55873275",
"0.5569598",
"0.5564557",
"0.55587107",
"0.5549136",
"0.5535089",
"0.5533303",
"0.55307376",
"0.552896",
"0.5510087",
"0.55072516",
"0.55026513",
"0.54950845",
"0.5486005",
"0.54784584",
"0.5461291",
"0.5457808",
"0.5456152",
"0.54545313",
"0.5451063",
"0.54469264",
"0.54469264",
"0.54469264",
"0.54469264",
"0.54469264",
"0.54469264",
"0.54219675",
"0.5413052",
"0.5408246",
"0.5404055",
"0.54008925",
"0.5399426",
"0.5391555",
"0.53900087",
"0.5384147",
"0.5383366",
"0.5379155",
"0.53733647",
"0.5369839",
"0.5366203",
"0.5363848",
"0.5356833",
"0.53561705",
"0.53534037",
"0.5352155",
"0.5351428",
"0.5350946",
"0.5336614",
"0.5335786",
"0.5333901",
"0.53324366",
"0.53314036",
"0.53234446",
"0.5318436",
"0.53169525",
"0.53104895",
"0.5309561",
"0.53052205",
"0.5293878"
] |
0.6669592
|
2
|
Init some internal vars
|
def init
@by_day = {}
if File.exist?('result.txt')
File.readlines('result.txt').each do |line|
a = line.chomp.split("\t")
@by_day[a.first] = a
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def custom_initialize_instance_variables\n @open_selector_bracket_detected = false\n @open_function_detected = false\n @open_include_detected = false\n @parents_stash = []\n @root_selectors = []\n @all_selectors = []\n @all_mixins = []\n @all_includes = []\n @all_properties = []\n end",
"def at_init\n\n\t\tend",
"def init\n end",
"def init\n end",
"def init\n end",
"def init\n\n end",
"def initialize\r\n init_public_members\r\n init_private_members\r\n end",
"def post_init\n end",
"def initialize() end",
"def init; end",
"def init_data\n end",
"def pre_initialize; end",
"def init()\n\t$numCharges = 0\n\t$numGiftCards = 0\n\t$giftCardAmount = 0\n\t$discountPercentage = 0\n\t$total = 0\n\t$labor = 0\nend",
"def init_private_members\r\n @original_direction = 2 # Original direction\r\n @original_pattern = 1 # Original pattern\r\n @anime_count = 0 # Animation count\r\n @stop_count = 0 # Stop count\r\n @jump_count = 0 # Jump count\r\n @jump_peak = 0 # Jump peak count\r\n @locked = false # Locked flag\r\n @prelock_direction = 0 # Direction before lock\r\n @move_succeed = true # Move success flag\r\n end",
"def initialize()\n @gen_info_fields = _general_information_fields();\n \n @addr_fields = _address_fields();\n\n end",
"def init\n\nend",
"def prep_variables\n end",
"def initialize\n init\n end",
"def pre_initialize\n end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize_methods_etc\n @method_list = []\n @attributes = []\n @aliases = []\n @requires = []\n @includes = []\n @extends = []\n @constants = []\n @external_aliases = []\n @current_line_visibility = nil\n\n # This Hash maps a method name to a list of unmatched aliases (aliases of\n # a method not yet encountered).\n @unmatched_alias_lists = {}\n\n @methods_hash = {}\n @constants_hash = {}\n\n @params = nil\n\n @store ||= nil\n end",
"def initialize\n\n\tend",
"def initialize\n\n\tend",
"def user_init; end",
"def initialize\n\t\t\n\tend",
"def initvars\n @provider_instances = []\n @needs_flush = false\n @failed = false\n end",
"def post_init\n\tend",
"def post_init\n end",
"def initialize\n \n end",
"def init_vars\n FLAGS.each do |position, flag|\n flag_set = ((@bits >> position) & 0x1) == 1\n instance_variable_set \"@#{flag}\", flag_set\n end\n end",
"def initialize\n\t \t# loading or not loading should be the key here.\n end",
"def initialize_default_instance_vars\n @success = true\n @code = STATUS_CODE[:ok]\n end",
"def a_init\nend",
"def initialize\n super\n\n @global_code = []\n @control_code = []\n @control_string = ''\n end",
"def initialize\n super()\n init_data()\n end",
"def mpt_init=(_arg0); end",
"def initialize\r\n\r\n end",
"def init_vars\n @repaint_required = true\n @widget_scrolled = true # 2011-10-15 \n @toprow = @pcol = 0\n if @show_selector\n @row_selected_symbol ||= '>'\n @row_unselected_symbol ||= ' '\n @left_margin ||= @row_selected_symbol.length\n end\n @row_selected_symbol ||= ''\n #@left_margin ||= 0\n @one_key_selection = false if @one_key_selection.nil?\n @row_offset = @col_offset = 0 if @suppress_borders\n\n end",
"def initialize #hash. Initializes them at nil if not provided\n @http_referers = nil\n @has_cookie = nil\n @session_duration = nil\n end",
"def init_globals\n $process_vars = ThreadSafeHash::ThreadSafeHashMonitored.new(Params['enable_monitoring'])\n $tmp_content_data_file = nil # will be init during execution\n $testing_memory_active = false\n $testing_memory_log = nil\n $indexed_file_count = 0\n $local_content_data = nil\n $local_content_data_lock = nil\n $remote_content_data_lock = nil\n $remote_content_data = nil\n $last_content_data_id = nil\n end",
"def initialize() #method\n @variables = {}\n end",
"def Init()\n end",
"def initialize()\r\n buildProperties = parse([BUILD_PROPERTIES, LOCAL_PROPERTIES]);\r\n testProperties = parse([TEST_PROPERTIES, LOCAL_PROPERTIES]);\r\n @app_host = testProperties[\"config_appHost\"]\r\n @module_html = buildProperties[\"config_appStartupUrl\"]\r\n @base_url = self.app_host + \"/\" + self.module_html\r\n @admin_user = testProperties[\"config_credentialsAdmin\"]\r\n @normal_user = testProperties[\"config_credentialsUser\"]\r\n @browser = testProperties[\"config_capybaraSeleniumBrowser\"]\r\n @browserPath = testProperties[\"config_capybaraSeleniumBrowserPath\"]\r\n @defaultAjaxWaitTime = testProperties[\"config_defaultAjaxWaitTime\"]\r\n end",
"def mpt_init; end",
"def set_initial_values\n now = Time.now\n @first_seen ||= now\n @last_activity ||= now\n @total_connections ||= 0\n @total_time ||= 0\n @money ||= 0\n @donations ||= 0\n @rank ||= 0\n @colour ||= :ansi\n @muffled ||= false\n @history ||= History.new\n @aliases ||= {}\n @ignoring ||= {}\n @ignoring_ips ||= {}\n @drug_strength ||= 0\n @alcohol_units ||= 0\n @onduty = @onduty.nil? ? true : @onduty\n end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize_data\n end",
"def initialize\n\n\n\n end",
"def initialize\n initialize!\n end",
"def initialize\n initialize!\n end",
"def initialize_vars\n # Initialize global variables\n $config = nil\n $channel = nil\n $mapping_channel = nil\n $nv2_channel = nil\n $content_channel = nil\n $last_potato = Time.now.to_i\n $potato = 0\n $last_mishu = nil\n $status_update = Time.now.to_i\n $twitch_token = nil\n $twitch_streams = {}\n $boot_time = Time.now.to_i\n $active_tasks = {}\n $memory_warned = false\n $memory_warned_c = false\n $linux = RbConfig::CONFIG['host_os'] =~ /linux/i\n $mutex = { ntrace: Mutex.new }\n\n # Set environment variables\n ENV['DISCORDRB_NONACL'] = '1' # Prevent libsodium warning message\n\n # Create additional needed folders\n [DIR_LOGS].each{ |d| Dir.mkdir(d) unless Dir.exist?(d) }\n\n log(\"Initialized global variables\")\nrescue => e\n fatal(\"Failed to initialize global variables: #{e}\")\n exit\nend",
"def main_variable\r\n super\r\n main_battledata # Setup Battle Temp Data & Interpreter\r\n main_troopdata # Setup Troop Data\r\n # Initialize wait count\r\n @wait_count = 0\r\n end",
"def init_class_vars \n @@untgv_jmptbl ||= initcvar_jmptbl_untagged_vlan \n end",
"def init\n self.current_time ||= 1800\n self.setting_time ||= 1800\n self.enabled ||= true\n self.state ||= false\n self.mode ||= 'auto'\n end",
"def init_private_members\n super\n @move_route = nil # Move route\n @move_route_index = 0 # Move route execution position\n @original_move_route = nil # Original move route\n @original_move_route_index = 0 # Original move route execution position\n @wait_count = 0 # Wait count\n end",
"def global_variables() end",
"def initialize_state\n @value_hash, @result_hash = {}, {}\n @derived_values, @attrs = [], []\n @timevec = []\n @utc_offset = Time.now.utc_offset\n @enum_index = 0\n end",
"def local_init(args)\n end",
"def initialize\n set_defaults\n end",
"def initialize\n set_defaults\n end",
"def init_public_members\n super\n @trigger = 0\n @list = nil\n @starting = false\n if $game_map.effectus_event_starting == self\n $game_map.effectus_event_starting = nil\n end\n end",
"def initialize()\n\t\tend",
"def initialize()\r\n\r\n end",
"def initialize\n reset!\n end",
"def initialize\n reset!\n end",
"def initialize()\n end",
"def pre_initialize_fields\n end",
"def initialize default_opts = {}\n @var_map = {}\n @default_opts = default_opts\n end",
"def init!\n @defaults = {\n :@refresh_token => ShakeTheCounter::Config.refresh_token,\n :@id => ShakeTheCounter::Config.client_id,\n :@secret => ShakeTheCounter::Config.client_secret,\n :@language_code => ShakeTheCounter::Config.language_code,\n }\n end",
"def init_variables\n\t\t@canvas = Magick::ImageList.new \n\t\t@canvas_width = 2880\n\t\t@canvas_height = 1800\n\t\t@quote = self.quote\n\t\t@citation = self.citation\n\t\t@highlight = self.colour_scheme.highlight\n\t\t@quote_marks = self.layout_scheme.quote_marks \n\t\t@font_size = self.layout_scheme.font_size.to_i\n\t\t@col = self.layout_scheme.col.to_i\n\t\t@position = self.layout_scheme.position\n\t\t@underline = self.layout_scheme.underline\n\tend",
"def initialize\n end",
"def init_declarations\n INITIAL_VALUES.each { |k, v| @declarations[k.to_s.tr('_', '-')] = v[:default] }\n end",
"def init_vars\n @repaint_required = true\n @toprow = @pcol = 0\n if @show_selector\n @row_selected_symbol ||= '>'\n @row_unselected_symbol ||= ' '\n @left_margin ||= @row_selected_symbol.length\n end\n #@left_margin ||= 0\n @one_key_selection = false if @one_key_selection.nil?\n @row_offset = @col_offset = 0 if @suppress_borders\n\n end",
"def initialize\n reset\n \tend",
"def build_vars\n\n end",
"def initialize\n preprocess false\n debug false\n end",
"def set_default_values\n # Ethernet configuration\n self.network_1_id ||= 1\n self.ethernet_ip_assignment_method_id ||=1\n # GRPS\n self.gprs_mtu ||= 1450\n # PSTN\n self.pstn_mtu ||= 1500\n # Time configuration\n self.time_zone ||= 'UTC'\n # Interval configuration\n self.configuration_update_interval ||= 3600\n self.status_interval ||= 3600\n self.send_data_interval ||= 86400\n # Software update configuration\n self.auto_update ||= false\n self.software_update_interval ||= 604800\n self.repo_type ||= 'stable'\n # Log configuration\n self.send_log_files ||= false\n # State XML\n self.state_xml ||= \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n<modified>true</modified>\\n\"\n end",
"def init\n if super\n @offset = 0\n @sg = ITALY\n self\n end\n end",
"def initvars\n @lexer = Puppet::Parser::Lexer.new\n end",
"def initialize_methods_etc\n @method_list = []\n @attributes = []\n @aliases = []\n @requires = []\n @includes = []\n @constants = []\n\n # This Hash maps a method name to a list of unmatched aliases (aliases of\n # a method not yet encountered).\n @unmatched_alias_lists = {}\n end",
"def init\n raise NotImplementedError\n end",
"def on_init; end",
"def on_init; end"
] |
[
"0.7499535",
"0.7499535",
"0.7499535",
"0.7499535",
"0.7403267",
"0.73084354",
"0.73083335",
"0.73083335",
"0.73083335",
"0.71712893",
"0.6974953",
"0.69629866",
"0.69508725",
"0.69495636",
"0.69443905",
"0.6892308",
"0.6850722",
"0.6816745",
"0.68156314",
"0.68055683",
"0.67793787",
"0.6720072",
"0.6702497",
"0.66960394",
"0.66960394",
"0.66960394",
"0.66960394",
"0.66960394",
"0.669226",
"0.66836417",
"0.66836417",
"0.66529864",
"0.6634686",
"0.6624861",
"0.6624102",
"0.6618776",
"0.6614647",
"0.66123766",
"0.6595724",
"0.65954596",
"0.65761584",
"0.657216",
"0.65559494",
"0.6543732",
"0.6536683",
"0.6525869",
"0.65219015",
"0.65212995",
"0.65103096",
"0.65057945",
"0.6490084",
"0.6483345",
"0.64823604",
"0.6474345",
"0.6474345",
"0.6474345",
"0.6474345",
"0.6474345",
"0.6474345",
"0.6474345",
"0.6474345",
"0.6474345",
"0.6474345",
"0.6474345",
"0.6464362",
"0.64549303",
"0.6443156",
"0.6443156",
"0.6440113",
"0.64382917",
"0.6433215",
"0.64321584",
"0.6420396",
"0.64170825",
"0.6416152",
"0.6414614",
"0.6392953",
"0.6392953",
"0.6390896",
"0.63906133",
"0.6388869",
"0.6385682",
"0.6385682",
"0.6384097",
"0.6373989",
"0.6356284",
"0.63431466",
"0.63402116",
"0.6337983",
"0.63233364",
"0.63214463",
"0.6316161",
"0.6301351",
"0.62974733",
"0.6284864",
"0.6273365",
"0.6272776",
"0.6271343",
"0.6270229",
"0.62691337",
"0.62691337"
] |
0.0
|
-1
|
Collects total number of requests and respond time for calculating average response time.
|
def response_by_days
selected_files.each do |file_name|
key = file_name[0,6]
next if @by_day[key]
result = [key, 0, 0, 0]
File.readlines(file_name).each do |line|
next unless line.match 'Completed 200 OK in'
time = $'.split('ms').first.strip.to_i
result[1] += 1
result[2] += time
end
# average
result[3] += result[2]/result[1]
p result
@by_day[key] = result
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def response_times\n times = []\n start_time = Time.now\n final_time = Time.now + @max_time\n counter = 1\n while Time.now < final_time do\n times << @request_builder.call(@url, counter)\n sleep(@sleep_time)\n counter += 1\n end\n times\n end",
"def average_response_time\n (active_time / requests.to_f) * 1000\n end",
"def time_request\n\t\tstarttimes = Process.times\n\t\tyield\n\tensure\n\t\truntimes = Process.times\n\t\t@run_count += 1\n\t\t@total_utime += utime = (runtimes.utime - starttimes.utime)\n\t\t@total_stime += stime = (runtimes.stime - starttimes.stime)\n\t\tself.log.info \\\n\t\t\t\"[PID %d] Runcount: %d, User: %0.2f/%0.2f, System: %0.2f/%0.2f\" %\n\t\t\t[ Process.pid, @run_count, utime, @total_utime, stime, @total_stime ]\n\tend",
"def request_stats\n @all = current_user.trip_requests.requests.count\n @completed = current_user.trip_requests.completed.requests.count\n @cancelled = current_user.trip_requests.cancelled.requests.count\n @active = current_user.trip_requests.active.requests.count\n @stats = current_user.trip_requests.requests.group_by_month(:created_at, format: \"%b\", reverse:true).count\n @response = { all: @all, completed: @completed, cancelled: @cancelled, active: @active, requests: @stats }\n json_response(@response)\n end",
"def response_time_metrics\n result = {}\n @urls.each do |url|\n result[url[:name]] = get_metrics(url[:path])\n end\n print result\n end",
"def requests_per_second\n requests / horizon_time\n end",
"def compute_times\n @render_avg = 0.0\n @db_avg = 0.0\n @total_avg = 0.0\n @render_max = 0.0\n @db_max = 0.0\n @total_max = 0.0\n @error_avg = 0.0\n \n @log_entries.each do |la|\n if la.error?\n @error_avg += 1.0\n next\n end\n @render_avg += la.rendering\n @db_avg += la.db\n @total_avg += la.duration\n @render_max = la.rendering if la.rendering > @render_max\n @db_max = la.db if la.db > @db_max\n @total_max = la.duration if la.duration > @total_max\n end\n \n @render_avg /= @log_entries.size.to_f - @error_avg + 0.0001\n @db_avg /= @log_entries.size.to_f - @error_avg + 0.0001\n @total_avg /= @log_entries.size.to_f - @error_avg + 0.0001\n @error_avg /= @log_entries.size.to_f\n\n # using math.log allows us to smooth out the score between\n # infrequent and very frequent actions. 0.1 is added for a\n # non-0 result\n @render_cost = @render_avg * Math.log(@log_entries.size+0.1)\n @db_cost = @db_avg * Math.log(@log_entries.size+0.1)\n @total_cost = @total_avg * Math.log(@log_entries.size+0.1)\n end",
"def average_response_time\n return summary_average[:average_response_time]\n end",
"def capture_request_response_cycle_end_info(capture_error: false)\n return gather_stats unless gather_stats\n\n # get system info\n current_time = get_system_current_time\n current_used_memory = get_system_used_memory_mb\n current_swap_memory = get_system_used_swap_memory_mb\n current_hostname = get_server_hostname\n current_gc_stat = get_gc_stat\n\n res_info = {\n req_object_id: request.object_id,\n res_object_id: response.object_id,\n res_time: current_time,\n }\n\n # fetching temporary request info\n # return false if temporary request info cannot be found\n redis_req_key_name = redis_record.req_key(get_server_hostname, res_info[:req_object_id])\n req_info = ActiveSupport::HashWithIndifferentAccess.new(redis_record.parsed_get(redis_req_key_name))\n return false if req_info == {}\n redis_record.del redis_req_key_name\n\n # generating request-response-cycle info\n req_res_info = {\n key_name: nil,\n # server_name: req_info[:server_name],\n server_name: current_hostname,\n api_name: req_info[:req_path],\n api_verb: req_info[:req_http_verb],\n api_controller: req_info[:req_controller],\n api_action: req_info[:req_action],\n request_count: 0,\n min_time: nil,\n max_time: nil,\n avg_time: 0,\n start_time: nil, # slot starting time\n end_time: nil, # slot ending time\n error_count: 0,\n min_used_memory_MB: nil,\n max_used_memory_MB: nil,\n avg_used_memory_MB: 0,\n min_swap_memory_MB: nil,\n max_swap_memory_MB: nil,\n avg_swap_memory_MB: 0,\n avg_gc_stat_diff: Hash.new(0),\n min_gc_stat_diff: {},\n max_gc_stat_diff: {},\n }\n redis_req_res_key_name = redis_record.req_res_key(req_res_info[:server_name], req_res_info[:api_name], req_res_info[:api_verb])\n req_res_info[:key_name] = redis_req_res_key_name\n req_res_info[:start_time], req_res_info[:end_time] = redis_record.get_slot_range_for_key(redis_req_res_key_name).map(&:to_s)\n req_res_info_parsed = redis_record.parsed_get(redis_req_res_key_name)\n req_res_info = if req_res_info_parsed.present?\n # making use of existing value from db\n ActiveSupport::HashWithIndifferentAccess.new(req_res_info_parsed)\n else\n # using default value\n ActiveSupport::HashWithIndifferentAccess.new(req_res_info)\n end\n current_cycle_time = (res_info[:res_time] - req_info[:req_time]).round(SECONDS_PRECISION)\n current_gc_stat_diff = get_gc_stat_diff(req_info[:gc_stat], current_gc_stat)\n req_res_info[:min_time] = [req_res_info[:min_time], current_cycle_time].compact.min\n req_res_info[:max_time] = [req_res_info[:max_time], current_cycle_time].compact.max\n req_res_info[:avg_time] = ((req_res_info[:avg_time] * req_res_info[:request_count] + current_cycle_time)/(req_res_info[:request_count] + 1)).round(SECONDS_PRECISION)\n req_res_info[:min_used_memory_MB] = [req_res_info[:min_used_memory_MB], current_used_memory].compact.min\n req_res_info[:max_used_memory_MB] = [req_res_info[:max_used_memory_MB], current_used_memory].compact.max\n req_res_info[:avg_used_memory_MB] = ((req_res_info[:avg_used_memory_MB] * req_res_info[:request_count] + current_used_memory)/(req_res_info[:request_count] + 1)).round(MEMORY_PRECISION)\n req_res_info[:min_swap_memory_MB] = [req_res_info[:min_swap_memory_MB], current_swap_memory].compact.min\n req_res_info[:max_swap_memory_MB] = [req_res_info[:max_swap_memory_MB], current_swap_memory].compact.max\n req_res_info[:avg_swap_memory_MB] = (req_res_info[:avg_swap_memory_MB] * req_res_info[:request_count] + current_swap_memory)/(req_res_info[:request_count] + 1)\n req_res_info[:min_gc_stat_diff] = get_min_max_sum_gc_stat_diff(:min, req_res_info[:min_gc_stat_diff], current_gc_stat_diff)\n req_res_info[:max_gc_stat_diff] = get_min_max_sum_gc_stat_diff(:max, req_res_info[:min_gc_stat_diff], current_gc_stat_diff)\n req_res_info[:avg_gc_stat_diff] = get_avg_gc_stat_diff(req_res_info[:request_count], req_res_info[:min_gc_stat_diff], current_gc_stat_diff)\n req_res_info[:request_count] += 1 # Note: updation of `request_count` should be the last\n\n # if error is raised\n if capture_error\n req_res_info[:error_count] += 1\n end\n\n # saving request-respose-cycle info to redis db\n redis_record.jsonified_set(redis_req_res_key_name, req_res_info)\n\n # return request-response-cycle info key\n redis_req_res_key_name\n end",
"def response_time\n metrics['Response Time'].round\n end",
"def get_stats_for_worker(worker_addr, maxtime)\n stats = {} \n stat_entries = []\n @log_entries.synchronize do\n stat_entries = @log_entries[worker_addr].select { |item| (Time.now - item[:time_local].to_time) <= maxtime }\n end \n \n stats[:request_count] = stat_entries.size\n stats[:response_time] = get_stats_for_one(stat_entries, :upstream_response_time)\n stats[:request_length] = get_stats_for_one(stat_entries, :request_length)\n stats[:response_length] = get_stats_for_one(stat_entries, :body_bytes_sent)\n\n stats\n end",
"def requests_per_hour\n group_by_hour.map { |hour, ents|\n [hour, ents.size]\n }.sort { |a,b|\n a[0] <=> b[0]\n }\n end",
"def server_timing; end",
"def capture_request_response_cycle_start_info\n return gather_stats unless gather_stats\n\n # get system info\n current_time = get_system_current_time\n\n # temporarily save request info\n req_info = {\n req_object_id: request.object_id,\n res_object_id: response.object_id,\n server_name: (request.env[\"SERVER_NAME\"] rescue \"some_server_name\"),\n req_path: (request.path rescue \"some_path\"),\n req_http_verb: (request.method rescue \"some_method\"),\n req_time: current_time, # implicit convertion to integer\n req_url: (request.url rescue \"some_url\"),\n req_format: (request.parameters[\"format\"] rescue \"some_format\"),\n req_controller: (request.parameters[\"controller\"] rescue \"some_controller\"),\n req_action: (request.parameters[\"action\"] rescue \"some_action\"),\n remote_ip: (request.remote_ip rescue \"some_ip\"),\n gc_stat: get_gc_stat,\n }\n redis_req_key_name = redis_record.req_key(get_server_hostname, req_info[:req_object_id])\n redis_record.jsonified_set(redis_req_key_name, req_info, {ex: LONGEST_REQ_RES_CYCLE}, {strict_key_check: false})\n\n # return key_name\n redis_req_key_name\n end",
"def update_stats\n @request_count += 1\n discover_server_periodically if(time_to_discover? && !@disconnected_connections.empty?)\n end",
"def display_status\n reqs_per_sec = sprintf('%.2f',\n (@req.inject(:+).to_f / @req.length.to_f))\n\n puts \"\\nRequests per second: #{reqs_per_sec}\"\n @status.map do |status_code, status_count|\n puts \"HTTP Status #{status_code}: #{status_count}\"\n end\n puts \"Total time: #{@total_time} s\"\n end",
"def stats\n {\n in_msgs: @msgs_received,\n out_msgs: @msgs_sent,\n in_bytes: @bytes_received,\n out_bytes: @bytes_sent\n }.freeze\n end",
"def run\n done = false\n times = []\n threads = ThreadGroup.new\n count_m = Mutex.new\n\n @threads.times do\n Thread.start do\n threads.add Thread.current\n until @num_requests <= 0 do\n count_m.synchronize do\n if @num_requests % @tenths == 0 then\n print @num_requests\n elsif @num_requests % @hundredths == 0 then\n print '.'\n end\n @num_requests -= 1\n end\n $stdout.flush\n times << time_request\n end\n end\n Thread.pass\n end\n\n threads.enclose\n\n threads.list.each { |t| t.join }\n puts\n\n return times\n end",
"def call(env)\n start = Time.now\n status, headers, @response = @app.call(env)\n stop = Time.now\n elapsed_ms = (stop - start) * 1000\n @log.debug(\"type=measure.response.elapsed \\\nmethod=#{env['REQUEST_METHOD']} \\\npath=#{env['PATH_INFO']} \\\nstatus=#{status} \\\nelapsed=#{elapsed_ms}ms\")\n headers['x-response-time'] = \"#{elapsed_ms}ms\" if !headers.include? 'x-response-time'\n [status, headers, self]\n end",
"def request_count; end",
"def stats\n stats = {\n :servers => {}, \n :results => 0, \n :taken_tasks => 0, \n :untaken_tasks => 0,\n :taken_master_tasks => 0,\n :taken_task_tasks => 0, \n :untaken_master_tasks => 0,\n :untaken_task_tasks => 0,\n :failed_tasks => 0,\n :untaken_future_tasks => 0,\n :time => Time.now.to_f,\n }\n\n stats[:untaken_future_tasks] = SkynetWorkerQueue.connection.select_value(%{\n SELECT count(id)\n FROM #{message_queue_table}\n WHERE expire_time > #{Time.now.to_i} and tasktype = 'task' and payload_type = 'master' \n })\n\n stat_rows = SkynetWorkerQueue.connection.select_all(%{\n SELECT tasktype, payload_type, iteration, count(id) as number_of_tasks, expire_time\n FROM #{message_queue_table} \n WHERE expire_time <= #{Time.now.to_i} \n GROUP BY tasktype, payload_type, iteration \n }) \n stat_rows.each do |row|\n if row[\"tasktype\"] == \"result\" or row[\"payload_type\"] == \"result\"\n stats[:results] += row[\"number_of_tasks\"].to_i\n elsif row[\"tasktype\"] == \"task\" \n type_of_tasks = nil\n if row[\"payload_type\"] == \"master\"\n type_of_tasks = :master_tasks\n elsif row[\"payload_type\"] == \"task\"\n type_of_tasks = :task_tasks\n end\n if row[\"iteration\"].to_i == 0\n stats[\"untaken_#{type_of_tasks}\".to_sym] += row[\"number_of_tasks\"].to_i \n stats[:untaken_tasks] += row[\"number_of_tasks\"].to_i\n elsif row[\"expire_time\"].to_i < Time.now.to_i\n stats[:failed_tasks] += row[\"number_of_tasks\"].to_i \n else\n stats[\"taken_#{type_of_tasks}\".to_sym] += row[\"number_of_tasks\"].to_i \n stats[:taken_tasks] += row[\"number_of_tasks\"].to_i\n end\n end\n end\n\n stats[:time] = Time.now.to_f - stats[:time]\n stats\n end",
"def calculate_thread_times\r\n # Cache thread times since this is an expensive\r\n # operation with the required sorting \r\n @result.threads.each do |thread_id, methods|\r\n top = methods.sort.last\r\n \r\n thread_time = 0.01\r\n thread_time = top.total_time if top.total_time > 0\r\n\r\n @thread_times[thread_id] = thread_time \r\n end\r\n end",
"def throughput\n return {}\n end",
"def time_request\n time do\n do_request\n end\n end",
"def service_time\n service_time = 0\n @solution.each { |route| service_time += route.service_time }\n return service_time\n end",
"def search_request_concern_bm_finish\n elapsed = Time.zone.now - @search_request_start_time\n @search_request_benchmark[:sum] = @search_request_benchmark.values.sum\n @search_request_benchmark[:elapsed] = elapsed\n logger.info \"Benchmark SearchRequestConcern #{controller_name}##{action_name} #{sprintf(\"%.3f sec\", elapsed)}\"\n logger.info \"Benchmark SearchRequestConcern #{controller_name}##{action_name} #{@search_request_benchmark.inspect}\"\n rescue => e\n logger.warn \"Benchmark SearchRequestConcern Internal error during benchmarking. Cause: #{e.inspecct}\"\n end",
"def response_time\n @response_time\n end",
"def stats\n request :get, \"_stats\"\n end",
"def stats\n request :get, \"_stats\"\n end",
"def update_request_info(app_name, total_requests_seen,\n time_requests_were_seen, update_dashboard)\n Djinn.log_debug(\"Time now is #{time_requests_were_seen}, last \" +\n \"time was #{@last_sampling_time[app_name]}\")\n Djinn.log_debug(\"Total requests seen now is #{total_requests_seen}, last \" +\n \"time was #{@total_req_rate[app_name]}\")\n requests_since_last_sampling = total_requests_seen - @total_req_rate[app_name]\n time_since_last_sampling = time_requests_were_seen - @last_sampling_time[app_name]\n if time_since_last_sampling.zero?\n time_since_last_sampling = 1\n end\n\n average_request_rate = Float(requests_since_last_sampling) / Float(time_since_last_sampling)\n if average_request_rate < 0\n Djinn.log_info(\"Saw negative request rate for app #{app_name}, so \" +\n \"resetting our haproxy stats for this app.\")\n initialize_scaling_info_for_app(app_name, force=true)\n return\n end\n\n if update_dashboard\n send_request_info_to_dashboard(app_name, time_requests_were_seen,\n average_request_rate)\n end\n\n Djinn.log_debug(\"Total requests will be set to #{total_requests_seen} \" +\n \"for app #{app_name}, with last sampling time #{time_requests_were_seen}\")\n @total_req_rate[app_name] = total_requests_seen\n @last_sampling_time[app_name] = time_requests_were_seen\n end",
"def calc_stats\n #puts \"bad_biz = #{@bad_business_records.length}\"\n #puts \"bad_user = #{@bad_user_records.length}\"\n #puts \"good_biz = #{@good_business_records.length}\"\n #puts \"good_user = #{@good_user_records.length}\"\n \n @total_rec_cnt = @bad_business_records.length + @bad_user_records.length +\n\t @good_business_records.length + @good_user_records.length\n @well_formed_rec_cnt = @good_business_records.length + @good_user_records.length\n @malformed_rec_cnt = @bad_business_records.length + @bad_user_records.length\n @biz_rec_cnt = @businesses.length\n @user_rec_cnt = @users.length\n end",
"def trips_stats \n @all = current_user.trip_requests.trips.count\n @completed = current_user.trip_requests.trips.completed.count\n @cancelled = current_user.trip_requests.trips.cancelled.count\n @pending = current_user.trip_requests.trips.pending.count\n @on_going = current_user.trip_requests.trips.on_going.count\n @active = current_user.trip_requests.trips.active.count\n @monthly_successful = current_user.trip_requests.completed.trips.group_by_month(:created_at, format: \"%b\", reverse:true).count\n @monthly_pending = current_user.trip_requests.pending.trips.group_by_month(:created_at, format: \"%b\", reverse:true).count\n @response = { all: @all, completed: @completed, cancelled: @cancelled, active: @active, monthly_pending:@monthly_pending, monthly_successful:@monthly_successful, pending: @pending, on_going: @on_going }\n json_response(@response)\n end",
"def send_stats\n first_time = @prev_stat.empty?\n stats = build_request\n @stat.keys.each { |k| stats[k] = @stat[k] - @prev_stat[k] }\n @prev_stat.replace(@stat)\n # These should be reported as absolute values\n [:mt, :ma, :mc].each {|k| @prev_stat[k] = 0}\n return if first_time\n\n req = Net::HTTP::Post.new('/')\n req.set_form_data(stats)\n res = Net::HTTP.start(API, use_ssl: true) { |http| http.request(req) }\n unless res.is_a?(Net::HTTPOK)\n STDERR.puts \"Error sending stat: #{res.message}\"\n end\n res\n end",
"def requests_avg_per(seconds = 60)\n requests_per = requests_per(seconds)\n requests_per / seconds.to_f\n end",
"def total_time; end",
"def total_by_time_period(options = {})\n response = options[:response] || {}\n search_options = {}\n search_options[:query] = options[:query] || ''\n search_options[:bucket] = options[:bucket] || 'day'\n search_options[:fromDate] = Gnip.format_date(options[:date_from]) if options[:date_from]\n search_options[:toDate] = Gnip.format_date(options[:date_to]) if options[:date_to]\n search_options[:next] = options[:next_cursor] if options[:next_cursor]\n\n url = [counts_url, search_options.to_query].join('?')\n call_done = 0\n\n begin\n gnip_call = self.class.get(url, basic_auth: @auth)\n\n parsed_response = gnip_call.parsed_response\n parsed_response = (parsed_response || {}).with_indifferent_access\n\n raise gnip_call.response.message unless parsed_response.present?\n\n if parsed_response[:error].present?\n response = { results: [], next: nil, error: parsed_response[:error][:message], code: gnip_call.response.code.to_i, calls: (response[:calls] || 0) + 1 }\n else\n call_done = 1 # we have received a valid response\n parsed_response[:results].each_with_index do |item, i|\n parsed_response[:results][i] = item.merge(timePeriod: DateTime.parse(item[:timePeriod]).to_s)\n end\n response = { results: (response[:results] || []) + parsed_response[:results], next: parsed_response[:next], code: gnip_call.response.code.to_i, calls: (response[:calls] || 0) + 1 }\n end\n rescue StandardError => e\n response = { results: [], next: nil, error: e.message, code: 500, calls: (response[:calls] || 0) + call_done }\n end\n # If the next cursor is not present we fetched all the data\n # It happens that twitter returns the same cursor, in that case we stop\n return response if !parsed_response[:next].to_s.present? || (parsed_response[:next].to_s.present? && parsed_response[:next] == search_options[:next])\n\n total_by_time_period(query: search_options[:query],\n date_from: search_options[:fromDate],\n date_to: search_options[:toDate],\n bucket: search_options[:bucket],\n next_cursor: parsed_response[:next],\n response: response)\n end",
"def get_total_runtime\n TimeDifference.between(*get_runtime_timestamps).humanize\n end",
"def hash\n [cert, event_type, failure, http_status_code, request_headers, response_body, response_headers, response_size, timings].hash\n end",
"def times_for_send_update_requests(start_time, end_time)\n times = []\n\n task_time = start_time.beginning_of_hour + 30.minutes\n task_time += 1.hour if task_time < start_time\n\n while task_time < end_time\n times << task_time\n task_time += 1.hour\n end\n\n times\n end",
"def send_agent_stats\n curr_time = Time.now\n\n if curr_time - @last_stat_flush > @stats_interval\n t = Process.times\n # amount of user/system cpu time in seconds\n Hastur.gauge(\"hastur.agent.utime\", t.utime, curr_time)\n Hastur.gauge(\"hastur.agent.stime\", t.stime, curr_time)\n # completed child processes' (plugins) user/system cpu time in seconds (always 0 on Windows NT)\n Hastur.gauge(\"hastur.agent.cutime\", t.cutime, curr_time)\n Hastur.gauge(\"hastur.agent.cstime\", t.cstime, curr_time)\n\n @counters.each do |name,count|\n if count > 0\n Hastur.counter(\"hastur.agent.#{name}\", count, curr_time)\n @counters[name] = 0\n end\n end\n\n # reset things\n @last_stat_flush = curr_time\n end\n end",
"def number_requests\r\n return @requests.length\r\n end",
"def number_requests\r\n\t\treturn @requests.length\r\n \tend",
"def fasthttp_statistics\n super\n end",
"def get_requests(snmp = nil)\n @req_rate ||= { }\n report = { }\n snmp = @snmp_manager unless snmp\n\n get_names(snmp) if @names.empty?\n res = gather_snmp_metrics_by_name(\"Virtual Servers/Requests\", @names, OID_LTM_VIRTUAL_SERV_STAT_TOT_REQUESTS, snmp)\n NewRelic::PlatformLogger.debug(\"Virtual Servers: Got #{res.size}/#{@names.size} Request metrics\")\n\n unless res.nil?\n res.each_key do |metric|\n @req_rate[metric] ||= NewRelic::Processor::EpochCounter.new\n report[metric] = @req_rate[metric].process(res[metric])\n end\n\n sorted_report = report.sort_by { |k,v| v }.reverse\n sorted_report.each_with_index do |row, index|\n @f5_agent.report_metric row[0], \"req/sec\", row[1]\n break if index >= (MAX_RESULTS - 1)\n end\n end\n end",
"def output_requests\n extract_data.map do |request| \n request.collect{ |string| string.to_i} \n end\n end",
"def average_call_duration\n average_duration(finished_contacts, 'answered', 'call_ended')\n end",
"def processing_times\n total = ab_output.match(/Total:\\s+([0-9.]+)\\s+([0-9.]+)\\s+([0-9.]+)\\s+([0-9.]+)\\s+([0-9.]+)/)\n ninety = ab_output.match(/ 90%\\s+([0-9.]+)/)\n ninetyfive = ab_output.match(/ 95%\\s+([0-9.]+)/)\n [total[1], total[2], total[4], ninety[1], ninetyfive[1], total[5]]\n end",
"def stats\n [ride_distance, ride_time]\n end",
"def multiple_usage\r\n date_ranges = get_date_ranges\r\n meters = get_meters\r\n dtps = get_dtps\r\n\r\n #MeterAggregation.aggregate_missing_data date_ranges, dtps, meters\r\n\r\n #dtps = []\r\n\r\n #usages = Meter.usage_by_meter date_ranges, dtps, meters\r\n #usages = Meter.detailed_usage_by_meter date_ranges, dtps, meters\r\n #usages = Meter.usage_by_time date_ranges, dtps, meters\r\n usages = {}\r\n\r\n t = Benchmark.measure {\r\n usages = Meter.detailed_usage_by_time date_ranges, dtps, meters\r\n }\r\n logger.info \"Time taken => #{t}\"\r\n # usages[:query_time] = t\r\n render :json => usages\r\n\r\n #redirect_to action: 'index'\r\n end",
"def response_counts!(start_date = Time.parse('2000-1-1'), end_date = Time.now.utc)\n time_fmt = '%Y-%m-%d'\n response = get 'getResponseCountsBySurvey', 'StartDate' => start_date.strftime(time_fmt), \n 'EndDate' => end_date.strftime(time_fmt)\n @response_counts = json_result(response)\n end",
"def record_stats(env, start_time)\n statsd_client = Protobuf::Statsd.client\n path = statsd_base_path(env)\n return unless statsd_client && path && env.response\n end_time = Time.now.utc\n\n if env.response.is_a?(Protobuf::Rpc::PbError)\n statsd_client.increment(\"#{path}.failure.total\")\n statsd_client.increment(\"#{path}.failure.#{env.response.error_type}\")\n else\n statsd_client.increment(\"#{path}.success\")\n end\n\n statsd_client.timing(\"#{path}.time\", end_time - start_time)\n rescue => e\n # We insert ourself after Exception handler, so no exceptions allowed!\n logger.warn { \"Error with Statsd middleware: #{e.message}\" }\n end",
"def requests_per(seconds = 60)\n requests_per = 0\n past_time = Time.now - seconds\n\n @requests.each do |request_time|\n requests_per += 1 if request_time >= past_time\n end\n\n return requests_per\n end",
"def create_hourly_report(url)\n @total_serv_time = 0\n @time_spent_g = 0\n @time_spent_p = 0\n @user_list = []\n @g_count = 0\n @p_count = 0\n @n = 1\n puts \"24 Hour Report for #{url}\"\n puts \"---------------------------------------------------------------------------------------------\"\n puts \"TH HOUR---# USER---# GET---# POST---TOTAL_TIME_GET(ms)---TOTAL_TIME_POST(ms)---TOTAL_TIME(ms)\"\n puts \"---------------------------------------------------------------------------------------------\"\n for n in 1..24\n $all_user_data.each do |k,v|\n if v[:th_hour] == n && !v[:uri].to_s.string_contains(url).nil? \n @total_serv_time += v[:time].to_i\n if v[:method] == 'G'\n @time_spent_g += v[:time].to_i\n @g_count += 1 \n end\n if v[:method] == 'P'\n @time_spent_p += v[:time].to_i\n @p_count += 1 \n end\n @user_list << v[:user].to_s\n end \n end\n #puts \"#{n}TH HOUR---#{@user_list.uniq.length} users---#{@g_count} GET REQs---#{@p_count} POST REQs---#{@time_spent_g}ms in GET---#{@time_spent_p}ms in POST---#{@total_serv_time}ms in Total\"\n puts \"#{n}TH HOUR---#{@user_list.length} users---#{@g_count} GET REQs---#{@p_count} POST REQs---#{@time_spent_g}ms in GET---#{@time_spent_p}ms in POST---#{@total_serv_time}ms in Total\"\n #pp @@user_list.uniq\n @total_serv_time = 0\n @time_spent_g = 0\n @time_spent_p = 0\n @g_count = 0\n @p_count = 0\n @user_list.clear\n end\n end",
"def allocations_hrs_total(alloc_params)\n total = 0\n alloc_params.values.each do |v|\n grant_hrs = convert_to_duration(v['hours'])\n total += grant_hrs\n end\n total\n end",
"def get_server_latency(server, num_requests)\n\n failures = 0\n latencies = []\n @fatal_errors = nil\n # common header parts\n headers = \"GET \" +\n (CLOUD_PATH % [@settings.licence_key, '']).gsub(/\\s+/, \"\") + \" HTTP/1.0\\r\\n\" +\n \"Host: \" + server[:host] + \":\" + server[:port].to_s + \"\\r\\n\" +\n \"Accept: application/json\\r\\n\" +\n \"User-Agent: ruby/\" + API_VERSION + \"\\r\\n\" +\n DA_HEADER_PREFIX + \"Latency-Checker: \"\n # only the first request will send the settings\n configs = ((@self_auto_ranking.nil?)?'y':@self_auto_ranking) + ';' +\n ((@settings.auto_server_ranking)?'y':'n') + ';' +\n @settings.cloud_service_timeout.to_s + ';' +\n @settings.auto_server_ranking_max_failures.to_s + ';' +\n @settings.auto_server_ranking_num_requests.to_s + ';' +\n @settings.auto_server_ranking_lifetime.to_s + ';' +\n @settings.server_phaseout_lifetime.to_s + ';' + \"\\r\\n\"\n # ignore the first call because it can take an unreal long time\n\n i = 0\n\n while i < num_requests+1 &&\n failures < @settings.auto_server_ranking_max_failures\n\n start = Time.now\n begin\n\n errors = []\n\n response = connect_cloud(server, headers + ((i==0)?configs:\"#{i}\\r\\n\") +\n \"Connection: Close\\r\\n\\r\\n\", errors)\n\n if response[0] == FAILOVER_NOT_REQUIRED\n if i > 0 \n latencies.push((Time.now - start)*1000) \n end\n i += 1\n next\n elsif response[0] == FAILOVER_STOP\n # licence errors which are found at ranking,\n # to stop any further cloud call\n @fatal_errors = errors\n break\n end\n rescue\n # Keep checking servers\n end\n failures += 1\n \n latencies.push(-1)\n \n end\n\n return latencies\n end",
"def get_total_time\n return RideShare.get_all_trip_durations_in_seconds(@trips)\n end",
"def total_sessions(options = {})\n request_model = @request_model_factory.total_sessions_request_model(options)\n response = @network_client.perform_request(request_model)\n JSON.parse(response.body)['sessions']\n end",
"def poll_cycle\n\n puts \"---------------------\"\n puts \"#{host}\"\n puts \"---------------------\"\n data = twemproxy_data()\n\n summary_ejections = 0\n summary_client_connections = 0\n summary_requests = 0\n summary_server_connections = 0\n summary_server_errors = 0\n summary_in_queue = 0\n summary_out_queue = 0\n summary_servers = 0\n data.keys.find_all{|k| data[k].is_a?(Hash)}.each do |pool|\n summary_client_connections += metric_total(\"client connections/#{pool}\", data[pool]['client_connections'], \"connections\")\n summary_ejections += metric_total(\"server ejections/#{pool}\", data[pool]['server_ejects'], \"ejects\")\n\n data[pool].keys.find_all{|k| data[pool][k].is_a?(Hash)}.each do |server|\n summary_servers += 1\n summary_requests += metric_value(\"server requests/#{pool}/#{server}\", data[pool][server]['requests'], \"requests\")\n summary_server_connections += metric_total(\"server connections/#{pool}/#{server}\", data[pool][server]['server_connections'], \"connections\")\n summary_server_errors += metric_value(\"server errors/#{pool}/#{server}\", data[pool][server]['server_err'], \"errors\")\n summary_in_queue += metric_total(\"in queue/#{pool}/#{server}\", data[pool][server]['in_queue'], \"ops\")\n summary_out_queue += metric_total(\"out queue/#{pool}/#{server}\", data[pool][server]['out_queue'], \"ops\")\n metric_value(\"request bytes/#{pool}/#{server}\", data[pool][server]['request_bytes'], \"bytes\")\n metric_value(\"response bytes/#{pool}/#{server}\", data[pool][server]['response_bytes'], \"bytes\")\n end\n end\n\n metric_total \"total ejections\", summary_ejections, \"ejects\"\n metric_total \"total client connections\", summary_client_connections, \"connections\"\n metric_total \"total server requests\", summary_requests, \"requests\"\n metric_total \"total server connections\", summary_server_connections, \"connections\"\n metric_total \"total server errors\", summary_server_errors, \"errors\"\n metric_total \"total in queue\", summary_in_queue, \"ops\"\n metric_total \"total out queue\", summary_out_queue, \"ops\"\n metric_total \"total servers\", summary_servers, \"servers\"\n metric_total \"percent up\", (((summary_servers - summary_ejections) / summary_servers) * 100.0), \"%\"\n end",
"def total_time\n (@fetch_time || 0) + (@parse_time || 0)\n end",
"def total_time\n (@fetch_time || 0) + (@parse_time || 0)\n end",
"def throughput(records)\n\t\tstart_time = 0\n\t\tpkt_sum = {}\n\t\tend_time = {}\n\t\t# debugger \n\t\tthrough_put = {}\n\t\t#iterate through all records, records are by time order.\n\t\t#x: time, y: throughput at each time point/ time elapsed.\n\t\t#1.for each receive record {time, sum}\n\t\tlast_time = -1\n\t\t# debugger\n\t\trecords.each do |r|\n\t\t\tif r[:event]==\"r\" && r[:fnode].to_i==2 && r[:tnode].to_i==3 && r[:fid].to_i==1\n\t\t\t\t#initialize last_time variable\n\t\t\t\t# debugger\n\t\t\t\tif last_time==-1\n\t\t\t\t\tlast_time = r[:time].to_f \n\t\t\t\t\tstart_time = r[:time].to_f\n\t\t\t\tend\n\t\t\t\tthrough_put[\"#{r[:time]}\"] = r[:pktsize].to_i + through_put[\"#{last_time}\"].to_i\n\t\t\t\tlast_time = r[:time]\n\t\t\tend\n\t\tend\n\t\told = Marshal.load( Marshal.dump(through_put) )\n\t\tthrough_put.each do |time, sum|\n\t\t\telapse = (time.to_f-start_time).to_f\n\t\t\tsum = elapse==(0.to_f)? sum : sum/elapse\n\t\t\tthrough_put[\"#{time}\"] = sum\n\t\tend\n\n\t\t{:old => old, :th => through_put}\n\tend",
"def chart_times\n access_times = self.daily_requests.limit(10)\n access_times.map(&:times)\n end",
"def total_results\n @lastresults[\"request\"][\"totalResults\"]\n end",
"def calc_user_time(user_id)\n @time_spent_g = 0\n @time_spent_p = 0\n $all_user_data.each do |k,v| \n if v[:user] == user_id\n @time_spent_g += v[:time].to_i if v[:method]=='G'\n @time_spent_p += v[:time].to_i if v[:method]=='P' \n end\n end\n puts \"User [#{user_id}] spent #{@time_spent_g} ms using GET method\"\n puts \"User [#{user_id}] spent #{@time_spent_p} ms using POST method\"\n end",
"def response_times_ok?\n if response_times.size > 0\n average_response_time <= threshold\n else\n true\n end\n end",
"def collect\n @sample_counter ||= 0\n\n extra_remnant_key = Remnant::Discover.results.delete(:extra_remnant_key)\n\n # don't send timings in development or test environments\n unless ::Rails.env.development? || ::Rails.env.test?\n # only log if above sample rate\n if @sample_counter > configuration.sample_rate\n key_prefix = [\n Remnant.configuration.tag,\n Remnant.configuration.env,\n extra_remnant_key\n ].compact.join('.')\n\n Remnant::Discover.results.map do |remnant_key, ms|\n Remnant.handler.timing(\"#{key_prefix}.#{remnant_key}\", ms.to_i)\n end\n\n Remnant.handler.timing(\"#{key_prefix}.gc\", Remnant::GC.time.to_i)\n Remnant.handler.timing(\"#{key_prefix}.db\", Remnant::Database.total_time.to_i)\n Remnant.handler.timing(\"#{key_prefix}.filters\", Remnant::Filters.total_time.to_i)\n\n @sample_counter = 0\n else\n @sample_counter += 1\n end\n end\n\n # run hook if given for all environments\n unless Remnant.configuration.custom_hook.nil?\n begin\n Remnant.configuration.custom_hook.call(Remnant::Discover.results)\n rescue => e\n ::Rails.logger.error \"Failed to run hook: #{e.message}\"\n end\n end\n\n Remnant::Database.reset\n Remnant::Template.reset\n Remnant::Filters.reset\n Remnant::Discover.results.clear\n end",
"def service_time\n service_time = 0\n (@path.size - 1).times { |i| service_time += @path[i].service_time }\n return service_time\n end",
"def total_requests_YTD(key)\n [{:key => key, :value => total_count_by_user_type(key)}]\nend",
"def summary(args)\n out = {'known'=> {}, 'forwarded'=>{},'unknown'=>{} }\n args[:end] ||= Time.now\n args[:start] ||= args[:end] - 10*86400 # 10 days\n get_all_reports_by_date(args[:start],args[:end]).each do |r|\n get_all_records_filtered(\"report_metadata_id\",r.id).each do |record|\n # if record.source_ip is part of authorized_senders\n out['known']['count'] += record.count\n end\n end\n return out\n end",
"def build_summary_data(start_time, end_time, response)\n build_enphase_summary(response.body) \n build_data_harvest(start_time, end_time, response)\n \n total_end_time = Time.now.to_f\n build_job(start_time, total_end_time)\n end",
"def requests_per_day\n group_by_day.map { |date, ents|\n [date, ents.size]\n }.sort { |a,b|\n a[0] <=> b[0]\n }\n end",
"def total\n total_time = 0.0\n each { |record| total_time += record[:time] }\n total_time\n end",
"def average_queue_duration\n average_duration(answered_contacts, 'arrived', 'forwarded_to_agent')\n end",
"def report!\n # Fulfill batches array with 1 second step timestamps\n #\n batches = []\n @min_time = Time.at(@min_time.to_f.truncate + 0.999)\n batches << @min_time\n \n (@max_time - @min_time).to_i.times {\n batches << batches.last + 1.second\n }\n batches << batches.last + 1.second\n \n @keys = @stats.keys.sort.each(&:to_sym)\n @keys.delete(:disconnect)\n \n CSV.open(File.expand_path(\"results/report.csv\"), 'w') do |csv|\n head = []\n @keys.each_with_index {|stat_name, index| head << \"N #{stat_name}\"; head << stat_name; head << \"Server\" }\n \n csv << [\"Time\"] + head + [\"Connections\"]\n # Calculate active connections per second\n \n net_bm = {}\n net_bm_count = {}\n net_bm_index = {}\n\n serv_bm = {}\n serv_bm_count = {}\n serv_bm_index = {}\n \n @keys.each { |stat_name| net_bm_index[stat_name] = 0; serv_bm_index[stat_name] = 0 }\n \n connections_index = 0\n \n batches.each_with_index do |batch, index|\n active_connections = 0\n for i in connections_index..(@connections_deltas.size - 1) do\n if @connections_deltas[i][:time].to_f <= batch.to_f\n active_connections += @connections_deltas[i][:delta]\n else\n connections_index = i\n break\n end\n \n if i == @connections_deltas.size-1\n connections_index = i + 1\n break\n end\n end\n \n @keys.each do |stat_name|\n net_bm[stat_name] = 0\n net_bm_count[stat_name] = 0\n \n for i in net_bm_index[stat_name]..(@stats[stat_name].size - 1) do\n if @stats[stat_name][i][:time].to_f <= batch.to_f\n net_bm[stat_name] += @stats[stat_name][i][:benchmark]\n net_bm_count[stat_name] += 1\n else\n net_bm_index[stat_name] = i\n break\n end\n \n if i == @stats[stat_name].size - 1\n net_bm_index[stat_name] = i + 1\n break\n end \n end \n end\n \n @keys.each do |stat_name|\n serv_bm[stat_name] = 0\n serv_bm_count[stat_name] = 0\n for i in serv_bm_index[stat_name]..(@server_stats[stat_name].size - 1) do\n if @server_stats[stat_name][i][:time].to_f <= batch.to_f\n serv_bm[stat_name] += @server_stats[stat_name][i][:benchmark]\n serv_bm_count[stat_name] += 1\n else\n serv_bm_index[stat_name] = i\n break\n end\n \n if i == @server_stats[stat_name].size - 1\n serv_bm_index[stat_name] = i + 1\n break\n end \n end \n end\n\n if index > 0\n @connections << active_connections + @connections[index - 1]\n else\n @connections << active_connections\n end\n \n result = []\n @keys.each_with_index do |stat_name, index|\n net_average = 0\n serv_average = 0\n net_average = (net_bm[stat_name] / net_bm_count[stat_name]) if net_bm_count[stat_name] > 0\n serv_average = (serv_bm[stat_name] / serv_bm_count[stat_name]) if serv_bm_count[stat_name] > 0\n \n result += [\"#{net_bm_count[stat_name]}\", \"%3.4f\"% net_average]\n result += [\"%3.4f\"% serv_average]\n end\n \n csv << [batch.strftime(\"%H:%M:%S\")] + result.flatten + [@connections[index]]\n end\n \n head = []\n @keys.each_with_index {|stat_name, index| head << \"N #{stat_name}\"; head << stat_name; head << \"Server\" }\n \n csv << [\" \"] + head + [\"Connections\"]\n end\n end",
"def total_visit\n parsed_result.each do |result|\n visit_hash[result.first] = result.last.count\n end\n visit_hash.sort_by{|k,v| v}.reverse.to_h\n end",
"def http_statistics\n super\n end",
"def average_completion_time\n respond_with Commit.average_completion_time\n end",
"def worker_stats\n\n # We estimate the hash rate over the last 5 minutes\n last_five = (5.minutes.ago..Time.now)\n seconds_in_five = 300;\n\n # Get shares in the last 5 mins\n recent_shares = Share.where(:time => last_five)\n \n workers = {}\n \n # Calculate numbers of shares and difficulty\n recent_shares.each do |share|\n # Update hash if key found\n if workers.has_key?(share.username)\n hash = workers[share.username]\n workers[share.username][:shares] = hash[:shares] + share.difficulty\n workers[share.username][:difficulty] = share.difficulty\n # Create Hash\n else\n workers[share.username] = {:shares => 0, :difficulty => share.difficulty} \n end\n end\n\n stats = []\n\n # Calculate hash rates from number of shares\n workers.keys.each do |username|\n worker = workers[username]\n # Find hash rate and divide by 1 million to get megahashes.\n hashrate = (2 ** 16) * worker[:shares].to_f / (seconds_in_five * 1000000)\n stats.push({:username => username, :hashrate => hashrate, :difficulty => worker[:difficulty]})\n end\n\n render :json => stats\n\n end",
"def total_time_spent\n\t\ttotal_time = 0\n\t\tclock_events.each do |clock_event|\n\t\t if clock_event.clock_out\n\t\t time_difference = clock_event.clock_out - clock_event.clock_in\n\t\t total_time += time_difference\n\t\t end\n\t\tend\n\t\tTime.at(total_time).utc.strftime \"%H:%M:%S\"\n\tend",
"def print_detailed_report\n @req = []\n @bucket.keys.sort.map do |time|\n @req << @bucket[time].length\n date = Time.at(time)\n ms = calc_response(@bucket[time])\n\n @csvexport.add_row([date, @bucket[time].length, ms]) unless @csv.nil?\n\n puts sprintf('%-30s %-10s %-20s',\n date, @bucket[time].length, ms) unless @detailed.nil?\n end\n end",
"def date_time_url\n @slowest_time= 0\n print \"\\nTotal requests grouped by the Date/hour\\n\\n\"\n\t\t\n #taking each date&hour\n @count.each do|val1,val2|\n slowest = 0\n \n #searching on each line to find slowest\n $file.each_line do|line|\n\tif line.include? val1\n\t time = line.match /\\d+$/\n\t if time\n\t #finding slowest time\n\t time = time[0].to_i\n\t if time > slowest\n\t slowest = time\n\t end\n\t end\n\tend\n\tslowest = slowest.to_s\n\t#finding slowest url in corresponding date\n\tif line.include? slowest\n\t @url = line.match /https?:\\/\\/[\\S]+/.to_s\n\tend\n\tslowest = slowest.to_i\n end\n \n #checking plural form of request.\n request = \"request\"\n if val1.to_i > 1\n\trequest += \"s\"\n end \n print \"#{ val1 } : #{ val2 } #{ request } \\tSlowest-Time : #{ slowest } \\tSlowest-URL : #{ @url }\\n\\n\"\n \n #finding slowest URL in the log.\n if slowest > @slowest_time\n @slowest_time = slowest\n @slowest_url = @url\n end\n end \n print \"Slowest URL : #{ @slowest_url }\\n\"\n end",
"def mean_response(records)\n if records.length == 0\n return 0.0\n end\n\n return records.map {|r| r.response_time}.reduce(:+) / records.length.to_f\nend",
"def perform_request\n returned = nil\n @requests ||= 0\n @requests += 1\n @request_time ||= 0\n @request_time += Benchmark.realtime { returned = yield }\n returned\n ensure\n @handlers.each { |handler| handler.call(@requests, @request_time) }\n end",
"def response_time_entries\n response_time_entries_raw = wrapper(@user).time_entries(1, harvest_project_id)\n\n # Getting the number of pages of the paginated response from projects API\n number_of_pages = response_time_entries_raw['total_pages']\n\n response_time_entries_per_project = []\n\n if number_of_pages == 1\n response_time_entries_per_project = response_time_entries_raw.dig('time_entries')\n else\n # for loop to loop through all the pages and fetch all and put into the variable response_time_entries_per_project\n\n (1..number_of_pages).each do |i|\n time_entries_raw = wrapper(@user).time_entries(i, harvest_project_id)\n\n next_array = time_entries_raw['time_entries']\n\n # add projects array to complete array\n response_time_entries_per_project += next_array\n end\n\n end\n response_time_entries_per_project\n end",
"def total_duration\n running_total = 0\n @trips.each do |trip|\n @total_driving_time += trip.duration\n end\n end",
"def summary\n \n # parse parameters to datetime objects\n \tstart = Time.at(params[:start].to_i)\n \tstop = Time.at(params[:stop].to_i)\n time = start..stop\n\n \t# find all shares within the range <3 rails\n \tround_shares = Share.where(:time => start..stop)\n\n \tnum_round_shares_accepted = round_shares.where(:our_result => \"Y\").reduce(0) { |sum, share| sum + share.difficulty}\n \tnum_round_shares_rejected = round_shares.where(:our_result => \"N\").reduce(0) { |sum, share| sum + share.difficulty}\n\n round_reject_rate = (num_round_shares_rejected.to_f / (num_round_shares_accepted + num_round_shares_rejected)) * 100\n\n\n ''' Worker data '''\n work = {}\n\n round_shares.each do |share|\n # Update hash if key found\n if work.has_key?(share.username)\n hash = work[share.username]\n if share.our_result == \"Y\"\n work[share.username][:accepted_shares] = hash[:accepted_shares] + share.difficulty\n else\n work[share.username][:rejected_shares] = hash[:rejected_shares] + share.difficulty\n end\n # Create Hash\n else\n if share.our_result == \"Y\"\n work[share.username] = {:accepted_shares => share.difficulty, :rejected_shares => 0}\n else\n work[share.username] = {:accepted_shares => 0, :rejected_shares => share.difficulty} \n end\n end\n end\n\n work.keys.each do |username|\n reject_rate = work[username][:rejected_shares].to_f / (work[username][:accepted_shares] + work[username][:rejected_shares])\n # Calculate the percentage of work done, notice the float\n percentage_of_work = work[username][:accepted_shares].to_f / num_round_shares_accepted\n\n work[username][:percentage_of_work] = percentage_of_work\n work[username][:reject_rate] = reject_rate\n end\n\n render :json => {:total_shares => (num_round_shares_accepted + num_round_shares_rejected), :accepted_shares => num_round_shares_accepted, :rejected_shares => num_round_shares_rejected, :work => work, :reject_rate => round_reject_rate}\n end",
"def get_total_runtime_ms\n (TimeDifference.between(*get_runtime_timestamps).in_seconds * 1000).to_i\n end",
"def get_progress()\n @result_tfile.rewind\n progress = @result_tfile.each_line.collect do |line|\n group = line.scan(/Completed (\\d+) requests/)\n group = group.empty? ? 0 : group[0][0]\n end\n progress.reject{|x| x == 0}.length * 10\n end",
"def number_of_completed_responses\n if statistics && !statistics.empty? && (completed_data = statistics.find {|a| a[0] == 'Complete'})\n completed_data[1]\n else\n 0\n end\n end",
"def statistics\n {\n identifier: connection_identifier,\n started_at: @started_at,\n subscriptions: subscriptions.identifiers,\n request_id: @env[\"action_dispatch.request_id\"]\n }\n end",
"def calculate_sim_stats(fences,walk)\n\ttime = (walk['distance']*111110.0).ceil/(@@vars['avg_path_speed_ms']/walk['body'].length)\n\tpath = \"random\"\n\tpath = @@vars['sim_static_walk'] if @@vars['sim_static_walk'] > 0\n\n\tputs \"====== System stats\" if @@vars['show_intermediate_countings']\n\tputs \" Walked distance: #{(walk['distance']*111110.0).ceil}m\n Sim time: #{time}s (#{(time/60).floor}m#{(((time/60)-(time/60).floor)*60).floor}s)\" if @@vars['show_intermediate_countings']\n\n\t# Add to total accumulators\n\t@@vars['total_walked_distance'] += (walk['distance']*111110.0).ceil\n\t@@vars['total_sim_time'] += time\n return\nend",
"def server_timing=(_arg0); end",
"def results\n {\n :controller => \"#{@event.duration.to_i}ms controller\",\n :sql => \"#{@event.payload[:db_runtime].to_i}ms sql\", # not documented?\n :views => \"#{@event.payload[:view_runtime].to_i}ms views\"\n }\n rescue\n # TODO: log an error here, or display it in the view\n {}\n end",
"def monitoring_stats(region = current_region)\n redis = Redis.new :host => \"localhost\"\n today = \"2012-02-14\" # TODO(philc): \n request_count = redis.get(\"#{region.name}_request_count\").to_i\n errors = redis.get(\"html5player:error_count:#{today}\").to_i\n error_rate = (request_count == 0) ? 0 : (errors / request_count.to_f * 100)\n latency = (request_count == 0) ? 0 : redis.get(\"#{region.name}_latency\").to_i / request_count\n {\n :request_count => request_count,\n :average_latency => latency,\n :error_count => errors,\n :error_rate => error_rate\n }\n end",
"def expected_runtime_seconds(report_count:)\n runs = report_count * options[:lines_multipliers].length\n warmup_time_seconds = runs * options[:benchmark_warmup]\n bench_time_seconds = runs * options[:benchmark_time]\n\n warmup_time_seconds + bench_time_seconds\n end",
"def request_count=(_arg0); end",
"def hash\n [_403, _404, _500, _504, start_timestamp, end_timestamp, start_datetime, end_datetime, total_requests, cache_hits, cache_hit_rate, total_request_time, avg_origin_response_time, response_time_ms, _100_x, _20_x, _30_x, _40_x, _50_x, _50th, _95th, _99th].hash\n end",
"def total_time\n @data[1]['ROUTE']['total_time']\n end",
"def init_counters\n calculate_ratio_sum\n calculate_proxies_needed\n end",
"def total_time=(_arg0); end"
] |
[
"0.74801856",
"0.7026983",
"0.66251844",
"0.6567912",
"0.6481149",
"0.64467406",
"0.6206925",
"0.62051684",
"0.6179116",
"0.6161156",
"0.6160014",
"0.6118688",
"0.6092785",
"0.60572064",
"0.6044486",
"0.5978203",
"0.5978184",
"0.59713954",
"0.5950833",
"0.59348035",
"0.5903419",
"0.58935285",
"0.5865857",
"0.5855761",
"0.5843334",
"0.58380693",
"0.5806287",
"0.5799206",
"0.5799206",
"0.57897776",
"0.57598275",
"0.5729787",
"0.57073873",
"0.5679379",
"0.5677675",
"0.5647596",
"0.5645419",
"0.5623254",
"0.5611014",
"0.5594495",
"0.55939025",
"0.5593095",
"0.55865085",
"0.5572878",
"0.5572203",
"0.55552495",
"0.5550266",
"0.55485636",
"0.5546501",
"0.5539581",
"0.55311733",
"0.55133873",
"0.5508558",
"0.5503768",
"0.55028814",
"0.54979455",
"0.5494883",
"0.5487271",
"0.5486103",
"0.5486103",
"0.5483441",
"0.5465192",
"0.54579467",
"0.5453029",
"0.5448907",
"0.54457563",
"0.54438376",
"0.54393184",
"0.5435732",
"0.54355764",
"0.54300797",
"0.5421851",
"0.53976536",
"0.53942764",
"0.5393478",
"0.539164",
"0.53897387",
"0.5389048",
"0.53791714",
"0.53717875",
"0.5363705",
"0.5356053",
"0.53471214",
"0.5344912",
"0.534249",
"0.53338766",
"0.5327989",
"0.5324504",
"0.5323684",
"0.53236145",
"0.5319377",
"0.5317238",
"0.5305912",
"0.5305722",
"0.53016853",
"0.52996397",
"0.528775",
"0.5285847",
"0.52839357",
"0.52727747"
] |
0.55189025
|
51
|
Prints links which resultet in 404 error.
|
def analyze_404
selected_files.each do |file_name|
result = [file_name[0,6], 0, 0]
url = ''
File.readlines(file_name).each do |line|
if m = /Started(.*?)for/.match(line)
url = m[1]
end
if m = /404/.match(line)
p url.gsub('"','')
end
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show_404 error='', target=''\n show_error \"Page \\\"#{target}\\\" Not Found\", :not_found\n end",
"def show_404\n show_error 'Page Not Found', :not_found\n end",
"def error_404\n error_layout 404, '404 Not Found', %[\n <p>\n The requested URL <code>#{h(request.REQUEST_URI)}</code> was not\n found on this server.\n </p>\n ]\n end",
"def page404(pathname);end",
"def not_found\n logger.error \"404 from #{request.referer}\"\n render :template => 'errors/404', :status => 404\n end",
"def check_404\n end",
"def visit_all links\n not_found = []\n server_error = []\n\n links.each do |link|\n puts \"visiting link: #{link}\"\n visit link\n\n grab_screen \"visited #{link}\"\n current_url.should == link\n\n if page.has_content?('404')\n not_found << link\n next\n end\n\n server_error << link if page.has_content?('500') || page.has_content?('rror') || page.has_content?('ception')\n end\n\n unless not_found.empty? && server_error.empty?\n fail \"The following links responded with status 404: #{not_found.inspect} and these responded with status 500: #{server_error}\"\n end\nend",
"def send_not_found(cli)\n custom_404_url = get_custom_404_url\n if custom_404_url.blank?\n super(cli)\n else\n send_redirect(cli, custom_404_url)\n end\n end",
"def path_not_found\n [\n 404,\n { CONTENT_TYPE => 'text/plain', 'X-Cascade' => 'pass' },\n [\"#{Utils::HTTP_STATUS_CODES[404]}\\n\"]\n ]\n end",
"def not_found\n raise ActionController::RoutingError.new('Permalink Not Found')\n end",
"def print_links_only\n found_issues = collect_issues_from_commits\n return if found_issues.empty?\n\n message = \"## Jira issues\\n\\n\"\n found_issues.each do |issue_id|\n if include_resolves_keyword\n message << \"Resolves \"\n end\n message << \"[#{issue_id}](#{jira_site}/browse/#{issue_id})\\n\\n\"\n end\n\n markdown message\n end",
"def give404(response, msg)\n\tgive_X(response, 404, \"plain/text\", msg)\n end",
"def find_404\n\tloop do\n\t\tr = await\n\t\tif r[\"status\"] == 404\n\t\t\tyield %w{status datetime request}.map{|col| r[col].to_s}.join(\" \")\n\t\tend\n\tend\nend",
"def error_404\n # The default router already logs things, so we don't need to do more.\n # You can do something like this to log more information, but be sure\n # to escape attacker data to counter log forging:\n # logger.info 'Page not found'\n render(\n template: 'static_pages/error_404',\n formats: [:html], layout: false,\n status: :not_found\n )\n end",
"def not_found(&block)\n error 404, &block\n end",
"def render_404\n render_optional_error_file(404)\n end",
"def render_404\n render_error(\"The remote resource was not found\")\n end",
"def render_404\n render :template => \"errors/404\", :status => :not_found, :layout => false\n end",
"def blank; render :plain => \"Not Found.\", :status => 404 end",
"def bad_urls\n result = []\n @pages.each do |page|\n result << page.hlu\n end\n result.compact!\n end",
"def not_found(env)\n [404,{'Content-Type'=>'text/plain','X-Cascade'=>'pass'},['Ooooopppps 404!']]\n end",
"def routes_not_found\n respond_to do |f|\n f.html{ render :template => \"errors/404\", :status => 404}\n end\n end",
"def get_custom_404_url\n datastore['Custom404'].to_s\n end",
"def render_404\n raise ActionController::RoutingError.new('Not Found')\n end",
"def page_not_found\n respond_to do |format|\n\t format.html { render template: 'errors/not_found_error', layout: 'layouts/application', status: 404 }\n\t format.all { render nothing: true, status: 404 }\n\t end\n end",
"def record_not_found\n \t\trender :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n \tend",
"def send_e404(cli, request)\n resp = Response::E404.new\n\n resp['Content-Type'] = 'text/html'\n\n resp.body =\n \"<html><head>\" +\n \"<title>404 Not Found</title>\" +\n \"</head><body>\" +\n \"<h1>Not found</h1>\" +\n \"The requested URL #{html_escape(request.resource)} was not found on this server.<p><hr>\" +\n \"</body></html>\"\n\n # Send the response to the client like what\n cli.send_response(resp)\n end",
"def render_missing\r\n RenderError.new('404')\r\n end",
"def render_404\n render :text => '404 Error: not found', :status => 404 \n end",
"def error_404\n render 'error/error404'\n end",
"def render_404\n respond_to do |format|\n format.html { render :file => \"#{Rails.root}/public/404\", :layout => false, :status => :not_found }\n format.xml { head :not_found }\n format.any { head :not_found }\n end\n end",
"def render_404\n render 'web/404', status: 404\n end",
"def render_404\n render \"404\", :status => 404\n end",
"def not_found generator, req, res, message = nil\n message ||= \"The page <kbd>#{ERB::Util.h req.path}</kbd> was not found\"\n res.body = generator.generate_servlet_not_found message\n res.status = 404\n end",
"def not_found_response\n [404, {'Content-Type' => \"text/plain\", 'Content-Length' => \"9\"}, ['Not found']]\n end",
"def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end",
"def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end",
"def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end",
"def render_404\n respond_to do |wants|\n wants.html do\n render(:template => \"#{DynamicErrors.config[:view_path]}/404\",\n :layout => DynamicErrors.config[:layout], :status => 404)\n end\n # TODO should have a response for XML and JSON requests?\n wants.all do\n render :nothing => true, :status => 404\n end\n end\n return true\n end",
"def record_not_found\n render :file => File.join(::Rails.root.to_s, 'public', '404.html'), :status => 404\n end",
"def page_not_found\n render 'shared/http_status', formats: [:html], locals: { code: '404', message: HttpStatusHelper::ERROR_CODE['message']['404'] }, status: 404, layout: false\n end",
"def not_found\n raise ActionController::RoutingError.new('Not Found')\n rescue\n render_404\n end",
"def not_found\n #render :file => \"#{RAILS_ROOT}/public/404.html\"\n render_optional_error_file(404)\n return false\n end",
"def render_404\n render :file => \"#{Rails.root.to_s}/public/404\", :formats => [:html], :status => 404\n true\n end",
"def error_404(exception=nil)\n @meta_title = \"The page you were looking for doesn't exist (404)\"\n render :template => '/errors/404', :formats => [:html], :status => 404\n return false\n end",
"def what_are_you_looking_for?\n raise Exceptions::NotFound.new(404, 'Not Found; You did not find what you were expecting because it is not here. What are you looking for?')\n end",
"def response_not_found\n render status: 404,\n json: {\n source: {\n pointer: request.original_url\n },\n errors: [ { message: \"Not Found\" } ]\n }\n end",
"def not_found\n render file: 'public/404', status: 404, formats: [:html]\n end",
"def not_found\n render_error status: :not_found, body: 'page not found'\n end",
"def not_found\n rescue_404(ActionController::RoutingError.new(\"No route matches #{request.request_method} #{request.path}\"))\n end",
"def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end",
"def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end",
"def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end",
"def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end",
"def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end",
"def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end",
"def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end",
"def record_not_found\n render file: 'public/404.zh-TW.html', stats: :not_found\n end",
"def not_found(body = nil)\n error(404, body)\n end",
"def render_404\n redirect_to not_found_path\n end",
"def exception_links(exception_report)\n super(exception_report) + [[\"Report to Lighthouse\", \"/lighthouse/report/#{exception_report.id}.html\"]]\n end",
"def not_found(x, title:\"Not Found\", message:nil)\n begin\n if message.nil? and @runs[:website] and @runs[:website][:page]\n return @runs[:website][:page][:get].call(x, *(x.args))\n end\n rescue => e\n message = e.to_s\n end\n error(x, status: 404, type: \"request\", title: title, message: message)\n end",
"def not_found_response\n [ 404, { \"Content-Type\" => \"text/plain\", \"Content-Length\" => \"9\", \"X-Cascade\" => \"pass\" }, [ \"Not found\" ] ]\n end",
"def not_found\n render :nothing => true, :status => 404\n end",
"def render_404\n render file:\"#{Rails.root}/public/404.html\", status:404, layout:false\n end",
"def render_404(exception=nil)\n if exception\n logger.error \"Rendering 404 with exception: #{exception.message}\"\n logger.error exception.backtrace.join(\"\\n\")\n end\n breadcrumbs.clear\n @error = [404, 'Not Found']\n render status: 404, template: 'errors/default.html'\n end",
"def rescue404\n render 'public/404'\n end",
"def render_404\n render file: \"public/404.html\", layout: false\n end",
"def page_not_found\n render file: Rails.root.join('public', '404.html'), status: :not_found, layout: false\n end",
"def not_found\n \trender file: \"#{Rails.root}/public/404.html\", layout: true, status: 404\n end",
"def handle_error (url, res)\n puts \"#{url} was not found\" if res.code.to_i == 404\n puts \"#{url} requires authorization\" if res.code.to_i == 401\n puts \"#{url} returns an application error\" if res.code.to_i == 500\nend",
"def render_not_found(exception)\n render :file => 'public/404', :format => :html, :status => :not_found, :layout => nil\n end",
"def render_not_found(exception)\n render :file => 'public/404', :format => :html, :status => :not_found, :layout => nil\n end",
"def not_found\n\n render_error( :not_found )\n\n end",
"def not_found\n render :status => 404\n end",
"def render_404 \n render :file => \"/public/404.html\", :status => 404,:layout => false\n end",
"def render_404 \n render :file => \"/public/404.html\", :status => 404,:layout => false\n end",
"def render_404 \n render :file => \"/public/404.html\", :status => 404,:layout => false\n end",
"def render_404 \n render :file => \"/public/404.html\", :status => 404,:layout => false\n end",
"def render_404 \n render :file => \"/public/404.html\", :status => 404,:layout => false\n end",
"def render_404 \n render :file => \"/public/404.html\", :status => 404,:layout => false\n end",
"def render_404 \n render file: \"public/404.html\", status: 404\n end",
"def not_found\n render :file => (Rails.root + \"public/404.html\").to_s\n true\n end",
"def page_not_found\n render_404\n end",
"def render_404\n render file: \"#{Rails.root}/public/404.html\", layout: false, status: 404\n end",
"def error(url); end",
"def render_404!\n render :file => File.join(Rails.root, 'public', '404.html'), :status => 404, :layout => false\n return true\n end",
"def not_found\n\trender :file => 'public/404.html', :status => :not_found, :layout => false\nend",
"def render_404(exception = nil)\n @not_found_path = exception.message if exception\n respond_to do |format|\n format.html { render template: 'errors/not_found', layout: 'application', status: 404 }\n format.all { render nothing: true, status: 404 }\n end\n end",
"def render_404(env)\n\t\t[404, {\"Content-Type\" => \"text/plain\"}, [\"env: #{env.to_s}\"]]\n\tend",
"def render_404(env)\n\t\t[404, {\"Content-Type\" => \"text/plain\"}, [\"env: #{env.to_s}\"]]\n\tend",
"def status_not_found\n @status = 404\n @e.error 'The requested page does not exist.', 404\n throw :exit\n end",
"def render_404\n render file: Rails.root.join('public/404.html'), status: 404, layout: false, content_type: 'text/html'\n end",
"def record_not_found\n render :file => Rails.root.join('public','404.html'), :status => \"404 Not Found\", layout: false\n end",
"def render_404(_exception = nil)\n errors = JsonApiServer.errors(\n status: 404,\n title: I18n.t('json_api_server.render_404.title'),\n detail: I18n.t('json_api_server.render_404.detail', name: _i18n_name)\n )\n render json: errors.to_json, status: 404\n end",
"def not_found\n raise ActionController::RoutingError.new('Page Not Found. Please contact the system administrator.')\n end",
"def not_found\n \trender file: \"#{Rails.root}/public/404.html\", status: 404\n end",
"def not_found\n status 404\n body \"not found\\n\"\n end",
"def not_found\n status 404\n body \"not found\\n\"\n end",
"def not_found\n status 404\n body \"not found\\n\"\n end"
] |
[
"0.7106146",
"0.70636886",
"0.6668664",
"0.6630374",
"0.6603528",
"0.6591183",
"0.6588572",
"0.65689796",
"0.6511051",
"0.64935327",
"0.6471278",
"0.6431427",
"0.6385634",
"0.6377854",
"0.6347115",
"0.6287983",
"0.6250355",
"0.6229473",
"0.62150854",
"0.6205698",
"0.62027305",
"0.6179168",
"0.6167359",
"0.6125944",
"0.61122864",
"0.6109247",
"0.6102053",
"0.6090372",
"0.6063993",
"0.6055773",
"0.60487455",
"0.604713",
"0.6039016",
"0.6033687",
"0.6027589",
"0.6024674",
"0.6024674",
"0.6024674",
"0.6014736",
"0.60091853",
"0.6007359",
"0.6005232",
"0.60041034",
"0.5986576",
"0.5985274",
"0.59846723",
"0.5984384",
"0.5979862",
"0.59662557",
"0.5958428",
"0.5952663",
"0.5952663",
"0.5952663",
"0.5952663",
"0.5952663",
"0.5952663",
"0.5952663",
"0.5942619",
"0.5941826",
"0.5941611",
"0.59403896",
"0.59370285",
"0.5935753",
"0.59222084",
"0.5917889",
"0.59151167",
"0.5914958",
"0.59149164",
"0.5913653",
"0.59092987",
"0.5907186",
"0.5904964",
"0.5904964",
"0.59036905",
"0.59002954",
"0.5900187",
"0.5900187",
"0.5900187",
"0.5900187",
"0.5900187",
"0.5900187",
"0.5889273",
"0.5886267",
"0.5883333",
"0.5874521",
"0.58740366",
"0.58726466",
"0.5864962",
"0.5851998",
"0.58492076",
"0.58492076",
"0.5841811",
"0.5839442",
"0.5837662",
"0.58353484",
"0.5832772",
"0.58260876",
"0.582578",
"0.582578",
"0.582578"
] |
0.6544341
|
8
|
GET /holiday_exceptions GET /holiday_exceptions.json
|
def index
@holiday_exceptions = HolidayException.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def calendar_exceptions\n get '/gtfs/calendarDate'\n end",
"def calendar_service_exceptions(service_id)\n get \"/gtfs/calendarDate/serviceId/#{service_id}\"\n end",
"def handle_response(response)\n case response.code.to_i\n when 200\n JSON.parse(response.body)['holidays']\n when 400\n raise BadRequest.new response.parsed_response\n when 401\n raise Unauthorized.new\n when 404\n raise NotFound.new\n when 400...500\n raise ClientError.new response.parsed_response\n when 500...600\n raise ServerError.new\n else\n response\n end\n end",
"def index\n @holidays = Holiday.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @holidays }\n end\n end",
"def index\n #Get the event\n @event = Event.find(params[:event_id])\n render :attendance, status: :ok\nrescue ActiveRecord::RecordNotFound => e\n render json: {\n error: e.to_s\n }, status: :not_found\n end",
"def get_date_in_exception\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/error/dateInException'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _context.response.status_code == 444\r\n raise ExceptionWithDateException.new(\r\n 'date in exception',\r\n _context\r\n )\r\n end\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body) unless\r\n _context.response.raw_body.nil? ||\r\n _context.response.raw_body.to_s.strip.empty?\r\n decoded\r\n end",
"def exceptions\n exceptions = DivaServicesApi.get(\"/algorithms/#{id}/exceptions\").parsed_response\n exceptions.map do |entry|\n DivaServicesApi::ExceptionMessage.new(id, DateTime.parse(entry['date']), entry['errorMessage'])\n end\n end",
"def set_holiday_exception\n @holiday_exception = HolidayException.find(params[:id])\n end",
"def not_found(exception)\n render json: { error: exception.message }, status: :not_found\n end",
"def update\n respond_to do |format|\n begin\n status = @holiday_exception.update(holiday_exception_params)\n rescue => e\n status = false\n customer_holiday_ids = CustomersHoliday.where(customer_id: @holiday_exception.customer_id).pluck(:holiday_id)\n @holidays = Holiday.where(global:true).or(Holiday.where(id: customer_holiday_ids))\n logger.debug\"UPDATE #{e.inspect} , STATUS #{status}\" \n end\n if status\n format.html { redirect_to edit_holiday_exception_path(@holiday_exception), notice: 'Holiday exception was successfully updated.' }\n format.json { render :show, status: :ok, location: @holiday_exception }\n else\n format.html { render :edit }\n format.json { render json: @holiday_exception.errors, status: :unprocessable_entity }\n end\n\n end\n end",
"def index\n @extra_holidays = ExtraHoliday.all\n end",
"def holiday_exception_params\n params.require(:holiday_exception).permit(:user_id, :project_id, :customer_id, :holiday_ids => [])\n end",
"def list_vuln_exceptions(status = nil)\n unless is_valid_vuln_exception_status?(status)\n raise \"Unknown Status ~> '#{status}' :: For available options refer to Nexpose::VulnException::Status\"\n end\n\n status = Nexpose::VulnException::Status.const_get(status_string_to_constant(status)) unless status.nil?\n\n results = []\n ajax_data = []\n\n url_size = 500\n url_page = 0\n\n req = Nexpose::AJAX.get(self, \"/api/3/vulnerability_exceptions?size=#{url_size}&page=#{url_page}\")\n data = JSON.parse(req, object_class: OpenStruct)\n ajax_data << data.resources\n\n if data.links.count > 1\n loop do\n url_page += 1\n req = Nexpose::AJAX.get(self, \"/api/3/vulnerability_exceptions?size=#{url_size}&page=#{url_page}\")\n data = JSON.parse(req, object_class: OpenStruct)\n ajax_data << data.resources\n links = data.links.select { |ll| ['self', 'last'].include?(ll.rel) }\n break if links[0].href == links[1].href\n end\n end\n\n ajax_data.compact!\n ajax_data.flatten!\n\n ajax_data.each do |vuln_excep|\n ve = VulnException.new(vuln_excep.scope.vulnerabilityID, vuln_excep.scope.type, vuln_excep.submit.reason, vuln_excep.state)\n ve.id = vuln_excep.id\n ve.submitter = vuln_excep.submit.name\n ve.submitter_comment = vuln_excep.submit.comment\n ve.submit_date = Time.parse(vuln_excep.submit.date) unless vuln_excep.submit.date.nil?\n ve.asset_id = vuln_excep.scope.assetID\n ve.site_id = vuln_excep.scope.siteID\n ve.asset_group_id = vuln_excep.scope.assetGroupID\n ve.port = vuln_excep.scope.port\n ve.vuln_key = vuln_excep.scope.key\n ve.expiration = Time.parse(vuln_excep.expires) unless vuln_excep.expires.nil?\n unless vuln_excep.review.nil?\n ve.reviewer = vuln_excep.review.name\n ve.reviewer_comment = vuln_excep.review.comment\n ve.review_date = Time.parse(vuln_excep.review.date) unless vuln_excep.review.date.nil?\n end\n results << ve\n end\n results.keep_if { |v| v.status == status } unless status.nil?\n results\n end",
"def no_route_exception_json(exception)\n code = 404\n render :json => Status::Errors.exception_json(exception, code).to_json, :status => code\n end",
"def not_found(exception)\n render json: { status: \"404\", \"#{exception.message}\": \"page not found\"}\n end",
"def show\n @holiday = Holiday.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @holiday }\n end\n end",
"def index\n @special_holidays = SpecialHoliday.all\n end",
"def exceptions\n @values['exceptions']\n end",
"def index\n @excuses = Excuse.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @excuses }\n end\n end",
"def new\n @holiday = Holiday.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @holiday }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @holiday }\n end\n end",
"def render_figgy_404 # rubocop:disable Naming/VariableNumber\n respond_to do |format|\n format.html { render \"errors/not_found\", status: :not_found }\n format.json { head :not_found }\n end\n end",
"def index\n @activity_holidays = ActivityHoliday.all\n end",
"def not_found_response\n [ 404, { \"Content-Type\" => \"text/plain\", \"Content-Length\" => \"9\", \"X-Cascade\" => \"pass\" }, [ \"Not found\" ] ]\n end",
"def destroy\n @holiday_exception.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Holiday exception was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def handle_exception e\n response.headers['Content-Type'] = 'application/json'\n response.body = { message: e.message, backtrace: e.backtrace }.to_json\n end",
"def error_response(exception)\n render json: { message: exception.message }, status: :bad_request\n end",
"def render_404\n render json: {\n message: '404 Not Found',\n details: exception.error_codes\n }, status: 404\n end",
"def not_found\n render json: { error: { message: 'There was nothing found at this address.' }}, status: :not_found\n end",
"def index\n @hk_public_holidays = HkPublicHoliday.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @hk_public_holidays }\n end\n end",
"def events\n url = 'https://api.artic.edu/api/v1/exhibitions?limit=35'\n\n res = RestClient.get(url)\n JSON.parse(res)\nend",
"def londons_rescue\n render json: { error: \"Gym not found\"}, status: 422\n end",
"def halt_not_found(exception)\n halt 404, json({ message: exception.reason })\n end",
"def destroy\n begin\n @holiday = Holiday.find(params[:id])\n if @holiday.destroy\n @@request_result = {success:true, notice: 'Operation ended successfully.'}\n else\n @@request_result[:errormsg] = @holiday.errors.full_messages[0]\n end\n rescue Exception => e \n @@request_result[:errormsg] = e.message\n end\n render json: @@request_result\n end",
"def does_not_exist_json(exception=nil)\n message = exception.message if !exception.nil?\n exception = AppError::UndefinedRouteOrActionError.new\n code = exception.code\n render :json => Status::Errors.exception_json(exception, code, message).to_json, :status => code\n end",
"def index\n\t\t@holidays = Holiday.all.order(\"created_at DESC\")\n\tend",
"def invalid_api_responses\n %w( json_no_route json_post_invalid_type json_user_cannot_read )\n end",
"def index\n @lates = Late.where(date: Date.today)\n @leaves = Leave.where(\"(start_date <= :date AND end_date >= :date) or start_date = :date\", date: Date.today)\n @schedules = Schedule.over_dates(Date.today, Date.today)\n @schedules = @schedules.where(\"user_id NOT IN (?)\", @leaves.select(\"user_id\").where(\"hours IS NULL OR hours >=8\").group(:user_id).map(&:user_id)) unless @leaves.blank?\n @holidays = Holiday.where(\"(start_date <= :date AND end_date >= :date) OR start_date = :date\", date: Date.today)\n\n respond_with(@schedules, @lates, @leaves, @holidays)\n end",
"def render_404(_exception = nil)\n errors = JsonApiServer.errors(\n status: 404,\n title: I18n.t('json_api_server.render_404.title'),\n detail: I18n.t('json_api_server.render_404.detail', name: _i18n_name)\n )\n render json: errors.to_json, status: 404\n end",
"def index\n if params[:company]\n @holiday = Holiday.new(:project_id => nil)\n set_content_title([t(\"screens.labels.company_calendar\")])\n @days_enable = can? :update_company_calendar, @holiday\n @dates_creation = can? :create_company_calendar, @holiday\n @holidays = Holiday.company_holidays\n @days_off = DayOff.company_days_off\n @holiday.company = true\n @days_off_for_fullcalendar = DayOff.calendar_wday_classes()\n else\n @holiday = Holiday.new(:project_id => actual_project.id)\n set_content_title([t(\"screens.labels.project_calendar\")])\n @days_enable = can? :update_project_calendar, @holiday\n @dates_creation = can? :create_project_calendar, @holiday\n @holidays = actual_project.holidays.order(\"day\")\n @days_off = actual_project.get_days_off\n @days_off_for_fullcalendar = DayOff.calendar_wday_classes(actual_project)\n end\n\n\n @holidays_for_fullcalendar = @holidays.map(&:milis_from_1970).join(', ')\n #@holidays_for_fullcalendar = \"1335852000000, 1337148000000, 1337234400000\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @holidays }\n end\n end",
"def exception_response\n { ok: false, message: 'Error processing request' }\n end",
"def invalid_json_json(exception)\n code = 500\n render :json => Status::Errors.exception_json(\"We are currently experiencing issues with our data server, please try again soon.\", code).to_json, :status => code\n end",
"def index\n @holidays = Holiday.where :employer_id => selected_employer_id\n end",
"def not_found(env)\n [404,{'Content-Type'=>'text/plain','X-Cascade'=>'pass'},['Ooooopppps 404!']]\n end",
"def index\n render locals: locals_for_index\n rescue MalformattedDateError\n redirect_to redirect_room_url, flash: { alert: t('errors.date.malformed') }\n rescue DayOffError\n redirect_to redirect_room_url, flash: { notice: t('errors.date.day_off') }\n end",
"def show\n @daily_data_delivery_exception = DailyDataDeliveryException.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @daily_data_delivery_exception }\n end\n end",
"def raise_bad_format\r\n error_message = ErrorMessage.new(\"400\", \"Api:et stödjer inte det begärda formatet.\",\r\n \"Felaktig begäran. Kontakta utvecklaren.\")\r\n render json: error_message, status: :bad_request\r\n end",
"def event_app_not_found\n render json: 'Unregistered application', status: :unprocessable_entity\n end",
"def return_404\n render :json => {:error => \"not-found\"}.to_json, :status => 404\n end",
"def not_found\n render(\n json: {\n errors: [{\n type: \"Not Found\"\n }]\n },\n status: :not_found #alias for 404 in rails\n )\n end",
"def exception_json(exception,code=500)\n render :json => Status::Errors.exception_json(exception, code).to_json, :status => code\n end",
"def access_denied\n error = error_response_method($e12)\n render :json => error\n end",
"def get_national_holidays\n national_holidays = Event.all.select { |event| event.event_type == \"National Holiday\"}\n return national_holidays \n end",
"def get_receive_exception_with_rfc_3339_datetime\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/error/Rfc3339InException'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _context.response.status_code == 444\r\n raise ExceptionWithRfc3339DateTimeException.new(\r\n 'DateTime Exception',\r\n _context\r\n )\r\n end\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body) unless\r\n _context.response.raw_body.nil? ||\r\n _context.response.raw_body.to_s.strip.empty?\r\n decoded\r\n end",
"def exceptions\n @exceptions ||= key[:exceptions]\n end",
"def not_found_response\n [404, {'Content-Type' => \"text/plain\", 'Content-Length' => \"9\"}, ['Not found']]\n end",
"def exceptions\n diva_algorithm = DivaServicesApi::Algorithm.by_id(self.diva_id)\n if diva_algorithm\n diva_algorithm.exceptions\n else\n Array.new\n end\n end",
"def index\n @search = ClaimValidationException.search(params[:q])\n # @claim_validation_exceptions = ClaimValidationException.order(\"id desc\").paginate(:page => params[:page])\n @claim_validation_exceptions = @search.result.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @claim_validation_exceptions }\n end\n end",
"def find_404\n\tloop do\n\t\tr = await\n\t\tif r[\"status\"] == 404\n\t\t\tyield %w{status datetime request}.map{|col| r[col].to_s}.join(\" \")\n\t\tend\n\tend\nend",
"def get_receive_exception_with_rfc_1123_datetime\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/error/rfc1123Exception'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _context.response.status_code == 444\r\n raise Rfc1123Exception.new(\r\n 'Rfc1123 Exception',\r\n _context\r\n )\r\n end\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body) unless\r\n _context.response.raw_body.nil? ||\r\n _context.response.raw_body.to_s.strip.empty?\r\n decoded\r\n end",
"def create\n @holiday_exception = HolidayException.new(holiday_exception_params)\n @project = Project.find holiday_exception_params[:project_id]\n @customer = Customer.find(@project.customer_id)\n \n @users_on_project = User.joins(\"LEFT OUTER JOIN projects_users ON users.id = projects_users.user_id AND projects_users.project_id = #{@project.id}\").select(\"users.email,first_name,email,users.id id,user_id, projects_users.project_id, projects_users.active,project_id\")\n respond_to do |format|\n if @holiday_exception.save\n\t@holiday_exceptions = @project.holiday_exceptions\n\tcustomer_holiday_ids = CustomersHoliday.where(customer_id: @holiday_exception.customer_id).pluck(:holiday_id)\n \t@holidays = Holiday.where(global:true).or(Holiday.where(id: customer_holiday_ids))\n\t@holiday_exception = HolidayException.new\n\tformat.js\n #format.html { redirect_to @holiday_exception, notice: 'Holiday exception was successfully created.' }\n format.json { render :show, status: :created, location: @holiday_exception }\n else\n format.html { render :new }\n format.json { render json: @holiday_exception.errors, status: :unprocessable_entity }\n end\n end\n end",
"def return_404_error\n\n render json: { success: false, error: I18n.t('errors.e_404'),\n status_code: 404 }, status: :not_found\n end",
"def get_public_holidays( year )\n PublicHoliday.factory( @localization ).all( year ) \n end",
"def show\n template = if template_exists?(status_code, 'exceptions')\n \"exceptions/#{status_code}\"\n else\n 'exceptions/500'\n end\n\n respond_to do |format|\n format.html { render template: template, status: status_code }\n format.json do\n render json: { message: exception.message }, status: status_code\n end\n end\n end",
"def eligibility\n respond_to :json\n @eligibility = Eligibility.find_by(client: @client, day: requested_day)\n unless @eligibility\n Rails.logger.warn \"Eligibility not pre-calculated for #{@client.id} on #{requested_day}\"\n @eligibility = EligibilityService.new(@client, requested_day, 1).run!\n end\n render json: {\n requested_day => {\n 'meetsMinimumPresence' => @eligibility.minimum_presence,\n # boolean (root)\n 'meetsFiveYearPresence' => @eligibility.five_year_presence,\n # boolean (child of root | parent of present_days_by_rolling_year)\n 'daysInNZ' => @eligibility.present_days_by_rolling_year,\n # hash of integers e.g. {'2019-06-07': 365.. } (child of five_year_presence)\n 'eachYearPresence' => @eligibility.each_year_presence,\n # boolean (child of root | parent of mimimum_presence_by_rolling_year)\n 'last5Years' => @eligibility.mimimum_presence_by_rolling_year\n # hash of booleans e.g. {'2019-06-07': true.. } (child of each_year_presence)\n }\n }\n end",
"def not_found\n render json: nil, status: :not_found\n end",
"def format_rest_error\n Array(Chef::JSONCompat.from_json(exception.response.body)[\"error\"]).join(\"; \")\n rescue Exception\n safe_format_rest_error\n end",
"def render_400(exception = nil)\n message = (exception && known?(exception) && exception.message) || I18n.t('json_api_server.render_400.detail')\n errors = JsonApiServer.errors(\n status: 400,\n title: I18n.t('json_api_server.render_400.title'),\n detail: message\n )\n render json: errors.to_json, status: 400\n end",
"def rescue_not_found\n render nothing: true, status: 404\n end",
"def get_honeybadger_errors(options = {})\n api_token = \"YOUR API TOKEN HERE\"\n project_id = \"YOUR PROJECT ID HERE\"\n\n url = \"https://api.honeybadger.io/v1/projects/#{project_id}/faults?auth_token=#{api_token}\"\n if options[:order]\n url += \"&order=#{options[:order]}\"\n end\n\n\turi = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n request = Net::HTTP::Get.new(uri.request_uri, {'Accept' => 'application/json', 'Content-Type' => 'application/json'})\n response = http.request(request)\n json_response = JSON.parse(response.body)\n \n upper_bound = options[:limit] || 5\n \n json_response['results'][0..(upper_bound - 1)]\nend",
"def exceptions_app; end",
"def exceptions_app; end",
"def not_found_response(env)\n if head_request?(env)\n [ 404, { \"content-type\" => \"text/plain\", \"content-length\" => \"0\", \"x-cascade\" => \"pass\" }, [] ]\n else\n [ 404, { \"content-type\" => \"text/plain\", \"content-length\" => \"9\", \"x-cascade\" => \"pass\" }, [ \"Not found\" ] ]\n end\n end",
"def render_parameter_missing_response(exception)\n render json: {error: exception.message}, status: 422\n end",
"def get_honeybadger_errors(options = {})\n api_token = ENV['HONEYBADGER_TOKEN']\n project_id = options[:project_id]\n\n url = \"https://app.honeybadger.io/v2/projects/#{project_id}/faults?q=environment:production\"\n url += \"&order=#{options[:order]}\" if options[:order]\n\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n request = Net::HTTP::Get.new(\n uri.request_uri,\n {\n 'Accept' => 'application/json',\n 'Content-Type' => 'application/json',\n 'Authorization' => \"Basic #{Base64.encode64(api_token).strip}\"\n })\n\n response = http.request(request)\n json_response = JSON.parse(response.body)\n\n upper_bound = options[:limit] || 5\n\n json_response['results'][0..(upper_bound - 1)]\nend",
"def four_zero_zero(e)\n render json: jsonData(e), status: :bad_request\n end",
"def catch_exceptions\n yield\n rescue ActiveRecord::RecordNotFound\n render_record_not_found\n rescue ActiveRecord::RecordInvalid => e\n render_error e.message, 400\n rescue Exception => e\n Rails.logger.debug e.inspect\n Rails.logger.debug e.message.inspect\n e.backtrace.each {|l| Rails.logger.debug l.inspect }\n render_error e.message\n end",
"def employee_vacations\n #vacaciones de este año\n vacations = Employee.find(params[:id]).get_vacation_days\n\n respond_to do |format|\n format.json { render json: vacations }\n end\n end",
"def not_found!\n [404, {\"Content-Type\" => \"text/plain\"}, [\"Jsus doesn't know anything about this entity\"]]\n end",
"def holidays\n ScheduleDataManager.holidays(@holiday_schedule_name)\n end",
"def render_404\n unless request.format.json?\n request.format = \"html\"\n end\n respond_to do |format|\n format.json { render json: { error: t(:not_found) }, status: 404 }\n format.all { render template: \"errors/error_404\", status: 404, layout: \"application\" }\n end\n end",
"def render_not_found(error)\n json_response({ error: { message: error.message } }, :not_found)\n end",
"def response_for(status, exception)\n render json: {\n errors: [exception.message],\n }, status: status\n end",
"def vuln_exception_listing(status = nil)\n option = {}\n\n if status && !status.empty?\n if status =~ /Under Review|Approved|Rejected/\n option['status'] = status\n else\n raise ArgumentError.new 'The vulnerability status passed in is invalid!'\n end\n end\n\n xml = make_xml('VulnerabilityExceptionListingRequest', option)\n r = execute xml, '1.2'\n\n if r.success\n res = []\n r.res.elements.each('//VulnerabilityException') do |ve|\n submitter_comment = ve.elements['submitter-comment']\n reviewer_comment = ve.elements['reviewer-comment']\n res << {\n :vuln_id => ve.attributes['vuln-id'],\n :exception_id => ve.attributes['exception-id'],\n :submitter => ve.attributes['submitter'],\n :reviewer => ve.attributes['reviewer'],\n :status => ve.attributes['status'],\n :reason => ve.attributes['reason'],\n :scope => ve.attributes['scope'],\n :device_id => ve.attributes['device-id'],\n :port_no => ve.attributes['port-no'],\n :expiration_date => ve.attributes['expiration-date'],\n :vuln_key => ve.attributes['vuln-key'],\n :submitter_comment => submitter_comment.nil? ? '' : submitter_comment.text,\n :reviewer_comment => reviewer_comment.nil? ? '' : reviewer_comment.text\n }\n end\n res\n else\n false\n end\n end",
"def index\n begin\n @holidaytypes = Holidaytype.where({:isactive=>1})\n @clean_types = @@stripper.activeRecordData(@holidaytypes)\n @@request_result[:success] = true\n @@request_result[:data] = @clean_types\n @@request_result[:metaData] = @@meta_data.create(@holidaytypes)\n rescue Exception => e\n @@request_result[:errmsg] = e.message\n end\n render json: @@request_result\n end",
"def not_found\n respond_with 404\n end",
"def new\n @daily_data_delivery_exception = DailyDataDeliveryException.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @daily_data_delivery_exception }\n end\n end",
"def exception_data\n {\n company: company.id,\n notified_user_ids: begin\n anniversary_hash = get_todays_event_hash(:anniversary) || {}\n birthday_hash = get_todays_event_hash(:birthday) || {}\n notified_user_ids = (anniversary_hash.keys + birthday_hash.keys).uniq\n notified_user_ids\n end\n }\n end",
"def show\n @except = Except.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @except }\n end\n end",
"def render_404\n render(\n json: {\n error_messages: ['Resource does not exist'],\n error_code: 'NOT_FOUND'\n },\n status: 404\n )\n end",
"def index\n @holiday = Holiday.find(params[:holiday_id])\n @occurrences = @holiday.occurrences\n end",
"def exceptions\n end",
"def destroy\n @holiday.destroy\n respond_to do |format|\n format.html { redirect_to holidays_url }\n format.json { head :no_content }\n end\n end",
"def not_found\n respond_with 404\n end",
"def record_not_found\n render json: {error: I18n.t('errors.not_found')}.to_json, status: 404\n end",
"def access_denied\n render :json => %Q~{\"errors\": [\"Please login to consume the REST API\"]}~, :status => 401\n end",
"def access_denied\n render :json => %Q~{\"errors\": [\"Please login to consume the REST API\"]}~, :status => 401\n end",
"def access_denied\n render :json => %Q~{\"errors\": [\"Please login to consume the REST API\"]}~, :status => 401\n end",
"def access_denied\n render :json => %Q~{\"errors\": [\"Please login to consume the REST API\"]}~, :status => 401\n end",
"def access_denied\n render :json => %Q~{\"errors\": [\"Please login to consume the REST API\"]}~, :status => 401\n end"
] |
[
"0.755907",
"0.6884884",
"0.64303064",
"0.6386149",
"0.6309451",
"0.6216709",
"0.61845356",
"0.6161303",
"0.60819626",
"0.60589796",
"0.59875226",
"0.5916819",
"0.5898217",
"0.5874412",
"0.5815764",
"0.5810869",
"0.5794554",
"0.5761122",
"0.5714819",
"0.5707645",
"0.57006437",
"0.5645002",
"0.56391805",
"0.56328505",
"0.5630232",
"0.5627614",
"0.56213295",
"0.561574",
"0.5604642",
"0.5599361",
"0.55978537",
"0.5588945",
"0.5580182",
"0.5566952",
"0.55530864",
"0.55499625",
"0.554613",
"0.5530505",
"0.55278516",
"0.5516598",
"0.551408",
"0.5509485",
"0.55001485",
"0.548581",
"0.5478196",
"0.5460287",
"0.5457591",
"0.5451703",
"0.5445539",
"0.54453",
"0.5445096",
"0.5442058",
"0.5432055",
"0.5429031",
"0.5428963",
"0.54235595",
"0.5416361",
"0.53979224",
"0.5397225",
"0.5396979",
"0.5391786",
"0.53836507",
"0.5378043",
"0.5363296",
"0.5346314",
"0.5341442",
"0.53330415",
"0.5331974",
"0.532377",
"0.5323162",
"0.53226906",
"0.53226906",
"0.5321878",
"0.53182393",
"0.5311167",
"0.530946",
"0.5302487",
"0.5299937",
"0.5297441",
"0.52945393",
"0.5278672",
"0.52774984",
"0.5276614",
"0.5269704",
"0.5264162",
"0.5262716",
"0.52557987",
"0.52520436",
"0.5251085",
"0.5250152",
"0.5249842",
"0.52474785",
"0.5231015",
"0.5230355",
"0.52297735",
"0.52190113",
"0.52190113",
"0.52190113",
"0.52190113",
"0.52190113"
] |
0.76140076
|
0
|
GET /holiday_exceptions/1 GET /holiday_exceptions/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @holiday_exceptions = HolidayException.all\n end",
"def calendar_exceptions\n get '/gtfs/calendarDate'\n end",
"def calendar_service_exceptions(service_id)\n get \"/gtfs/calendarDate/serviceId/#{service_id}\"\n end",
"def index\n #Get the event\n @event = Event.find(params[:event_id])\n render :attendance, status: :ok\nrescue ActiveRecord::RecordNotFound => e\n render json: {\n error: e.to_s\n }, status: :not_found\n end",
"def set_holiday_exception\n @holiday_exception = HolidayException.find(params[:id])\n end",
"def handle_response(response)\n case response.code.to_i\n when 200\n JSON.parse(response.body)['holidays']\n when 400\n raise BadRequest.new response.parsed_response\n when 401\n raise Unauthorized.new\n when 404\n raise NotFound.new\n when 400...500\n raise ClientError.new response.parsed_response\n when 500...600\n raise ServerError.new\n else\n response\n end\n end",
"def get_date_in_exception\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/error/dateInException'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _context.response.status_code == 444\r\n raise ExceptionWithDateException.new(\r\n 'date in exception',\r\n _context\r\n )\r\n end\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body) unless\r\n _context.response.raw_body.nil? ||\r\n _context.response.raw_body.to_s.strip.empty?\r\n decoded\r\n end",
"def index\n @holidays = Holiday.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @holidays }\n end\n end",
"def update\n respond_to do |format|\n begin\n status = @holiday_exception.update(holiday_exception_params)\n rescue => e\n status = false\n customer_holiday_ids = CustomersHoliday.where(customer_id: @holiday_exception.customer_id).pluck(:holiday_id)\n @holidays = Holiday.where(global:true).or(Holiday.where(id: customer_holiday_ids))\n logger.debug\"UPDATE #{e.inspect} , STATUS #{status}\" \n end\n if status\n format.html { redirect_to edit_holiday_exception_path(@holiday_exception), notice: 'Holiday exception was successfully updated.' }\n format.json { render :show, status: :ok, location: @holiday_exception }\n else\n format.html { render :edit }\n format.json { render json: @holiday_exception.errors, status: :unprocessable_entity }\n end\n\n end\n end",
"def not_found(exception)\n render json: { error: exception.message }, status: :not_found\n end",
"def show\n @holiday = Holiday.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @holiday }\n end\n end",
"def exceptions\n exceptions = DivaServicesApi.get(\"/algorithms/#{id}/exceptions\").parsed_response\n exceptions.map do |entry|\n DivaServicesApi::ExceptionMessage.new(id, DateTime.parse(entry['date']), entry['errorMessage'])\n end\n end",
"def list_vuln_exceptions(status = nil)\n unless is_valid_vuln_exception_status?(status)\n raise \"Unknown Status ~> '#{status}' :: For available options refer to Nexpose::VulnException::Status\"\n end\n\n status = Nexpose::VulnException::Status.const_get(status_string_to_constant(status)) unless status.nil?\n\n results = []\n ajax_data = []\n\n url_size = 500\n url_page = 0\n\n req = Nexpose::AJAX.get(self, \"/api/3/vulnerability_exceptions?size=#{url_size}&page=#{url_page}\")\n data = JSON.parse(req, object_class: OpenStruct)\n ajax_data << data.resources\n\n if data.links.count > 1\n loop do\n url_page += 1\n req = Nexpose::AJAX.get(self, \"/api/3/vulnerability_exceptions?size=#{url_size}&page=#{url_page}\")\n data = JSON.parse(req, object_class: OpenStruct)\n ajax_data << data.resources\n links = data.links.select { |ll| ['self', 'last'].include?(ll.rel) }\n break if links[0].href == links[1].href\n end\n end\n\n ajax_data.compact!\n ajax_data.flatten!\n\n ajax_data.each do |vuln_excep|\n ve = VulnException.new(vuln_excep.scope.vulnerabilityID, vuln_excep.scope.type, vuln_excep.submit.reason, vuln_excep.state)\n ve.id = vuln_excep.id\n ve.submitter = vuln_excep.submit.name\n ve.submitter_comment = vuln_excep.submit.comment\n ve.submit_date = Time.parse(vuln_excep.submit.date) unless vuln_excep.submit.date.nil?\n ve.asset_id = vuln_excep.scope.assetID\n ve.site_id = vuln_excep.scope.siteID\n ve.asset_group_id = vuln_excep.scope.assetGroupID\n ve.port = vuln_excep.scope.port\n ve.vuln_key = vuln_excep.scope.key\n ve.expiration = Time.parse(vuln_excep.expires) unless vuln_excep.expires.nil?\n unless vuln_excep.review.nil?\n ve.reviewer = vuln_excep.review.name\n ve.reviewer_comment = vuln_excep.review.comment\n ve.review_date = Time.parse(vuln_excep.review.date) unless vuln_excep.review.date.nil?\n end\n results << ve\n end\n results.keep_if { |v| v.status == status } unless status.nil?\n results\n end",
"def index\n @extra_holidays = ExtraHoliday.all\n end",
"def no_route_exception_json(exception)\n code = 404\n render :json => Status::Errors.exception_json(exception, code).to_json, :status => code\n end",
"def new\n @holiday = Holiday.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @holiday }\n end\n end",
"def show\n @daily_data_delivery_exception = DailyDataDeliveryException.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @daily_data_delivery_exception }\n end\n end",
"def get_receive_exception_with_rfc_1123_datetime\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/error/rfc1123Exception'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _context.response.status_code == 444\r\n raise Rfc1123Exception.new(\r\n 'Rfc1123 Exception',\r\n _context\r\n )\r\n end\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body) unless\r\n _context.response.raw_body.nil? ||\r\n _context.response.raw_body.to_s.strip.empty?\r\n decoded\r\n end",
"def index\n @special_holidays = SpecialHoliday.all\n end",
"def not_found(exception)\n render json: { status: \"404\", \"#{exception.message}\": \"page not found\"}\n end",
"def index\n @excuses = Excuse.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @excuses }\n end\n end",
"def destroy\n @holiday_exception.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Holiday exception was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @holiday }\n end\n end",
"def holiday_exception_params\n params.require(:holiday_exception).permit(:user_id, :project_id, :customer_id, :holiday_ids => [])\n end",
"def destroy\n begin\n @holiday = Holiday.find(params[:id])\n if @holiday.destroy\n @@request_result = {success:true, notice: 'Operation ended successfully.'}\n else\n @@request_result[:errormsg] = @holiday.errors.full_messages[0]\n end\n rescue Exception => e \n @@request_result[:errormsg] = e.message\n end\n render json: @@request_result\n end",
"def index\n @holidays = Holiday.where :employer_id => selected_employer_id\n end",
"def render_404\n render json: {\n message: '404 Not Found',\n details: exception.error_codes\n }, status: 404\n end",
"def halt_not_found(exception)\n halt 404, json({ message: exception.reason })\n end",
"def index\n @activity_holidays = ActivityHoliday.all\n end",
"def does_not_exist_json(exception=nil)\n message = exception.message if !exception.nil?\n exception = AppError::UndefinedRouteOrActionError.new\n code = exception.code\n render :json => Status::Errors.exception_json(exception, code, message).to_json, :status => code\n end",
"def index\n\t\t@holidays = Holiday.all.order(\"created_at DESC\")\n\tend",
"def render_404(_exception = nil)\n errors = JsonApiServer.errors(\n status: 404,\n title: I18n.t('json_api_server.render_404.title'),\n detail: I18n.t('json_api_server.render_404.detail', name: _i18n_name)\n )\n render json: errors.to_json, status: 404\n end",
"def show\n template = if template_exists?(status_code, 'exceptions')\n \"exceptions/#{status_code}\"\n else\n 'exceptions/500'\n end\n\n respond_to do |format|\n format.html { render template: template, status: status_code }\n format.json do\n render json: { message: exception.message }, status: status_code\n end\n end\n end",
"def find_404\n\tloop do\n\t\tr = await\n\t\tif r[\"status\"] == 404\n\t\t\tyield %w{status datetime request}.map{|col| r[col].to_s}.join(\" \")\n\t\tend\n\tend\nend",
"def exceptions\n @values['exceptions']\n end",
"def render_figgy_404 # rubocop:disable Naming/VariableNumber\n respond_to do |format|\n format.html { render \"errors/not_found\", status: :not_found }\n format.json { head :not_found }\n end\n end",
"def handle_exception e\n response.headers['Content-Type'] = 'application/json'\n response.body = { message: e.message, backtrace: e.backtrace }.to_json\n end",
"def not_found\n render json: { error: { message: 'There was nothing found at this address.' }}, status: :not_found\n end",
"def index\n if params[:company]\n @holiday = Holiday.new(:project_id => nil)\n set_content_title([t(\"screens.labels.company_calendar\")])\n @days_enable = can? :update_company_calendar, @holiday\n @dates_creation = can? :create_company_calendar, @holiday\n @holidays = Holiday.company_holidays\n @days_off = DayOff.company_days_off\n @holiday.company = true\n @days_off_for_fullcalendar = DayOff.calendar_wday_classes()\n else\n @holiday = Holiday.new(:project_id => actual_project.id)\n set_content_title([t(\"screens.labels.project_calendar\")])\n @days_enable = can? :update_project_calendar, @holiday\n @dates_creation = can? :create_project_calendar, @holiday\n @holidays = actual_project.holidays.order(\"day\")\n @days_off = actual_project.get_days_off\n @days_off_for_fullcalendar = DayOff.calendar_wday_classes(actual_project)\n end\n\n\n @holidays_for_fullcalendar = @holidays.map(&:milis_from_1970).join(', ')\n #@holidays_for_fullcalendar = \"1335852000000, 1337148000000, 1337234400000\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @holidays }\n end\n end",
"def show\n @holidaytype = Holidaytype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @holidaytype }\n end\n end",
"def index\n @hk_public_holidays = HkPublicHoliday.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @hk_public_holidays }\n end\n end",
"def not_found_response\n [ 404, { \"Content-Type\" => \"text/plain\", \"Content-Length\" => \"9\", \"X-Cascade\" => \"pass\" }, [ \"Not found\" ] ]\n end",
"def events\n url = 'https://api.artic.edu/api/v1/exhibitions?limit=35'\n\n res = RestClient.get(url)\n JSON.parse(res)\nend",
"def return_404\n render :json => {:error => \"not-found\"}.to_json, :status => 404\n end",
"def get_receive_exception_with_rfc_3339_datetime\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/error/Rfc3339InException'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _context.response.status_code == 444\r\n raise ExceptionWithRfc3339DateTimeException.new(\r\n 'DateTime Exception',\r\n _context\r\n )\r\n end\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body) unless\r\n _context.response.raw_body.nil? ||\r\n _context.response.raw_body.to_s.strip.empty?\r\n decoded\r\n end",
"def index\n @search = ClaimValidationException.search(params[:q])\n # @claim_validation_exceptions = ClaimValidationException.order(\"id desc\").paginate(:page => params[:page])\n @claim_validation_exceptions = @search.result.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @claim_validation_exceptions }\n end\n end",
"def error_response(exception)\n render json: { message: exception.message }, status: :bad_request\n end",
"def index\n @holiday = Holiday.find(params[:holiday_id])\n @occurrences = @holiday.occurrences\n end",
"def new\n @daily_data_delivery_exception = DailyDataDeliveryException.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @daily_data_delivery_exception }\n end\n end",
"def get_national_holidays\n national_holidays = Event.all.select { |event| event.event_type == \"National Holiday\"}\n return national_holidays \n end",
"def create\n @holiday_exception = HolidayException.new(holiday_exception_params)\n @project = Project.find holiday_exception_params[:project_id]\n @customer = Customer.find(@project.customer_id)\n \n @users_on_project = User.joins(\"LEFT OUTER JOIN projects_users ON users.id = projects_users.user_id AND projects_users.project_id = #{@project.id}\").select(\"users.email,first_name,email,users.id id,user_id, projects_users.project_id, projects_users.active,project_id\")\n respond_to do |format|\n if @holiday_exception.save\n\t@holiday_exceptions = @project.holiday_exceptions\n\tcustomer_holiday_ids = CustomersHoliday.where(customer_id: @holiday_exception.customer_id).pluck(:holiday_id)\n \t@holidays = Holiday.where(global:true).or(Holiday.where(id: customer_holiday_ids))\n\t@holiday_exception = HolidayException.new\n\tformat.js\n #format.html { redirect_to @holiday_exception, notice: 'Holiday exception was successfully created.' }\n format.json { render :show, status: :created, location: @holiday_exception }\n else\n format.html { render :new }\n format.json { render json: @holiday_exception.errors, status: :unprocessable_entity }\n end\n end\n end",
"def exception_json(exception,code=500)\n render :json => Status::Errors.exception_json(exception, code).to_json, :status => code\n end",
"def invalid_json_json(exception)\n code = 500\n render :json => Status::Errors.exception_json(\"We are currently experiencing issues with our data server, please try again soon.\", code).to_json, :status => code\n end",
"def show\n @except = Except.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @except }\n end\n end",
"def not_found\n render(\n json: {\n errors: [{\n type: \"Not Found\"\n }]\n },\n status: :not_found #alias for 404 in rails\n )\n end",
"def four_zero_zero(e)\n render json: jsonData(e), status: :bad_request\n end",
"def show\n @exception = ExceptionHandler::Exception.new request #-> Service Object\n render status: @exception.status #-> Show apppropriate response\n end",
"def londons_rescue\n render json: { error: \"Gym not found\"}, status: 422\n end",
"def error_rescue(exception = nil)\n return render_error_status(404, exception.message)\n end",
"def show\n @claim_validation_exception = ClaimValidationException.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @claim_validation_exception }\n end\n end",
"def index\n @lates = Late.where(date: Date.today)\n @leaves = Leave.where(\"(start_date <= :date AND end_date >= :date) or start_date = :date\", date: Date.today)\n @schedules = Schedule.over_dates(Date.today, Date.today)\n @schedules = @schedules.where(\"user_id NOT IN (?)\", @leaves.select(\"user_id\").where(\"hours IS NULL OR hours >=8\").group(:user_id).map(&:user_id)) unless @leaves.blank?\n @holidays = Holiday.where(\"(start_date <= :date AND end_date >= :date) OR start_date = :date\", date: Date.today)\n\n respond_with(@schedules, @lates, @leaves, @holidays)\n end",
"def find_class_period(id)\n restHttpGet(\"#{class_period_endpoint}/#{id}\")\n case @res.code\n when 200\n JSON.parse(@res)\n when 404\n nil\n else\n @res.code.to_s.should match(/^(200|404)$/)\n end\nend",
"def format_rest_error\n Array(Chef::JSONCompat.from_json(exception.response.body)[\"error\"]).join(\"; \")\n rescue Exception\n safe_format_rest_error\n end",
"def raise_bad_format\r\n error_message = ErrorMessage.new(\"400\", \"Api:et stödjer inte det begärda formatet.\",\r\n \"Felaktig begäran. Kontakta utvecklaren.\")\r\n render json: error_message, status: :bad_request\r\n end",
"def not_found_response\n [404, {'Content-Type' => \"text/plain\", 'Content-Length' => \"9\"}, ['Not found']]\n end",
"def index\n render locals: locals_for_index\n rescue MalformattedDateError\n redirect_to redirect_room_url, flash: { alert: t('errors.date.malformed') }\n rescue DayOffError\n redirect_to redirect_room_url, flash: { notice: t('errors.date.day_off') }\n end",
"def get_throw\n response = RestClient.get('https://5eddt4q9dk.execute-api.us-east-1.amazonaws.com/rps-stage/throw')\n parsed_response = JSON.parse(response)\n # Checking for valid data, if there is no statusCode, then return false\n if parsed_response[\"statusCode\"] == 200\n return JSON.parse(parsed_response['body'])\n else\n return false\n end\n end",
"def exception_response\n { ok: false, message: 'Error processing request' }\n end",
"def not_found\n render json: nil, status: :not_found\n end",
"def four_zero_four(error)\n json_response({ errors: error }, :not_found)\n end",
"def employee_vacations\n #vacaciones de este año\n vacations = Employee.find(params[:id]).get_vacation_days\n\n respond_to do |format|\n format.json { render json: vacations }\n end\n end",
"def render_400(exception = nil)\n message = (exception && known?(exception) && exception.message) || I18n.t('json_api_server.render_400.detail')\n errors = JsonApiServer.errors(\n status: 400,\n title: I18n.t('json_api_server.render_400.title'),\n detail: message\n )\n render json: errors.to_json, status: 400\n end",
"def return_404_error\n\n render json: { success: false, error: I18n.t('errors.e_404'),\n status_code: 404 }, status: :not_found\n end",
"def show\n @commission_fixing = CommissionFixing.find(params[:id]) \n rescue ActiveRecord::RecordNotFound\n render :json=>{:response=>\"The record can't be found\"}\n end",
"def event_app_not_found\n render json: 'Unregistered application', status: :unprocessable_entity\n end",
"def get_honeybadger_errors(options = {})\n api_token = \"YOUR API TOKEN HERE\"\n project_id = \"YOUR PROJECT ID HERE\"\n\n url = \"https://api.honeybadger.io/v1/projects/#{project_id}/faults?auth_token=#{api_token}\"\n if options[:order]\n url += \"&order=#{options[:order]}\"\n end\n\n\turi = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n request = Net::HTTP::Get.new(uri.request_uri, {'Accept' => 'application/json', 'Content-Type' => 'application/json'})\n response = http.request(request)\n json_response = JSON.parse(response.body)\n \n upper_bound = options[:limit] || 5\n \n json_response['results'][0..(upper_bound - 1)]\nend",
"def render_parameter_missing_response(exception)\n render json: {error: exception.message}, status: 422\n end",
"def four_zero_four(error)\n json_response({ message: error.message }, :not_found)\n end",
"def not_found(env)\n [404,{'Content-Type'=>'text/plain','X-Cascade'=>'pass'},['Ooooopppps 404!']]\n end",
"def render_404\n render(\n json: {\n error_messages: ['Resource does not exist'],\n error_code: 'NOT_FOUND'\n },\n status: 404\n )\n end",
"def rescue_not_found\n render nothing: true, status: 404\n end",
"def index\n begin\n @holidaytypes = Holidaytype.where({:isactive=>1})\n @clean_types = @@stripper.activeRecordData(@holidaytypes)\n @@request_result[:success] = true\n @@request_result[:data] = @clean_types\n @@request_result[:metaData] = @@meta_data.create(@holidaytypes)\n rescue Exception => e\n @@request_result[:errmsg] = e.message\n end\n render json: @@request_result\n end",
"def index\n @trace_exceptions = TraceException.all\n end",
"def destroy\n @holiday.destroy\n respond_to do |format|\n format.html { redirect_to holidays_url }\n format.json { head :no_content }\n end\n end",
"def show\n @employee = Employee.find(params[:id])\n @attendance = Employee.new.attendances.build(params[:attendance])\n @taxable_income = @employee.cutoff_salary - (@employee.sss + @employee.philhealth + @employee.pagibig)\n @withholding_tax = ((@taxable_income - 15833) * 0.25) + 1875\n unless Attendance.find_by_date(Date.yesterday).nil?\n if Attendance.find_by_date(Date.yesterday).holiday?\n if @employee.attendances.find_by_date(Date.yesterday).nil?\n flash[:info] = \"NOTICE: Your have received your regular salary yesterday without working due to national holiday\"\n Attendance.create(date: Date.yesterday, employee_id: @employee.id, holiday: true, total_salary_earned: @employee.salary_per_day, time_in: @employee.starting_time, time_out: @employee.dismissal_time )\n end\n end\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @employee }\n end\n end",
"def eligibility\n respond_to :json\n @eligibility = Eligibility.find_by(client: @client, day: requested_day)\n unless @eligibility\n Rails.logger.warn \"Eligibility not pre-calculated for #{@client.id} on #{requested_day}\"\n @eligibility = EligibilityService.new(@client, requested_day, 1).run!\n end\n render json: {\n requested_day => {\n 'meetsMinimumPresence' => @eligibility.minimum_presence,\n # boolean (root)\n 'meetsFiveYearPresence' => @eligibility.five_year_presence,\n # boolean (child of root | parent of present_days_by_rolling_year)\n 'daysInNZ' => @eligibility.present_days_by_rolling_year,\n # hash of integers e.g. {'2019-06-07': 365.. } (child of five_year_presence)\n 'eachYearPresence' => @eligibility.each_year_presence,\n # boolean (child of root | parent of mimimum_presence_by_rolling_year)\n 'last5Years' => @eligibility.mimimum_presence_by_rolling_year\n # hash of booleans e.g. {'2019-06-07': true.. } (child of each_year_presence)\n }\n }\n end",
"def exception_data\n {\n company: company.id,\n notified_user_ids: begin\n anniversary_hash = get_todays_event_hash(:anniversary) || {}\n birthday_hash = get_todays_event_hash(:birthday) || {}\n notified_user_ids = (anniversary_hash.keys + birthday_hash.keys).uniq\n notified_user_ids\n end\n }\n end",
"def show\n @excuse = Excuse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @excuse }\n end\n end",
"def invalid_document_id_error(exception)\n error_info = {\n \"status\" => \"404\",\n \"error\" => \"#{exception.class}: #{exception.message}\"\n }\n\n respond_to do |format|\n format.xml { render xml: error_info, status: :not_found }\n format.json { render json: error_info, status: :not_found }\n\n # default to HTML response, even for other non-HTML formats we don't\n # neccesarily know about, seems to be consistent with what Rails4 does\n # by default with uncaught ActiveRecord::RecordNotFound in production\n format.any do\n # use standard, possibly locally overridden, 404.html file. Even for\n # possibly non-html formats, this is consistent with what Rails does\n # on raising an ActiveRecord::RecordNotFound. Rails.root IS needed\n # for it to work under testing, without worrying about CWD.\n render \"errors/not_found\", status: :not_found\n end\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @office_hours }\n end\n end",
"def get_public_holidays( year )\n PublicHoliday.factory( @localization ).all( year ) \n end",
"def new\n @holidaytype = Holidaytype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @holidaytype }\n end\n end",
"def get_honeybadger_errors(options = {})\n api_token = ENV['HONEYBADGER_TOKEN']\n project_id = options[:project_id]\n\n url = \"https://app.honeybadger.io/v2/projects/#{project_id}/faults?q=environment:production\"\n url += \"&order=#{options[:order]}\" if options[:order]\n\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n request = Net::HTTP::Get.new(\n uri.request_uri,\n {\n 'Accept' => 'application/json',\n 'Content-Type' => 'application/json',\n 'Authorization' => \"Basic #{Base64.encode64(api_token).strip}\"\n })\n\n response = http.request(request)\n json_response = JSON.parse(response.body)\n\n upper_bound = options[:limit] || 5\n\n json_response['results'][0..(upper_bound - 1)]\nend",
"def access_denied\n error = error_response_method($e12)\n render :json => error\n end",
"def handle_not_found(exception)\n raise exception\n end",
"def new\n @holiday = Holiday.new\n respond_to do |format|\n format.html\n end\n end",
"def render_not_found(error)\n json_response({ error: { message: error.message } }, :not_found)\n end",
"def index\n @reserved_dates = ReservedDate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reserved_dates }\n end\n end",
"def index\n @holidays = Holiday.all.where(\"day > ?\", Time.now).order(:day)\n end",
"def vuln_exception_listing(status = nil)\n option = {}\n\n if status && !status.empty?\n if status =~ /Under Review|Approved|Rejected/\n option['status'] = status\n else\n raise ArgumentError.new 'The vulnerability status passed in is invalid!'\n end\n end\n\n xml = make_xml('VulnerabilityExceptionListingRequest', option)\n r = execute xml, '1.2'\n\n if r.success\n res = []\n r.res.elements.each('//VulnerabilityException') do |ve|\n submitter_comment = ve.elements['submitter-comment']\n reviewer_comment = ve.elements['reviewer-comment']\n res << {\n :vuln_id => ve.attributes['vuln-id'],\n :exception_id => ve.attributes['exception-id'],\n :submitter => ve.attributes['submitter'],\n :reviewer => ve.attributes['reviewer'],\n :status => ve.attributes['status'],\n :reason => ve.attributes['reason'],\n :scope => ve.attributes['scope'],\n :device_id => ve.attributes['device-id'],\n :port_no => ve.attributes['port-no'],\n :expiration_date => ve.attributes['expiration-date'],\n :vuln_key => ve.attributes['vuln-key'],\n :submitter_comment => submitter_comment.nil? ? '' : submitter_comment.text,\n :reviewer_comment => reviewer_comment.nil? ? '' : reviewer_comment.text\n }\n end\n res\n else\n false\n end\n end",
"def record_not_found\n render json: ErrorSerializer.serialize({ record: \"Record not found.\" }), status: :not_found\n end"
] |
[
"0.75456697",
"0.7276394",
"0.67768484",
"0.652367",
"0.6458206",
"0.6340638",
"0.6324775",
"0.63114595",
"0.61729664",
"0.6057226",
"0.60384023",
"0.6007452",
"0.5923895",
"0.5920864",
"0.58761567",
"0.58277744",
"0.58118975",
"0.5796585",
"0.576613",
"0.5763417",
"0.5761554",
"0.57583755",
"0.57388777",
"0.57009065",
"0.5683941",
"0.56376255",
"0.5627669",
"0.5612707",
"0.56125236",
"0.55902284",
"0.5576547",
"0.5575723",
"0.55669075",
"0.556436",
"0.5562129",
"0.5556069",
"0.5528948",
"0.5522078",
"0.5520909",
"0.55193335",
"0.55177253",
"0.55101615",
"0.55041605",
"0.54945964",
"0.5479393",
"0.54646224",
"0.5462464",
"0.5450332",
"0.5448309",
"0.54253644",
"0.5423165",
"0.5420662",
"0.5413692",
"0.53979504",
"0.539756",
"0.5396073",
"0.53771734",
"0.5360146",
"0.535801",
"0.53560615",
"0.5346637",
"0.5346295",
"0.534177",
"0.5340558",
"0.5339185",
"0.5336855",
"0.53357613",
"0.5333838",
"0.53167236",
"0.531236",
"0.5310627",
"0.5310522",
"0.5310086",
"0.5307633",
"0.5295735",
"0.52928364",
"0.52771866",
"0.5276865",
"0.52763915",
"0.526464",
"0.5261206",
"0.5260338",
"0.525867",
"0.52578104",
"0.52560043",
"0.52452385",
"0.5240273",
"0.5234235",
"0.523326",
"0.5233123",
"0.52325135",
"0.52292365",
"0.52284455",
"0.5224302",
"0.52242804",
"0.5218656",
"0.52096874",
"0.5207435",
"0.5204698",
"0.5201215",
"0.51998734"
] |
0.0
|
-1
|
POST /holiday_exceptions POST /holiday_exceptions.json
|
def create
@holiday_exception = HolidayException.new(holiday_exception_params)
@project = Project.find holiday_exception_params[:project_id]
@customer = Customer.find(@project.customer_id)
@users_on_project = User.joins("LEFT OUTER JOIN projects_users ON users.id = projects_users.user_id AND projects_users.project_id = #{@project.id}").select("users.email,first_name,email,users.id id,user_id, projects_users.project_id, projects_users.active,project_id")
respond_to do |format|
if @holiday_exception.save
@holiday_exceptions = @project.holiday_exceptions
customer_holiday_ids = CustomersHoliday.where(customer_id: @holiday_exception.customer_id).pluck(:holiday_id)
@holidays = Holiday.where(global:true).or(Holiday.where(id: customer_holiday_ids))
@holiday_exception = HolidayException.new
format.js
#format.html { redirect_to @holiday_exception, notice: 'Holiday exception was successfully created.' }
format.json { render :show, status: :created, location: @holiday_exception }
else
format.html { render :new }
format.json { render json: @holiday_exception.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def holiday_exception_params\n params.require(:holiday_exception).permit(:user_id, :project_id, :customer_id, :holiday_ids => [])\n end",
"def index\n @holiday_exceptions = HolidayException.all\n end",
"def calendar_exceptions\n get '/gtfs/calendarDate'\n end",
"def set_holiday_exception\n @holiday_exception = HolidayException.find(params[:id])\n end",
"def update\n respond_to do |format|\n begin\n status = @holiday_exception.update(holiday_exception_params)\n rescue => e\n status = false\n customer_holiday_ids = CustomersHoliday.where(customer_id: @holiday_exception.customer_id).pluck(:holiday_id)\n @holidays = Holiday.where(global:true).or(Holiday.where(id: customer_holiday_ids))\n logger.debug\"UPDATE #{e.inspect} , STATUS #{status}\" \n end\n if status\n format.html { redirect_to edit_holiday_exception_path(@holiday_exception), notice: 'Holiday exception was successfully updated.' }\n format.json { render :show, status: :ok, location: @holiday_exception }\n else\n format.html { render :edit }\n format.json { render json: @holiday_exception.errors, status: :unprocessable_entity }\n end\n\n end\n end",
"def create\n begin\n @new_holiday = @@data_util.strip_hash_data(params[:holiday])\n @new_holiday[:mypclient_id] = session[:client_id].strip\n @new_holiday[:createdby] = session[:username].strip\n @new_holiday[:holidaydate] = Date.strptime(@new_holiday[:holidaydate], \"%m/%d/%Y\")\n @locals = JSON.parse params[:locals] unless params[:locals].empty? \n\n Holiday.transaction do\n @holiday = Holiday.new(@new_holiday)\n if @holiday.save\n self.add_holiday_local(@locals, @holiday.id)\n @@request_result[:success] = true\n @@request_result[:notice] = \"Holiday was successfully created.\"\n else\n @@request_result[:errormsg] = @holiday.errors.full_messages[0]\n ActiveRecord::Rollback\n end\n end\n rescue Exception => e\n ActiveRecord::Rollback\n @@request_result[:errormsg] = e.message\n end\n render json: @@request_result\n end",
"def handle_response(response)\n case response.code.to_i\n when 200\n JSON.parse(response.body)['holidays']\n when 400\n raise BadRequest.new response.parsed_response\n when 401\n raise Unauthorized.new\n when 404\n raise NotFound.new\n when 400...500\n raise ClientError.new response.parsed_response\n when 500...600\n raise ServerError.new\n else\n response\n end\n end",
"def create\n @extra_holiday = ExtraHoliday.new(extra_holiday_params)\n\n respond_to do |format|\n if @extra_holiday.save\n format.html { redirect_to @extra_holiday, notice: 'Extra holiday was successfully created.' }\n format.json { render :show, status: :created, location: @extra_holiday }\n else\n format.html { render :new }\n format.json { render json: @extra_holiday.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t respond_to do |format|\n\t\t holiday_params[:date].split(\"\\n\").each do |date|\n\t\t @holiday = Holiday.new(:employer_id => holiday_params[:employer_id], :date => date)\n\n unless @holiday.save\n\t format.html { render action: 'new' }\n format.json { render json: @holiday.errors, status: :unprocessable_entity }\n end\n\t\t end\n\t\t format.html { redirect_to holidays_url, notice: 'Holiday was successfully created.' }\n\t\t format.json { head :no_content }\n\t end\n end",
"def calendar_service_exceptions(service_id)\n get \"/gtfs/calendarDate/serviceId/#{service_id}\"\n end",
"def create\n @special_holiday = SpecialHoliday.new(special_holiday_params)\n\n respond_to do |format|\n if @special_holiday.save\n format.html { redirect_to @special_holiday, notice: 'Special holiday was successfully created.' }\n format.json { render :show, status: :created, location: @special_holiday }\n else\n format.html { render :new }\n format.json { render json: @special_holiday.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @holiday_date = HolidayDate.new(holiday_date_params)\n\n respond_to do |format|\n if @holiday_date.save\n format.html { redirect_to @holiday_date, notice: 'Holiday date was successfully created.' }\n format.json { render :show, status: :created, location: @holiday_date }\n else\n format.html { render :new }\n format.json { render json: @holiday_date.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @holiday = current_user.holidays.build(params[:holiday])\n\n respond_to do |format|\n if @holiday.save\n format.html { redirect_to @holiday, notice: 'El Feriado fue creado en forma satisfactoria.' }\n format.json { render json: @holiday, status: :created, location: @holiday }\n else\n format.html { render action: \"new\" }\n format.json { render json: @holiday.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @holiday = Holiday.new(params[:holiday])\n\n respond_to do |format|\n if @holiday.save\n format.html { redirect_to holidays_index_path(@holiday),\n notice: 'Holiday is Submitted' }\n else\n format.html { render \"new\",\n error: 'Holiday not saved' }\n end\n end\n end",
"def create\n @holiday = Holiday.new(holiday_params)\n\n respond_to do |format|\n if @holiday.save\n format.html { redirect_to holidays_url, notice: '成功添加.' }\n format.json { render :show, status: :created, location: @holiday }\n else\n format.html { render :new }\n format.json { render json: @holiday.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @holiday_exception.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Holiday exception was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def exception_date_params\n params.require(:exception_date).permit(:name, :dates=>[])\n end",
"def handle_exception e\n response.headers['Content-Type'] = 'application/json'\n response.body = { message: e.message, backtrace: e.backtrace }.to_json\n end",
"def raise_bad_format\r\n error_message = ErrorMessage.new(\"400\", \"Api:et stödjer inte det begärda formatet.\",\r\n \"Felaktig begäran. Kontakta utvecklaren.\")\r\n render json: error_message, status: :bad_request\r\n end",
"def create\n @activity_holiday = ActivityHoliday.new(activity_holiday_params)\n\n respond_to do |format|\n if @activity_holiday.save\n format.html { redirect_to @activity_holiday, notice: 'Activity holiday was successfully created.' }\n format.json { render :show, status: :created, location: @activity_holiday }\n else\n format.html { render :new }\n format.json { render json: @activity_holiday.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @exception_date = ExceptionDate.new(exception_date_params)\n\n respond_to do |format|\n if @exception_date.save\n flash[:success] = 'Exception date was successfully created.'\n format.html { redirect_to exception_dates_url}\n format.json { render :show, status: :created, location: @exception_date }\n else\n format.html { render :new }\n format.json { render json: @exception_date.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(exception_data)\n hash = exception_data.to_hash\n hash[:session].delete(\"initialization_options\")\n hash[:session].delete(\"request\")\n call_remote(:errors, hash.to_json)\n end",
"def holiday_params\n params.require(:holiday).permit(:date, :remarks, :holiday, :activate)\n end",
"def create\n @daily_data_delivery_exception = DailyDataDeliveryException.new(params[:daily_data_delivery_exception])\n\n respond_to do |format|\n if @daily_data_delivery_exception.save\n format.html { redirect_to @daily_data_delivery_exception, notice: 'Daily data delivery exception was successfully created.' }\n format.json { render json: @daily_data_delivery_exception, status: :created, location: @daily_data_delivery_exception }\n else\n format.html { render action: \"new\" }\n format.json { render json: @daily_data_delivery_exception.errors, status: :unprocessable_entity }\n end\n end\n end",
"def holiday_params\n params.require(:holiday).permit(:day, :name)\n end",
"def create\n @hospitalization_day = @adverse_event.hospitalization_days.create(hospitalization_day_params)\n\n respond_to do |format|\n if @hospitalization_day.save\n format.html { redirect_to adverse_event_path(@adverse_event), notice: 'Día de estancia ingresado satisfactoriamente.' }\n format.json { render :show, status: :created, location: @hospitalization_day }\n else\n format.html { render :new }\n format.json { render json: @hospitalization_day.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_date_in_exception\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/error/dateInException'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _context.response.status_code == 444\r\n raise ExceptionWithDateException.new(\r\n 'date in exception',\r\n _context\r\n )\r\n end\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body) unless\r\n _context.response.raw_body.nil? ||\r\n _context.response.raw_body.to_s.strip.empty?\r\n decoded\r\n end",
"def four_twenty_two(e)\n json_response({ message: e.message}, :unprocessable_entity)\nend",
"def invalid_json_json(exception)\n code = 500\n render :json => Status::Errors.exception_json(\"We are currently experiencing issues with our data server, please try again soon.\", code).to_json, :status => code\n end",
"def holiday_params\n params.require(:holiday).permit(:employer_id, :date)\n end",
"def destroy\n begin\n @holiday = Holiday.find(params[:id])\n if @holiday.destroy\n @@request_result = {success:true, notice: 'Operation ended successfully.'}\n else\n @@request_result[:errormsg] = @holiday.errors.full_messages[0]\n end\n rescue Exception => e \n @@request_result[:errormsg] = e.message\n end\n render json: @@request_result\n end",
"def create\n @holiday = Holiday.find(params[:holiday_id])\n @occurrence = Occurrence.new(occurrence_params)\n\n respond_to do |format|\n if @occurrence.save\n format.html { redirect_to :back, notice: 'Occurrence was successfully created.' }\n format.json { render :show, status: :created, location: @occurrence }\n else\n format.html { render :new }\n format.json { render json: @occurrence.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @daily_data_delivery_exception = DailyDataDeliveryException.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @daily_data_delivery_exception }\n end\n end",
"def new\n @holiday = Holiday.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @holiday }\n end\n end",
"def response_with_unprocessable\n error_response( message: @group_event.errors.full_messages.to_sentence,\n fields_errors: @group_event.errors.full_messages,\n status: 422\n )\n end",
"def record_invalid(exception)\n render json: exception.record.errors, status: :unprocessable_entity\n end",
"def holiday_date_params\n params.require(:holiday_date).permit(:holiday_id, :calendar_date_id)\n end",
"def holiday_params\n params.require(:holiday).permit(:holiday, :type, :remark)\n end",
"def create\n @rescue = Rescue.new(rescue_params)\n @emergency = Emergency.find(@rescue.emergency_id)\n respond_to do |format|\n if @rescue.save\n format.html { redirect_to @rescue, notice: 'La informacion del formulario de rescate fue creada con exito.' }\n format.json { render :show, status: :created, location: @rescue }\n else\n format.html { render :new }\n format.json { render json: @rescue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def exceptions=(value)\n @values['exceptions'] = value\n end",
"def create\n @holidaytype = Holidaytype.new(params[:holidaytype])\n\n respond_to do |format|\n if @holidaytype.save\n format.html { redirect_to @holidaytype, notice: 'Holidaytype was successfully created.' }\n format.json { render json: @holidaytype, status: :created, location: @holidaytype }\n else\n format.html { render action: \"new\" }\n format.json { render json: @holidaytype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(exception_data)\n hash = exception_data.to_hash\n if hash[:session]\n hash[:session].delete(\"initialization_options\")\n hash[:session].delete(\"request\")\n end\n\n Exceptional.post_exception(hash.to_json)\n end",
"def error_response(exception)\n render json: { message: exception.message }, status: :bad_request\n end",
"def londons_rescue\n render json: { error: \"Gym not found\"}, status: 422\n end",
"def four_zero_zero(e)\n render json: jsonData(e), status: :bad_request\n end",
"def create\n @holiday = Holiday.new(holiday_params)\n\n if @holiday.save\n flash[:success] = \"Feiertag angelegt.\"\n redirect_to @holiday\n else\n render :new \n end\n end",
"def exception_response\n { ok: false, message: 'Error processing request' }\n end",
"def create\n @holiday = Holiday.new(params[:holiday])\n\n redirect = holidays_path\n redirect = holidays_path(:company => true) if !params[:holiday][:company].blank?\n\n respond_to do |format|\n if @holiday.save\n format.html { redirect_to(redirect, :notice => t(\"screens.notice.successfully_created\")) }\n format.xml { render :xml => @holiday, :status => :created, :location => @holiday }\n else\n format.html { redirect_to(redirect, :alert => @holiday.errors.full_messages.join(\", \") ) }\n format.xml { render :xml => @holiday.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def status_code; 422; end",
"def status_code; 422; end",
"def status_code; 422; end",
"def status_code; 422; end",
"def create\n @holiday = Holiday.new_holiday(params, @company.id, @current_user)\n @holidays = @company.holidays\n respond_to do |format|\n if @holiday.save\n Workstream.register_user_action(@company.id, @current_user.id, request.remote_ip,\n \" new holiday for #{@holiday.holiday} on date #{@holiday.holiday_date}\", \"created\", @current_user.branch_id)\n end\n format.js { render \"create_holiday\" }\n end\n end",
"def holiday_params\n params.require(:holiday).permit(:name, :date, :id, :country_id)\n end",
"def new\n @holiday = current_user.holidays.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @holiday }\n end\n end",
"def holiday_params\n params.require(:holiday).permit(\n :base64,\n :location,\n :attractions,\n :when_to_go,\n :departureDate,\n :returnDate,\n :departureAirport,\n :arrivalAirport,\n :user_id,\n :group_id\n )\n end",
"def index\n #Get the event\n @event = Event.find(params[:event_id])\n render :attendance, status: :ok\nrescue ActiveRecord::RecordNotFound => e\n render json: {\n error: e.to_s\n }, status: :not_found\n end",
"def test_post_invalid\n header 'Content-Type', 'application/json'\n\n json = JSON.generate [{ latitude: 'wrong', longitude: 'wrong' }]\n post('/traces', json, 'CONTENT_TYPE': 'application/json')\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end",
"def create\n @account_output_event = AccountOutputEvent.new(params[:account_output_event])\n\n respond_to do |format|\n begin \n @account_output_event.save!\n format.html { redirect_to account_output_events_url, notice: 'Account output event was successfully created.' }\n format.json { render json: @account_output_event, status: :created, location: @account_output_event }\n rescue ArgumentError => err\n @account_output_event.errors[:account_id] << err.message if err.message.downcase.include?\"account\"\n @account_output_event.errors[:value] << err.message if err.message.downcase.include?\"number\" or err.message.downcase.include?\"funds\"\n format.html { render action: \"new\" }\n format.json { render json: @account_input_event.errors, status: :unprocessable_entity }\n rescue ActiveRecord::RecordInvalid => err\n @account_output_event.errors[:account_id] << err.message if err.message.downcase.include?\"account\"\n @account_output_event.errors[:value] << err.message if err.message.downcase.include?\"value\"\n format.html { render action: \"new\" }\n format.json { render json: @account_output_event.errors, status: :unprocessable_entity }\n rescue Exception => ex\n format.html { redirect_to new_account_output_event_url, alert: \"Funcionalidade temporariamente indisponivel: #{err.message}\" }\n end\n end\n end",
"def render_parameter_missing_response(exception)\n render json: {error: exception.message}, status: 422\n end",
"def create\n attendance_params[:checkin] = attendance_params[:checkin].to_time\n attendance_params[:checkout] = attendance_params[:checkout].to_time\n attendance_params[:attendance_date] = attendance_params[:attendance_date].to_date\n\n r = @api.create_attendance(attendance_params)\n respond_to do |format|\n if r.code == 201\n format.html { redirect_to attendances_url, notice: 'Attendance was successfully created.' }\n else\n response = JSON.parse(r.body)\n format.html { redirect_to attendances_url, alert: response['message']}\n end\n end\n end",
"def create\n @claim_validation_exception = ClaimValidationException.new(params[:claim_validation_exception])\n\n respond_to do |format|\n if @claim_validation_exception.save\n format.html { redirect_to @claim_validation_exception, notice: 'Claim validation exception was successfully created.' }\n format.json { render json: @claim_validation_exception, status: :created, location: @claim_validation_exception }\n else\n format.html { render action: \"new\" }\n format.json { render json: @claim_validation_exception.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n successful = false\n @leave_day = @user.leave_days.build\n @leave_day.leave_day_type = leave_day_params[:leave_day_type]\n\n @leave_day_dates = params[:leave_day_dates]\n\n dates = params[:leave_day_dates].split(\",\")\n if dates.size == 0\n successful = false\n #TODO add manual validation error 'missing dates'\n end\n begin\n ActiveRecord::Base.transaction do\n for date in dates\n leave_day = @user.leave_days.build\n leave_day.date = date\n leave_day.leave_day_type = leave_day_params[:leave_day_type]\n leave_day.description = leave_day_params[:description]\n begin\n if (!leave_day.save)\n flash[:alert] = I18n.t('controllers.leave_days.could_not_save', date: date)\n break\n end\n rescue ActiveRecord::RecordNotUnique => e\n flash[:alert] = I18n.t('controllers.leave_days.leave_day_already_exists', date: date)\n raise e\n end\n end\n successful = true\n end\n rescue ActiveRecord::RecordNotUnique => e\n logger.error \"Error persisting leave day #{e.message}\"\n end\n\n respond_to do |format|\n if successful\n format.html { redirect_to user_leave_days_path(@user), notice: I18n.t('controllers.leave_days.successfully_created') }\n format.json { render :show, status: :created, location: @leave_day }\n else\n format.html { render :new }\n format.json { render json: @leave_day.errors, status: :unprocessable_entity }\n end\n end\n end",
"def excuse_params\n params.require(:excuse).permit(:reason, :status)\n end",
"def four_twenty_two(e)\n render json: { message: e.message }, status: :unprocessable_entity\n end",
"def four_twenty_two(e)\n render json: { message: e.message }, status: :unprocessable_entity\n end",
"def create\n @except = Except.new(params[:except])\n\n respond_to do |format|\n if @except.save\n format.html { redirect_to @except, notice: 'Except was successfully created.' }\n format.json { render json: @except, status: :created, location: @except }\n else\n format.html { render action: \"new\" }\n format.json { render json: @except.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n begin\n @updated_holiday = @@data_util.strip_hash_data(params[:holiday])\n @updated_holiday[:lastupdateby] = session[:username].strip\n @updated_holiday[:holidaydate] = Date.strptime(@updated_holiday[:holidaydate], \"%m/%d/%Y\")\n @locals = JSON.parse params[:locals] unless params[:locals].nil? \n\n @holiday = Holiday.find(params[:id])\n if @holiday.update_attributes(@updated_holiday)\n unless @locals.empty?\n self.add_holiday_local(@locals,@holiday.id)\n end\n @@request_result[:success] = true\n @@request_result[:notice] = \"Holiday was successfully updated.\"\n else\n @@request_result[:errormsg] = @holiday.errors.full_messages[0]\n end\n rescue Exception => e\n @@request_result[:errormsg] = e.message\n end\n render json: @@request_result\n end",
"def payroll_except_params\n params.require(:payroll_except).permit(:name, :location, :typeofexception, :totalhours, :comments, :date)\n \n end",
"def destroy\n @extra_holiday.destroy\n respond_to do |format|\n format.html { redirect_to extra_holidays_url, notice: 'Extra holiday was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def process_action(*args)\n super\n rescue ActionDispatch::Http::Parameters::ParseError => exception\n json_response(nil ,400, :bad_request)\n end",
"def exceptions\n exceptions = DivaServicesApi.get(\"/algorithms/#{id}/exceptions\").parsed_response\n exceptions.map do |entry|\n DivaServicesApi::ExceptionMessage.new(id, DateTime.parse(entry['date']), entry['errorMessage'])\n end\n end",
"def update\n respond_to do |format|\n if @extra_holiday.update(extra_holiday_params)\n format.html { redirect_to @extra_holiday, notice: 'Extra holiday was successfully updated.' }\n format.json { render :show, status: :ok, location: @extra_holiday }\n else\n format.html { render :edit }\n format.json { render json: @extra_holiday.errors, status: :unprocessable_entity }\n end\n end\n end",
"def extra_holiday_params\n params.require(:extra_holiday).permit(:title, :description, :is_hourly, :is_comment_required, :is_paid, :is_as_attended)\n end",
"def list_vuln_exceptions(status = nil)\n unless is_valid_vuln_exception_status?(status)\n raise \"Unknown Status ~> '#{status}' :: For available options refer to Nexpose::VulnException::Status\"\n end\n\n status = Nexpose::VulnException::Status.const_get(status_string_to_constant(status)) unless status.nil?\n\n results = []\n ajax_data = []\n\n url_size = 500\n url_page = 0\n\n req = Nexpose::AJAX.get(self, \"/api/3/vulnerability_exceptions?size=#{url_size}&page=#{url_page}\")\n data = JSON.parse(req, object_class: OpenStruct)\n ajax_data << data.resources\n\n if data.links.count > 1\n loop do\n url_page += 1\n req = Nexpose::AJAX.get(self, \"/api/3/vulnerability_exceptions?size=#{url_size}&page=#{url_page}\")\n data = JSON.parse(req, object_class: OpenStruct)\n ajax_data << data.resources\n links = data.links.select { |ll| ['self', 'last'].include?(ll.rel) }\n break if links[0].href == links[1].href\n end\n end\n\n ajax_data.compact!\n ajax_data.flatten!\n\n ajax_data.each do |vuln_excep|\n ve = VulnException.new(vuln_excep.scope.vulnerabilityID, vuln_excep.scope.type, vuln_excep.submit.reason, vuln_excep.state)\n ve.id = vuln_excep.id\n ve.submitter = vuln_excep.submit.name\n ve.submitter_comment = vuln_excep.submit.comment\n ve.submit_date = Time.parse(vuln_excep.submit.date) unless vuln_excep.submit.date.nil?\n ve.asset_id = vuln_excep.scope.assetID\n ve.site_id = vuln_excep.scope.siteID\n ve.asset_group_id = vuln_excep.scope.assetGroupID\n ve.port = vuln_excep.scope.port\n ve.vuln_key = vuln_excep.scope.key\n ve.expiration = Time.parse(vuln_excep.expires) unless vuln_excep.expires.nil?\n unless vuln_excep.review.nil?\n ve.reviewer = vuln_excep.review.name\n ve.reviewer_comment = vuln_excep.review.comment\n ve.review_date = Time.parse(vuln_excep.review.date) unless vuln_excep.review.date.nil?\n end\n results << ve\n end\n results.keep_if { |v| v.status == status } unless status.nil?\n results\n end",
"def test_create_fail\n post '/resources'\n assert_equal 400, last_response.status\n last_response.headers['Content-Type'].must_equal 'application/json;charset=utf-8'\n assert_json_match error_message_pattern, last_response.body\n end",
"def exception_data\n {\n company: company.id,\n notified_user_ids: begin\n anniversary_hash = get_todays_event_hash(:anniversary) || {}\n birthday_hash = get_todays_event_hash(:birthday) || {}\n notified_user_ids = (anniversary_hash.keys + birthday_hash.keys).uniq\n notified_user_ids\n end\n }\n end",
"def index\n begin\n @holidaytypes = Holidaytype.where({:isactive=>1})\n @clean_types = @@stripper.activeRecordData(@holidaytypes)\n @@request_result[:success] = true\n @@request_result[:data] = @clean_types\n @@request_result[:metaData] = @@meta_data.create(@holidaytypes)\n rescue Exception => e\n @@request_result[:errmsg] = e.message\n end\n render json: @@request_result\n end",
"def four_ninety_eight(e)\n render json: jsonData(e), status: :invalid_token\n end",
"def create\n @off_day = OffDay.new(off_day_params)\n\n respond_to do |format|\n if @off_day.save\n format.html { redirect_to @off_day, notice: 'Off day was successfully created.' }\n format.json { render :show, status: :created, location: @off_day }\n else\n format.html { render :new }\n format.json { render json: @off_day.errors, status: :unprocessable_entity }\n end\n end\n end",
"def missing_params(e)\n \trender json: { message: e.message }, status: :unprocessable_entity\n end",
"def exception_json(exception,code=500)\n render :json => Status::Errors.exception_json(exception, code).to_json, :status => code\n end",
"def create\n redirect_to event_attendance_entries_path(@event)\n # respond_to do |format|\n # if @attendance_entry.save\n # format.html { redirect_to event_attendance_entries_path(@attendance_entry.event), notice: 'Event attendance entry was successfully created.' }\n # format.json { render action: 'show', status: :created, location: @attendance_entry }\n # else\n # format.html { render action: 'new' }\n # format.json { render json: @attendance_entry.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def destroy\n @holiday_date.destroy\n respond_to do |format|\n format.html { redirect_to holiday_dates_url, notice: 'Holiday date was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @holiday.destroy\n respond_to do |format|\n format.html { redirect_to holidays_url }\n format.json { head :no_content }\n end\n end",
"def four_twenty_two(error)\n json_response(error.message, :unprocessable_entity)\n end",
"def four_ninety_eight(e)\n render json: { message: e.message }, status: :invalid_token_time\n end",
"def create\n @hk_public_holiday = HkPublicHoliday.new(params[:hk_public_holiday])\n\n respond_to do |format|\n if @hk_public_holiday.save\n format.html { redirect_to(@hk_public_holiday, :notice => 'Hk public holiday was successfully created.') }\n format.xml { render :xml => @hk_public_holiday, :status => :created, :location => @hk_public_holiday }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @hk_public_holiday.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def four_twenty_two(e)\n json_response({ message: e.message }, :unprocessable_entity)\n end",
"def four_twenty_two(e)\n json_response({ message: e.message }, :unprocessable_entity)\n end",
"def throw_error(error)\n render json: error, status: :bad_request\n end",
"def create\n @user = @current_user\n @excuse = @user.excuses.build(params[:excuse])\n @excuse.location = @user.location\n\n respond_to do |format|\n if @excuse.save\n format.html { redirect_to @excuse, notice: 'Excuse was successfully created.' }\n format.json { render json: @excuse, status: :created, location: @excuse }\n else\n format.html { render action: \"new\" }\n format.json { render json: @excuse.errors, status: :unprocessable_entity }\n end\n end\n end",
"def holiday_cannot_be_on_weekends\n if (self.date.strftime(\"%u\") == \"6\" or self.date.strftime(\"%u\") == \"7\")\n errors.add(:date, \"Holiday should not be on weekends\")\n end\n end",
"def postEntityOpening_times( entity_id, monday, tuesday, wednesday, thursday, friday, saturday, sunday, closed, closed_public_holidays)\n params = Hash.new\n params['entity_id'] = entity_id\n params['monday'] = monday\n params['tuesday'] = tuesday\n params['wednesday'] = wednesday\n params['thursday'] = thursday\n params['friday'] = friday\n params['saturday'] = saturday\n params['sunday'] = sunday\n params['closed'] = closed\n params['closed_public_holidays'] = closed_public_holidays\n return doCurl(\"post\",\"/entity/opening_times\",params)\n end",
"def create\n # Get user\n user = AuthorizeApiRequest.call(params).result\n #Find the event that they are try to mark as attending\n @event = Event.find(params[:event_id])\n #See if event exists and does not belong to this host and user is not already going to it\n if (@event && !user.event.exists?(params[:event_id]) && !@event.going.include?(user.id.to_s))\n #Save the person as going to the event \n if @event.going == nil\n @event.update!(going: [ user.id ] )\n render :attendance_event, status: :ok\n elsif @event.update!(going: @event.going.push(user.id ))\n render :attendance_event, status: :ok\n else\n render json: { status: 'error' }, status: :unprocessable_entity\n end\n else\n render json: { status: 'error' }, status: :unprocessable_entity\n end\n rescue ActiveRecord::RecordNotFound => e\n render json: {\n error: e.to_s\n }, status: :not_found\n end",
"def special_holiday_params\n params.require(:special_holiday).permit(:title, :description, :special_holiday_ctgr_id, :is_paid, :is_as_attended)\n end",
"def destroy\n @special_holiday.destroy\n respond_to do |format|\n format.html { redirect_to special_holidays_url, notice: 'Special holiday was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def bad_request(object)\n render json: object, status: 400\n end",
"def index\n @holidays = Holiday.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @holidays }\n end\n end",
"def four_ninety_eight(e)\n\t\tjson_response({ message: e.message}, :invalid_token)\n\tend"
] |
[
"0.6857052",
"0.66587925",
"0.64760387",
"0.6408504",
"0.62489325",
"0.6170495",
"0.6165304",
"0.61534625",
"0.6128376",
"0.59260494",
"0.59206617",
"0.5898576",
"0.58143544",
"0.5801346",
"0.5798304",
"0.5754728",
"0.5744671",
"0.5731647",
"0.5697546",
"0.5697295",
"0.5686211",
"0.5674492",
"0.5671647",
"0.5652213",
"0.56277287",
"0.5609926",
"0.55989695",
"0.5590289",
"0.5575281",
"0.555055",
"0.5547882",
"0.5541118",
"0.55383945",
"0.55087835",
"0.5492055",
"0.5490087",
"0.54900736",
"0.5483879",
"0.5468215",
"0.54511416",
"0.5449502",
"0.5444805",
"0.5438584",
"0.5419435",
"0.5414817",
"0.5412173",
"0.54119164",
"0.54092306",
"0.5404735",
"0.5404735",
"0.5404735",
"0.5404735",
"0.5403796",
"0.5400588",
"0.54004014",
"0.53904015",
"0.5380515",
"0.5367502",
"0.5365688",
"0.53631496",
"0.5352716",
"0.5340031",
"0.53392327",
"0.532947",
"0.5317743",
"0.5317743",
"0.5308218",
"0.53047687",
"0.5303466",
"0.53009146",
"0.529036",
"0.5285038",
"0.5283728",
"0.5272577",
"0.5261021",
"0.52594745",
"0.5252498",
"0.52482027",
"0.52397126",
"0.52342445",
"0.5233946",
"0.5230434",
"0.5225988",
"0.52160853",
"0.5211654",
"0.5209221",
"0.52076",
"0.52008855",
"0.520031",
"0.520031",
"0.51894516",
"0.5179463",
"0.5174569",
"0.5169578",
"0.5162658",
"0.5161133",
"0.5159626",
"0.51555306",
"0.5150594",
"0.51450455"
] |
0.6024993
|
9
|
PATCH/PUT /holiday_exceptions/1 PATCH/PUT /holiday_exceptions/1.json
|
def update
respond_to do |format|
begin
status = @holiday_exception.update(holiday_exception_params)
rescue => e
status = false
customer_holiday_ids = CustomersHoliday.where(customer_id: @holiday_exception.customer_id).pluck(:holiday_id)
@holidays = Holiday.where(global:true).or(Holiday.where(id: customer_holiday_ids))
logger.debug"UPDATE #{e.inspect} , STATUS #{status}"
end
if status
format.html { redirect_to edit_holiday_exception_path(@holiday_exception), notice: 'Holiday exception was successfully updated.' }
format.json { render :show, status: :ok, location: @holiday_exception }
else
format.html { render :edit }
format.json { render json: @holiday_exception.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n respond_to do |format|\n if @extra_holiday.update(extra_holiday_params)\n format.html { redirect_to @extra_holiday, notice: 'Extra holiday was successfully updated.' }\n format.json { render :show, status: :ok, location: @extra_holiday }\n else\n format.html { render :edit }\n format.json { render json: @extra_holiday.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @holiday.update_attributes(params[:holiday])\n format.html { redirect_to @holiday, notice: 'El Feriado fue Actualizado.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @holiday.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @special_holiday.update(special_holiday_params)\n format.html { redirect_to @special_holiday, notice: 'Special holiday was successfully updated.' }\n format.json { render :show, status: :ok, location: @special_holiday }\n else\n format.html { render :edit }\n format.json { render json: @special_holiday.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n begin\n @updated_holiday = @@data_util.strip_hash_data(params[:holiday])\n @updated_holiday[:lastupdateby] = session[:username].strip\n @updated_holiday[:holidaydate] = Date.strptime(@updated_holiday[:holidaydate], \"%m/%d/%Y\")\n @locals = JSON.parse params[:locals] unless params[:locals].nil? \n\n @holiday = Holiday.find(params[:id])\n if @holiday.update_attributes(@updated_holiday)\n unless @locals.empty?\n self.add_holiday_local(@locals,@holiday.id)\n end\n @@request_result[:success] = true\n @@request_result[:notice] = \"Holiday was successfully updated.\"\n else\n @@request_result[:errormsg] = @holiday.errors.full_messages[0]\n end\n rescue Exception => e\n @@request_result[:errormsg] = e.message\n end\n render json: @@request_result\n end",
"def update\n # model\n @holiday.update(holiday_params)\n\n if @holiday.valid?\n redirect_to @holiday\n else\n flash[:bad_job] = @holiday.errors.full_messages\n redirect_to \"/holidays/#{@holiday.id}/edit\"\n end\n\n # response\n end",
"def update\n respond_to do |format|\n if @activity_holiday.update(activity_holiday_params)\n format.html { redirect_to @activity_holiday, notice: 'Activity holiday was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity_holiday }\n else\n format.html { render :edit }\n format.json { render json: @activity_holiday.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @holiday_date.update(holiday_date_params)\n format.html { redirect_to @holiday_date, notice: 'Holiday date was successfully updated.' }\n format.json { render :show, status: :ok, location: @holiday_date }\n else\n format.html { render :edit }\n format.json { render json: @holiday_date.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_holiday_exception\n @holiday_exception = HolidayException.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @holiday.update(holiday_params)\n format.html { redirect_to holidays_url, notice: '成功更新.' }\n format.json { render :show, status: :ok, location: @holiday }\n else\n format.html { render :edit }\n format.json { render json: @holiday.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @holiday.update_attributes(params[:holiday])\n format.html { redirect_to holiday_path(@holiday),\n notice: 'Holiday is successfully updated' }\n else\n format.html { render \"edit\" }\n end\n end\n end",
"def update\n @holiday = Holiday.find(params[:id])\n \n respond_to do |format|\n if @holiday.update_attributes(params[:holiday])\n Workstream.register_user_action(@company.id, @current_user.id, request.remote_ip,\n \" holiday for #{@holiday.holiday} on date #{@holiday.holiday_date}\", \"updated\", @current_user.branch_id)\n format.html { redirect_to(@holiday, :notice => 'Holiday was successfully updated.') }\n # format.xml { head :ok }\n format.json { head :ok }\n else\n @menu = \"Organisation Settings\"\n @page_name = \"Manage Holiday\"\n format.html { render :action => \"edit\" }\n # format.xml { render :xml => @holiday.errors, :status => :unprocessable_entity }\n format.json { respond_with_bip(@holiday) }\n end\n end\n end",
"def update\n respond_to do |format|\n if @exception_date.update(exception_date_params)\n flash[:success] = 'Exception date was successfully updated.'\n format.html { redirect_to exception_dates_url }\n format.json { render :show, status: :ok, location: @exception_date }\n else\n format.html { render :edit }\n format.json { render json: @exception_date.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @claim_validation_exception = ClaimValidationException.find(params[:id])\n\n respond_to do |format|\n if @claim_validation_exception.update_attributes(params[:claim_validation_exception])\n format.html { redirect_to @claim_validation_exception, notice: 'Claim validation exception was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @claim_validation_exception.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @holidaytype = Holidaytype.find(params[:id])\n\n respond_to do |format|\n if @holidaytype.update_attributes(params[:holidaytype])\n format.html { redirect_to @holidaytype, notice: 'Holidaytype was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @holidaytype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @holidaytask.update(holidaytask_params)\n format.html { redirect_to @holidaytask, notice: 'Holidaytask was successfully updated.' }\n format.json { render :show, status: :ok, location: @holidaytask }\n else\n format.html { render :edit }\n format.json { render json: @holidaytask.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @daily_data_delivery_exception = DailyDataDeliveryException.find(params[:id])\n\n respond_to do |format|\n if @daily_data_delivery_exception.update_attributes(params[:daily_data_delivery_exception])\n format.html { redirect_to @daily_data_delivery_exception, notice: 'Daily data delivery exception was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @daily_data_delivery_exception.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @emergency = Emergency.find(@rescue.emergency_id)\n respond_to do |format|\n if @rescue.update(rescue_params)\n format.html { redirect_to @rescue, notice: 'La informacion del formulario de rescate fue actualizada con exito.' }\n format.json { render :show, status: :ok, location: @rescue }\n else\n format.html { render :edit }\n format.json { render json: @rescue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @except = Except.find(params[:id])\n\n respond_to do |format|\n if @except.update_attributes(params[:except])\n format.html { redirect_to @except, notice: 'Except was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @except.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n raise @calendar.inspect\n\n if @calendar.update(calendar_params)\n format.html { redirect_to @calendar, notice: 'Calendar was successfully updated.' }\n format.json { render :show, status: :ok, location: @calendar }\n else\n format.html { render :edit }\n format.json { render json: @calendar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n attendance_params[:checkout] = DateTime.parse(attendance_params[:checkout]) if attendance_params[:checkout].present?\n attendance_params[:attendance_date] = attendance_params[:attendance_date].to_date if attendance_params[:attendance_date].present?\n\n r = @api.update_attendance(params[:id], attendance_params)\n respond_to do |format|\n if r.code == 204\n format.html { redirect_to attendances_url, notice: 'Attendance was successfully updated.' }\n else\n response = JSON.parse(r.body)\n format.html { redirect_to attendances_url, alert: response['message']}\n end\n end\n \n end",
"def update\n respond_to do |format|\n if @throwable.update(throwable_params)\n format.html { redirect_to @throwable, notice: 'Throwable was successfully updated.' }\n format.json { render :show, status: :ok, location: @throwable }\n else\n format.html { render :edit }\n format.json { render json: @throwable.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @holiday.update(holiday_params)\n flash[:success] = \"Feiertag aktualisiert.\"\n redirect_to @holiday\n else\n render :edit \n end\n end",
"def update\n respond_to do |format|\n if @trace_exception.update(trace_exception_params)\n format.html { redirect_to @trace_exception, notice: 'Trace exception was successfully updated.' }\n format.json { render :show, status: :ok, location: @trace_exception }\n else\n format.html { render :edit }\n format.json { render json: @trace_exception.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @special_holiday_ctgr.update(special_holiday_ctgr_params)\n format.html { redirect_to @special_holiday_ctgr, notice: 'Special holiday ctgr was successfully updated.' }\n format.json { render :show, status: :ok, location: @special_holiday_ctgr }\n else\n format.html { render :edit }\n format.json { render json: @special_holiday_ctgr.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event_request = EventRequest.find(params[:id])\n\n respond_to do |format|\n if @event_request.update_attributes(params[:event_request])\n format.html { redirect_to @event_request, notice: 'Event request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @incident.update(incident_params)\n format.json { head :no_content }\n else\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.json { head :no_content }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @entry.update(entry_params)\n format.html { redirect_to @entry, notice: 'Your entry was successfully updated sir.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n # format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @excuse.update(excuse_params)\n redirect_to excuses_path(committee_id: @excuse.attendance_record.meeting.committee.id),\n notice: 'Excuse was successfully updated.'\n end",
"def update\n @flat_happening = FlatHappening.find(params[:id])\n\n if @flat_happening.update_attributes(params[:flat_happening])\n head :no_content\n else\n render json: @flat_happening.errors, status: :unprocessable_entity\n end\n end",
"def update\n begin\n @appointment = Appointment.find(params[:id])\n rescue\n respond_info('error', 'internal_server_error', 'Update Appointment Failed', :internal_server_error)\n return\n end\n if @appointment.update(appointment_params)\n render :json => @appointments, :status => :no_content #HTTP status code: 204 No Content\n else\n render json: @appointment.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @off_day.update(off_day_params)\n format.html { redirect_to @off_day, notice: 'Off day was successfully updated.' }\n format.json { render :show, status: :ok, location: @off_day }\n else\n format.html { render :edit }\n format.json { render json: @off_day.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @event.update(event_params)\n render json: @event, status: 201\n else\n render json: { message: \"Error. Error. Please try again.\"}, status: 400\n end\n end",
"def update\n # @event = Event.find(params[:id])\n\n if @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def update\n @hk_public_holiday = HkPublicHoliday.find(params[:id])\n\n respond_to do |format|\n if @hk_public_holiday.update_attributes(params[:hk_public_holiday])\n format.html { redirect_to(@hk_public_holiday, :notice => 'Hk public holiday was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @hk_public_holiday.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @holiday = Holiday.find(params[:id])\n if current_user.has_permission?(:holidays)\n @holiday.accessible = :all\n end\n\n respond_to do |format|\n if @holiday.update_attributes(params[:holiday])\n format.html { redirect_to [:admin, @holiday], :notice => \"Holiday was successfully updated.\" }\n else\n flash[:error] = \"Holiday was not updated.\"\n format.html { render active_admin_template(:edit) }\n end\n end\n end",
"def update\n respond_to do |format|\n if @attendance_entry.update(attendance_entry_params)\n format.html { redirect_to @attendance_entry, notice: 'Event attendance entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @attendance_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vacation_hours_event.update(vacation_hours_event_params)\n format.html { redirect_to vacation_hours_events_path, notice: 'Vacation hours event was successfully updated.' }\n format.json { render :show, status: :ok, location: @vacation_hours_event }\n else\n format.html { render :edit }\n format.json { render json: @vacation_hours_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def holiday_exception_params\n params.require(:holiday_exception).permit(:user_id, :project_id, :customer_id, :holiday_ids => [])\n end",
"def edit_resource(type, id, data)\n bad_attrs = data_includes_invalid_attrs(data)\n\n if bad_attrs.present?\n msg = \"Attribute(s) '#{bad_attrs}' should not be specified for updating a server resource\"\n raise BadRequestError, msg\n end\n\n super\n end",
"def update\n\tif @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def update\n @closing_day = ClosingDay.find(params[:id])\n\n respond_to do |format|\n if @closing_day.update_attributes(params[:closing_day])\n format.html { redirect_to @closing_day, notice: 'Closing day was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @closing_day.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @food_event.update(food_event_params)\n format.html { redirect_to @food_event, notice: 'Food event was successfully updated.' }\n format.json { render :show, status: :ok, location: @food_event }\n else\n format.html { render :edit }\n format.json { render json: @food_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def calendar_exceptions\n get '/gtfs/calendarDate'\n end",
"def update\n @event_interest = EventInterest.find(params[:id])\n\n respond_to do |format|\n if @event_interest.update_attributes(params[:event_interest])\n format.html { redirect_to @event_interest, notice: 'Event interest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event_interest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch_event\n user_id = params[\"user_id\"]\n group_id = params[\"group_id\"]\n event_id = params[\"event_id\"]\n\n #TODO Handle 404 if event not found\n event = Event.find(event_id)\n\n json_body = JSON.parse(request.body.read)\n\n @@event_service.patch_event(json_body, user_id, group_id, event_id)\n\n render status: :ok, text: \"\"\n end",
"def update\n if @item.update(item_params)\n render status: 201, :json => @item, :include =>[{:location =>{:except=>[:id, :created_at, :updated_at]}}, {:food =>{:except =>[:id, :created_at, :updated_at]}}], :except => [:created_at, :updated_at, :food_id, :location_id]\n else\n render status: 404, json: { message: @item.errors}.to_json\n end\n\n \n end",
"def update\n respond_to do |format|\n if @sick_hours_event.update(sick_hours_event_params)\n format.html { redirect_to sick_hours_events_path, notice: 'Sick hours event was successfully updated.' }\n format.json { render :show, status: :ok, location: @sick_hours_event }\n else\n format.html { render :edit }\n format.json { render json: @sick_hours_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @appointment_request = current_user.requests.find_by(\n id: params[:request_id]\n )\n\n if @appointment_request.present?\n render json: { appointment_request: @appointment_request, status: 200 }\n else\n render json: { status: 404, layout: false }, status: 404\n end\n end",
"def update\n @dayoff = Dayoff.find(params[:id])\n\n respond_to do |format|\n if @dayoff.update_attributes(params[:dayoff])\n format.html { redirect_to @dayoff, notice: 'Dayoff was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dayoff.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n @timezones = TimeZone.all\n @currencies = Money::Currency.table\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n if @event.cancelled\n format.html { redirect_to events_path, notice: t('flash.event.cancel.success') }\n else\n format.html { redirect_to events_path, notice: t('flash.event.update.success') }\n end\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @commission_fixing = CommissionFixing.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n render :json=>{:response=>\"The record can't be found\"}\n end",
"def update\n respond_to do |format|\n if @event_day.update(event_day_params)\n format.html { redirect_to events_path, notice: 'Event day was successfully updated.' }\n format.json { render :show, status: :ok, location: @event_day }\n else\n format.html { render :edit }\n format.json { render json: @event_day.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n if @event.update(params[:event])\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @base_event.update(base_event_params)\n format.json { head :no_content }\n else\n format.json { render json: @base_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @callout.update(callout_params)\n format.html { redirect_to @callout, notice: 'Callout was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @callout.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @employee = Employee.find_by_id(params[:id])\n @employee.update_attributes({:id => params[:id],\n :name => params[:name],\n :title => params[:title],\n :status => params[:status],\n :employment_type => params[:employment_type],\n :attendance_type_id => params[:attendance_type_id],\n :hourly_rate => params[:hourly_rate],\n :location => params[:location],\n :capitalizable_group_id => params[:capitalizable_group_id],\n :leave_days => params[:leave_days],\n :commencement_date => params[:commencement_date],\n :termination_date => params[:termination_date]})\n if request.xhr?\n render :json => @employee\n end\n end",
"def update\n @holidaymaster = Holidaymaster.find(params[:id])\n\n respond_to do |format|\n if @holidaymaster.update_attributes(params[:holidaymaster])\n format.html { redirect_to(@holidaymaster, :notice => 'Holidaymaster was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @holidaymaster.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @exception = args[:exception] if args.key?(:exception)\n @regular_hours = args[:regular_hours] if args.key?(:regular_hours)\n end",
"def update\n @event = Event.find(params[:id])\n\n if @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n if @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @employee_event.update(employee_event_params)\n format.html { redirect_to @employee_event, notice: 'Employee event was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee_event }\n else\n format.html { render :edit }\n format.json { render json: @employee_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n @event.update(status: \"Pending\")\n else\n @reopen = true\n format.json { render json: @event.errors, status: :unprocessable_entity }\n format.html { render :show }\n end\n end\n end",
"def update\n # raise params.to_s\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Работник обновлен.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @myevent = Myevent.find(params[:id])\n\n respond_to do |format|\n if @myevent.update_attributes(params[:myevent])\n format.html { redirect_to @myevent, notice: 'Myevent was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @myevent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: @employee_user.errors unless @employee_user.update(employee_user_params)\n end",
"def update\n respond_to do |format|\n if @lunch_event.update(lunch_event_params)\n format.html { redirect_to @lunch_event, notice: 'Lunch event was successfully updated.' }\n format.json { render :show, status: :ok, location: @lunch_event }\n else\n format.html { render :edit }\n format.json { render json: @lunch_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @rescue_time_chart.update(rescue_time_chart_params)\n format.html { redirect_to @rescue_time_chart, notice: 'Rescue time chart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rescue_time_chart.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event_requirement = EventRequirement.find(params[:id])\n\n if @event_requirement.update(event_requirement_params)\n head :no_content\n else\n render json: @event_requirement.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @financial_event.update(financial_event_params)\n format.html { redirect_to @financial_event, notice: 'Financial event was successfully updated.' }\n format.json { render :show, status: :ok, location: @financial_event }\n else\n format.html { render :edit }\n format.json { render json: @financial_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_with Expense.update(params[:id], expense_params), status: 204\n end",
"def calendar_service_exceptions(service_id)\n get \"/gtfs/calendarDate/serviceId/#{service_id}\"\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to dashboard_home_path }\n else\n format.html { render html: '500', status: :unprocessable_entity }\n end\n end\n end",
"def update\n @incident = Incident.find(params[:id])\n\n if @incident.update(incident_params)\n head :no_content\n else\n render json: @incident.errors, status: :unprocessable_entity\n end\n end",
"def update\n @instance_fault = InstanceFault.find(params[:id])\n\n respond_to do |format|\n if @instance_fault.update_attributes(params[:instance_fault])\n format.html { redirect_to @instance_fault, notice: 'Instance fault was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @instance_fault.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bad_date = BadDate.find(params[:id])\n\n respond_to do |format|\n if @bad_date.update_attributes(params[:bad_date])\n format.html { redirect_to @bad_date, :notice=> 'Bad date was successfully updated.' }\n\n else\n format.html { render :action=> \"edit\" }\n\n end\n end\n end",
"def update\n respond_to do |format|\n if @calender_event.update(calender_event_params)\n format.html { redirect_to @calender_event, notice: '予定を変更しました。' }\n format.json { render :show, status: :ok, location: @calender_event }\n else\n format.html { render :edit }\n format.json { render json: @calender_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @create_event = CreateEvent.find(params[:id])\n\n respond_to do |format|\n if @create_event.update_attributes(params[:create_event])\n format.html { redirect_to @create_event, notice: 'Create event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @create_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @service_fault.update(service_fault_params)\n format.html { redirect_to @service_fault, notice: 'Service fault was successfully updated.' }\n format.json { render :show, status: :ok, location: @service_fault }\n else\n format.html { render :edit }\n format.json { render json: @service_fault.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_body_with_exception(body, exception)\n body.merge(\n \"retries\" => body.fetch(\"retries\", 0) + 1,\n \"exceptions\" => Array(body[\"exceptions\"]) + [{\n 'exception' => exception.class.name,\n 'message' => exception.to_s,\n 'backtrace' => exception.backtrace\n }]\n )\n end",
"def update\n @outside_request = OutsideRequest.find(params[:id])\n\n respond_to do |format|\n if @outside_request.update_attributes(params[:outside_request])\n format.html { redirect_to @outside_request, notice: 'Outside request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \\\"edit\\\" }\n format.json { render json: @outside_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: \"l'évenement a bien été modifié.\" }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\nend",
"def update\n @calendar_event = CalendarEvent.find(params[:id])\n\n respond_to do |format|\n if @calendar_event.update_attributes(params[:calendar_event])\n format.html { redirect_to @calendar_event, notice: 'Calendar event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @calendar_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @attendance.flake!({reason: params[:attendance][:reason]})\n format.html { redirect_to profile_path, notice: 'Your spot is now open for someone else!' }\n format.json { render :show, status: :created, location: @tea_time }\n else\n format.html { redirect_to profile_path }\n format.json { render json: @attendance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event_recurrence.update(event_recurrence_params)\n format.html { redirect_to @event_recurrence, notice: 'Event recurrence was successfully updated.' }\n format.json { render :show, status: :ok, location: @event_recurrence }\n else\n format.html { render :edit }\n format.json { render json: @event_recurrence.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @dis_alcohol_interaction.update(dis_alcohol_interaction_params)\n format.html { redirect_to @dis_alcohol_interaction, notice: 'Dis alcohol interaction was successfully updated.' }\n format.json { render :show, status: :ok, location: @dis_alcohol_interaction }\n else\n format.html { render :edit }\n format.json { render json: @dis_alcohol_interaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @event.update(event_params(params))\n render json: @event, status: 200\n else\n render :json => @event.errors, :status => 422\n end\n end",
"def update\n respond_to do |format|\n if @female_discus_throw.update(female_discus_throw_params)\n format.html { redirect_to @female_discus_throw, notice: 'Female discus throw was successfully updated.' }\n format.json { render :show, status: :ok, location: @female_discus_throw }\n else\n format.html { render :edit }\n format.json { render json: @female_discus_throw.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n date_format = \"#{appointment_params[\"date(1i)\"]}-#{appointment_params[\"date(2i)\"]}-#{appointment_params[\"date(3i)\"]}\"\n @appointment = Appointment.new(type_appointment_id: appointment_params[:type_appointment_id], description: appointment_params[:description], date: date_format,\n user_id: appointment_params[:user_id], estate_id: appointment_params[:estate_id], doctor_id: appointment_params[:doctor_id])\n \n respond_to do |format|\n if @appointment.update\n format.html { redirect_to @appointment, notice: 'Appointment was successfully updated.' }\n format.json { render :show, status: :ok, location: @appointment }\n else\n format.html { render :edit }\n format.json { render json: @appointment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event_service.update_attributes(event_service_params)\n format.html { redirect_to @event_service, notice: 'Event service was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @everyday.update(everyday_params)\n format.html { redirect_to :back, notice: 'Everyday was successfully updated.' }\n format.json { render :show, status: :ok, location: :back }\n else\n format.html { render :edit }\n format.json { render json: @everyday.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @hive_event = HiveEvent.find(params[:id])\n\n respond_to do |format|\n if @hive_event.update_attributes(params[:hive_event])\n format.html { redirect_to @hive_event, notice: 'Hive event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hive_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contract_employee.update(contract_employee_params)\n format.html { redirect_to @contract_employee, notice: 'Contract employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @contract_employee }\n else\n format.html { render :edit }\n format.json { render json: @contract_employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n \n @event = Event.find(params[:id])\n\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: t(:event_updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n \n end\n end",
"def update\n respond_to do |format|\n if @elective_day.update(elective_day_params)\n format.html { redirect_to 'index', notice: 'Elective day was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @elective_day.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @day.update(day_params)\n format.html { redirect_to days_path, notice: 'Day was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @day.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @weather_event = WeatherEvent.find(params[:id])\n\n respond_to do |format|\n if @weather_event.update_attributes(params[:weather_event])\n format.html { redirect_to @weather_event, notice: 'Weather event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @weather_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n return forbidden unless user_is_owner\n return bad_request unless @event.update_attributes(event_params)\n render json: @event, status: :ok\n end",
"def update\n # @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @dis_generic_alcohol_interaction.update(dis_generic_alcohol_interaction_params)\n format.html { redirect_to @dis_generic_alcohol_interaction, notice: 'Dis generic alcohol interaction was successfully updated.' }\n format.json { render :show, status: :ok, location: @dis_generic_alcohol_interaction }\n else\n format.html { render :edit }\n format.json { render json: @dis_generic_alcohol_interaction.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.66124696",
"0.6513476",
"0.6476268",
"0.63946867",
"0.6384276",
"0.6287663",
"0.6247102",
"0.61614746",
"0.6155098",
"0.6103232",
"0.6100695",
"0.60963273",
"0.6084834",
"0.6074538",
"0.58965045",
"0.5814902",
"0.58013284",
"0.57657105",
"0.5750159",
"0.5733447",
"0.5732978",
"0.5728881",
"0.5687808",
"0.5677984",
"0.5674492",
"0.5667681",
"0.5655493",
"0.564272",
"0.5641638",
"0.5640509",
"0.56329775",
"0.5621355",
"0.56203705",
"0.5611551",
"0.5604844",
"0.5604053",
"0.5603949",
"0.55864596",
"0.5585771",
"0.5580808",
"0.5576611",
"0.5568072",
"0.5559058",
"0.5558919",
"0.5554101",
"0.5547471",
"0.5540722",
"0.55402017",
"0.55401045",
"0.55379444",
"0.55303746",
"0.55166954",
"0.5508476",
"0.54983526",
"0.5491919",
"0.548926",
"0.5487691",
"0.5477983",
"0.547443",
"0.5468901",
"0.5468901",
"0.5468148",
"0.54665107",
"0.5458569",
"0.54585236",
"0.5455724",
"0.5449091",
"0.54472226",
"0.54387546",
"0.54364336",
"0.54349107",
"0.5430156",
"0.54232085",
"0.542261",
"0.54213214",
"0.54185414",
"0.5418265",
"0.54177076",
"0.5416709",
"0.5408728",
"0.5407227",
"0.54065466",
"0.5403136",
"0.53989404",
"0.5396868",
"0.5395655",
"0.5392615",
"0.5391494",
"0.53897136",
"0.53874606",
"0.538615",
"0.5383662",
"0.5382625",
"0.5377768",
"0.53771776",
"0.5371002",
"0.5370665",
"0.53699857",
"0.5361761",
"0.53605574"
] |
0.72125435
|
0
|
DELETE /holiday_exceptions/1 DELETE /holiday_exceptions/1.json
|
def destroy
@holiday_exception.destroy
respond_to do |format|
format.html { redirect_to projects_url, notice: 'Holiday exception was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @holiday.destroy\n respond_to do |format|\n format.html { redirect_to holidays_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @extra_holiday.destroy\n respond_to do |format|\n format.html { redirect_to extra_holidays_url, notice: 'Extra holiday was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n begin\n @holiday = Holiday.find(params[:id])\n if @holiday.destroy\n @@request_result = {success:true, notice: 'Operation ended successfully.'}\n else\n @@request_result[:errormsg] = @holiday.errors.full_messages[0]\n end\n rescue Exception => e \n @@request_result[:errormsg] = e.message\n end\n render json: @@request_result\n end",
"def destroy\n @holiday.destroy\n\n respond_to do |format|\n format.html { redirect_to holidays_url, notice: 'El Feriado fue Eliminado.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @holiday.destroy\n respond_to do |format|\n format.html { redirect_to holidays_url, notice: '成功删除.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @special_holiday.destroy\n respond_to do |format|\n format.html { redirect_to special_holidays_url, notice: 'Special holiday was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @holidaytype = Holidaytype.find(params[:id])\n @holidaytype.destroy\n\n respond_to do |format|\n format.html { redirect_to holidaytypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @holiday_date.destroy\n respond_to do |format|\n format.html { redirect_to holiday_dates_url, notice: 'Holiday date was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity_holiday.destroy\n respond_to do |format|\n format.html { redirect_to activity_holidays_url, notice: 'Activity holiday was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @holiday = Holiday.find(params[:id])\n @holiday.destroy\n\n respond_to do |format|\n format.html { redirect_to(:back) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @daily_data_delivery_exception = DailyDataDeliveryException.find(params[:id])\n @daily_data_delivery_exception.destroy\n\n respond_to do |format|\n format.html { redirect_to daily_data_delivery_exceptions_url }\n format.json { head :no_content }\n end\n end",
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end",
"def destroy\n @excuse = Excuse.find(params[:id])\n @excuse.destroy\n\n respond_to do |format|\n format.html { redirect_to excuses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hk_public_holiday = HkPublicHoliday.find(params[:id])\n @hk_public_holiday.destroy\n\n respond_to do |format|\n format.html { redirect_to(hk_public_holidays_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @holidaytask.destroy\n respond_to do |format|\n format.html { redirect_to holidaytasks_url, notice: 'Holidaytask was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @daily_happiness.destroy\n respond_to do |format|\n format.html { redirect_to daily_happinesses_url, notice: 'Daily happiness was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @special_holiday_ctgr.destroy\n respond_to do |format|\n format.html { redirect_to special_holiday_ctgrs_url, notice: 'Special holiday ctgr was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def incident_delete(statuspage_id, incident_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['incident_id'] = incident_id\n\n request :method => :post,\n :url => @url + 'incident/delete',\n :payload => data\n end",
"def destroy\n @hospitalization_day.destroy\n respond_to do |format|\n format.html { redirect_to hospitalization_days_url, notice: 'Día de estancia eliminado satisfactoriamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @holiday = Holiday.find(params[:id])\n @holiday.destroy\n Workstream.register_user_action(@company.id, @current_user.id, request.remote_ip,\n \" holiday for #{@holiday.holiday} on date #{@holiday.holiday_date} is marked as deleted\", \"deleted\", @current_user.branch_id)\n respond_to do |format|\n format.html { redirect_to(settings_payroll_path, :notice => \"Holiday has been successfully deleted\" ) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @dayoff = Dayoff.find(params[:id])\n @dayoff.destroy\n\n respond_to do |format|\n format.html { redirect_to dayoffs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @off_day.destroy\n respond_to do |format|\n format.html { redirect_to off_days_url, notice: 'Off day was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @holiday = Holiday.find_by_id(params[:id])\n @holiday.destroy\n flash[:notice] = 'Holiday is successfully deleted.'\n redirect_to action: 'index'\n end",
"def destroy\n @exception_date.destroy\n respond_to do |format|\n flash[:success] = 'Exception date was successfully destroyed.'\n format.html { redirect_to exception_dates_url}\n format.json { head :no_content }\n end\n end",
"def destroy\n @holidaymaster = Holidaymaster.find(params[:id])\n @holidaymaster.destroy\n\n respond_to do |format|\n format.html { redirect_to(holidaymasters_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @attendance_entry.destroy\n respond_to do |format|\n format.html { redirect_to event_attendance_entries_path(@attendance_entry.event) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @closing_day = ClosingDay.find(params[:id])\n @closing_day.destroy\n\n respond_to do |format|\n format.html { redirect_to closing_days_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @claim_validation_exception = ClaimValidationException.find(params[:id])\n @claim_validation_exception.destroy\n\n respond_to do |format|\n format.html { redirect_to claim_validation_exceptions_url }\n format.json { head :ok }\n end\n end",
"def cfa_delete\n Rails.logger.info_log.info \" I,[#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S %Z\")}]\" \"INFO -- : Entered in cfa titles cfa_delete method\"\n begin\n id=params[\"format\"] \n cfa=RestClient.delete $api_service+'/cfa_titles/'+id\n rescue =>e\n Rails.logger.custom_log.error { \"#{e} Cfa controller delete method\" }\n end\n redirect_to action: \"index\"\n end",
"def destroy\n @except = Except.find(params[:id])\n @except.destroy\n\n respond_to do |format|\n format.html { redirect_to excepts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_expense.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_expenses_url, notice: 'Expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @day.destroy\n respond_to do |format|\n format.html { redirect_to days_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @elective_day.destroy\n respond_to do |format|\n format.html { redirect_to elective_days_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event_date.destroy\n respond_to do |format|\n format.html { redirect_to event_dates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n event = @event_day.destroy\n @event_day.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Event day was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @date_infected.destroy\n respond_to do |format|\n format.html { redirect_to date_infecteds_url, notice: 'Date infected was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rescue_time_chart.destroy\n respond_to do |format|\n format.html { redirect_to rescue_time_charts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @start_female_discus_throw.destroy\n respond_to do |format|\n format.html { redirect_to start_female_discus_throws_url, notice: 'Start female discus throw was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @female_discus_throw.destroy\n respond_to do |format|\n format.html { redirect_to female_discus_throws_url, notice: 'Female discus throw was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sunday.destroy\n respond_to do |format|\n format.html { redirect_to sundays_url, notice: 'Sunday was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event_interest = EventInterest.find(params[:id])\n @event_interest.destroy\n\n respond_to do |format|\n format.html { redirect_to event_interests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sick_hours_event.destroy\n respond_to do |format|\n format.html { redirect_to sick_hours_events_url, notice: 'Sick hours event was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@incidentcategory.destroy\n render json: {}, status: 200\n end",
"def destroy\n r = @api.destroy_attendance(params[:id])\n respond_to do |format|\n if r.code == 204\n format.html { redirect_to attendances_url, notice: 'Attendance was successfully destroy.' }\n else\n response = JSON.parse(r.body)\n format.html { redirect_to attendances_url, alert: response['message']}\n end\n end\n end",
"def destroy\n @important_date.destroy\n respond_to do |format|\n format.html { redirect_to important_dates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @theory_day.destroy\n respond_to do |format|\n format.html { redirect_to theory_days_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @date_request.destroy\n respond_to do |format|\n format.html { redirect_to date_requests_url, notice: \"Date request was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event_attendance = EventAttendance.find(params[:id])\n @event_attendance.destroy\n\n respond_to do |format|\n format.html { redirect_to event_attendances_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @daily_exercise = DailyExercise.find(params[:id])\n @daily_exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to daily_exercises_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @weekday = Weekday.find(params[:id])\n @weekday.destroy\n\n respond_to do |format|\n format.html { redirect_to weekdays_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @weather_event = WeatherEvent.find(params[:id])\n @weather_event.destroy\n\n respond_to do |format|\n format.html { redirect_to weather_events_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vacation_hours_event.destroy\n respond_to do |format|\n format.html { redirect_to vacation_hours_events_url, notice: 'Vacation hours event was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @food_event.destroy\n respond_to do |format|\n format.html { redirect_to food_events_url, notice: 'Food event was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @diary_entry.destroy\n respond_to do |format|\n format.html { redirect_to diary_entries_url, notice: 'Dagbogsnotatet er slettet' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @incident.destroy\n respond_to do |format|\n format.html { redirect_to incidents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @incident.destroy\n respond_to do |format|\n format.html { redirect_to incidents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @calificacione = Calificacione.find(params[:id])\n @calificacione.destroy\n\n respond_to do |format|\n format.html { redirect_to calificaciones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @violation.destroy\n respond_to do |format|\n format.html { redirect_to violations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event_request = EventRequest.find(params[:id])\n @event_request.destroy\n\n respond_to do |format|\n format.html { redirect_to event_requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @daytime = Daytime.find(params[:id])\n @daytime.destroy\n\n respond_to do |format|\n format.html { redirect_to daytimes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @emergency = Emergency.find(@rescue.emergency_id)\n @rescue.destroy\n respond_to do |format|\n format.html { redirect_to formularios_path(@emergency), notice: 'Rescue was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @default_line_calendar.destroy\n respond_to do |format|\n format.html { redirect_to default_line_calendars_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @economic.destroy\n respond_to do |format|\n format.html { redirect_to economics_url, notice: 'Economic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @holiday_song_period = HolidaySongPeriod.find(params[:id])\n @holiday_song_period.destroy\n\n respond_to do |format|\n format.html { redirect_to holiday_song_periods_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @day = Day.find(params[:id])\n @day.destroy\n\n respond_to do |format|\n format.html { redirect_to days_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @adverse_event.destroy\n respond_to do |format|\n format.html { redirect_to adverse_events_url, notice: 'Evento adverso eliminado satisfactoriamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hive_event = HiveEvent.find(params[:id])\n @hive_event.destroy\n\n respond_to do |format|\n format.html { redirect_to hive_events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @financial_event.destroy\n respond_to do |format|\n format.html { redirect_to financial_events_url, notice: 'Financial event was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_of_business = LineOfBusiness.find(params[:id])\n @line_of_business.destroy\n\n respond_to do |format|\n format.html { redirect_to(line_of_businesses_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end",
"def destroy\n @diary_entry.destroy\n respond_to do |format|\n format.html { redirect_to diary_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @business_hour.destroy\n respond_to do |format|\n format.html { redirect_to business_hours_url, notice: 'Business hour was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @everyday.destroy\n respond_to do |format|\n format.html { redirect_to everydays_url, notice: 'Everyday was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_event\r\n event = Event.find_by(id: params[:eventid].to_i)\r\n if event.present?\r\n event.update(status: 3)\r\n lt_update_event_status event, 'archived'\r\n render json: SuccessResponse.new(\r\n code: 200,\r\n message: 'Event Deleted.'\r\n ), adapter: :json, status: :ok\r\n else\r\n render json: ErrorResponse.new(\r\n code: 404,\r\n message: 'Event not found!'\r\n ), adapter: :json, status: :not_found\r\n end\r\n\r\n end",
"def destroy\n @holiday.destroy\n flash[:success] = \"Feiertag gelöscht.\"\n redirect_to holidays_url\n end",
"def destroy\n @event_typology.destroy\n respond_to do |format|\n format.html { redirect_to event_typologies_url, notice: 'La tipologia è stata cancellata correttamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @employee_events = EmployeeEvent.with_deleted.find(params[:id])\n if params[:type]=='normal'\n @employee_event.delete\n elsif params[:type]=='restore'\n @employee_event.restore\n @employee_event.update(deleted_at: nil)\n end\n\n @employee_event.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Host was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @investigated.destroy\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @occasion = Occasion.find(params[:id])\n @occasion.destroy\n\n respond_to do |format|\n format.html { redirect_to occasions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gifday.destroy\n respond_to do |format|\n format.html { redirect_to gifdays_url, notice: 'Gifday was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entrada_inventario = EntradaInventario.find(params[:id])\n @entrada_inventario.destroy\n\n respond_to do |format|\n format.html { redirect_to entrada_inventarios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @calender_event.destroy\n respond_to do |format|\n format.html { redirect_to calender_events_url, notice: '予定を削除しました。' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @daily_horoscope = DailyHoroscope.find(params[:id])\n @daily_horoscope.destroy\n\n respond_to do |format|\n format.html { redirect_to daily_horoscopes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @day_week.destroy\n respond_to do |format|\n format.html { redirect_to day_weeks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @economic = Economic.find(params[:id])\n @economic.destroy\n\n respond_to do |format|\n format.html { redirect_to(economics_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @income_entry = IncomeEntry.find(params[:id])\n @income_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to income_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dis_alcohol_interaction.destroy\n respond_to do |format|\n format.html { redirect_to dis_alcohol_interactions_url, notice: 'Dis alcohol interaction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @maintenance_event.destroy\n notify_user(:notice, \"The service record was successfully removed.\")\n respond_to do |format|\n format.html { redirect_to inventory_maintenance_events_url(@asset) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @periodic.destroy\n respond_to do |format|\n format.html { redirect_to periodics_url, notice: 'Periódico excluido com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n# @event_indicator_relationship = EventIndicatorRelationship.find(params[:id])\n# @event_indicator_relationship.destroy\n\n\t\tmsg = I18n.t('app.msgs.success_deleted', :obj => I18n.t('app.common.event_custom_view'))\n\t\tsend_status_update(I18n.t('app.msgs.cache_cleared', :action => msg))\n respond_to do |format|\n format.html { redirect_to admin_event_indicator_relationships_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @throw_head2.destroy\n respond_to do |format|\n format.html { redirect_back(fallback_location: root_path, notice: 'Eliminado exitosamente' ) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_of_day.destroy\n respond_to do |format|\n format.html { redirect_to time_of_days_url, notice: 'Time of day was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @socioeconomic.destroy\n respond_to do |format|\n format.html { redirect_to socioeconomics_url, notice: 'Socioeconomic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @calificacion = Calificacion.find(params[:id])\n @calificacion.destroy\n\n respond_to do |format|\n format.html { redirect_to calificaciones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @calificacion = Calificacion.find(params[:id])\n @calificacion.destroy\n\n respond_to do |format|\n format.html { redirect_to calificaciones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @biodatum.destroy\n respond_to do |format|\n format.html { redirect_to biodata_url, notice: \"Biodatum was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @incident = Incident.find(params[:id])\n @incident.destroy\n\n respond_to do |format|\n format.html { redirect_to incidents_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.7002371",
"0.68797535",
"0.6859485",
"0.6815075",
"0.6803325",
"0.67865103",
"0.6731",
"0.6698058",
"0.6689843",
"0.6626396",
"0.66021675",
"0.6595427",
"0.6402482",
"0.63887775",
"0.6379769",
"0.63430214",
"0.63414776",
"0.63273454",
"0.6326809",
"0.63128775",
"0.6305207",
"0.63016397",
"0.6287082",
"0.6281669",
"0.62798595",
"0.6279806",
"0.6265776",
"0.6260164",
"0.6252799",
"0.62420034",
"0.62334156",
"0.6220661",
"0.6204093",
"0.6191089",
"0.61890644",
"0.61833876",
"0.6175434",
"0.6169035",
"0.61628735",
"0.61576945",
"0.6153518",
"0.61514026",
"0.6148048",
"0.61406404",
"0.61382574",
"0.6137804",
"0.6129852",
"0.61291194",
"0.61234397",
"0.61112386",
"0.61077094",
"0.6106828",
"0.6100651",
"0.60981107",
"0.6094788",
"0.60914",
"0.60914",
"0.60901934",
"0.6089562",
"0.6082631",
"0.60787886",
"0.60773355",
"0.6074908",
"0.6068917",
"0.6066744",
"0.60667247",
"0.60605925",
"0.6060147",
"0.6057929",
"0.60565656",
"0.60527563",
"0.6047837",
"0.6042823",
"0.603945",
"0.60394007",
"0.6036635",
"0.60341537",
"0.6029677",
"0.60284275",
"0.60284275",
"0.60284275",
"0.60279423",
"0.60243124",
"0.60241985",
"0.6015795",
"0.6014954",
"0.60143614",
"0.6010174",
"0.60063916",
"0.60047305",
"0.6001253",
"0.6000339",
"0.59998834",
"0.59992605",
"0.5997439",
"0.59972185",
"0.59941614",
"0.59941614",
"0.5992935",
"0.59923685"
] |
0.7129668
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_holiday_exception
@holiday_exception = HolidayException.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup_handler\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def before_dispatch(env); end",
"def process_action(...)\n send_action(...)\n end",
"def setup\n # override and do something appropriate\n end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def action\n end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def config(action, *args); end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def before_action \n end",
"def action\n end",
"def setup\n # override this if needed\n end",
"def matt_custom_action_begin(label); end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def setup_signals; end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def lookup_action; end",
"def around_hooks; end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def save_action; end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def action_target()\n \n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def setup(&blk)\n @setup_block = blk\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def callback_phase\n super\n end",
"def advice\n end",
"def call\n setup_context\n super\n end",
"def _handle_action_missing(*args); end",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend",
"def duas1(action)\n action.call\n action.call\nend"
] |
[
"0.6162554",
"0.60452986",
"0.5945278",
"0.59169763",
"0.58877826",
"0.5834763",
"0.5775349",
"0.5704972",
"0.5704972",
"0.56543803",
"0.5621491",
"0.5427202",
"0.54093206",
"0.54093206",
"0.54093206",
"0.53975695",
"0.53776276",
"0.53562194",
"0.5340594",
"0.5337824",
"0.5328757",
"0.5310255",
"0.5300339",
"0.5298796",
"0.5295774",
"0.5256034",
"0.5243039",
"0.5236007",
"0.5235239",
"0.5235239",
"0.5235239",
"0.5235239",
"0.5235239",
"0.52321917",
"0.5227032",
"0.52216744",
"0.5216349",
"0.52161187",
"0.5210265",
"0.5207244",
"0.5177388",
"0.5177142",
"0.51747334",
"0.516293",
"0.51629275",
"0.5155534",
"0.51540613",
"0.515197",
"0.5151636",
"0.5145279",
"0.51380795",
"0.5135777",
"0.5117378",
"0.5115066",
"0.5115066",
"0.5110235",
"0.5106418",
"0.50917816",
"0.50909185",
"0.50855017",
"0.5082105",
"0.506359",
"0.5055345",
"0.50546116",
"0.50523037",
"0.50523037",
"0.50327307",
"0.5024364",
"0.5021113",
"0.50174654",
"0.50163317",
"0.5000553",
"0.50002855",
"0.49991882",
"0.49905527",
"0.49905527",
"0.49849054",
"0.4982546",
"0.4980941",
"0.4979153",
"0.49693102",
"0.4967172",
"0.49594432",
"0.49564302",
"0.49552485",
"0.49533385",
"0.49506924",
"0.49452737",
"0.49442786",
"0.49347955",
"0.49341312",
"0.49295264",
"0.49261844",
"0.4925649",
"0.49251428",
"0.4920729",
"0.49177617",
"0.4916373",
"0.49158472",
"0.4915794",
"0.49156648"
] |
0.0
|
-1
|
Never trust parameters from the scary internet, only allow the white list through.
|
def holiday_exception_params
params.require(:holiday_exception).permit(:user_id, :project_id, :customer_id, :holiday_ids => [])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] |
0.0
|
-1
|
num The roof of the faqtorial. sum The sum of the faqtorial. Examples faq(5) => 120 Returns the sum of the faq
|
def faq(num)
i = 1
sum = 1
while i <= num
sum = sum * i
i = i + 1
end
return sum
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def sum(n)\n end",
"def summation(num)\r\n puts 1.upto(num).reduce(0, :+)\r\nend",
"def sum(num, total) => total += num",
"def total\n # Each square has 1 << (n-1) grains of rice, one more than all squares\n # before it combined. The total number of grains on a chess board can\n # thus be calculated by subtracting one from the number of grains on a\n # theoretical 65th square.\n square(65)-1\n end",
"def sum; end",
"def sum_of_amicable_numbers(n)\r\n amicable_numbers(n).reduce(:+)\r\nend",
"def total_score\n\t\tall_scores = picks.collect { |pick|\n\t\t\tpicks_golfers = TournamentGolfer.where(golfer_id: pick.golfer_id, tournament_id: pick.pool.tournament_id).pluck(:total)[0]\n\t\t} - [nil] - [\"CUT\"]\n\t\tif all_scores.count < 5\n\t\t\treturn \"DQ\"\n\t\telse \n\t\t\tall_scores = all_scores.map {|score| score.to_i}\n\t\t\tall_scores = all_scores.sort\n\t\t\treturn all_scores[0..(pool.number_golfers_for_scoring-1)].sum\n\t\tend\n\tend",
"def sum(n=16) end",
"def square_of_sum\n\t\t@n**2*(@n+1)**2/4\n\tend",
"def SimpleAdding(num\n total = 1.upto(num).reduce(&:+)\n total \nend",
"def summation(num)\n (1..num).reduce(:+)\nend",
"def aliquot_sum(num)\n return 0 if num <= 1\n factors = []\n (1...num).each do |n|\n factors << n if num % n == 0\n end\n factors.reduce(:+)\nend",
"def sums num\n\tsum_of_squares = 0\n\tsum = 0\n\t1.upto num do |n|\n\t\tsum_of_squares += n*n\n\t\tsum += n\n\tend\n\tsum**2 - sum_of_squares \nend",
"def fizzbuzzsum(n)\n (3...n).select{ |i| i % 3 == 0 || i % 5 == 0 }.reduce(&:+)\nend",
"def total(num)\n\tsum = num.inject {|x,y| x + y }\n\treturn sum\nend",
"def sum_nums(num)\n\t\n\tnumbers = []\n\tnum_sum = num\n\t\nuntil numbers.length == num_sum\n\tnumbers.push(num)\n\tnum = num - 1\nend\n return\tnumbers.inject(:+)\nend",
"def sum\n reduce(0, &:+)\n end",
"def suma(num)\n\t\ttotal =0\n\t\t((num*2).to_s.chars.map(&:to_i)).each{|x| total+=x}\n\t\treturn total\n\tend",
"def problem_six\n (1.upto(100).reduce(:+)) ** 2 - (1.upto(100).map { |n| n ** 2 }).reduce { |sum, n| sum + n }\n end",
"def total(num)\n\tnum.inject {|x,y| x + y }\nend",
"def adding(num)\n\tsum = 0\n\t(1..num).each do |x|\n\t\tsum += x\n\tend\n\treturn sum\nend",
"def total_score\n\t\t0 + score_one.to_i + score_two.to_i + score_three.to_i + score_four.to_i\n\tend",
"def sum_of_fifth n\r\n n.to_s.split(\"\").map! {|i| (i.to_i)**5}.inject(:+)\r\nend",
"def total\n (1..64).reduce { |sum, space_number| sum + square(space_number) }\n end",
"def sum(n)\n result = 0\n n.each do |number|\n result = result + number\n end\n return result\n end",
"def sum_of_squares\n return @n * (@n + 1) * (2 * @n + 1) / 6\n end",
"def total\n squares = (1..64).map{|i| square(i)}\n squares.inject(:+)\n end",
"def sum\n numbers_array = @max.select do |num|\n num % 3 == 0 || num % 5 == 0\n end\n sum = numbers_array.reduce(:+)\n\n end",
"def six\n square_of_sum(100) - sum_of_squares(100)\nend",
"def compute_sum(number)\n (1..number).reduce(:+)\nend",
"def sum(numbers)\r\n numbers.reduce(0, :+)\r\nend",
"def sum(num)\n p num.to_s.chars.tally.keys.map(&:to_i).reduce(:+)\nend",
"def sum_up_to_squared n=100\r\n (2 * n + 1) * (n + 1) * n / 6\r\nend",
"def sum_recursive(num)\n # can also compute sum with symbol (1..5).inject(:+)\n (1..num).inject { |sum, n| sum + n }\nend",
"def total\n # Each square has 1 << (n-1) grains of rice. In the binary representation\n # square one therefore has bit 1 set, square two bit 2 and so on. If we sum\n # all squares up, we end up with a number in whose binary representation\n # bits 1 through 64 are set.\n 0xFFFFFFFFFFFFFFFF\n end",
"def sum(numbers)\n numbers.reduce(&:+)\n end",
"def summation(num)\n sum = (0..num).inject(:+)\n return sum\nend",
"def total\n (1..64).inject {|sum, num| sum + square(num)}\n end",
"def problem1(num)\n (1..num-1).select{|a| a%3 ==0 or a%5==0}.reduce(:+)\nend",
"def sum(number)\n n = number\n array = []\n answer = []\n while n > 1 do\n array << (n -= 1)\n end\n num = array.reduce(:*)\n num.to_s.split(\"\").each do |i|\n answer << i.to_i\n end\n return answer.reduce(:+)\nend",
"def square_of_sums\n sum=((@num**2+@num)/2)**2\n end",
"def sum roll\n roll.reduce &:+\n end",
"def sum n\n\tbegin\n\tn.reduce(:+)\n\trescue \n\t\tn.map!{|x| x.is_a?(Array) ? x.reduce(:+) : x }\n\t\tsum n\n\tend\n\tp n.reduce(:+)\nend",
"def sumOf(n)\n i = 0\n multiples = []\n while i < n do\n if i % 3 == 0 || i % 5 == 0\n multiples.push(i)\n end\n i += 1\n end\n multiples.inspect\n multiples.reduce(:+)\nend",
"def sum_nums(max) # Defines method\n\n\ti = 1 # i starts at one because thats where the numbers start\n\tsum = 0 # sum starts at zero because we increment += 1 into sum\n\n\twhile i <= max # i has to be <= max cause we are adding up to max\n\t\t\n\t\tsum += i # sum increments by i; first time is one, second time is two\n\t\ti += 1 # here we set the rate of which i increments at, we do this after += i because if we did it before we would get an entirely different result and our aim is to return 10 and 15\n\tend # end while loop\n\treturn sum # return sum here and not in while loop because it exits method after return\nend",
"def total(num)\n sum = 0\n num.each do |int|\n sum = sum + int\n end\n return sum\nend",
"def rFact(num)\n\tif num == 0 or num == 1\n\t\treturn 1\n\telse\n\t\treturn rFact(num -1) * num\n\tend\nend",
"def sum_to(n)\n n > 1 ? n + sum_to(n - 1) : n < 1 ? [].first : 1\n end",
"def sumList(num)\n\tnum.inject(:+)\nend",
"def rec_sum(nums)\n\nend",
"def rec_sum(nums)\n\nend",
"def total(numbers)\n\tnumbers.inject(:+)\nend",
"def compute_sum_r(num1,num2)\n num2>0 ? compute_sum(num1+1,num2-1) : num1\n end",
"def total\n (1..64).inject {|sum, square| sum + square(square)}\n end",
"def SimpleAdding(num)\n\ti = 0\n\ttotal = 0\n\twhile i <= num\n\t\ttotal += i\n\t\ti += 1\n\tend\n\tprint total\nend",
"def addition(number)\n (1..number).reduce(:+)\nend",
"def sum_num(first_num, last_num)\n # Your code goes here\n sum = 0\n first_num = first_num - 1\n num_count = (last_num - first_num)\n num_count.times do\n first_num += 1\n sum += first_num \n end\n return sum\nend",
"def total(numbers)\n numbers.reduce(:+)\nend",
"def sum_nums(num)\n (1..num).inject(&:+)\nend",
"def total(numbers)\n return numbers.reduce(:+)\nend",
"def add_up(num)\n\tsum = 0;\n\t(1..num).each { |x| sum += x }\n\tsum\nend",
"def sum(number, other)\n number + other\n end",
"def sum(num)\n digits = []\n sum = 0\n digits = num.digits\n sum = digits.sum\n return sum\nend",
"def sum_of_n_numbers()\n\tsum=0\n\ta=gets.chomp.to_i\n#\tputs a\n\tfor i in 1 .. a\n\t\tsum=sum+gets.chomp.to_i\n\tend\n\tputs sum\nend",
"def aliquot_sum(num)\n proper_factors(num).sum\nend",
"def sum(num)\n digits = num.to_s.chars.map(&:to_i) # Get an array of ints\n digits.reduce(:+) # Return sum of digits\nend",
"def total(num)\n sum = 0\n num.each do |x|\n sum = sum + x\n end\n return sum\nend",
"def square_of_sums\n return (@n * (@n + 1) / 2)**2\n end",
"def total(nums)\n nums.inject(:+)\nend",
"def sum\n inject(0) { |acc, i| acc + i }\n end",
"def calevensum\n @total = 0\n @i = 0\n \n while true\n @num = fib(@i)\n @i += 1;\n \n if @num < @max\n if @num % 2 == 0\n @total += @num\n end\n else\n break\n end\n end\n \n puts \"Sum = #{@total}!\"\n end",
"def SimpleAdding(num)\nsum=0\n 1.upto(num) do |x|\n\tsum+=x\n\tend\n\t\nreturn sum\nend",
"def sumar()\n\t\tnumeroUno = 1\n\t\tnumeroDos = 3\n\t\tputs \"-------------------\"\n\t\tputs numeroUno + numeroDos\n\tend",
"def fibs_sum(n)\n\nend",
"def fibs_sum(n)\n\nend",
"def fibs_sum(n)\n\nend",
"def fibs_sum(n)\n\nend",
"def fibs_sum(n)\n\nend",
"def sum(num)\n num.to_s.chars.map(&:to_i).reduce(:+)\nend",
"def sum(num)\n num.to_s.chars.map(&:to_i).reduce(:+)\nend",
"def sum_to(n)\n (1..n).reduce(0) do |sum, value|\n sum + value\n end\nend",
"def subScore(n)\n subTotal=0\n case \n when n==0 #first place\n subTotal = subTotal + 15\n when n==1 #second place \n subTotal = subTotal + 10\n when n==2 #3rd place \n subTotal = subTotal + 5 \n when n==3 #4th place\n subTotal = subTotal + 3\n when n==4 #5th place\n subTotal = subTotal + 1 \n else \n end #case\n end",
"def square_of_sum\n @number_range.sum**2\n end",
"def sum\n\t\t#sets sum at 0\n\t\tsum = 0\t\t\n\n\t\t#adds each card to the sum\n\t\t@hand_contents.each do |card|\n\t\t\tsum += card.number\n\t\tend\n\n\t\t@hand_contents.each do |card|\n\t\t\tif card.number.eql? 1 then\n\t\t\t\tif sum + 10 <= 21 then\n\t\t\t\t\tsum += 10\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\t#return the sum\t\t\n\t\treturn sum\n\tend",
"def compute_sum(number)\n (1..number).inject(:+)\nend",
"def total ( numbers )\r\n\r\n\treturn numbers.reduce(:+);\r\n\r\nend",
"def sum(i)\n sum = i.digits.reduce(:+)\n sum\nend",
"def sum_3_5(number) \r\n\tsum3 = 0\r\n\tsum5 = 0\r\n\tsum15 = 0\r\n\t0.step(number-1,3) do |num|\r\n\t\tsum3 += num\r\n\tend\r\n\t0.step(number-1,5) do |num|\r\n\t\tsum5 += num\r\n\tend\r\n\t0.step(number-1,15) do |num|\r\n\t\tsum15 += (num)\r\n\tend\r\n\treturn sum3 + sum5 - sum15\r\nend",
"def sumoftwonumbers(number1, number2)\n return number1 + number2\nend",
"def calorie_count\n @sugar_amount * CALORIES_PER_SUGAR_GRAM +\n @flour_amount * CALORIES_PER_FLOUR_GRAM\n end",
"def notfancy_sum(mynumbers=[])\n\treturn 0 if mynumbers.empty?\n\n\ts = 0\n\tmynumbers.each do |num|\n\t\ts += num\n\tend\n\tputs s\nend",
"def square_of_sum\n end",
"def multisum(number)\n (0..number).reduce { |sum, n| n % 5 == 0 || n % 3 == 0 ? sum + n : sum }\nend",
"def p6\n\trange = (1..100).to_a\n\tsquare_of_sum = range.reduce(:+) ** 2\n\tsum_of_square = (range.map{|x| x ** 2}).reduce(:+)\n\tsquare_of_sum - sum_of_square\nend",
"def SimpleAdding(num)\n\n # code goes here\n range_sum = *(1..num)\n return range_sum.inject(:+)\n \nend",
"def num_of_sums(num, list)\n # => divide and conquer\n helper(num, list, 0)\nend",
"def square_of_sum\n\tsquare_of = 0\n\n\t(1..100).each do |x|\n\t\tsquare_of += x\n\tend\n\tsquare_of = square_of**2\n\tsquare_of\nend",
"def euler_sum \n\tnums = (1...999).select { |n| n % 3 === 0 || n % 5 === 0 }\n\n\tnum_sum = nums.inject(0) {|s, n| s += n }\nend",
"def total_sprees\n ranked_sprees.to_i + social_sprees.to_i\n end",
"def mult_sum num\n(1...num).select{|x| x%3==0 || x%5==0}.reduce(:+)\nend"
] |
[
"0.68030584",
"0.64271843",
"0.6421403",
"0.6338028",
"0.6333191",
"0.6317147",
"0.62949866",
"0.6287474",
"0.62454236",
"0.6236907",
"0.62135524",
"0.6204225",
"0.6193907",
"0.617802",
"0.6168739",
"0.61653197",
"0.6117427",
"0.61142194",
"0.6112384",
"0.61071986",
"0.6085712",
"0.60791355",
"0.6075559",
"0.60735273",
"0.60666543",
"0.60655576",
"0.6042401",
"0.60267353",
"0.6020535",
"0.6019925",
"0.60019976",
"0.59936833",
"0.5981014",
"0.59321916",
"0.59291244",
"0.5924394",
"0.59232354",
"0.59196234",
"0.5914793",
"0.59074944",
"0.58936185",
"0.5886431",
"0.5882163",
"0.58748066",
"0.58719295",
"0.58707225",
"0.58688587",
"0.58688104",
"0.5868118",
"0.5867241",
"0.5867241",
"0.5855507",
"0.5852009",
"0.58502036",
"0.58363223",
"0.5829832",
"0.5828658",
"0.58227324",
"0.5817503",
"0.5812437",
"0.5802153",
"0.579806",
"0.5795376",
"0.57879573",
"0.5785723",
"0.5785556",
"0.5783934",
"0.5779947",
"0.5777786",
"0.5776212",
"0.5766539",
"0.57665133",
"0.5766506",
"0.57579786",
"0.57579786",
"0.57579786",
"0.57579786",
"0.57579786",
"0.57497585",
"0.57497585",
"0.57461256",
"0.5744952",
"0.5743619",
"0.57419175",
"0.57395506",
"0.5738935",
"0.5734284",
"0.57320666",
"0.5728868",
"0.57287264",
"0.5724908",
"0.5722709",
"0.5720217",
"0.5719439",
"0.57161087",
"0.57123977",
"0.57112795",
"0.5709819",
"0.57076967",
"0.5704471"
] |
0.63582855
|
3
|
extract into new structure
|
def sign_in(email, password)
visit '/sessions/new'
fill_in :email, with: email
fill_in :password, with: password
click_button 'Sign in'
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def extract_metadata; end",
"def extract\n extract_all\n extract_ccs\n end",
"def extract\n nil\n end",
"def extract_meta\n end",
"def extract\n # assume records are active until we discover a deprecation attribute\n self.active = true if attributes.key?('active') && attributes['active'].nil?\n if source_data.blank?\n return if @record.blank? # nothing to extract\n\n self.source_data = @record.to_xml\n end\n self.source_fingerprint ||= Digest::SHA2.hexdigest(source_data)\n self.database ||= record.database\n self.uid ||= record.uid\n self.doi ||= record.doi if record.doi.present?\n self.pmid ||= record.pmid if record.pmid.present?\n end",
"def extract\n # assume records are active until we discover a deprecation attribute\n self.active = true if attributes.key?('active') && attributes['active'].nil?\n if source_data.blank?\n return if @record.blank? # nothing to extract\n self.source_data = @record.to_xml\n end\n self.source_fingerprint ||= Digest::SHA2.hexdigest(source_data)\n # Intended to be used as part of the Email invitation to an author to claim the publication\n # related to this WSSR\n self.hashed_uid ||= Digest::SHA2.hexdigest(record.uid)\n self.database ||= record.database\n self.uid ||= record.uid\n end",
"def extract( options )\n \n end",
"def extract(*attrs)\n @to_extract = attrs\n attr_reader *attrs\n end",
"def extract(entry, dest_path, &block); end",
"def unpack!\n @container = @container.container\n end",
"def unpack!\n @container = @container.container\n end",
"def extract_contents\n @play_time = contents[:playtime_s]\n @gold = contents[:gold]\n @map_name = contents[:map_name]\n @actors = contents[:characters]\n @player = contents[:player_name]\n @story = contents[:story]\n end",
"def extract\n @store.all_classes_and_modules.each do |klass|\n extract_from_klass(klass)\n end\n @po\n end",
"def extract\n begin\n return [] unless (@project && @gxdb)\n\n doc = Utility.base_doc(@project, @label)\n\n doc.merge!(interpreters)\n doc.merge!(version_and_coordsys)\n doc.merge!(proj_file_stats)\n doc.merge!(proj_db_stats)\n\n doc[:surface_bounds] = surface_bounds\n doc[:activity_score] = activity_score(doc)\n\n doc = purge_ages(doc)\n\n [doc] # array to be consistent with other extractors\n\n rescue Exception => e\n puts e.message\n puts e.backtrace\n raise e\n ensure\n @gxdb.disconnect if @gxdb\n end\n\n end",
"def copy(cleanse = true)\n a = dup\n a.cleanse if cleanse\n vehicle_features.each do |x|\n a.vehicle_features << x\n end\n fta_service_types.each do |x|\n a.fta_service_types << x\n end\n fta_mode_types.each do |x|\n a.fta_mode_types << x\n end\n a\n end",
"def copy(cleanse = true)\n a = dup\n a.cleanse if cleanse\n vehicle_features.each do |x|\n a.vehicle_features << x\n end\n fta_service_types.each do |x|\n a.fta_service_types << x\n end\n fta_mode_types.each do |x|\n a.fta_mode_types << x\n end\n a\n end",
"def extract(result)\n if !result.nil? then\n init(result)\n case \n when @type.name == \"Float\"\n return extract_as_currency(result)\n \n when @type.name == \"String\"\n return extract_as_str(result)\n end\n end\n return nil\n end",
"def extract()\n if size == 0 then nil\n else\n root = @contents[0]\n @contents[0] = @contents[-1]\n @contents.delete_at(-1)\n bubble_down(0)\n root\n end\n end",
"def extract_and_set_fields\n @type = raw_event['type']\n @is_public = raw_event['public']\n @payload = raw_event['payload']\n @id = raw_event['id']\n # https://github.com/igrigorik/gharchive.org/blob/c9ae11426e5bcc30fe15617d009dfc602697ecde/bigquery/schema.js#L17-L38\n @repo = parse_repo\n\n # https://github.com/igrigorik/gharchive.org/blob/c9ae11426e5bcc30fe15617d009dfc602697ecde/bigquery/schema.js#L39-L70\n @actor = parse_actor\n\n # https://github.com/igrigorik/gharchive.org/blob/c9ae11426e5bcc30fe15617d009dfc602697ecde/bigquery/schema.js#L71-L102\n @org = parse_org\n\n @created_at = parse_created_at\n end",
"def new_from_element(element)\n OpenStruct.new.tap do |obj|\n obj.asin = element.at('ASIN').inner_text\n obj.url = element.at('DetailPageURL').inner_text\n obj.title = element.at(\"Title\").inner_text\n end\n end",
"def extract_fields\n @assets.each do |value| \n online_only = value['is_asset_online_event']\n if !online_only\n next if @online_auctions_only == true # save only online events\n end\n asset = get_required_fields(value,@required_fields)\n asset[:listed_date] = DateTime.now.strftime('%Y-%m-%d')\n asset[:end_date] = asset[:start_date] #because auction end date has not been specified in json object\n if value['buying_format'].strip == 'auction'\n asset[:auction] = true \n else\n asset[:auction] = false \n end\n next if asset[:current_price].nil? #Don't save assets who's price have not been set\n asset[:internet_sale] = online_only.nil? ? true : false\n asset[:img_large] = get_resource_link(asset[:img_large])\n asset[:img_thumbnail] = get_resource_link(asset[:img_thumbnail]) \n if value['auction_type'] == 'residential'\n asset[:residential] = true\n else\n asset[:residential] = false\n end\n log(\"Fetched property #{asset[:source_asset_id]} from #{@home_url}\")\n #check for field/parse errors here before pushing\n @assets_extracted.push(asset)\n end\n end",
"def structure_records_from_flat_hash h\n rtn = {}\n rtn[:klass] = h.delete :klass\n rtn[:code] = h.delete :code\n rtn[:xlate] = h.extract! :name, :note, :desc\n rtn[:no_xlate] = h\n return rtn\n end",
"def extract_field(header, val, processed)\n return if val.blank?\n case header\n when 'type', 'accession_number', 'id', 'status', 'ark', 'call_number', 'preservation_level', 'visibility'\n # single valued fields\n processed[header.to_sym] = val\n when /^(created|issued|date_copyrighted|date_valid)_(.*)$/\n key = \"#{Regexp.last_match(1)}_attributes\".to_sym\n # TODO: this only handles one date of each type\n processed[key] ||= [{}]\n update_date(processed[key].first, Regexp.last_match(2), val)\n when 'collection_id'\n processed[:collections] ||= []\n processed[:collections] << { id: val }\n else\n last_entry = Array(processed[header.to_sym]).last\n if last_entry.is_a?(Hash) && !last_entry[:name]\n update_typed_field(header, val, processed)\n else\n extract_multi_value_field(header, val, processed)\n end\n end\n end",
"def extractFrom aTweet\n aText= aTweet.text\n aGeo= aTweet.geo\n offerData= {}\n \tofferData.default(\"\")\n\n #More abstraction needed\n #Check extractMatchFromText\n\t @regexps.each do |regexp, value_name|\n aMatchData = regexp.match(aText)\n offerData[value_name] = aMatchData[value_name] unless aMatchData.nil?\n #offerData[value_name] = aMatchData != nil ? @factories[value_name].build(aMatchData[value_name]) : nil\n aText = aMatchData.nil? ? \"\" : aMatchData[:rest]\n\t end\n\t \n aProduct= offerData[\"product\"]\n aPrice= offerData[\"price_value\"].to_f\n aUnit= offerData[\"unit\"]\n anAddressLocation= AddressLocation.new offerData[\"address\"]\n #for future usage\n #anGeoLotacion= [ anAddressLocation.geoLocation, GeoLocation.new aGeo ].compact.first\n\n Offer.new anAddressLocation, aProduct, aPrice, aUnit\n end",
"def dissect_to_record_hashes\n end",
"def parse()\n #This is a stub, used for indexing\n end",
"def extract(wdk_raw, wdk_new)\n\tcontent = File.readlines(wdk_raw).drop(1)\n\tnew_content = content.map{|entry| generate entry}.flatten.join(\"\\n\")\n\tfile = File.new(wdk_new, \"w\")\n\tfile.puts new_content\n\tfile.close\nend",
"def extract_data( page )\n strip_tags page[:content]\n\n #extract_concepts( page[:title] , page , LOC_TITLE ) if page[:title] && page[:title] !=~ PTN_EMPTY\n if page[:tag] && page[:tag] !=~ PTN_EMPTY\n page[:tag] = page[:tag].split(SEP_TAG).map{|e|\"[[\"+e+\"]]\"}.join(\";\")\n extract_concepts( page[:tag] , page , LOC_TAG )\n end\n\n extract_concepts( page[:title] , page , LOC_TITLE)\n extract_concepts( page[:content] , page )\n extract_resources( page[:content] , page )\n end",
"def extract(rec)\n super(rec)\n @abstracts = rec.doc.xpath(path).map(&:text)\n end",
"def extract\n @extractors.each do |ex|\n @variables.substitute!(ex.field)\n if @request.has_response_field?(ex.field, @target)\n field = @request.get_response_field(ex.field, @target)\n if ex.pattern\n @variables.substitute!(ex.pattern)\n Regexp.new(ex.pattern).match(field)\n if Regexp.last_match\n @variables[ex.variable] = Regexp.last_match(1)\n else\n Log.warn(\"Extraction from response #{@target} field '#{ex.field}' ('#{field}') with pattern '#{ex.pattern}' failed.\")\n end\n else\n @variables[ex.variable] = field\n end\n @variables.mark_for_save(ex.variable) if ex.save\n @variables.export(ex.variable) if ex.export\n else\n Log.warn(\"Extraction from response #{@target} field '#{ex.field}' failed: field not found.\")\n end\n end if @extractors\n end",
"def remand_clone_attributes\n slice(\n :ticorkey, :tistkey, :titrnum, :tinum, :tiadtime, :tiagor, :tiasbt, :tigwui,\n :tihepc, :tiaids, :timgas, :tiptsd, :tiradb, :tiradn, :tisarc, :tisexh,\n :titoba, :tinosc, :ti38us, :tinnme, :tinwgr, :tipres, :titrtm, :tinoot\n )\n end",
"def delete\n extract.children.to_a.each(&:extract)\n end",
"def extract(rec)\n super(rec)\n @mesh = extract_mesh(rec)\n end",
"def unpack_header(header)\n # fixed fields\n self.version = header.slice!(0)\n self.type = header.slice!(0)\n self.seq_no = header.slice!(0)\n self.flags = header.slice!(0)\n self.session_id = header.slice!(0..3)\n self.length = header.slice!(0..3)\n return(nil)\n end",
"def parse(ewkb)\r\n @factory.reset\r\n @unpack_structure=UnpackStructure::new(ewkb)\r\n @with_z = false\r\n @with_m = false\r\n parse_geometry\r\n @unpack_structure.done\r\n @srid=nil\r\n end",
"def extract_declares!\n # Ensure there is a name.\n self.force_name!\n # The extracted declares.\n decls = []\n # Extract the types.\n types = []\n self.each_type {|type| types << type }\n types.each {|type| self.delete_type!(type) }\n # Renames them with the current level.\n types.each do |type|\n former = type.name\n self.extend_name!(type)\n self.replace_names_subs!(former,type.name)\n end\n # Adds the types\n decls << types\n # Extract the systemTs.\n systemTs = []\n self.each_systemT {|systemT| systemTs << systemT }\n systemTs.each {|systemT| self.delete_systemT!(systemT) }\n # Renames them with the current level.\n systemTs.each do |systemT|\n former = systemT.name\n self.extend_name!(systemT)\n self.replace_names_subs!(former,systemT.name)\n end\n # Adds the systemTs\n decls << systemTs\n # Extract the inners.\n inners = []\n self.each_inner {|inner| inners << inner }\n inners.each {|inner| self.delete_inner!(inner) }\n # Renames them with the current level.\n inners.each do |inner|\n former = inner.name\n self.extend_name!(inner)\n self.replace_names_subs!(former,inner.name)\n end\n # Adds the inners\n decls << inners\n # Extract the systemIs\n systemIs = []\n self.each_systemI {|systemI| systemIs << systemI }\n systemIs.each {|systemI| self.delete_systemI!(systemI) }\n # Renames them with the current level.\n systemIs.each do |systemI|\n former = systemI.name\n self.extend_name!(systemI)\n self.replace_names_subs!(former,systemI.name)\n end\n # Adds the systemIs\n decls << systemIs\n # Returns the extracted declares.\n return decls\n end",
"def extract_singles(obs)\n obs\nend",
"def unpack_h\n @unpack_h ||= attributes.transform_values(&:unpack)\n end",
"def extract_metadata(hash)\n new_metadata = hash.each_with_object({}) do |(k,v), hash|\n if key = k[/^x-ms-meta-(?<key>.*)?/, :key]\n hash[key] = v\n end\n end\n\n metadata.replace(new_metadata)\n end",
"def apply(input)\n filter_types(input).reduce({}) do |out, (var,with)|\n func = \"extract_#{with[:type]}\".to_sym\n self.send(func, with[:data]).each do |key,val|\n ind = [var,key].map(&:to_s).reject{ |s| s.empty? }.join('_')\n out[ind] = val\n end\n out\n end\n end",
"def ir_add_source_structure!(ir)\n ir.keys.each do |k|\n if ir[k][:full_source_relation_name]\n ir[k][:source_structure] = ir[\n ir[k][:full_source_relation_name]\n ]\n end\n end\n end",
"def preprocess_avc(contents)\n new_contents = contents # no manipulation done here\n new_contents\n end",
"def extract_extends_data\n @extends_data.tap { @extends_data = nil }\n end",
"def deconstruct\n return @base_object.map(&NEW_DIVE) if @base_object.is_a?(Array)\n\n @attributes.map { NEW_DIVE[@base_object.public_send(_1)] }\n end",
"def transform\n {\n 'name' => names,\n 'org' => org,\n 'other' => other_data,\n 'associates' => associates,\n 'xref' => xref,\n\n # these are lists with zero or more members; duplicates allowed; member order is arbitrary (so we pick\n # a standardized order for list comparison purposes)\n 'phones' => phones,\n 'addresses' => addresses,\n 'emails' => emails,\n 'links' => links\n }.reject {|k,v| v.nil? || v.empty?}\n end",
"def unpack(data); end",
"def adapt_feature(feature_ast)\n return nil unless feature_ast\n\n adapted_feature = {}\n\n # Saving off the original data and removing parsed data for child elements in order to avoid duplicating data\n save_original_data(adapted_feature, feature_ast)\n clear_child_elements(adapted_feature, [[:tags],\n [:children]])\n\n adapted_feature['language'] = feature_ast.language\n adapted_feature['keyword'] = feature_ast.keyword\n adapted_feature['name'] = feature_ast.name\n adapted_feature['description'] = feature_ast.description\n adapted_feature['line'] = feature_ast.location.line\n adapted_feature['column'] = feature_ast.location.column\n\n adapted_feature['elements'] = adapt_child_elements(feature_ast)\n adapted_feature['tags'] = adapt_tags(feature_ast)\n\n adapted_feature\n end",
"def extract(blob)\n highlights= {}\n highlights['type'] = blob['type']\n if blob['type']==\"ref-updated\"\n highlights['project'] = blob['refUpdate']['project']\n else\n highlights['project'] = blob['change']['project']\n highlights['subject'] = blob['change']['subject']\n highlights['url'] = blob['change']['url']\n if blob['type']==\"comment-added\"\n highlights['author'] = blob['author']['name']\n highlights['comment'] = blob['comment']\n if blob['approvals']\n highlights['approval-values'] = blob['approvals'].map{|x| x['value']}\n end\n elsif blob['type']==\"change-merged\"\n highlights['submitter'] = blob['submitter']['name']\n elsif blob['type']==\"change-abandoned\"\n highlights['abandoner'] = blob['abandoner']['name']\n elsif blob['type']==\"patchset-created\"\n highlights['uploader'] = blob['uploader']['name']\n end\n end\n\n return highlights\nend",
"def parse(row)\n membership = membership(row['codigo_membro']&.strip)\n return unless membership.present?\n\n member = Member.find_or_initialize_by(membership: membership)\n member.ensemble = ensemble(row)\n member.name = name(row, membership)\n member.birthdate = birthdate(row, membership)\n member.email = email(row, membership)\n member.food_restrictions = food_restrictions(row)\n member.additional_information = additional_information(row)\n member.identity_documents << identity_documents(row, member.identity_documents)\n member.phones << phones(row, member.phones)\n member.addresses << addresses(row, member.addresses)\n member\n end",
"def deep_copy_for account\n\n\t\tarticle_copy = Article.new(self.get_params)\n\t\tarticle_copy.update_attribute(\"account_id\", account.id)\n\t\tunless self.image == nil\n\t\t\tarticle.build_image(self.image.get_params)\t\n\t\tend\n\t\tself.segments.each do |s|\n\t\t\t\n\t\t\ts_copy = article_copy.segments.build(s.get_params)\n\t\t\ts.contents.each do |c|\n\t\t\t\tc_copy = s_copy.contents.build(c.get_params)\n\t\t\t\t\n\t\t\t\t\n\t\t\tend\n\t\tend\n\n\t\tself.tips.each do |t|\n\t\t\tt_copy = article_copy.tips.build(t.get_params)\n\t\t\tt.contents.each do |tc|\n\t\t\t\ttc_copy = t_copy.contents.build(tc.get_params)\n\t\t\tend \n\n\t\tend\n\t\tself.warnings.each do |w|\n\t\t\tw_copy = article_copy.warnings.build(w.get_params)\n\t\t\tw.contents.each do |wc|\n\t\t\t\twc_copy = w_copy.contents.build(wc.get_params)\n\t\t\tend \n\t\t\t\n\t\tend\n\n\t\treturn article_copy\n\t\n\tend",
"def process_data(attributes)\n meta_data_from_parent = Hash[*attributes.first]\n attributes.shift\n attributes.each do |element_array|\n column_name_and_obj_id = element_array.first.split(\",\")\n column_name = column_name_and_obj_id.first\n obj_id = column_name_and_obj_id.last.strip\n element_array.shift\n meta_data_hash = Hash[*element_array.first.flatten(1)]\n obj = identify_the_object(obj_id)\n insert_meta_data([meta_data_hash[\"LEFT\"].to_f, meta_data_hash[\"TOP\"].to_f, meta_data_hash[\"BOTTOM\"].to_f, meta_data_hash[\"RIGHT\"].to_f], meta_data_from_parent[\"Page\"], column_name, meta_data_hash[\"WORD\"], meta_data_from_parent[\"Valid\"], obj, meta_data_from_parent[\"Score\"])\n end\n end",
"def copy_holdings\n Nokogiri::XML::Builder.with(@doc.at('record')) do |xml|\n xml.holdings do\n @record.xpath('./datafield[@tag=\"AVA\"]').each do |holding|\n next if holding.at_xpath('./subfield[@code=\"8\"]').blank?\n\n xml.holding do\n xml.holding_id holding.at_xpath('./subfield[@code=\"8\"]')&.text\n xml.call_number holding.at_xpath('./subfield[@code=\"d\"]')&.text\n xml.library holding.at_xpath('./subfield[@code=\"b\"]')&.text\n xml.location holding.at_xpath('./subfield[@code=\"j\"]')&.text\n end\n end\n end\n end\n end",
"def extract(opts)\n from = opts.fetch(:from) { fail ArgumentError, \"from is required\" }\n to = opts.fetch(:to) { fail ArgumentError, \"to is required\" }\n context = opts.fetch(:context, self)\n\n raw_val = context.instance_exec from, &fetcher\n return [] if raw_val.nil?\n\n val = context.instance_exec raw_val, &value_coercion\n\n to.public_send \"#{attr}=\", val\n\n []\n rescue => err\n [err.message]\n end",
"def extract_new (file = nil)\n Zip::ZipFile.open(file) { |zip_file|\n zip_file.each { |image|\n photo = self.photos.build\n photo.image = image.get_input_stream\n photo.save\n }\n }\n end",
"def extract(body,uri,item_content={})\n {:body => normalize((Hpricot(body)/'body').inner_html), :thumb_path=>nil, :has_video=>false }\n end",
"def extract(pattern); end",
"def extract(format, carrier)\n @propagator.extract(format, carrier)\n end",
"def merge_into(r)\n if !self.metadata[:add].nil?\n if !r.metadata[:add].nil?\n r.metadata[:add] |= self.metadata[:add]\n else\n r.metadata[:add] = self.metadata[:add]\n end\n end\n\n if !self.metadata[:remove].nil?\n if !r.metadata[:remove].nil?\n r.metadata[:remove] |= self.metadata[:remove]\n else\n r.metadata[:remove] = self.metadata[:remove]\n end\n end\n\n if !r.metadata[:todos].nil?\n r.metadata[:todos] |= r.metadata[:add] - r.metadata[:remove]\n else\n r.metadata[:todos] = r.metadata[:add] - r.metadata[:remove]\n end\n\n if !r.metadata[:tags].nil?\n r.metadata[:tags] |= self.metadata[:tags] if !self.metadata[:tags].nil?\n else\n r.metadata[:tags] = self.metadata[:tags]\n end\n\n if !self.metadata[:tags]\n self.metadata[:tags].each do |tag|\n r.add_tags(tag)\n end\n end\n\n r.sector_tag_list |= self.sector_tag_list\n r.type_tag_list |= self.type_tag_list\n r.input_method_list |= self.input_method_list\n r.PFO_statu_list |= self.PFO_statu_list\n r.organizer_list |= self.organizer_list\n\n r.email << (\", \" + self.email) if r.email.blank? && !self.email.blank?\n r.phone = self.phone if r.phone.blank? && !self.phone.blank?\n r.organization = self.organization if r.organization.blank? && !self.organization.blank?\n r.position = self.position if r.position.blank? && !self.position.blank?\n r.address = self.address if r.address.blank? && !self.address.blank?\n\n r.street_address = self.street_address if r.street_address.nil? && !self.street_address.nil?\n r.user = self.user if r.user.nil? && !self.user.nil?\n\n if !self.notes.nil? && !self.notes.empty?\n if r.notes.nil?\n r.notes = self.notes\n else\n new_notes = r.notes << \", \" << self.notes\n r.notes = nil\n r.save\n r.notes = new_notes\n end\n end\n\n r.manually_added ||= self.manually_added\n r.save\n end",
"def extract_info(data) \n schema = [:email, :address, :phone]\n \n result = {}\n\n schema.each_with_index do |category, index|\n result[category] = data[index]\n end\n\n result\nend",
"def process_result(doc)\n entry = {}\n\n source = {}\n source = doc['_source'] if doc['_source']\n\n @es_fields.each do |field|\n # default empty value\n entry[field] = ''\n\n case field\n when :id\n entry[:id] = doc['_id'] if doc['_id']\n when :lang\n entry[:lang] = source['lang'] if source['lang']\n when :url\n entry[:url] = source['url'] if source['url']\n when :site\n if source['site'] && source['site'].is_a?(Array) \\\n && !source['site'].empty?\n\n # adjust to 2 different 'site' configurations\n if source['site'][0].include?('.')\n entry[:site] = source['site'][0]\n else\n entry[:site] = source['site'].join('.')\n end\n end\n when :keywords\n if source['keywords'] && source['keywords'].is_a?(Array) \\\n && !source['keywords'].empty?\n\n entry[:keywords] = source['keywords'].select{|word| word.size < 30 }\n entry[:keywords] = entry[:keywords].uniq.join(' ')\n end\n when :title\n entry[:title] = source['title'] if source['title']\n when :description\n entry[:description] = source['description'] if source['description']\n when :content\n entry[:content] = source['content'] if source['content']\n when :content_analyzed\n # recover array of [word, stem, pos]\n if source['content_analyzed']\n nlp = source['content_analyzed']\n entry[:content_nlp] = Xi::ML::Tools::Formatter.words_from_nlp(nlp)\n end\n else\n @logger.warn(\"Unknown requested field '#{field}'. \"\\\n 'You should add a new feature to the gem. '\\\n 'Otherwise it will always be empty')\n end\n end\n\n # store only contents of minimum '@min_nchars' characters\n if entry[:content].size < @min_nchars\n entry[:content] = ''\n return entry\n end\n\n # keep a reference content for content duplicate detection\n entry[:raw_content] = entry[:content]\n\n # include words from url, title and keywords into content\n # when present in the es_fields argument\n words = []\n\n if entry[:url] && !entry[:url].nil? && !entry[:url].empty?\n url = Unicode.downcase(entry[:url])\n words.concat(Xi::ML::Tools::Formatter.words_from_url(url).split())\n end\n\n if entry[:title] && !entry[:title].empty?\n title = Unicode.downcase(entry[:title])\n words.concat(title.split())\n end\n\n if entry[:keywords] && !entry[:keywords].empty?\n keywords = Unicode.downcase(entry[:keywords])\n words.concat(keywords.split())\n end\n\n unless words.empty?\n words.uniq!\n entry[:content] << ' ' << words.join(' ')\n end\n\n # replace possible 'new line' characters with a dot\n entry[:content].gsub!(/\\n\\r/, '. ')\n entry[:content].gsub!(/\\n/, '. ')\n\n # return processed entry\n entry\n end",
"def unpack(message)\n payload = super\n if(self.is_a?(Jackal::Cfn::Resource))\n begin\n if(payload['Message'])\n payload = MultiJson.load(payload['Message']).to_smash\n payload = transform_parameters(payload)\n payload[:origin_type] = message[:message].get('Body', 'Type')\n payload[:origin_subject] = message[:message].get('Body', 'Subject')\n payload[:request_type] = snakecase(payload[:request_type])\n payload\n else\n payload.to_smash.fetch('Attributes', 'Body', payload.to_smash.fetch('Body', payload.to_smash))\n end\n rescue MultiJson::ParseError\n # Not our expected format so return empty payload\n Smash.new\n end\n else\n payload.to_smash.fetch('Attributes', 'Body', payload.to_smash.fetch('Body', payload.to_smash))\n end\n end",
"def parse_result(result)\n genus = nil\n spec = nil\n infra_sp = nil\n infra_g = nil\n authorships = []\n uni = nil\n attributes = {}\n warns = nil\n quality = 0\n norm = nil\n if result.key?('details')\n result['details'].each do |hash|\n hash.each do |k, v|\n next if v.nil? # specific_epithet seems to do this occassionally and I don't know why. :|\n k = k.underscore.downcase # Looks like the format changed from this_style to thisStyle; change it back!\n next if k == 'annotation_identification'\n next if k == 'ignored'\n if k == 'infraspecific_epithets'\n attributes['infraspecific_epithet'] = v.map { |i| i['value'] }.join(' ; ')\n v.each do |i|\n add_authorship(authorships, i)\n end\n else\n begin\n attributes[k] = v['value']\n rescue => e\n @process.warn(\"ERROR: no '#{k}' value for attributes: #{v.inspect}\")\n raise e\n end\n add_authorship(authorships, v)\n end\n end\n end\n end\n if result.key?('canonicalName')\n canonical = result['canonicalName']\n canon =\n if canonical.is_a?(String)\n canonical\n elsif canonical.is_a?(Hash)\n if canonical.key?('valueRanked')\n canonical['valueRanked']\n elsif canonical.key?('value')\n canonical['value']\n elsif canonical.key?('extended')\n canonical['extended']\n elsif canonical.key?('simple')\n canonical['simple']\n elsif canonical.key?('full')\n canonical['full']\n end\n end\n end\n if result['parsed']\n warns = if result.key?('qualityWarnings')\n result['qualityWarnings'].map { |a| a[1] }.join('; ')\n end\n quality = result['quality'] ? result['quality'].to_i : 0\n norm = result['normalized'] ? result['normalized'] : nil\n else\n warns = 'UNPARSED'\n quality = 0\n canon = result['verbatim']\n end\n norm = result['verbatim'] if norm.blank?\n if norm.size > 250\n norm = canon\n authorships.each do |authorship|\n norm += \" #{authorship[:first]}, et. al\"\n norm += \" #{authorship[:year]}\" if authorship[:year]\n end\n norm = norm[0..249] if norm.size > 250 # Forced to simply truncate it if we couldn't parse it.\n end\n norm = result['verbatim'] if norm.blank?\n\n attributes.merge(\n normalized: norm,\n canonical: canon,\n authorship: authorships.flat_map { |a| a[:authors].blank? ? [] : a[:authors].map { |n| n&.tr(';', '|') } }.join('; '),\n warnings: warns,\n parse_quality: quality,\n year: authorships.map { |a| a[:year] }.compact.sort.first # Yeeesh! We take the earliest year (we only get one!)\n )\n end",
"def fields_transform \n @fields[:share] = nil\n @fields[:dst_sharename] = nil\n @fields[:src_sharename] = nil\n @fields[:sharename] = nil\n\n case @type\n when :fileBrowser_main\n case @command\n when :browse\n field_path_transform(:share,:path) \n when :move_copy\n field_path_transform(:dst_sharename,:dst_path) \n field_path_transform(:src_sharename,:src_files) \n field_path_transform(:src_sharename,:src_folders) \n when :create_folder\n field_path_transform(:share,:path) \n when :rename\n field_path_transform(:share,:new_path) \n field_path_transform(:share,:old_path) \n when :delete\n field_path_transform(:sharename,:files) \n field_path_transform(:sharename,:folders) \n when :state\n field_path_transform(:share,:path) \n end\n end\n notify \"Transformed Fields : \"\n notify @fields.inspect\n end",
"def update_info(interior_design)\n interior_design[:name] = interior_design[:name]\n interior_design[:children] = interior_design[:children]\n interior_design[:age] = interior_design[:age]\n interior_design[:theme] = interior_design[:theme]\n return interior_design\nend",
"def extract_content( update_from_params = false )\n\n # wrap in a callback so we can do things further down\n run_callbacks :content_extract do\n\n # load the object\n @content = params.key?( :id ) ? @model_class.find( params[:id] ) : @model_class.new\n\n # if we’re trying to update things\n @content.assign_attributes( get_assignable_params ) if update_from_params\n\n # call down, if we’ve been provided with a block\n yield if block_given?\n\n end\n\n # Add the content to our context\n @form_context << @content\n\n end",
"def parse(data); end",
"def adopt_extractions extraction_params={}\n if extraction_params.present?\n build_gleaning unless gleaning\n # Declare the attributes needed w/o launching to glean\n # NB: we take ALL proffered attributes, not just those that are priorly needed\n # gleaning.attribs_needed! *extraction_params.keys\n gleaning.accept_attributes extraction_params\n\n # attribs_needed! *extraction_params.keys\n accept_attributes extraction_params\n end\n end",
"def parse; end",
"def parse; end",
"def parse; end",
"def import(data)\n dat = data['data']\n self[0] = dat[0, 4]\n self[1] = dat[4, 4]\n self[2] = dat[8, 4]\n self[3] = dat[12, 4]\n self\n end",
"def json_parse(url, header_type)\n\n raw_data = open(url)\n parsed = JSON.parse(raw_data.read)\n columns = parsed['meta']['view']['columns']\n if header_type == 1\n headers = columns.map{|column| column['name']}\n ########################\n # for potholes:\n elsif header_type == 2\n headers = [\"sid\",\"id\",\"position\",\"created_at\",\"created_meta\",\"updated_at\",\"updated_meta\",\"meta\",\"Creation Date\",\"Status\",\"Completion Date\",\"Service Request Number\",\"Type of Service Request\",\"CURRENT ACTIVITY\",\"MOST RECENT ACTION\",\"NUMBER OF POTHOLES FILLED ON BLOCK\",\"Street Address\",\"ZIP Code\",\"X COORDINATE\",\"Y COORDINATE\",\"Ward\",\"Police District\",\"Community Area\",\"SSA\",\"Latitude\",\"Longitude\", \"Location\"]\n end\n # binding.pry\n data = parsed['data']\n # sliced_hash_holder = []\n data.each do |row|\n data_hash = Hash[headers.zip(row)]\n slice_hash = data_hash.slice(\"Creation Date\", \"Status\", \"Completion Date\", \"Service Request Number\", \"Type of Service Request\",\n \"Street Address\", \"ZIP Code\", \"Latitude\", \"Longitude\", \"Location\")\n mappings = {\"Creation Date\" => :creation_date, \"Status\" => :status, \"Completion Date\" => :completion_date,\n \"Service Request Number\" => :service_request_number, \"Type of Service Request\" => :type_of_service_request,\n \"Street Address\" => :street_address, \"ZIP Code\" => :zip_code, \"Latitude\" => :latitude, \"Longitude\" => :longitude, \"Location\" => :location}\n # p slice_hash\n Request.create(Hash[slice_hash.map {|k, v| [mappings[k], v] }])\n #Request.create(slice_hash)\n # sliced_hash_holder << slice_hash\n # binding.pry\n end\n # 100.times do |i|\n # Request.create(sliced_hash_holder[i])\n # end\nend",
"def extract\n source = self.options.fetch(:source, nil)\n @raw = OpenContent::Extractor.process(source, ET.logger)\n end",
"def structure_dump() end",
"def extract(data)\n return data if @markup.format == :txt\n data.gsub(/(@startuml\\r?\\n.+\\r?\\n@enduml)/m) do\n id = Digest::SHA1.hexdigest($1)\n @map[id] = { :code => $1 }\n id\n end\n end",
"def extract(collection, index)\n val = Convert(collection)\n if val.type.kind == :vector\n @builder.extract_element(val, Convert(index, :integer))\n else\n @builder.extract_value(val, index.to_i)\n end\n end",
"def transform; end",
"def parse\n end",
"def extract_attributes(file_name)\n extract_publish_date(file_name)\n extract_tags(file_name)\n extract_filter(file_name)\n extract_title_and_content(file_name)\n @path = Pathname.new(file_name)\n @file = @path.to_s\n @title = @file.gsub('_', ' ').capitalize if @title.to_s.empty?\n @summary = @content.match(%r{<p>.*</p>}).to_s\n self\n end",
"def prepare\n @result = @content.dup\n end",
"def import_attributes(array)\n index = 0\n map_values = Array.new \n\n while index < array.length\n current_line = array[index].strip\n #puts current_line\n if assert_tag(\"map\", current_line)\n map_values = Map.extract_tag(\"map\", current_line)\n index = array.length\n end\n index = index.next\n end\n\n if map_values.length >= 7\n self.name = map_values[0]\n self.container_width = map_values[1]\n self.container_height = map_values[2]\n self.width = map_values[3]\n self.height = map_values[4]\n self.tile_width = map_values[5]\n self.tile_height = map_values[6]\n end\n end",
"def apply_extracted_metadata\n\n return if content_blob.nil? or content_type.nil?\n\n metadata = Workflow.extract_metadata(:type => content_type.title, :data => content_blob.data)\n\n self.title = metadata[\"title\"] if metadata[\"title\"] and title.nil?\n self.body = metadata[\"description\"] if metadata[\"description\"] and body.nil?\n self.image = metadata[\"image\"] if metadata[\"image\"] and image.nil?\n self.svg = metadata[\"svg\"] if metadata[\"svg\"] and svg.nil?\n end",
"def apply_extracted_metadata\n\n return if content_blob.nil? or content_type.nil?\n\n metadata = Workflow.extract_metadata(:type => content_type.title, :data => content_blob.data)\n\n self.title = metadata[\"title\"] if metadata[\"title\"] and title.nil?\n self.body = metadata[\"description\"] if metadata[\"description\"] and body.nil?\n self.image = metadata[\"image\"] if metadata[\"image\"] and image.nil?\n self.svg = metadata[\"svg\"] if metadata[\"svg\"] and svg.nil?\n end",
"def extract_target_entries\n extract_host_entries\n extract_event_entries\n extract_service_entries\n extract_note_entries\n extract_vuln_entries\n extract_web_entries\n end",
"def copy_fields(to_msg)\n\t\tend",
"def result_structure\r\n AlphaStructure.new map, @creatures, @spawners, @quests, @knowledge_base, pool, file_key, requests, get_meta_data\r\n end",
"def convert(raw)\n return build_fault(raw) if raw.key?('code')\n\n {\n address: format_address(raw.dig('target', 'address')),\n country_code: raw.dig('target', 'address', 'countryCode'),\n name: raw.dig('target', 'name'),\n vat_number: raw.dig('target', 'vatNumber'), valid: true\n }.tap do |hash|\n hash[:request_date] = Time.parse(raw['processingDate']) if raw.key?('processingDate')\n hash[:request_identifier] = raw['consultationNumber'] if raw.key?('consultationNumber')\n end\n end",
"def extract(args, *params)\n args, opts = args.args_and_opts\n name = extract_value opts, :name\n opts.merge!(@singular.to_sym => name ) if name\n params.map do |param| # for every symbol in params Array:\n arg = args.next rescue nil # try to assign sequential argument from args\n arg ||= extract_value opts, param # try to assign named argument from opts\n arg || case param # assign defaults if no other value found\n when :user\n API.auth['login']\n when :branch\n 'master'\n when :public\n !extract_value(opts, :private) unless arg == false\n else\n nil # no default found, parameter is nil\n end\n end\n end",
"def deconstruct = [name]",
"def copy(cleanse = true)\n a = dup\n a.cleanse if cleanse\n fta_service_types.each do |x|\n a.fta_service_types << x\n end\n fta_mode_types.each do |x|\n a.fta_mode_types << x\n end\n a\n end",
"def parse\n\n @structure = {}\n\n # Name\n @structure['name'] = @sopm.xpath('/otrs_package/Name').children[0].content\n\n # Version\n @structure['version'] = @sopm.xpath('/otrs_package/Version').children[0].content\n\n # Vendor\n @structure['vendor'] = @sopm.xpath('/otrs_package/Vendor').children[0].content\n\n # License\n @structure['license'] = @sopm.xpath('/otrs_package/License').children[0].content\n\n # URL\n # TODO: Remove! URL should be required\n if @sopm.xpath('/otrs_package/URL').children.length > 0\n @structure['url'] = @sopm.xpath('/otrs_package/URL').children[0].content\n end\n\n # BuildDate\n if @sopm.xpath('/otrs_package/BuildDate').children.length > 0\n @structure['build_date'] = @sopm.xpath('/otrs_package/BuildDate').children[0].content\n end\n\n # BuildHost\n if @sopm.xpath('/otrs_package/BuildHost').children.length > 0\n @structure['build_host'] = @sopm.xpath('/otrs_package/BuildHost').children[0].content\n end\n\n # PackageIs* blocks (optional)\n %w(Visible Downloadable Removable).each { |is_type|\n\n next if @sopm.xpath('/otrs_package/PackageIs' + is_type).children.length == 0\n\n flag = @sopm.xpath('/otrs_package/PackageIs' + is_type).children[0].content\n\n is_type.downcase!\n\n @structure['package_is_' + is_type] = flag == '1' ? true : false\n }\n\n # ChangeLog (optional)\n change_log_nodes = @sopm.xpath('/otrs_package/ChangeLog')\n if change_log_nodes.length > 0\n @structure['change_log'] = []\n change_log_nodes.each { |change_log_node|\n\n change_log_entry = {}\n change_log_entry['version'] = change_log_node['Version']\n change_log_entry['date'] = change_log_node['Date']\n change_log_entry['log'] = change_log_node.children[0].content\n\n @structure['change_log'].push change_log_entry\n }\n end\n\n # OS (optional)\n os_nodes = @sopm.xpath('/otrs_package/OS')\n if os_nodes.length > 0\n @structure['os'] = []\n os_nodes.each { |os_node|\n\n @structure['os'].push os_node.children[0].content\n }\n end\n\n # \n \n \n \n work\n @structure['framework'] = []\n framework_nodes = @sopm.xpath('/otrs_package/Framework')\n framework_nodes.each { |framework_node|\n @structure['framework'].push framework_node.children[0].content\n }\n\n # PackageRequired (optional)\n package_required_nodes = @sopm.xpath('/otrs_package/PackageRequired')\n if package_required_nodes.length > 0\n @structure['package_required'] = []\n package_required_nodes.each { |package_required_node|\n\n package_required_entry = {}\n package_required_entry['version'] = package_required_node['Version']\n package_required_entry['name'] = package_required_node.children[0].content\n\n @structure['package_required'].push package_required_entry\n }\n end\n\n # ModuleRequired (optional)\n module_required_nodes = @sopm.xpath('/otrs_package/ModuleRequired')\n if module_required_nodes.length > 0\n @structure['module_required'] = []\n module_required_nodes.each { |module_required_node|\n\n module_required_entry = {}\n module_required_entry['version'] = module_required_node['Version']\n module_required_entry['name'] = module_required_node.children[0].content\n\n @structure['module_required'].push module_required_entry\n }\n end\n\n # Description\n @structure['description'] = []\n description_nodes = @sopm.xpath('/otrs_package/Description')\n description_nodes.each { |description_node|\n\n description_entry = {}\n description_entry['language'] = description_node['Lang']\n description_entry['text'] = description_node.children[0].content\n\n @structure['description'].push description_entry\n }\n\n # Filelist/File\n @structure['files'] = []\n files_nodes = @sopm.xpath('/otrs_package/Filelist/File')\n files_nodes.each { |files_node|\n\n files_entry = {}\n files_entry['permission'] = files_node['Permission']\n files_entry['location'] = files_node['Location']\n\n if files_node['Encode'] == 'Base64'\n files_entry['content'] = Base64.decode64( files_node.children[0].content )\n end\n\n @structure['files'].push files_entry\n }\n\n # Code blocks (optional)\n %w(Install Upgrade Reinstall Uninstall).each { |block_type|\n\n code_block_nodes = @sopm.xpath('/otrs_package/Code' + block_type)\n\n next if code_block_nodes.length == 0\n\n # convert to lowercase\n block_type.downcase!\n\n @structure[ 'code_' + block_type ] = []\n code_block_nodes.each { |code_block_node|\n\n code_block_entry = {}\n code_block_entry['type'] = code_block_node['Type']\n code_block_entry['code'] = code_block_node.children[0].content\n\n # optional\n if code_block_node['Version']\n code_block_entry['version'] = code_block_node['Version']\n end\n if code_block_node['IfPackage']\n code_block_entry['if_package'] = code_block_node['IfPackage']\n end\n if code_block_node['IfNotPackage']\n code_block_entry['if_not_package'] = code_block_node['IfNotPackage']\n end\n\n @structure[ 'code_' + block_type ].push code_block_entry\n }\n }\n\n # Intro blocks (optional)\n %w(Install Upgrade Reinstall Uninstall).each { |block_type|\n\n intro_block_nodes = @sopm.xpath('/otrs_package/Intro' + block_type)\n\n next if intro_block_nodes.length == 0\n\n # convert to lowercase\n block_type.downcase!\n\n @structure[ 'code_' + block_type ] = []\n intro_block_nodes.each { |intro_block_node|\n\n intro_block_entry = {}\n intro_block_entry['type'] = intro_block_node['Type']\n intro_block_entry['intro'] = intro_block_node.children[0].content\n\n # optional\n if intro_block_node['Version']\n intro_block_entry['version'] = intro_block_node['Version']\n end\n if intro_block_node['Lang']\n intro_block_entry['language'] = intro_block_node['Lang']\n end\n if intro_block_node['Title']\n intro_block_entry['title'] = intro_block_node['Title']\n end\n if intro_block_node['Format']\n intro_block_entry['format'] = intro_block_node['Format']\n end\n\n @structure[ 'code_' + block_type ].push intro_block_entry\n }\n }\n\n # Database blocks (optional)\n %w(Install Upgrade Reinstall Uninstall).each { |block_type|\n\n intro_block_nodes = @sopm.xpath('/otrs_package/Database' + block_type)\n\n next if intro_block_nodes.length == 0\n\n # convert to lowercase\n block_type.downcase!\n\n @structure[ 'database_' + block_type ] = []\n intro_block_nodes.each { |intro_block_node|\n\n next if !intro_block_node\n next if !intro_block_node.children.is_a?(Array)\n next if intro_block_node.children.empty?\n\n @structure[ 'database_' + block_type ].push intro_block_node.children[0].content\n }\n }\n\n @structure\n end",
"def unpack_body(body)\n # fixed fields\n self.action = body.slice!(0)\n self.priv_lvl = body.slice!(0)\n self.authen_type = body.slice!(0)\n self.service = body.slice!(0)\n self.user_len = body.slice!(0)\n self.port_len = body.slice!(0)\n self.rem_addr_len = body.slice!(0)\n self.data_len = body.slice!(0)\n \n # variable fields\n self.user = body.slice!(0..(@user_len - 1)) if (@user_len != 0)\n self.port = body.slice!(0..(@port_len - 1)) if (@port_len != 0)\n self.rem_addr = body.slice!(0..(@rem_addr_len - 1)) if (@rem_addr_len != 0)\n self.data = body.slice!(0..(@data_len - 1)) if (@data_len != 0) \n return(nil)\n end",
"def build_prosecution(attrs, page)\n doc = Nokogiri::HTML(page.body) {|c| c.noblanks}\n elements = doc.search('div.wysiwyg').first.children\n header = elements.search(\"//a[@id='#{attrs['id']}']\").first.parent\n\n els = [header]\n current = header.next\n until current.nil? || current.name == 'h3' do\n els << current\n current = current.next\n end\n\n if more_attrs = extract_attrs(els)\n puts \"Extracting #{more_attrs['address']}\"\n attrs.merge(more_attrs)\n else\n nil\n end\nend",
"def extract_new_preview\n delete_extract\n extract_preview\n end",
"def copy_650\n et = node.xpath(\"//marc:datafield[@tag='240']\", NAMESPACE)\n genre = node.xpath(\"//marc:datafield[@tag='650']/marc:subfield[@code='a']\", NAMESPACE)\n if et.empty?\n new_et = genre.first.content.capitalize rescue \"Pieces\"\n tag = Nokogiri::XML::Node.new \"datafield\", node\n tag['tag'] = '240'\n tag['ind1'] = ' '\n tag['ind2'] = ' '\n sfa = Nokogiri::XML::Node.new \"subfield\", node\n sfa['code'] = 'a'\n sfa.content = new_et.sub(/\\s{1}\\(.*$/, \"\").sub(/\\s{1}\\-.*$/, \"\")\n tag << sfa\n node.root << tag\n end\n end",
"def build_metadata\n raise StandardError, 'Record not found' if record.nil?\n raise StandardError, \"Missing required elements, missing element(s) are: #{importerexporter.parser.missing_elements(keys_without_numbers(record.keys)).join(', ')}\" unless importerexporter.parser.required_elements?(keys_without_numbers(record.keys))\n \n self.parsed_metadata = {}\n self.parsed_metadata[work_identifier] = [record[source_identifier]]\n add_work_type\n add_standard_metadata\n add_file\n add_visibility\n add_rights_statement\n add_admin_set_id\n add_collections\n add_local\n self.parsed_metadata\n end",
"def extract_data(row)\n row_map.each_with_object({}) do |(db_column, row_column), output|\n output[db_column] = row[row_column]\n end\n end",
"def unpack format\n @b.unpack format\n end",
"def unpack(message)\n payload = super\n if(self.class == Jackal::Cfn::Event)\n begin\n unless(payload.get(:data, :cfn_event))\n payload = format_event(payload.fetch('Body', 'Message', payload))\n payload[:origin_type] = message[:message].get('Body', 'Type')\n payload[:origin_subject] = message[:message].get('Body', 'Subject')\n end\n payload\n rescue\n Smash.new\n end\n else\n payload.to_smash.fetch('Body', payload.to_smash)\n end\n end",
"def extract_table(table)\n puts \"Extracting from #{table['name']}\\n\"\n puts \">>> assoc: #{table['associations']}\"\n extract_associations(table['associations']) if table['associations']\n @outfile.puts create_table(table)\n columns = table_columns(table)\n ids = table_ids(table)\n query = table_query(table, columns, ids)\n results = db_client.query(query)\n results.each do |row|\n @outfile.puts make_insert(table, columns, results.fields, row)\n end\n end",
"def rebuild_stats_details( parse_result_hash )\n parse_result_hash[:stats_details] = [] if parse_result_hash[ :stats_details ].nil?\n # Find out which stat page is used:\n old_stats_row = parse_result_hash[:stats_details_1].first ||\n parse_result_hash[:stats_details_2].first\n return unless old_stats_row.instance_of?(Hash)\n # Do a field-by-field conversion:\n parse_result_hash[:stats_details] << {\n id: nil,\n fields: {\n teams_tot: old_stats_row[:fields][ :teams_tot ],\n teams_presence: old_stats_row[:fields][ :teams_presence ],\n swimmer_tot: old_stats_row[:fields][ :swimmer_tot ],\n swimmer_presence: old_stats_row[:fields][ :swimmer_presence ],\n entries_tot: old_stats_row[:fields][ :entries_tot ],\n entries_presence: old_stats_row[:fields][ :entries_presence ],\n disqual_tot: old_stats_row[:fields][ :disqual_tot ],\n withdrawals_tot: old_stats_row[:fields][ :withdrawals_tot ]\n },\n import_text: old_stats_row[:import_text]\n }\n end"
] |
[
"0.61241126",
"0.606426",
"0.6060183",
"0.60367936",
"0.5855847",
"0.5822673",
"0.5767442",
"0.5712888",
"0.56870574",
"0.55156505",
"0.55156505",
"0.5473919",
"0.5472822",
"0.546262",
"0.5453069",
"0.5453069",
"0.5414861",
"0.54120433",
"0.540159",
"0.539407",
"0.5376462",
"0.5322357",
"0.5314781",
"0.5259741",
"0.52391756",
"0.523611",
"0.5225514",
"0.5194366",
"0.5177149",
"0.51689416",
"0.51516086",
"0.51443094",
"0.51311535",
"0.5096898",
"0.5054369",
"0.50509375",
"0.5049815",
"0.50397056",
"0.50285625",
"0.5028383",
"0.50268084",
"0.50242686",
"0.501826",
"0.50123245",
"0.5005586",
"0.4982748",
"0.49770126",
"0.49746466",
"0.4973071",
"0.4966742",
"0.49639335",
"0.49626383",
"0.49485326",
"0.49452293",
"0.4944229",
"0.49423334",
"0.49401724",
"0.49388316",
"0.49296805",
"0.49195674",
"0.49103788",
"0.49090308",
"0.49051023",
"0.48791966",
"0.486594",
"0.4865176",
"0.48578495",
"0.48544756",
"0.48544756",
"0.48544756",
"0.48538363",
"0.48518205",
"0.4840621",
"0.4823679",
"0.4820567",
"0.48140925",
"0.4812747",
"0.48049626",
"0.48017225",
"0.48010746",
"0.48008272",
"0.48004302",
"0.48004302",
"0.47985452",
"0.47966278",
"0.47821885",
"0.47799397",
"0.47785082",
"0.4777894",
"0.47777024",
"0.4776488",
"0.47739717",
"0.47734833",
"0.47721136",
"0.47616792",
"0.47560206",
"0.47531617",
"0.4745619",
"0.47422644",
"0.47387126",
"0.47371024"
] |
0.0
|
-1
|
converts a name and quote id into the desired format. (Ex: author: Noah Finberg quote_id: 1 => 'NF1')
|
def unique_tag
##collect transforms given array into the new array abbr
abbr = self.author.split(" ").collect do |sub_string|
sub_string[0] #puts first letter of each substring into intials array
end
return abbr.join + '#' + self.id.to_s ##join concatenates an array into a string
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def highwire_author_format(name)\n if name.include? ','\n name.split(',').reverse.join(' ').strip\n else\n name\n end\n end",
"def normalize_author_name(auth_toks)\n return '' if auth_toks.empty?\n str = auth_toks.join(\" \")\n if str =~ /(.+),\\s*(.+)/\n str = \"#{$1} #{$2}\"\n end\n str.gsub!(/\\.\\-/, '-')\n str.gsub!(/[\\,\\.]/, ' ')\n str.gsub!(/ +/, ' ')\n str.strip!\n\n if (str =~ /^[^\\s][^\\s]+(\\s+[^\\s]|\\s+[^\\s]\\-[^\\s])+$/)\n new_toks = str.split(/\\s+/)\n new_order = new_toks[1...new_toks.length];\n new_order << new_toks[0]\n str = new_order.join(\" \")\n end\n return str\n end",
"def normalize_author_name(auth_toks)\n return '' if auth_toks.empty?\n str = auth_toks.join(\" \")\n if str =~ /(.+),\\s*(.+)/\n str = \"#{$1} #{$2}\"\n end\n str.gsub!(/\\.\\-/, '-')\n str.gsub!(/[\\,\\.]/, ' ')\n str.gsub!(/ +/, ' ')\n str.strip!\n\n if (str =~ /^[^\\s][^\\s]+(\\s+[^\\s]|\\s+[^\\s]\\-[^\\s])+$/)\n new_toks = str.split(/\\s+/)\n new_order = new_toks[1...new_toks.length];\n new_order << new_toks[0]\n str = new_order.join(\" \")\n end\n\n str.gsub!(/^[^A-Za-z0-9]+/, '')\n str.gsub!(/[^A-Za-z0-9]+$/, '')\n return str\n end",
"def id2name() end",
"def id2name() end",
"def make_name_to_id\n build_hash('name', 'id')\n end",
"def make_id_to_name\n build_hash('id', 'name')\n end",
"def name_as_id\n self.name.downcase.gsub(/\\s/, '-')\n end",
"def quote_identifier(name)\n quote_identifiers? ? quoted_identifier(name) : name.to_s\n end",
"def author\n quote_of_the_day[second_to_last_index(quote_of_the_day, \"~\")..quote_of_the_day.rindex(\"~\")].gsub(/(\\A~\\s*|\\s*~\\z)/, \"\")\n end",
"def nice_author(author)\n return nice_author(\"#{$2} #{$1}\") if author =~ /^(.+),\\s+(.+)$/\n return nice_author(\"#{$1} #{$2}\") if author =~ /^(.+)\\.(.+)$/\n return author.titleize\nend",
"def format_sort_name(name, author)\n str = format_name(name, :deprecated).\n sub(/^_+/, \"\").\n gsub(/_+/, \" \"). # put genus at the top\n sub(/ \"(sp[-.])/, ' {\\1'). # put \"sp-1\" at end\n gsub(/\"([^\"]*\")/, '\\1'). # collate \"baccata\" with baccata\n sub(\" subg. \", \" {1subg. \").\n sub(\" sect. \", \" {2sect. \").\n sub(\" subsect. \", \" {3subsect. \").\n sub(\" stirps \", \" {4stirps \").\n sub(\" subsp. \", \" {5subsp. \").\n sub(\" var. \", \" {6var. \").\n sub(\" f. \", \" {7f. \").\n strip.\n sub(/(^\\S+)aceae$/, '\\1!7').\n sub(/(^\\S+)ineae$/, '\\1!6').\n sub(/(^\\S+)ales$/, '\\1!5').\n sub(/(^\\S+?)o?mycetidae$/, '\\1!4').\n sub(/(^\\S+?)o?mycetes$/, '\\1!3').\n sub(/(^\\S+?)o?mycotina$/, '\\1!2').\n sub(/(^\\S+?)o?mycota$/, '\\1!1')\n\n # put autonyms at the top\n 1 while str.sub!(/(^| )([A-Za-z-]+) (.*) \\2( |$)/, '\\1\\2 \\3 !\\2\\4')\n\n if author.present?\n str += \" \" + author.\n gsub(/\"([^\"]*\")/, '\\1'). # collate \"baccata\" with baccata\n gsub(/[Đđ]/, \"d\"). # mysql isn't collating these right\n gsub(/[Øø]/, \"O\").\n strip\n end\n str\n end",
"def name_to_id\n @name_to_id ||= build_hash('name', 'id')\n end",
"def quoted_id\n id\n end",
"def id_to_name\n @id_to_name ||= build_hash('id', 'name')\n end",
"def normalize_author_identity(first_name, middle_name, last_name, institution)\n \"First: #{first_name} Middle: #{middle_name} Last: #{last_name} Institution: #{institution}\"\n end",
"def quoted_identifier(name)\n \"\\\"#{name.to_s.upcase}\\\"\"\n end",
"def name_2_id( a_string ) \n return a_string.gsub(\"[\",\"_\").gsub(\"]\",\"\");\n end",
"def unique_format_name\n string_with_id(name.observation_name)\n rescue StandardError\n \"\"\n end",
"def formatAuthName(auth)\n str = \"\"\n if auth.at(\"lname\") && auth.at(\"fname\")\n str = auth.at(\"lname\").text.strip + \", \" + auth.at(\"fname\").text.strip\n auth.at(\"mname\") and str += \" \" + auth.at(\"mname\").text.strip\n auth.at(\"suffix\") and str += \", \" + auth.at(\"suffix\").text.strip\n elsif auth.at(\"fname\")\n str = auth.at(\"fname\").text\n elsif auth.at(\"lname\")\n str = auth.at(\"lname\").text\n else\n puts \"Warning: can't figure out author #{auth}\"\n str = auth.text\n end\n return str\nend",
"def format_market_uid\n @formated_market_uid = market_uid.to_s\n if specifier.present?\n @formated_market_uid += \"^#{specifier.to_s}\" \n self.specifier_name = specifier.to_s\n end\n end",
"def full_name_with_id\n id.to_s + \": \" + first_name + \" \" + last_name\n end",
"def unique_format_name\n title + \" (#{id || \"?\"})\"\n end",
"def parse_string_or_id(msg, quoted: nil, final: nil, remove: false)\n name, msg = parse_term(msg, quoted: quoted, remove: true)\n return (remove ? [name, msg] : name) if !name.empty?\n name, msg = parse_term(msg, final: final, remove: true)\n name = name.strip.to_i if is_num(name)\n return (remove ? [name, msg] : name)\nrescue\n remove ? ['', msg] : ''\nend",
"def format_name\n if target\n target.format_name\n else\n orphan_title.sub(/ (\\d+)$/, \"\")\n end\n end",
"def format_name\n if target\n target.format_name\n else\n orphan_title.sub(/ (\\d+)$/, \"\")\n end\n end",
"def id\n name && name.gsub(' ', '').downcase\n end",
"def fix_id(id, format, extra)\n id << \".\" + format if !format.blank?\n id << \".\" + extra if !extra.blank?\n return id\n end",
"def format_identifier\n self.identifier.to_s\n end",
"def formatAuthName(auth)\n str = \"\"\n fname, lname = auth.text_at(\"./fname\"), auth.text_at(\"./lname\")\n if lname && fname\n str = \"#{lname}, #{fname}\"\n mname, suffix = auth.text_at(\"./mname\"), auth.text_at(\"./suffix\")\n mname and str += \" #{mname}\"\n suffix and str += \", #{suffix}\"\n elsif fname\n str = fname\n elsif lname\n str = lname\n elsif auth.text_at(\"./email\") # special case\n str = auth.text_at(\"./email\")\n else\n str = auth.text.strip\n str.empty? and return nil # ignore all-empty author\n puts \"Warning: can't figure out author #{auth}\"\n end\n return str\nend",
"def reformat_twofaced_names(card)\n end",
"def titleize_proper_names\n self.author = self.author.titleize\n self.editor = self.editor.titleize if self.editor\n self.buyed_from = self.buyed_from.titleize if self.buyed_from\n end",
"def entire_name_with_id\r\n self.entire_full_name + \" (#{self.id})\"\r\n end",
"def id\n name.gsub(':', '-')\n end",
"def quoted_name\n Squirm.quote_ident name\n end",
"def id2name\n to_s\n end",
"def name\n \"#{id}-#{company_name}\"\n end",
"def extract_dbid_an(id)\n dbid, an = id.split('__')\n [dbid, an.to_s.tr('_', '.')]\n end",
"def name\n id.to_s\n end",
"def generate_name\n self.name ||= header ? header.parameterize : id\n end",
"def to_param\n id.to_s << \"-\" << (name ? name.parameterize : '' )\n end",
"def normalize_author(hsh)\n str = hsh['author']\n tokens = repair_and_tokenize_author_text(str)\n authors = []\n current_auth = []\n begin_auth = 1\n tokens.each {|tok|\n if tok =~ /^(&|and)$/i\n if !current_auth.empty?\n auth = normalize_author_name(current_auth)\n authors << auth\n end\n current_auth = []\n begin_auth = 1\n next\n end\n if begin_auth > 0\n current_auth << tok\n begin_auth = 0\n next\n end\n if tok =~ /,$/\n current_auth << tok\n if !current_auth.empty?\n auth = normalize_author_name(current_auth)\n authors << auth\n current_auth = []\n begin_auth = 1\n end\n else\n current_auth << tok\n end\n }\n if !current_auth.empty?\n auth = normalize_author_name(current_auth)\n authors << auth unless auth.strip == \"-\"\n end\n hsh['authors'] = authors\n hsh\n end",
"def normalize_author(hsh)\n str = hsh['author']\n tokens = repair_and_tokenize_author_text(str)\n authors = []\n current_auth = []\n begin_auth = 1\n tokens.each {|tok|\n if tok =~ /^(&|and)$/i\n if !current_auth.empty?\n auth = normalize_author_name(current_auth)\n authors << auth\n end\n current_auth = []\n begin_auth = 1\n next\n end\n if begin_auth > 0\n current_auth << tok\n begin_auth = 0\n next\n end\n if tok =~ /,$/\n current_auth << tok\n if !current_auth.empty?\n auth = normalize_author_name(current_auth)\n authors << auth\n current_auth = []\n begin_auth = 1\n end\n else\n current_auth << tok\n end\n }\n if !current_auth.empty?\n auth = normalize_author_name(current_auth)\n authors << auth.strip unless auth.strip == \"-\" || auth.strip.blank?\n end\n hsh['authors'] = authors if !authors.empty?\n normalize('author',hsh)\n hsh\n end",
"def company_name\n quote.name\n end",
"def identifier_format\n scheme = identifier_scheme&.name\n return scheme if %w[orcid ror fundref].include?(scheme)\n\n return 'ark' if value.include?('ark:')\n\n doi_regex = %r{(doi:)?[0-9]{2}\\.[0-9]+/.}\n return 'doi' if value.match?(doi_regex)\n\n return 'url' if value.starts_with?('http')\n\n 'other'\n end",
"def format_name\n name.observation_name\n end",
"def prepare_related_identifiers_for_csv(csv, _headings, hash)\n csv << [_('Related Works: ')]\n csv << hash[:related_works].first.keys.map { |key| key.to_s.capitalize.tr('_', ' ') }\n hash[:related_works].each do |related_work|\n csv << related_work.values\n end\n csv << []\n csv << []\n end",
"def author_to_marc(a)\n author = ''\n author << a.von + ' ' unless a.von.blank?\n author << a.last\n author << ' ' + a.suffix unless a.suffix.blank?\n author << ', ' + a.first\n author\n end",
"def specific_quote(id)\n quote = @db.get_first_value(\"SELECT quote FROM quotes WHERE id = ? LIMIT 1;\",id)\n return quote\n end",
"def format_id\n id.delete('-')\n end",
"def id\n name.gsub /-/, '_'\n end",
"def quote_names\n @feed_quote_map.values \n end",
"def rearrange(name)\n match = /(\\w+), (\\w+)( \\w+)?/.match(name) # (1)\n\n last_name = match[1]\n first_name = match[2]\n if match[3]\n separator = \"#{match[3][0,2]}. \" # (2)\n else\n separator = ' ' # (3)\n end\n \n \"#{first_name}#{separator}#{last_name}\" # (4)\nend",
"def full_name_with_id\n id.to_s + \": \" + user.first_name + \" \" + user.last_name\n end",
"def id_to_name!\n @id_to_name = make_id_to_name\n self\n end",
"def to_param\n \"#{id}-#{name}\".parameterize if id.present?\n end",
"def text_id\n \"#{name} (##{id})\"\n end",
"def posessivize(name)\n return name if name.blank?\n\n if name.last == \"s\"\n name + \"'\"\n else\n name + \"'s\"\n end\n end",
"def posessivize(name)\n return name if name.blank?\n\n if name.last == \"s\"\n name + \"'\"\n else\n name + \"'s\"\n end\n end",
"def format_autonym(name, author, _rank, deprecated)\n words = name.split\n if author.blank?\n format_name(name, deprecated)\n elsif words[-7] == words[-1]\n [\n format_name(words[0..-7].join(\" \"), deprecated),\n author,\n words[-6],\n format_name(words[-5], deprecated),\n words[-4],\n format_name(words[-3], deprecated),\n words[-2],\n format_name(words[-1], deprecated)\n ].join(\" \")\n elsif words[-5] == words[-1]\n [\n format_name(words[0..-5].join(\" \"), deprecated),\n author,\n words[-4],\n format_name(words[-3], deprecated),\n words[-2],\n format_name(words[-1], deprecated)\n ].join(\" \")\n elsif words[-3] == words[-1]\n [\n format_name(words[0..-3].join(\" \"), deprecated),\n author,\n words[-2],\n format_name(words[-1], deprecated)\n ].join(\" \")\n else\n format_name(name, deprecated) + \" \" + author\n end\n end",
"def format_name(name)\n name.split(' ').join('_')\n end",
"def format_name(name)\n name.split(' ').join('_')\n end",
"def name\n @name ||= parse_name(id.name)\n end",
"def to_id\n\t\treturn self.\n\t\t\tgsub(\"::\", \"\").\n\t\t\tgsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n\t\t\tgsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n\t\t\tdowncase.\n\t\t\tgsub(\"_\", \"-\")\n\tend",
"def get_author\n a = cached_author_year.to_s.gsub(/,\\s\\(?\\d+\\)?\\s\\[\\d+\\]|,\\s\\(?\\d+\\)?/, '')\n a = a.gsub('(', '') if a.starts_with?('(') && !a.include?(')')\n return a\n end",
"def posessivize(name)\n return name if name.blank?\n\n if name.last == 's'\n name + \"'\"\n else\n name + \"'s\"\n end\n end",
"def format_id(id)\n /(\\d+)/.match(id)\n end",
"def normalize_name(name)\n return name.to_s if !name.is_a?(String) && !name.is_a?(MatchData)\n name = name.captures.compact.join('-') if name.is_a?(MatchData)\n name.split('-').map { |s| s[/\\A[0-9]\\Z/].nil? ? s : \"0#{s}\" }.join('-').upcase\nrescue\n name.to_s\nend",
"def format_name(name)\n name.match(/\\,/).nil? ? name : \"#{name.split(\", \").reverse.join(\" \")}\"\n end",
"def format_parcel_id(pid)\n \"#{pid[0..1]} #{pid[2..3]} #{pid[4..5]} #{pid[6]} #{pid[7..9]} #{pid[10..12]}.#{pid[13..15]}\"\n end",
"def to_param\n \"#{id} #{company.name}\".parameterize\n end",
"def unique_format_name\n display_name + \" (#{id || \"?\"})\"\n end",
"def esr9_format_account_id(account_id)\n (pre, main, post) = account_id.split('-')\n\n sprintf('%02i%06i%1i', pre.to_i, main.to_i, post.to_i)\n end",
"def name_format\n self.name.gsub!(/[^0-9a-z\\-_ ]/i, '_') unless self.name.nil?\n self.name.gsub!(/\\s+/, '-') unless self.name.nil?\n self.name = self.name.downcase unless self.name.nil?\n end",
"def squeeze_author(str)\n str.gsub(/([A-Z]\\.) (?=[A-Z]\\.)/, '\\\\1')\n end",
"def name_format\n self.name.gsub!(/[^0-9a-z\\-_ ]/i, '_') unless self.name.nil?\n self.name.gsub!(/\\s+/, '-') unless self.name.nil?\n self.name = self.name.downcase unless self.name.nil?\n end",
"def to_s\n author_name\n end",
"def format_name\n [@comment[:first], @comment[:last]].join(' ')\n end",
"def titleIdentifier\n titleIdentifier = title + ' / ' + author\n titleIdentifier\n end",
"def to_author(author)\n\t\t\t# When an account is given\n\t\t\treturn \"@\" + author[\"login\"] if author[\"login\"]\n\n\t\t\t# Commits have a username key\n\t\t\tif author[\"username\"]\n\t\t\t\t\"@\" + author[\"username\"]\n\t\t\telsif author[\"name\"]\n\t\t\t\tauthor[\"name\"]\n\t\t\telse\n\t\t\t\t# When no known key can be used?\n\t\t\t\t# FIXME : log this?\n\t\t\t\t\"(?)\"\n\t\t\tend\n\t\tend",
"def ids_names(items)\n\t\titems.reject(&:new_record?).collect {|item| {id: item.id, name: item.name.html_escape}}\n\tend",
"def author_string\n auth = nil\n if authors.size > 0 # Build based on People \n case authors.size\n when 1\n auth = authors.first.last_name # self.author\n when 2 \n auth = authors.map(&:last_name).join(\" & \")\n when 3...100\n auth = authors[0..-1].map(&:last_name).join(\", \") + \" & \" + authors.last.last_name\n end\n else # Build based on string\n auth = self.author\n end\n auth\n end",
"def quote_identifier(v)\n schema_utility_dataset.quote_identifier(v)\n end",
"def quote_identifier(v)\n schema_utility_dataset.quote_identifier(v)\n end",
"def make_id\n \"#{self.class.name.downcase}#{id}\"\n end",
"def to_param\n \"#{id}-#{name.try(:parameterize)}\" if id\n end",
"def name_to_id!\n @name_to_id = make_name_to_id\n self\n end",
"def author_name\n \"#{author.last_name}, #{author.first_name}\"\n end",
"def name_or_number\n if !name.empty?\n name\n elsif number\n \"Chapter #{number_as_word}\"\n else\n \"\"\n end\n end",
"def title\n [id, name].join(' ')\n end",
"def quote_identifier(v)\n schema_utility_dataset.quote_identifier(v)\n end",
"def quote_identifier(v)\n schema_utility_dataset.quote_identifier(v)\n end",
"def to_s\n @identifier.to_s.upcase\n end",
"def to_param\n \"#{id}-#{name.parameterize}\"\n end",
"def to_param\n \"#{id}-#{name.parameterize}\"\n end",
"def to_param\n \"#{id}-#{name.parameterize}\"\n end",
"def to_param\n \"#{id}-#{name.parameterize}\"\n end",
"def some_text_and_id( some_text, some_id )\n t = some_text.to_s\n i = some_id.nil? ? '' : \"[#{ some_id }]\"\n t + (( t.empty? || i.empty? ) ? '' : ' ' ) + i\n end",
"def quoted_identifier(name)\n \"[#{name}]\"\n end",
"def parse_userlevel_author(msg, remove: false)\n name, msg = parse_term(msg, quoted: ['author id'], remove: true)\n if !name.empty? && is_num(name)\n name = name.strip.to_i\n else\n name, msg = parse_string_or_id(msg, quoted: ['by', 'author'], final: ['by'], remove: true)\n name.strip! if name.is_a?(String)\n end\n remove ? [name, msg] : name\nrescue\n remove ? ['', msg] : ''\nend",
"def format_name\n name ? name.observation_name : \"\"\n end"
] |
[
"0.66060776",
"0.65178853",
"0.6461776",
"0.6262212",
"0.6262212",
"0.6089769",
"0.60794055",
"0.6031379",
"0.58920485",
"0.5870832",
"0.5861802",
"0.5856684",
"0.58513814",
"0.5825163",
"0.5793458",
"0.5782591",
"0.5750283",
"0.5742723",
"0.5736744",
"0.57201636",
"0.56890374",
"0.5686025",
"0.5650095",
"0.56476516",
"0.56317466",
"0.5631242",
"0.5619815",
"0.56027955",
"0.56019485",
"0.56008",
"0.55994487",
"0.5587202",
"0.55751115",
"0.55356723",
"0.55289394",
"0.5515549",
"0.5512469",
"0.5509281",
"0.55039006",
"0.5472284",
"0.5467167",
"0.5461478",
"0.54595256",
"0.54481184",
"0.5442039",
"0.54212976",
"0.5418129",
"0.54127175",
"0.5411741",
"0.5381378",
"0.5360731",
"0.5355395",
"0.53464603",
"0.5339697",
"0.5335675",
"0.5325706",
"0.53206325",
"0.53182614",
"0.53182614",
"0.5316939",
"0.53160655",
"0.53160655",
"0.5314615",
"0.5312191",
"0.53076774",
"0.5297444",
"0.5296377",
"0.5293257",
"0.5287126",
"0.5284215",
"0.5275203",
"0.5267884",
"0.52665514",
"0.5259961",
"0.52598727",
"0.525979",
"0.52571833",
"0.52479184",
"0.52448285",
"0.5241427",
"0.5233381",
"0.5232447",
"0.523127",
"0.523127",
"0.5228772",
"0.5226649",
"0.52254426",
"0.5221356",
"0.5218913",
"0.5196602",
"0.51911306",
"0.51911306",
"0.51851404",
"0.51833063",
"0.51833063",
"0.51833063",
"0.51833063",
"0.51770526",
"0.5176234",
"0.51707023",
"0.5162408"
] |
0.0
|
-1
|
Preview this email at
|
def Job_application
AccountCreatedMailer.Job_application
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def preview\n @email = Email.find(params[:id])\n render :text => @email.body\n end",
"def preview\n @email = DirectEmail.find(params[:id])\n render :text => @email.body\n end",
"def preview\n @email = EventEmail.find(params[:id])\n render :text => @email.body\n end",
"def preview_email\r\n invitation = Invitation.new(:user => current_user, :code => Code.new)\r\n mail = Mailers::Debate.create_invitation(current_user, @resource, invitation)\r\n @mail_body = mail.body.sub('No message provided', 'YOUR PERSONALIZED NOTE GOES HERE')\r\n\r\n render :inline => %Q{<%= simple_format(@mail_body, {:style => 'margin: 8px 0px'}) %>}\r\n end",
"def demo\n preview(DemoMailer.demo)\n end",
"def demo\n preview(DemoMailer.demo)\n end",
"def call(email, params = {})\n preview = new(params)\n message = preview.public_send(email)\n inform_preview_interceptors(message)\n message\n end",
"def call(email)\n preview = self.new\n preview.public_send(email)\n end",
"def preview_newsletter\n @newsletter = @structure.newsletters.friendly.find params[:id]\n\n # Send email to no recipients to generate mail object\n mail = NewsletterMailer.send_newsletter(@newsletter, nil)\n @body = MailerPreviewer.preview(mail)\n\n render layout: false\n end",
"def preview\n task = MailTasks::Task.new( params[:task] )\n recipient = StoreUser.find( params[:id], :include => \"customer\", :readonly => true )\n mail = task.generate_mails( [recipient], false, mail_layout_options ).first\n render :text => mail.content_with_layout( mail_layout_options ), :layout => false\n # rescue => exception\n # headers[\"Content-Type\"] = \"text/plain\"\n # render :text => exception.to_yaml, :layout => false\n end",
"def preview_to(recipient)\n @newsletter = build_newsletter\n mail = build_mail\n mail.to = recipient.email\n replace_and_send_mail_safely(mail, recipient)\n end",
"def show_body\n I18n.with_locale @email_locale do\n @mail_body = mail_body(@preview, @part_type)\n render :show_body, layout: 'rails_email_preview/email'\n end\n end",
"def process_explanation_mail\n petition = Petition.where(status: 'live').first\n PetitionMailer.process_explanation_mail(Petition.live.first)\n end",
"def content_for_preview( layout_options )\r\n content = self.body.dup\r\n content.gsub!( /<%=\\s?(@[^%]+)\\s?%>/, '<code>\\1</code>' )\r\n mail = Mail.new( :token => \"\" )\r\n mail.content = Render::Base.new( content ).mail_content\r\n template = IO.read(\"#{RAILS_ROOT}/app/views/mail_tasks/mailer/this_mail.text.html.rhtml\")\r\n \r\n render = Render::Base.new( template, layout_options.merge( :mail => mail ) )\r\n render.mail_content\r\n end",
"def preview\n frm.button(:value=>\"Preview\").click\n PreviewAnnouncements.new(@browser)\n end",
"def compose_email\n @title = t 'conclusion_draft_review.send_by_email'\n end",
"def preview\n end",
"def preview\n end",
"def show\n @decrypted = @autocrypt.decrypt(@email)\n @reply_params = {\n to: @email.from,\n subject: 'Re: ' + @email.subject,\n body: (@decrypted || @email.body).gsub(/^/, '> ')\n }\n end",
"def preview\n attachments.first.file.url(:preview)\n rescue StandardError => exc\n logger.error(\"Message for the log file while retrieving preview #{exc.message}\")\n 'empty_file.png'\n end",
"def preview\n redirect_to preview_url\n end",
"def preview\n @text = params[:deliverable][:description]\n render :partial => 'common/preview'\n end",
"def preview_announcement(subject)\n frm.link(:text=>subject).click\n PreviewAnnouncements.new(@browser)\n end",
"def show\n if @sent_email.photo.nil?\n @display_name = ''\n @title = ''\n @flickr_url = ''\n else\n @display_name = @sent_email.photo.member.display_name\n @title = @sent_email.photo.title\n @flickr_url = @sent_email.photo.get_flickr_url\n end\n end",
"def preview\n frm.button(:value=>\"Preview\").click\n AssignmentsPreview.new(@browser)\n end",
"def preview\n frm.button(:value=>\"Preview\").click\n AssignmentsPreview.new(@browser)\n end",
"def send_preview(recipients, personalize=\"fallback\")\n options = { :body => {\n :PreviewRecipients => recipients.kind_of?(String) ? [ recipients ] : recipients,\n :Personalize => personalize }.to_json }\n response = post \"sendpreview\", options\n end",
"def create\n @mail = Mail.new(params[:mail])\n @mail.user = current_user\n \n if params[:preview_button] || !@mail.save\n render :action => \"new\"\n else\n flash[:notice] = 'Mail was successfully created.'\n redirect_to(@mail)\n end\n end",
"def last_message_preview=(value)\n @last_message_preview = value\n end",
"def edit\n yield @editor\n @mail = @editor.mail\n @message = @mail.to_s\n end",
"def preview_text\n return @preview_text\n end",
"def preview_text\n return @preview_text\n end",
"def preview\n return @preview\n end",
"def inspect\n \"#<Envelope::Message to=#{formatted_to} from=#{formatted_from} cc=#{formatted_cc} bcc=#{formatted_bcc} reply_to=#{formatted_reply_to} subject=\\\"#{subject}\\\" text_part=\\\"#{preview = (text_part || html_part); (preview && preview.gsub(/\\s+/, ' ') || 'No preview available')[0..50]}...\\\">\"\n end",
"def petition_announcement_mail\n petition = Petition.where(status: 'live').first\n PetitionMailer.petition_announcement_mail(Petition.live.first)\n end",
"def preview\n frm.link(:text=>\"Preview\").click\n PreviewOverview.new(@browser)\n end",
"def preview() @page.find(input_elements[:preview]) end",
"def preview(channel_id, msg_id, data)\n channel_config, message_config, text =\n prepare_message(channel_id, msg_id, data)\n chats = channel_config.chat_ids\n connector = channel_config.connector\n\n if message_allowed?(message_config, data)\n connector.preview(chats, text, message_config)\n else\n puts \"No message sent beacuse it's not allowed\"\n end\n end",
"def improve_and_reopen_mail\n petition = Petition.where(status: 'live').first\n PetitionMailer.improve_and_reopen_mail(Petition.live.first)\n end",
"def hand_over_to_office_mail\n petition = Petition.where(status: 'live').first\n PetitionMailer.hand_over_to_office_mail(Petition.live.first)\n end",
"def content_preview\n self.send(content_preview_method)\n end",
"def write_about_hand_over_mail\n petition = Petition.where(status: 'live').first\n PetitionMailer.write_about_hand_over_mail(Petition.live.first)\n end",
"def preview\n order = current_user.orders.find_by_cookbook_id(params[:id])\n @cookbook = (order) ? order.cookbook : current_cookbook\n preview_path = \"#{PDF_PREVIEW_FOLDER}/preview_cookbook-#{@cookbook.id}_#{Time.now.to_i}.pdf\"\n session[:preview_filename] = preview_path\n preview = CookbookPreviewWorker.new(\n cookbook: @cookbook, \n filename: preview_path\n )\n preview.cookbook\n render \"previews/preview\"\n end",
"def preview=(value)\n @preview = value\n end",
"def preview_path_for_attachment(attachment)\n preview_attachment_path(id: attachment.attachment_data.id, file: attachment.filename.split('.').first, extension: attachment.file_extension)\n end",
"def preview(attachment, options)\n Rails.application.routes.url_helpers.rails_representation_path(attachment.preview(options), only_path: true)\n end",
"def preview_doc\n @tpl = Template.find(params[\"template_id\"]) \n output = @tpl.render_by_model_id(params[:id], 'print', 'www.freightoperations.com:8080')\n render(:text => output, :layout => false) \n end",
"def preview\n frm.button(:value=>\"Preview\").click\n @@file_number=0\n AssignmentStudentPreview.new(@browser)\n end",
"def preview\n frm.button(:value=>\"Preview\").click\n @@file_number=0\n AssignmentStudentPreview.new(@browser)\n end",
"def last_message_preview\n return @last_message_preview\n end",
"def preview\n @preview ||= Preview.new(self) #if has_preview?\n end",
"def tweet_reviewed_by_influencer(tweet)\n @tweet = tweet\n\n set_attachments\n\n mail(to: tweet.campaign.advertiser.user.email, subject: \"Notificaciones @ Social Target - Uno de tus tweets fue revisado/modificado por una empresa\")\n end",
"def body_preview=(value)\n @body_preview = value\n end",
"def preview\n content[0..19]\n end",
"def view(review, recipient)\n @review = review\n\n mail(to: recipient.email, subject: \"#{@review.review_type == \"cto\" ? @review.booking.user.first_name : @review.booking.offer.user.first_name} vous a laissé un commentaire\")\n end",
"def new_review_email (review)\n\t@book = review.book\n\t@review = review\n\tmail :to => @book.readers.collect{|r| r.email},\n\t :subject=>\"New review for #{@book.title}\"\n end",
"def preview(element_key)\n parameter = { basic_auth: @auth }\n self.class.get(\"/elements/#{element_key}/preview\", parameter)\n end",
"def open\n mail = MailTasks::Mail.find_by_token( params[:id] )\n raise ActiveRecord::RecordNotFound unless mail # raise 404 if mail is not found\n \n options = {\n :post_back_url => url_for( :controller => \"/email\", :action => \"red_logo\" ),\n :base => [request.protocol, request.host].join\n }\n render :text => mail.content_with_layout( options ), :layout => false\n end",
"def emailOnMetareview(revieweeId)\r\n puts \"in Metareview\"\r\n participant = Participant.find_by_id(revieweeId).user_id\r\n asstId = Participant.find_by_id(revieweeId).parent_id\r\n user=User.find_by_id(participant)\r\n assignment=Assignment.find_by_id(asstId).name\r\n partialName=\"email_on_review_of_review\"\r\n if(user.email_on_review_of_review)\r\n email(user.email,\"Metareview\",ApplicationHelper::get_user_first_name(user),assignment,partialName)\r\n end\r\n end",
"def body_preview\n return @body_preview\n end",
"def preview(*)\n nil\n end",
"def preview(*)\n nil\n end",
"def preview\n preview_path = \"#{PDF_PREVIEW_FOLDER}/preview_extra_page-#{@extra_page.id}_#{Time.now.to_i}.pdf\"\n session[:preview_filename] = preview_path\n preview = CookbookPreviewWorker.new(\n cookbook: current_cookbook, \n filename: preview_path\n )\n preview.extra_page @extra_page.id\n render \"previews/preview\"\n end",
"def reference_number_mail\n petition = Petition.where(status: 'live').first\n PetitionMailer.reference_number_mail(Petition.live.first)\n end",
"def ask_office_for_answer_mail\n petition = Petition.where(status: 'live').first\n PetitionMailer.ask_office_for_answer_mail(Petition.live.first)\n end",
"def show\n set_retail\n end",
"def preview_name\n name.sub(/Preview$/, '').underscore\n end",
"def preview\n mixpanel_tab_event(\"View Item\", \"Get Preview URL\")\n begin\n embed_url = user_client.embed_url(params[:id])\n redirect_to embed_url\n rescue\n redirect_to no_support_url\n end\n\n end",
"def blog_preview\n object._challenge\n end",
"def show\n session[:applicant_token] = params[:id] unless current_user\n @email = ERB.new(Settings.email_template).result(get_binding)\n p EMAIL: @email\n end",
"def ping_reviewer(review)\n\n to_list = [review[:user].email]\n cc_list = []\n subject = 'Your unresolved Design Review(s)'\n\n @user = review[:user]\n @result = review[:results]\n \n if review[:urgent]\n attachments.inline['warning.png'] = File.read('app/assets/images/warning.png')\n headers['Importance'] = 'high'\n headers['X-Priority'] = '1'\n headers['X-MSMail-Priority'] = 'High'\n end\n\n mail( :to => to_list,\n :subject => subject,\n :cc => cc_list,\n ) \n end",
"def preview_text(maxlength = 30)\n return \"\" if description.blank?\n my_contents = description[\"contents\"]\n return \"\" if my_contents.blank?\n content_flagged_as_preview = my_contents.select { |a| a[\"take_me_for_preview\"] }.first\n if content_flagged_as_preview.blank?\n content_to_take_as_preview = my_contents.first\n else\n content_to_take_as_preview = content_flagged_as_preview\n end\n preview_content = self.contents.select { |content| content.name == content_to_take_as_preview[\"name\"] }.first\n return \"\" if preview_content.blank? || preview_content.essence.blank?\n text = preview_content.essence.preview_text(maxlength)\n text.size > maxlength ? \"#{text[0..maxlength]}...\" : text\n end",
"def link_to_preview(text, type_id, *args)\n link_to_function text, \"CCPEVE.showPreview(#{type_id.inspect})\", *args\n end",
"def preview_text=(value)\n @preview_text = value\n end",
"def preview_text=(value)\n @preview_text = value\n end",
"def resume_confirm(email, username, filename)\n subject 'You have uploaded your resume to YouIntern'\n recipients email\n from 'support@youintern.com'\n sent_on Time.now\n \n body :username => username, :filename => filename\n end",
"def preview_text(max_length = 30)\n attachment&.name.to_s[0..max_length - 1]\n end",
"def display_resume\n\t profile_resume = Profile.find_by_id(params[:id]).resume\n send_data(profile_resume.attachment_binary.data,\n\t\t\t\t :filename => profile_resume.name,\n\t\t\t\t :type => profile_resume.content_type,\n\t\t\t\t :disposition => \"attachment\"\n\t\t\t\t )\n end",
"def generate_complete_timeline_preview_url(given_timeline_id)\n tl_entry_to_use = Timeline.find(given_timeline_id)\n target_page_path = timeline_path(tl_entry_to_use)\n \n protocol_host_port = \"#{request.protocol}#{request.host_with_port}\"\n main_url = \"#{protocol_host_port}#{target_page_path}?preview=true\"\n \n url_to_return = URI::encode(main_url)\n return url_to_return\n end",
"def preview(article)\n unless article.published_at.nil?\n article_path(article)\n else\n preview_path(article.preview_hash)\n end\n end",
"def post_edit_email\n NotificationMailer.post_edit_email('default@email.com')\n end",
"def reviewed(inquiry)\n @inquiry = inquiry\n mail to: inquiry.email, subject: 'Verteo Biopharma Inquiry Reviewed'\n end",
"def update\n @mail = Mail.find(params[:id]) \n if !@mail.update_attributes(params[:mail]) || params[:preview_button]\n \n render :action => \"edit\"\n else\n flash[:notice] = 'Mail was successfully updated.'\n redirect_to(@mail)\n end\n end",
"def to_s\n \"Last Modified: #{@modifiedAt}\\nStatus: #{@status}\\nAssigned to: #{@owner}\\nSubject: #{@subject}\\n#{@preview}\"\n end",
"def show\n #TRACKER.track(current_user['email'], \"READ_EMAIL\", {\"email_id\" => @email.id, \"email_reference\" => @email.reference_id})\n TRACKER.track(current_user['email'], \"READ_EMAIL\", @email.id, @email.reference_id)\n end",
"def preview!(purchase)\n post(purchase, \"#{collection_path}/preview\")\n end",
"def preview!(purchase)\n post(purchase, \"#{collection_path}/preview\")\n end",
"def preview\n begin\n page = Comatose::Page.new(params[:page])\n page.author = current_user\n if params.has_key? :version\n content = page.to_html( {'params'=>params.stringify_keys, 'version'=>params[:version]} )\n else\n content = page.to_html( {'params'=>params.stringify_keys} )\n end\n rescue SyntaxError\n content = \"<p>There was an error generating the preview.</p><p><pre>#{$!.to_s.gsub(/\\</, '<')}</pre></p>\"\n rescue\n content = \"<p>There was an error generating the preview.</p><p><pre>#{$!.to_s.gsub(/\\</, '<')}</pre></p>\"\n end\n render :text=>content, :layout => false\n end",
"def show\n # notification_email\n end",
"def preview\n self.content.split(' ')[0...5].join(' ') + '...'\n end",
"def apply(interviewee,interviewer)\n @interviewee = interviewee\n @interviewer = interviewer\n mail(to: @interviewee.email + \",\" + @interviewer.email, subject: '面接日程承認のお知らせ')\n end",
"def to_s\n '#<Twilio::REST::Preview>'\n end",
"def to_s\n '#<Twilio::REST::Preview>'\n end",
"def email_approved_proposal\n ProposalMailer.email_approved_proposal\n end",
"def preview_submit\n @story = Story.find(params[:submission])\n @story_slam_preview = true # to hide/show certain things in the header\n end",
"def set_preview\n @preview = Preview.find(params[:id])\n end",
"def preview_msg(msg_params_with_name)\n uri = 'cgi-bin/operate_appmsg?sub=preview&t=ajax-appmsg-preview'\\\n \"&type=10&token=#{@token}&lang=zh_CN\"\n headers = {\n referer: 'https://mp.weixin.qq.com/cgi-bin/appmsg?t=media/appmsg_edit'\\\n \"&action=edit&type=10&isMul=0&isNew=1&lang=zh_CN&token=#{@token}\",\n host: 'mp.weixin.qq.com',\n x_requested_with: 'XMLHttpRequest'\n }\n resource = RestClient::Resource.new(@home_url, headers: headers, cookies: @cookies)\n\n res = resource[uri].post msg_params_with_name\n # \"ret\":\"0\", \"msg\":\"preview send success!\", \"appMsgId\":\"201796045\", \"fakeid\":\"\"\n JSON.parse res.to_s\n end",
"def review_posted(email,permalink) \n @service_permalink = permalink \n subject = \"A review was posted for your service\"\n setup_email(email, subject)\n end",
"def preview_cover\n preview_path = \"#{PDF_PREVIEW_FOLDER}/preview_cover-#{current_cookbook.id}_#{Time.now.to_i}.pdf\"\n session[:preview_filename] = preview_path\n preview = CookbookPreviewWorker.new(\n cookbook: current_cookbook, \n filename: preview_path\n )\n preview.cover\n render \"previews/preview\"\n end",
"def emailOnReview(revieweeId)\r\n puts \"we are in email on review\"\r\n @team_member = TeamsUser.find_all_by_team_id(revieweeId)\r\n asstId = Team.find_by_id(revieweeId).parent_id\r\n assignment=Assignment.find_by_id(asstId).name\r\n partialName=\"email_on_review\"\r\n @team_member.each do |team_Member|\r\n # get parameters for sending mail\r\n user=User.find_by_id(team_Member.user_id)\r\n puts \"teammate name = #(user.name)\"\r\n if(user.email_on_review)\r\n email(user.email,\"Review\",ApplicationHelper::get_user_first_name(user),assignment,partialName)\r\n end\r\n end\r\n end",
"def preview_edit\n\n layout_style = nil\n if (params[:layout])\n layout_style = params[:layout]\n end\n\n\n begin\n @bulletin = Bulletin.find(params[:id])\n @bulletin_layout = @bulletin.layout_for_editing(layout_style, self)\n headers[\"Content-Type\"] = @bulletin_layout.filetype + \"; charset=\" + @bulletin_layout.charset\n render :text => @bulletin_layout.rendered, :layout => 'bulletin'\n return\n rescue SyntaxError\n @error = _('A fatal error has occurred while compiling the temlpate!') + \n '<br /><br />ERROR: '+$!\n end\n render :action => 'error', :layout => 'bulletin'\n end"
] |
[
"0.71475905",
"0.71186084",
"0.70552814",
"0.6985626",
"0.6848472",
"0.6848472",
"0.6832406",
"0.6663229",
"0.64324814",
"0.631654",
"0.6304366",
"0.6181875",
"0.6167911",
"0.61338973",
"0.61305445",
"0.6115152",
"0.61100966",
"0.61100966",
"0.60882556",
"0.60132533",
"0.5982547",
"0.5970752",
"0.5921947",
"0.5854165",
"0.58256847",
"0.58256847",
"0.5801412",
"0.5798907",
"0.57861274",
"0.5756108",
"0.57435614",
"0.57311475",
"0.5694853",
"0.5693586",
"0.56733876",
"0.56689703",
"0.5667859",
"0.56230783",
"0.5584482",
"0.5580056",
"0.556691",
"0.5565034",
"0.553256",
"0.55282027",
"0.5521174",
"0.55182135",
"0.54865557",
"0.54802716",
"0.54802716",
"0.5475045",
"0.54698133",
"0.5462231",
"0.54592174",
"0.5457588",
"0.54561025",
"0.5434102",
"0.54326165",
"0.5418592",
"0.5416024",
"0.5406969",
"0.5398783",
"0.5398783",
"0.5390498",
"0.53865004",
"0.53677875",
"0.5354904",
"0.53483963",
"0.53450906",
"0.53428084",
"0.5339015",
"0.5331245",
"0.5324016",
"0.5320464",
"0.52986485",
"0.52971554",
"0.52956325",
"0.52885884",
"0.52866477",
"0.52858466",
"0.52848935",
"0.5274558",
"0.52651525",
"0.5261375",
"0.5255958",
"0.52543974",
"0.52372897",
"0.52372897",
"0.5235101",
"0.522828",
"0.5226132",
"0.5213765",
"0.52118236",
"0.52118236",
"0.52064675",
"0.5192629",
"0.5186882",
"0.5167913",
"0.51622766",
"0.5158241",
"0.515572",
"0.5152641"
] |
0.0
|
-1
|
Use callbacks to share common setup or constraints between actions.
|
def set_sectoral_share7
@sectoral_share7 = SectoralShare7.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
Only allow a trusted parameter "white list" through.
|
def sectoral_share7_params
params.require(:sectoral_share7).permit(:State, :'2013-14', :'2014-15', :'2015-16', :Indicator)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def filtered_parameters; end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def valid_params?; end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def filter_parameters; end",
"def filter_parameters; end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def check_params; true; end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def list_params\n params.permit(:name)\n end",
"def check_params\n true\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def additional_permitted_params\n []\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end",
"def allow_params_authentication!; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end",
"def quote_params\n params.permit!\n end",
"def list_params\n params.permit(:list_name)\n end",
"def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def all_params; end",
"def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end",
"def source_params\n params.require(:source).permit(all_allowed_params)\n end",
"def user_params\n end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end",
"def permitted_params\n @wfd_edit_parameters\n end",
"def user_params\r\n end",
"def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def params_permit\n params.permit(:id)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def filter_params\n params.permit(*resource_filter_permitted_params)\n end",
"def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end",
"def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend",
"def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def argument_params\n params.require(:argument).permit(:name)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def parameters\n nil\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end",
"def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end",
"def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def special_device_list_params\n params.require(:special_device_list).permit(:name)\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end"
] |
[
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.63804525",
"0.6373396",
"0.6360051",
"0.6355191",
"0.62856233",
"0.627813",
"0.62451434",
"0.6228103",
"0.6224965",
"0.6222941",
"0.6210244",
"0.62077755",
"0.61762565",
"0.61711127",
"0.6168448",
"0.6160164",
"0.61446255",
"0.6134175",
"0.6120522",
"0.6106709",
"0.60981655",
"0.6076113",
"0.60534036",
"0.60410434",
"0.6034582",
"0.6029977",
"0.6019861",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.60184896",
"0.60157263",
"0.6005857",
"0.6003803",
"0.60012573",
"0.59955895",
"0.5994598",
"0.5993604",
"0.5983824",
"0.5983166",
"0.5977431",
"0.597591",
"0.5968824",
"0.5965953",
"0.59647584",
"0.59647584",
"0.59566855",
"0.59506303",
"0.5950375",
"0.59485626",
"0.59440875",
"0.5930872",
"0.5930206",
"0.5925668",
"0.59235454",
"0.5917905",
"0.59164816",
"0.5913821",
"0.59128743",
"0.5906617",
"0.59053683",
"0.59052664",
"0.5901591",
"0.58987755",
"0.5897456",
"0.58970183",
"0.58942604"
] |
0.0
|
-1
|
Generate video for a slide by combining the image and audio
|
def video_gen(slide)
term = slide['term']
kind = slide['kind']
index = slide['index']
audio = slide['audio']
image = slide['image']
raise "audio is required fof #{term}" unless audio
raise "image is required fof #{term}" unless image
file_name = file_name_gen(slide, ".mpg")
audio = command_arg(slide['audio'])
image = command_arg(slide['image'])
video = command_arg(file_name)
`ffmpeg -loop 1 -y -i #{image} -i #{audio} -acodec libmp3lame -vcodec mpeg4 -shortest -qscale:v 1 #{video}`
slide['video'] = file_name
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def combine_video(presentation)\n term = presentation['term']\n args = []\n for slide in presentation['slides']\n args.push command_arg(slide['video'])\n end\n args = args.join(' ')\n combined_arg = command_arg(\"#{BUILD_DIR}/#{term}/#{term}-combined.mpg\")\n final = \"#{DIST_DIR}/#{term}/#{term}.avi\"\n final_arg = command_arg(final)\n `cat #{args} > #{combined_arg}`\n `ffmpeg -y -i #{combined_arg} -r 25 -qscale:v 1 #{final_arg}`\n presentation['video'] = final\nend",
"def generate_black_video(movie, visual)\n #Render an image and create a video file from it\n @generated_videos += 1\n filename = movie.project.trimmed + \"/generated-#{@generated_videos}.avi\"\n cmd = @settings['still_video'].dup\n length = visual.end_point - visual.start_point\n cmd.sub!('<frames>', length.to_frames(25).to_s)\n cmd.sub!('<source>', VREConfig.instance.vre_root + \"resources/black_box.png\")\n cmd.sub!('<resolution>', movie.resolution)\n cmd.sub!('<target>', filename)\n system(cmd)\n filename\n end",
"def create_black_video(movie, visual)\n #Render an image and create a video file from it\n @generated_videos += 1\n filename = movie.project.trimmed + \"/generated-#{@generated_videos}.avi\"\n cmd = @settings['still_video'].dup\n length = visual.end_point - visual.start_point\n cmd.sub!('<frames>', length.to_frames(25).to_s)\n cmd.sub!('<source>', VREConfig.instance.vre_root + \"resources/black_box.png\")\n cmd.sub!('<resolution>', movie.resolution)\n cmd.sub!('<target>', filename)\n system(cmd)\n visual.file = filename\n visual.type = \"video\"\n visual.mute = true\n filename\n end",
"def convertSlidesToVideo(presentationSlidesStart)\n presentationSlidesStart.each do |item|\n # Path to original svg\n originalLocation = File.join(item[\"filepath\"], item[\"filename\"])\n # Save conversion with similar path in tmp\n dirname = File.join(TMP_PATH, item[\"presentationName\"], \"svgs\")\n finalLocation = File.join(dirname, changeFileExtensionTo(item[\"filename\"], \"mp4\"))\n\n if (!File.exists?(finalLocation))\n # Create path to save conversion to\n unless File.directory?(dirname)\n FileUtils.mkdir_p(dirname)\n end\n\n # Convert to png\n image = MiniMagick::Image.open(originalLocation)\n image.format 'png'\n pathToImage = File.join(dirname, changeFileExtensionTo(item[\"filename\"], \"png\"))\n image.write pathToImage\n\n # Convert to video\n # Scales the output to be divisible by 2\n system \"ffmpeg -loglevel quiet -nostdin -nostats -y -r 30 -i #{pathToImage} -vf crop='trunc(iw/2)*2:trunc(ih/2)*2' #{finalLocation}\"\n end\n\n item[\"filepath\"] = dirname\n item[\"filename\"] = finalLocation.split('/').last\n end\n\n return presentationSlidesStart\nend",
"def video_background_with_features(slides, options={})\n default_options = { hide_for_small: true, hide_arrow: false, pattern_overlay: true }\n options = default_options.merge options\n\n hide_for_small = (options[:hide_for_small]) ? \"hide-for-small\" : \"\"\n ret = \"\"\n\n if slides.size > 0\n if slides.pluck(:slide_file_name).find{|f| /^(.*)\\.webm|mp4$/ =~ f}\n fname = $1\n\n video_sources = \"\"\n if webm = slides.find{|f| /webm/i =~ f.slide_content_type && /^#{fname}\\./ =~ f.slide_file_name }\n video_sources += \"<source src='#{ webm.slide.url }' type='#{ webm.slide_content_type }'/>\"\n end\n\n if ogv = slides.find{|f| /ogv/i =~ f.slide_content_type && /^#{fname}\\./ =~ f.slide_file_name }\n video_sources += \"<source src='#{ ogv.slide.url }' type='video/ogg ogv' codecs='theora, vorbis'/>\"\n end\n\n if mp4 = slides.find{|f| /mp4/i =~ f.slide_content_type && /^#{fname}\\./ =~ f.slide_file_name }\n video_sources += \"<source src='#{ mp4.slide.url }' type='#{ mp4.slide_content_type }'/>\"\n end\n poster = slides.find{|f| /jpg|jpeg|png/i =~ f.slide_content_type && /^#{fname}\\./ =~ f.slide_file_name }\n\n ret += content_tag(:video, video_sources.html_safe,\n poster: (poster) ? poster.slide.url : '',\n id: \"video_background\",\n preload: \"auto\",\n autoplay: \"true\",\n loop: \"loop\",\n muted: \"true\",\n volume: 0)\n\n if options[:pattern_overlay]\n ret += content_tag(:div, \"\", id: \"video_pattern\")\n end\n\n if anim = slides.find{|f| /gif/i =~ f.slide_content_type && /^#{fname}\\./ =~ f.slide_file_name }\n ret += content_tag(:div, class: \"bg-gif\") do\n image_tag( anim.slide.url, lazy: false )\n end\n elsif poster\n ret += content_tag(:div, class: \"bg-gif\") do\n image_tag( poster.slide.url, lazy: false )\n end\n end\n\n if website.homepage_headline\n if website.homepage_headline_product_id\n headline_slide = content_tag(:h1, website.homepage_headline)\n product = Product.find(website.homepage_headline_product_id)\n if product.name.match(/^\\d*$/)\n headline_slide += content_tag(:p, \"#{product.name} #{product.short_description_1}\")\n else\n headline_slide += content_tag(:p, product.name)\n end\n headline_slide += link_to(\"Learn More\", product, class: \"secondary button\")\n if product.in_production?\n headline_slide += buy_it_now_link(product, html_button: true)\n end\n elsif website.homepage_headline_product_family_id\n product_family = ProductFamily.find(website.homepage_headline_product_family_id)\n headline_slide = content_tag(:h1, product_family.name.titleize)\n headline_slide += content_tag(:p, website.homepage_headline)\n headline_slide += link_to(\"Learn More\", product_family, class: \"button\")\n else\n headline_slide = content_tag(:h1, website.homepage_headline)\n end\n headline_class = website.homepage_headline_overlay_class || \"large-6 small-12 columns\"\n ret += content_tag(:div, class: 'row headline_slide') do\n content_tag(:div, headline_slide, class: headline_class )\n end\n else\n ret += content_tag(:div, class: \"container\", id: \"feature_spacer\") do\n if options[:tagline]\n content_tag(:h1, website.tagline, id: \"tagline\")\n end\n end\n end\n\n ret = content_tag(:div, ret.html_safe, id: \"video-container\", class: hide_for_small)\n ret += content_tag(:div, \"\", class: \"bouncing-arrow\") unless options[:hide_arrow]\n @leftover_slides = slides.reject{|f| /^#{fname}\\./ =~ f.slide_file_name }\n\n else\n\n ret += content_tag(:div, class: \"row\") do\n content_tag(:div, class: \"large-12 #{ hide_for_small } columns\") do\n orbit_slideshow(slides: slides, duration: 6000, navigation_arrows: false, transition: \"fade\")\n end\n end\n\n end\n end\n\n raw(ret)\n end",
"def render_video_directly options={}\n # render video player\n content_tag(:div) do\n options[:value].collect do |video_md5|\n l1 = video_md5[0..1]\n l2 = video_md5[2..3]\n content_tag(:video,\n content_tag(:source, \"I'm sorry; your browser doesn't support HTML5 video in MP4 with H.264.\",\n src: \"https://cspace-prod-02.ist.berkeley.edu/#TENANT#_nuxeo/data/#{l1}/#{l2}/#{video_md5}\",\n id: 'video_md5',\n type: 'video/mp4'),\n controls: 'controls',\n style: 'width: 640px;')\n end.join.html_safe\n end\n end",
"def combine_video(movie)\n \n trimmed_visuals = \"\"\n contents = movie.visual_sequence.visuals\n contents.each{|visual|\n trimmed_visuals += \" #{visual.file}\"\n }\n video_file = movie.project.final + \"/videotrack.avi\"\n cmd = @settings['video_combine'].dup\n cmd.sub!('<source>', trimmed_visuals)\n cmd.sub!('<target>', video_file)\n puts \"Combining videos\"\n puts cmd\n system(cmd)\n return video_file\n end",
"def media(filename, opts = {})\n n = input(filename, opts)\n @videos << n\n @audios << n\n n\n end",
"def slide_video_tag(slide, field)\n if current_page?(controller: 'signs', action: 'play')\n if field == :background\n video_tag(slide.background, id: \"js-background-video\", class: \"ui-slide-background\", preload: \"auto\", loop: true)\n else\n video_tag(slide.foreground, id: \"js-foreground-video\", class: \"ui-slide-foreground\", preload: \"auto\", loop: true)\n end\n else\n if field == :background\n video_tag(slide.background, controls: true, muted: true, id: \"js-background-video\", class: \"ui-slide-background\", preload: \"auto\", loop: true)\n else\n video_tag(slide.foreground, controls: true, muted: true, id: \"js-foreground-video\", class: \"ui-slide-foreground\", preload: \"auto\", loop: true)\n end\n end\n end",
"def mux(options={})\n if File.file?(options[:output])\n File.delete(options[:output])\n end\n\n create do |mp4creator|\n mp4creator.create = options[:audio]\n mp4creator.file = options[:output]\n end\n\n create do |mp4creator|\n mp4creator.create = options[:video]\n mp4creator.rate = options[:frame_rate].to_f\n mp4creator.file = options[:output]\n end\n\n if options[:hint]\n create do |mp4creator|\n mp4creator.hint = 1\n mp4creator.file = options[:output]\n end\n\n create do |mp4creator|\n mp4creator.hint = 2\n mp4creator.file = options[:output]\n end\n\n create do |mp4creator|\n mp4creator.optimize = true\n mp4creator.file = options[:output]\n end\n end\n end",
"def addWebCam()\n pathToWebcam = \"#{$PATHTOPUBLISHED}/#{@meetingData.meetingId}/video/webcams.webm\"\n pathToIntermediates= \"#{$PATHTOGENERATEINTERMEDIATES}/#{@meetingData.meetingId}\"\n\n # resize the webcam video\n puts \" Resizing webcam recording \"\n system \"ffmpeg -i #{pathToWebcam} -vcodec libx264 -vf scale=200:-1 #{pathToIntermediates}/webcamResized.mp4 -loglevel quiet\"\n \n # create a directory to store the final video(inside the published)\n pathToCompleteRecording=\"#{$PATHTOPUBLISHED}/#{@meetingData.meetingId}/completeVideo\"\n createDirectoryIfNotExists(pathToCompleteRecording)\n\n puts \"Adding webcam into final video\"\n #merge it with the presentation+deskshare video\n system \"ffmpeg -i #{pathToIntermediates}/output.mp4 -i #{pathToIntermediates}/webcamResized.mp4 -filter_complex \\' overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10 \\' #{pathToCompleteRecording}/finalcut.mp4 -loglevel quiet\"\n end",
"def video(*sources)\n options = sources.extract_options!.symbolize_keys\n sources = sources.shift if sources.size == 1\n\n if options[:poster]\n options[:poster] = asset_path(options[:poster])\n end\n\n if size = options.delete(:size)\n options[:width], options[:height] = size =~ /^\\d+x\\d+$/ ? size.split('x') : size\n end\n\n if sources.is_a?(Array)\n content_tag(:video, options) do\n sources.collect { |source| tag(:source, src: asset_path(source)) }.join(\"\\n\")\n end\n else\n tag(:video, options.reverse_merge(src: asset_path(sources)))\n end\n end",
"def video(filename, opts = {})\n n = input(filename, opts)\n @videos << n\n n\n end",
"def audio_gen(slide)\n term = slide['term']\n kind = slide['kind'] || nil\n index = slide['index'] || nil\n file_name = file_name_gen(slide, \".WAV\")\n say = command_arg('[[slnc 1000]]' + slide['script'] + '[[slnc 1000]]')\n output = command_arg(file_name)\n `say -v Jill #{say} -o #{output}`\n slide['audio'] = file_name\nend",
"def generateVideos()\n #GENERATE AN INTERMEDIARY DIRECTORY WHERE WE'D STORE THE VIDEO FRAGMENTS\n pathToIntermediates=\"#{$PATHTOGENERATEINTERMEDIATES}/#{@meetingData.meetingId}\"\n puts \"generating intermediate videos in #{pathToIntermediates}\"\n createDirectoryIfNotExists(pathToIntermediates)\n \n dsPath=\"#{$PATHTOPUBLISHED}/#{@meetingData.meetingId}/deskshare\"\n presentationPath=\"#{$PATHTOPUBLISHED}/#{@meetingData.meetingId}/presentation\"\n \n #Scale to optimal resolution\n maxW=0\n maxH=0\n if Dir.exist?dsPath then\n maxW, maxH = getMaxResolution(dsPath)\n else \n maxW, maxH = getMaxResolution()\n end\n\n\n @objects.each_with_index{\n |val, index|\n puts \"Generating a #{val.class} video in interval [#{val.start_timestamp}, #{val.stop_timestamp}]\"\n val.generateVideo(pathToIntermediates, index, maxW, maxH)\n } \n end",
"def audio(path, attr=nil)\n attr ||= {}\n attr.merge!( {width: 0, height: 0, hidden: true} )\n video(path, attr)\nend",
"def mergeVideos()\n pathToIntermediates=\"#{$PATHTOGENERATEINTERMEDIATES}/#{@meetingData.meetingId}\"\n vidList=\"#{pathToIntermediates}/vidList.txt\"\n # Create a txt file with the lists of all videos to concatenate\n system \"echo >#{vidList}\"\n (0...@objects.length).each do |e|\n system \"echo file \\'#{pathToIntermediates}/vid-#{e}.mp4\\' >> #{vidList}\" \n end\n # Concatenate videos from the txt file\n system \"ffmpeg -f concat -safe 0 -i #{vidList} -c copy #{pathToIntermediates}/output.mp4 -loglevel quiet\"\n end",
"def open_narration(slide_no)\n if @type == 'm4a'\n @files.extract(\"ppt/media/media#{slide_no}.m4a\", \"#{Rails.root}/public/audios/#{$filename}media#{slide_no}.m4a\") rescue\n $filename+'media'+slide_no.to_s+'.m4a'\n end\n if @type == 'wav'\n\n @files.extract(\"ppt/media/media#{slide_no}.wav\", \"#{Rails.root}/public/audios/#{$filename}media#{slide_no}.wav\") rescue\n $filename+'media'+slide_no.to_s+'.wav'\n\n end\n end",
"def embed_code_html(width = 500, height = 315)\n '[video saved - will display when done]'\n end",
"def video\n \"#{self.video_file_name}\"\n end",
"def encode_movie(m)\r\n\tmovie_path = m[0..(m.length-2)].join('\\\\')\r\n\tmovie_folder = m[m.length-1]\r\n\r\n\tprint movie_folder + \", path:\" +movie_path+ \"\\n\"\r\n\r\n\tmovie_data_path = movie_path + \"\\\\\" + movie_folder + \"\\\\Pos0\\\\\"\r\n\tout_file = movie_data_path + \"..\\\\\" + movie_folder\r\n\tffmpeg_cmd = \"ffmpeg32 -framerate 30 -threads 2 -report -i \\\"#{movie_data_path}\\\\img_%09d_Default_000.tif\\\" -pix_fmt yuv420p \\\"#{out_file}.m4v\\\"\"\r\n\tprint \"#{ffmpeg_cmd}\\n=>\\n\"\r\n\t`#{ffmpeg_cmd}`\r\n\treturn [movie_path, \"#{out_file}.m4v\", movie_folder]\r\nend",
"def do_video_job(*inputs)\n puts \"Creating output movie: #{@output}\"\n do_system(\"cp\", inputs.first, @output) # FIXME\n # TODO: http://ffmpeg.org/trac/ffmpeg/wiki/How%20to%20concatenate%20%28join,%20merge%29%20media%20files\n # do_system\n # dir & .work -> output to: @output\n end",
"def render_video_csid options={}\n # render video player\n content_tag(:div) do\n options[:value].collect do |video_csid|\n content_tag(:video,\n content_tag(:source, \"I'm sorry; your browser doesn't support HTML5 video in MP4 with H.264.\",\n src: \"https://webapps.cspace.berkeley.edu/#TENANT#/imageserver/blobs/#{video_csid}/content\",\n id: 'video_csid',\n type: 'video/mp4'),\n controls: 'controls',\n style: 'width: 640px;')\n end.join.html_safe\n end\n end",
"def embed\n \"#{video.__embed__}#{tracker(true)}\"\n end",
"def smart_video_preview\n vp = Tempfile.new([\"video-preview\", \".png\"], binmode: true)\n\n # https://ffmpeg.org/ffmpeg.html#Main-options\n # https://ffmpeg.org/ffmpeg-filters.html#thumbnail\n output = shell!(\"ffmpeg -i #{file.path.shellescape} -vf thumbnail=300 -frames:v 1 -y #{vp.path.shellescape}\")\n Rails.logger.debug(output)\n\n MediaFile.open(vp)\n end",
"def smart_video_preview\n vp = Tempfile.new([\"video-preview\", \".png\"], binmode: true)\n\n # https://ffmpeg.org/ffmpeg.html#Main-options\n # https://ffmpeg.org/ffmpeg-filters.html#thumbnail\n output = shell!(\"ffmpeg -i #{file.path.shellescape} -vf thumbnail=300 -frames:v 1 -y #{vp.path.shellescape}\")\n Rails.logger.debug(output)\n\n MediaFile.open(vp)\n end",
"def combine(file,chapter)\n\t`ffmpeg -f concat -i \"#{file}\" -c copy chapters/Chapter\"#{chapter}\".aiff`\nend",
"def sequence_images\n \n end",
"def convert_img(el, indent)\n\t\tif el.attr['alt'] == 'videoplayer'\n\t\t\treturn \"<video src='#{cdn_url(el.attr['src'])}' controls preload='none' class='video-js vjs-default-skin' data-setup='{}'>\"\n\t\telsif el.attr['src'] && el.attr['src'] !~ /(^[\\w]*:|^\\/)/\n\t\t\tel.attr['src'] = File.join(@options[:asset_prefix], el.attr['src'])\n\t\tend\n\t\tsuper\n\tend",
"def take\n check\n `adb pull /dev/graphics/fb0 fb0`\n `dd bs=1920 count=800 if=fb0 of=fb0b`\n `ffmpeg -vframes 1 -vcodec rawvideo -f rawvideo -pix_fmt rgb565 -s 480x800 -i fb0 -f image2 -vcodec png #{@destination_folder}/#{@prefix}#{@no}.png`\n `rm fb0b`\n end",
"def show; @video.show; end",
"def audio; end",
"def slide\n slde = { start_date: mk_date(start_year),\n end_date: mk_date((end_year.presence || start_year)),\n text: mk_text(body, name) }\n if image.attached?\n slde['media'] = { url: cover_url.to_s,\n link: url }\n end\n slde\n end",
"def thumbnail(options={})\n image = File.expand_path(options[:image])\n\n encode do |ffmpeg|\n ffmpeg.input = options[:video]\n ffmpeg.record_start_time = options[:start]\n ffmpeg.record_for = options[:length]\n ffmpeg.video_frames = options[:frames]\n ffmpeg.fps = (options[:fps] || 1)\n ffmpeg.video_frame_size = \"#{options[:width]}x#{options[:height]}\"\n ffmpeg.disable_audio = true\n ffmpeg.overwrite_output_files = true\n ffmpeg.output = image\n end\n\n image_search = image.split('%d').map { |part|\n Regexp.escape(part)\n }.join('*')\n\n return Dir[image_search]\n end",
"def timelapse\n raise NoSnapshotError if Dir.glob(saving_path+'/*.jpg').count.zero?\n\n puts \"Generate video...\"\n MovieMaker.build\n puts \"Video is ready.\"\n end",
"def draw_audio_demos(product)\n ret = \"\"\n if product.audio_demos.size > 0\n # ret += '<div id=\"sm2-container\"></div>'\n ret += '<ul class=\"graphic\">'\n product.audio_demos.each do |audio_demo|\n ret += content_tag(:li, link_to(audio_demo.name, audio_demo.wet_demo.url, class: \"sm2_link\"))\n end\n ret += \"</ul>\"\n end\n raw(ret)\n end",
"def create\n if !params[:video][:video].nil?\n videoName = params[:video][:video].original_filename.gsub(/\\s/,'_') \n @video = Video.new({:title => params[:video][:title], :video => \"/worshipvideos/#{videoName}\"})\n else\n @video = Video.new({:title => params[:video][:title]})\n end\n\n if !params[:video][:video].nil?\n tmp = params[:video][:video].tempfile\n file = File.join(\"public/worshipvideos\", videoName)\n FileUtils.cp tmp.path, file\n FileUtils.rm tmp\n end\n\n respond_to do |format|\n if @video.save\n if !params[:video][:video].nil?\n #logger.debug \"./createVideoPics.sh '#{videoName}'\"\n #fork do\n #system(\"./createVideoPics.sh '#{videoName}'\")\n #exec(\"ffmpeg -i 'public/worshipvideos/#{videoName}' -an -ss 00:00:20 -r 1 -vframes 1 -f mjpeg -y 'app/assets/images/worship_pics/#{videoName}_1.jpg'\")\n #logger.debug \"ffmpeg -i 'public/worshipvideos/#{videoName}' -an -ss 00:00:20 -r 1 -vframes 1 -f mjpeg -y 'app/assets/images/worship_pics/#{videoName}_1.jpg'\"\n #exec(\"ffmpeg -i 'public/worshipvideos/#{videoName}' -an -ss 00:00:40 -r 1 -vframes 1 -f mjpeg -y 'app/assets/images/worship_pics/#{videoName}_2.jpg'\")\n #logger.debug \"ffmpeg -i 'public/worshipvideos/#{videoName}' -an -ss 00:00:40 -r 1 -vframes 1 -f mjpeg -y 'app/assets/images/worship_pics/#{videoName}_2.jpg'\"\n #exec(\"ffmpeg -i 'public/worshipvideos/#{videoName}' -an -ss 00:01:00 -r 1 -vframes 1 -f mjpeg -y 'app/assets/images/worship_pics/#{videoName}_3.jpg'\")\n #logger.debug \"ffmpeg -i 'public/worshipvideos/#{videoName}' -an -ss 00:01:00 -r 1 -vframes 1 -f mjpeg -y 'app/assets/images/worship_pics/#{videoName}_3.jpg'\"\n #end\n\n @video.update_attribute(\"pic1\", \"worship_pics/#{videoName}_1.jpg\")\n @video.update_attribute(\"pic2\", \"worship_pics/#{videoName}_2.jpg\")\n @video.update_attribute(\"pic3\", \"worship_pics/#{videoName}_3.jpg\")\n end\n\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def render_audio_directly options={}\n # render audio player\n content_tag(:div) do\n options[:value].collect do |audio_md5|\n l1 = audio_md5[0..1]\n l2 = audio_md5[2..3]\n content_tag(:audio,\n content_tag(:source, \"I'm sorry; your browser doesn't support HTML5 audio in MPEG format.\",\n src: \"https://cspace-prod-02.ist.berkeley.edu/#TENANT#_nuxeo/data/#{l1}/#{l2}/#{audio_md5}\",\n id: 'audio_md5',\n type: 'audio/mpeg'),\n controls: 'controls',\n style: 'height: 60px; width: 640px;')\n end.join.html_safe\n end\n end",
"def make\n return @file unless @streaming\n\n src = @file\n dst = Tempfile.new([@basename, @format ? \".#{@format}\" : ''])\n dst.binmode\n\n parameters = []\n # Add source\n parameters << \":source\"\n # Add destination\n parameters << \":dest\"\n\n parameters = parameters.flatten.compact.join(\" \").strip.squeeze(\" \")\n\n Paperclip.log(\"[qtfaststart] #{parameters}\")\n begin\n success = Paperclip.run(\"qtfaststart\", parameters, :source => \"#{File.expand_path(src.path)}\", :dest => File.expand_path(dst.path))\n rescue Cocaine::ExitStatusError => e\n raise PaperclipError, \"error while processing video for #{@basename}: #{e}\" if @whiny\n end\n\n dst\n end",
"def videostab(path_to_video, width, height, crop, tracking_mode)\n\t# from true/false to 1/0\n\ttracking_mode = tracking_mode && 1 || 0\n\tpython_output = `python #{PYNAME} #{path_to_video} #{width} #{height} #{crop} #{tracking_mode}`\n\tputs \"The output from #{PYNAME} is: #{python_output}\"\nend",
"def make\n src = @file\n dst = Tempfile.new([@basename, @format ? \".#{@format}\" : ''])\n dst.binmode\n \n\n parameters = []\n \n # Add source\n parameters << @convert_options[:input].map { |k,v| \"-#{k.to_s} #{v} \"}\n parameters << \"-f --quiet :source\"\n parameters << @convert_options[:output].map { |k,v| \"-#{k.to_s} #{v} \"}\n parameters << \":dest\"\n\n parameters = parameters.flatten.compact.join(\" \").strip.squeeze(\" \")\n \n Paperclip.log(\"[lame] #{parameters}\")\n begin\n success = Paperclip.run(\"lame\", parameters, :source => \"#{File.expand_path(src.path)}\", :dest => File.expand_path(dst.path))\n rescue Cocaine::ExitStatusError => e\n raise PaperclipError, \"error while processing video for #{@basename}: #{e}\" if @whiny\n end\n\n dst\n end",
"def perform(recording_id)\n FFMPEG.logger = logger\n\n @recording = Recording.find recording_id\n\n render_video\n end",
"def ffmpeg_libvpx_cmd(input_path, output_path, bitrate, output_size, force=false)\n replace = force ? \"-y\" : \"\"\n return [\n \"ffmpeg -i '#{input_path}' -threads 8\",\n \"-c:v libvpx -pix_fmt yuv420p -crf 10 -b:v #{bitrate} -s #{output_size} -movflags +faststart -r 29.97 -c:a libvorbis -aq 5 #{replace} '#{output_path}'\"\n ]\nend",
"def autoplay_embed\n \"#{video.__autoplay_embed__}#{tracker(true)}\"\n end",
"def play\n path=\"\"\n @song = Song.where(:id=>params[:id]).first\n @audio = @song.audio\n @audio_path = @audio.id.to_s+\".mp3\"\n @audioimage_path = audioimagepath(@audio)\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def create_videos\n end",
"def convert_video_to_AVI(filename, path, content, url)\n logger.debug \"Convert the video ( #{filename} ) path ( #{path}) from content type of #{content} to H264\"\n File.new(File.join(Rails.root, 'public' , 'system', File.dirname(path), \"#{filename}.avi\"), File::CREAT | File::TRUNC| File::RDWR, 0644)\n videoavi = File.join(Rails.root, 'public' , 'system', File.dirname(path), \"#{filename}.avi\")\n system(\"ffmpeg -i #{url} -acodec copy -vcodec copy #{videoavi} -y\")\n return videoavi\n end",
"def render_x3d_directly options={}\n # render x3d player\n content_tag(:div) do\n options[:value].collect do |x3d_md5|\n l1 = x3d_md5[0..1]\n l2 = x3d_md5[2..3]\n content_tag(:video,\n content_tag(:source, \"I'm sorry; your browser doesn't support HTML5 video in MP4 with H.264.\",\n src: \"https://cspace-prod-02.ist.berkeley.edu/#TENANT#_nuxeo/data/#{l1}/#{l2}/#{x3d_md5}\",\n id: 'x3d_md5',\n type: 'model/x3d+xml'),\n controls: 'controls',\n style: 'width: 640px;')\n end.join.html_safe\n end\n end",
"def run\n outputs = nil\n \n in_tmp_dir do\n image = tmp_path 'text_to_image.jpg'\n Image::Editing::Cmd::TextToImage.new(text, image, @options).run!\n\n outputs = ImageToVideo.new(image, @output_without_extension, duration, @log_folder).run\n end\n\n outputs\n end",
"def video_convert_to_mp4_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VideoApi.video_convert_to_mp4 ...'\n end\n # resource path\n local_var_path = '/video/convert/to/mp4'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n header_params[:'fileUrl'] = opts[:'file_url'] if !opts[:'file_url'].nil?\n header_params[:'maxWidth'] = opts[:'max_width'] if !opts[:'max_width'].nil?\n header_params[:'maxHeight'] = opts[:'max_height'] if !opts[:'max_height'].nil?\n header_params[:'preserveAspectRatio'] = opts[:'preserve_aspect_ratio'] if !opts[:'preserve_aspect_ratio'].nil?\n header_params[:'frameRate'] = opts[:'frame_rate'] if !opts[:'frame_rate'].nil?\n header_params[:'quality'] = opts[:'quality'] if !opts[:'quality'].nil?\n\n # form parameters\n form_params = {}\n form_params['inputFile'] = opts[:'input_file'] if !opts[:'input_file'].nil?\n\n # http body (model)\n post_body = nil\n auth_names = ['Apikey']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VideoApi#video_convert_to_mp4\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def path_to_video(source, options = T.unsafe(nil)); end",
"def videos_test\n end",
"def generate_compilation\n puts \"Generating compilation\"\n get_selected_vines\n pathArray = [];\n @selected_vines.each do |vid|\n vine = Vine.find(vid)\n pathArray.push vine.path\n end\n if pathArray.count > 0\n return outputFile = execute_ffmpeg(pathArray)\n end\n end",
"def outputs\n VIDEO_PRESETS.map do |variant, preset_id|\n {\n key: \"#{name}-#{variant}\",\n thumbnail_pattern: \"#{name}-#{variant}-{count}\",\n preset_id: preset_id,\n segment_duration: SEGMENT_DURATION\n }\n end\n end",
"def generate_previews(filename, options = {})\n\tframegrab_grid = options['framegrab_grid'] || Config['PreviewSettings']['default_grid']\n\tframegrab_interval = options['framegrab_interval'] || Config['PreviewSettings']['default_interval']\n\tframegrab_height = options['framegrab_height'] || Config['PreviewSettings']['default_height']\n\n\tbase_filename = File.basename(filename)\n\tfilesize = File.size(filename)\n\tfile_info = Mediainfo.new filename\n\n\tif framegrab_interval.to_i == 0\n\t\ttotal_images = 1\n\t\tframegrab_grid.split('x').each do |x|\n\t\t\ttotal_images *= x.to_i\n\t\tend\n\t\tframegrab_interval = file_info.duration / total_images\n\tend\n\n\tcount = 0\n\tunits = ['bytes', 'KB', 'MB', 'GB', 'TB']\n\tloop do\n\t\tbreak if filesize < 1024.0\n\t\tcount += 1\n\t\tfilesize /= 1024.0\n\tend\n\n\tpretty_filesize = filesize.round(2).to_s + ' ' + units[count]\n\n\tduration = file_info.duration\n\tremainder = 0\n\tcount = 0\n\tunits = ['sec','min','h']\n\tloop do\n\t\tbreak if duration < 60\n\t\tcount += 1\n\t\tremainder = duration % 60\n\t\tduration /= 60\n\tend\n\n\tpretty_duration = duration.round(0).to_s + ' ' + units[count]\n\n\tif remainder > 0\n\t\tpretty_duration += ' ' + remainder.round(0).to_s + ' ' + units[count-1]\n\tend\n\n\tcommand = \"ffmpeg -loglevel panic -y -i \\\"#{filename}\\\" -frames 1 -q:v 1 -vf \\\"select='isnan(prev_selected_t)+gte(t-prev_selected_t\\,\" + framegrab_interval.to_s + \")',scale=-1:\" + framegrab_height.to_s + \",tile=\" + framegrab_grid + \"\\\" '/tmp/video_preview.jpg'\"\n\t# puts command\n\tif system(command)\n\t# \t# Now that the preview is generated, post it to Mattermost\n\t\tif !(uploaded_file_url = upload_file('/tmp/video_preview.jpg', base_filename))\n\t\t\tcall_mattermost({:text => \"We ran into a problem uploading the file. Have someone look at this!\"})\n\t\telse\n\t\t\tmessage = \"\\n\\n\"\n\t\t\tmessage+= \"|#{base_filename}|[(preview)](#{uploaded_file_url})|\\n\"\n\t\t\tmessage+= \"|-|-:|\\n\"\n\t\t\tmessage+= \"|File Size| **#{pretty_filesize}**|\\n\"\n\t\t\tmessage+= \"|Duration| **#{pretty_duration}**|\\n\"\n\t\t\tmessage+= \"|Format| **#{file_info.format}**|\"\n\n\t\t\tactions = Config['FileOperations']\n\t\t\tattachments_actions = []\n\t\t\tactions.keys.each do |key|\n\t\t\t\taction_hash = {\n\t\t\t\t\t'name': key,\n\t\t\t\t\t'integration': {\n\t\t\t\t\t\t'url': [Config['Webhook']['url'], 'run-command'].join('/'),\n\t\t\t\t\t\t'context': {\n\t\t\t\t\t\t\t'command': key,\n\t\t\t\t\t\t\t'filename': File.realpath(filename)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tattachments_actions.push(action_hash)\n\t\t\tend\n\n\n\t\t\tattachments = [\n \t\t{\n \t\t\t\"text\": message,\n \t\t\t\"actions\": attachments_actions\n\t\t }]\n\n\t\t\tpayload = {:attachments => attachments}\n\n\t\t\tcall_mattermost(payload)\n\t\tend\n\telse\n\t\tLog.error \"There was an error running the command: #{command}\"\n\t\tcall_mattermost({:text => \"### DANGER WILL ROBINSON\\nERROR\"})\n\tend\n\nend",
"def combine_files files\n tempfile = Tempfile.new(\"video\")\n path = tempfile.path\n tempfile.close\n `cat #{files.join(\" \")} > #{path}.avi`\n path\n end",
"def video_tag(options = {})\n options = ActiveRecord::Acts::Cinema::DEFAULT_OPTIONS.merge(options)\n video_url = read_attribute(ActiveRecord::Acts::Cinema::SOURCE_PARAM)\n\n width = options[:width]\n height = options[:height]\n allow_full_screen = options[:allow_full_screen] ? \"true\" : \"false\"\n \n # Check the tag option, if a method is assigned, \n # call it to get the template string\n if options[:tag_template].is_a?(Symbol) \n tag_template = self.send options[:tag_template]\n else\n tag_template = options[:tag_template]\n end\n ERB.new(tag_template).result(binding)\n end",
"def extract_cover!(offset=0.0)\n random_name = (0...8).map { (65 + rand(26)).chr }.join\n tmp_file = \"tmp/#{random_name}.jpg\"\n\n `ffmpeg -itsoffset -#{offset} -i '#{video_file.path}' -vframes 1 -an #{tmp_file}`\n\n # Attach output image as cover image\n File.open(tmp_file) do |f|\n self.cover_image = f\n save\n end\n end",
"def create\n\n @video = Video.new(video_params)\n file = @video.video.tempfile\n\n video = Panda::Video.create(:file => file)\n # binding.pry\n video.encodings['h264'].reload\n\n until video.encodings['h264'].status == 'success'\n video.encodings['h264'].reload\n end\n\n video.encodings['h264'].encoding_progress\n @video.video = video.encodings['h264'].url\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def render_audio_csid options={}\n # render audio player\n content_tag(:div) do\n options[:value].collect do |audio_csid|\n content_tag(:audio,\n content_tag(:source, \"I'm sorry; your browser doesn't support HTML5 audio in MPEG format.\",\n src: \"https://webapps.cspace.berkeley.edu/#TENANT#/imageserver/blobs/#{audio_csid}/content\",\n id: 'audio_csid',\n type: 'audio/mpeg'),\n controls: 'controls',\n style: 'height: 60px; width: 640px;')\n end.join.html_safe\n end\n end",
"def codec\n if RAILS_ENV == 'development'\n \"-ar 22050 -ab 32 -f flv -y\"\n else\n \"-vcodec libx264 -vpre hq -ar 22050 -ab 32 -crf 15\"\n end\n end",
"def create_frame_and_thumbnail\n if (File.extname(self.image_sequence) == \".mha\")\n file_path = Rails.root.join(dir_path, self.image_sequence)\n result = system(Rails.root.join('scripts','mha_to_png','bin',\"MhaToPng #{file_path} 1\").to_s)\n base_name = File.basename(file_path, \".mha\")\n image = MiniMagick::Image.open(\"#{dir_path}/#{base_name}_frame.png\")\n image.resize \"200x200\"\n image.format \"png\"\n image.write \"#{dir_path}/#{base_name}_thumbnail.png\"\n File.chmod(0644, \"#{dir_path}/#{base_name}_thumbnail.png\")\n self.thumbnail = \"#{base_name}_thumbnail.png\"\n self.frame = \"#{base_name}_frame.png\"\n end\n end",
"def create_image(title, description, parent_id, mime_type, file_name)\n\t insert_file(title, description, parent_id, 'application/vnd.google-apps.video', file_name)\n\tend",
"def gen_highlights_for_multi_sessions(session_count, video_dir, txt_dir, dst_video)\n mpg_videos = []\n seg_filenames = []\n k = 1\n (1..session_count).each do |i|\n src_video = File.join(video_dir, \"session#{i}.mp4\")\n txt_file = File.join(txt_dir, \"session#{i}.txt\")\n pairs = get_time_pairs(txt_file)\n pairs.each do |pair|\n outmp4 = File.join($tmp_folder, \"#{k}.mp4\")\n outmpg = File.join($tmp_folder, \"#{k}.mpg\")\n seg_filenames << outmpg\n cmd_str = \"#{$ffmpeg} -ss #{pair[0]} -t #{pair[1] - pair[0] + 2} -i \\\"#{src_video}\\\" #{outmp4}\"\n p cmd_str\n system(cmd_str) unless File.exists? outmp4\n cmd_str = \"#{$ffmpeg} -i #{outmp4} -qscale:v 1 #{outmpg}\"\n p cmd_str\n system(cmd_str) unless File.exists? outmpg\n k = k + 1\n end\n end\n all_segs = seg_filenames.join('|')\n mpg_all = File.join($tmp_folder, 'all.mpg')\n cmd_str = \"#{$ffmpeg} -i \\\"concat:#{all_segs}\\\" -c copy #{mpg_all}\"\n p cmd_str\n system(cmd_str) unless File.exists? mpg_all\n cmd_str = \"#{$ffmpeg} -i #{mpg_all} -qscale:v 1 #{dst_video}\"\n p cmd_str\n system(cmd_str)\nend",
"def process_audio\n `ffmpeg -y #{debug_settings} -i #{@filename} -c:a libfdk_aac -b:a 128k -vn #{audio_filepath}`\n `mp4fragment #{audio_filepath} #{audio_filepath_fragmented}`\n FileUtils.rm audio_filepath\n end",
"def create_thumbnails()\n # {{{\n begin\n @@logger.log('IMAGE UP | Importing image')\n image_renderer = @@image_renderer.new(@media_asset)\n \n id = @media_asset.media_asset_id\n ext = @media_asset.extension.dup.downcase\n path = Aurita.project_path(:public, :assets, \"asset_#{id}.#{ext}\")\n \n @@logger.log(\"IMAGE UP | Path is #{path}\")\n # Every image needs a jpeg base image (esp. needed for PDF): \n STDERR.puts \"Importing #{path} using #{image_renderer.class.inspect}\"\n image_renderer.import(path)\n image_renderer.create_image_variants(@@variants)\n\n if ext == 'pdf' then\n image_renderer.create_pdf_preview()\n elsif @media_asset.is_video? then\n dest = Aurita.project_path(:public, :assets, \"asset_#{id}.jpg\")\n # File.open(source, 'w')\n # system \"ffmpeg -i #{path} -ar 22050 -ab 32 -acodec mp3\n # -s 480x360 -vcodec flv -r 25 -qscale 8 -f flv -y #{ dest }\"\n system(\"ffmpeg -i '#{path}' -ss 00:00:10 -vframes 1 -f image2 -vcodec mjpeg '#{dest}'\")\n ext = 'jpg'\n end\n rescue ::Exception => e\n STDERR.puts('Error when trying to create image versions: ' << e.message)\n e.backtrace.each { |m| \n STDERR.puts(m)\n }\n end\n end",
"def perform(video_id)\n video = Video.get(video_id)\n flv_video = FFMPEG::Movie.new(video.flv)\n options = {\n resolution: flv_video.resolution,\n video_bitrate: flv_video.video_bitrate,\n audio_bitrate: flv_video.audio_bitrate\n }\n mp4_video = flv_video.transcode('uploads/' + video.id.to_s + '.mp4', options)\n video.update(mp4: mp4_video.path)\n end",
"def enhance(video:, output_dir: append_enhanced(File.join(video.base_dir, video.name_no_ext)),\n make_content_frames: false,\n output_content_dir: append_content(File.join(video.base_dir, video.name_no_ext)))\n frames = get_frames(video.frame_dir)\n frame_dir_setup(output_dir)\n frame_dir_setup(output_content_dir) if make_content_frames\n output_content_dir = nil unless make_content_frames\n frames.each_slice(num_procs).with_index(1) do |elements, i|\n elements.each do |frame|\n fork do\n combined_file = Pathname.new('').join(output_dir, File.basename(frame))\n content_file = Pathname.new('').join(output_content_dir, File.basename(frame))\n enhance_frame(frame: frame, footer_height: video.footer_height,\n content_file: content_file, combined_file: combined_file)\n end\n end\n Process.waitall\n print \"\\tEnhancing frames from #{video.name}: #{(i * elements.size / frames.size.to_f * 100).truncate(1)}%\\r\"\n end\n puts\n output_name = append_enhanced(video.name_no_ext) + video.extension\n output_content_name = append_enhanced(video.name_no_ext) + '_content' + video.extension\n video.class.frames_to_video(frame_dir: output_dir, duration: video.duration, name: output_name)\n video.class.frames_to_video(frame_dir: output_content_dir, duration: video.duration, name: output_content_name)\n # TODO: Return both SEMVideo objects\n end",
"def encode\n Rails.logger.debug \"*** Sending video to encoding.com\"\n self.encodingid = ENCQ.add_and_process(\n encoding_source_url, #source\n {\n # Task 1: Encode into a 608x size video mp4 (normal)\n # encoding_target_url => EncodingDotCom::Format.create(\n # 'output' => 'mp4',\n # 'size' => '608x0',\n # 'add_meta' => 'yes',\n # 'bitrate' => '1024k',\n # 'framerate' => '25',\n # 'video_codec' => 'libx264',\n # 'audio_bitrate' => '128k',\n # 'profile' => 'baseline',\n # 'two_pass' => 'yes'),\n # Encode into a 608x size video flv w/ vp6\n encoding_target_url('flv') => EncodingDotCom::Format.create(\n 'output' => 'flv',\n 'size' => '608x0',\n 'bitrate' => '1024k',\n 'framerate' => '25',\n 'video_codec' => 'vp6',\n 'audio_bitrate' => '128k'),\n # # Task 2: Encode into a 320x size video (preview)\n # resource.container_encoded_url('preview') => EncodingDotCom::Format.create(\n # 'output' => 'mp4',\n # 'size' => '320x0',\n # 'add_meta' => 'yes',\n # 'bitrate' => '1024k',\n # 'framerate' => '25',\n # 'video_codec' => 'libx264',\n # 'audio_bitrate' => '128k',\n # 'profile' => 'baseline',\n # 'two_pass' => 'yes'),\n \n # Task 2: Generate a thumbnail\n encoding_target_url('jpg') => EncodingDotCom::Format.create(\n 'output' => 'thumbnail', \n 'width' => '100', \n 'height' => '100',\n 'time' => 2),\n },\n #{ 'notify' => encoding_callback_url }\n { 'notify' => encoding_callback_url(:host => ENCODING_DOT_COM_POSTBACK_HOST)}\n # Alternatively you could also:\n #{ 'notify' => \"marc@eternos.com\" }\n )\n save\n end",
"def url_to_video(source, options = T.unsafe(nil)); end",
"def create\n @frame = Frame.new(frame_params)\n\n # movie = FFMPEG::Movie.new(\"/Users/nicolai/code/projects/emotionAPI_test/public/mark_zuck.mp4\")\n # movie.transcode(\"movie.mp4\", \"-r 1 /Users/nicolai/code/projects/emotionAPI_test/public/test2/image-%04d.jpeg\") { |progress| puts progress } # 0.2 ... 0.5 ... 1.0\n\n # Emotion Image API attempt\n if @frame.save\n uri = URI('https://api.projectoxford.ai/emotion/v1.0/recognize')\n uri.query = URI.encode_www_form({\n })\n\n data = File.read(\"./public/full color pic.png\")\n\n request = Net::HTTP::Post.new(uri.request_uri)\n # Request headers\n request['Ocp-Apim-Subscription-Key'] = '6f027d66bef64938872d4f519168495f'\n # Request body\n # request.body = data\n request['Content-Type'] = 'application/octet-stream'\n request.body = data\n # '{\"url\": \"http://localhost:4000/mark_zuck.mp4\"}'\n response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|\n http.request(request)\n end\n\n puts response.body\n # Capture response and save it into database each emotion at a time\n # Create chart from data; save it into db?\n else\n # TBD\n end\n # Failed Emotion Video API attempt\n # uri = URI('https://api.projectoxford.ai/emotion/v1.0/recognizeinvideo')\n # uri.query = URI.encode_www_form({\n # })\n\n # # data = File.read(\"./public/mark_zuck.mov\")\n\n # request = Net::HTTP::Post.new(uri.request_uri)\n # # Request headers\n # request['Ocp-Apim-Subscription-Key'] = '6f027d66bef64938872d4f519168495f'\n # # Request body\n # # request.body = data\n # request['Content-Type'] = 'application/octet-stream'\n # request.body = '{\"url\": \"http://localhost:4000/mark_zuck.mp4\"}'\n # response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|\n # http.request(request)\n # end\n\n # puts response.body\n\n\n # respond_to do |format|\n # if @frame.save\n # format.html { redirect_to @frame, notice: 'Frame was successfully created.' }\n # format.json { render :show, status: :created, location: @frame }\n # else\n # format.html { render :new }\n # format.json { render json: @frame.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def create\n # byebug\n image_file = Cloudinary::Uploader.upload(params[:image_file])\n audio_file = Cloudinary::Uploader.upload(params[:audio_file], :resource_type => :video)\n sample = Sample.create(image_file: image_file[\"url\"], audio_file: audio_file[\"url\"], name: params[:name], genre: params[:genre], collection: params[:collection])\n\n render json: sample\n end",
"def embed_media( options = {} )\n width = options[:width] || 633\n height = options[:height] || 475\n\n if options[:link] && options[:uploaded_image_url]\n raise ArgumentError, \"embed_media cannot have both \\\"link\\\" and\n \\\"uploaded_image_url\\\" arguments\"\n end\n\n if options[:link]\n return embed_video(link: options[:link], \n width: width, \n height: height,\n class: options[:class])\n\n elsif options[:uploaded_image_url]\n return \"<img src=\\\"#{options[:uploaded_image_url]}\\\" class=\\\"#{options[:class]}\\\">\".html_safe\n\n elsif !options[:uploaded_image_url] && !options[:link]\n return broken_image_tag(height, width, options[:class])\n end\n\n end",
"def play\n \n end",
"def run\n\n @options = @video.convert_options\n @output_file = \"#{generate_path @video.name}/#{@video.name}#{@options[:postfix]}.#{@options[:extension]}\"\n\n command = \"#{CONFIG[:ffmpeg_binary]} -y -i '#{@video.path}' #{@options} '#{@output_file}'\"\n output = \"\"\n convert_error = true\n\n # before convert callbacks\n Hook.exec :before_convert, @video, command\n\n # process video\n Open3.popen3(command) do |stdin, stdout, stderr|\n stderr.each \"r\" do |line|\n VTools.fix_encoding line\n output << line\n\n # we know, that all is not so bad, if \"time=\" at least once met\n if line.include? \"time=\"\n\n convert_error = false # that is why, we say \"generally it's OK\"\n\n if line =~ /time=(\\d+):(\\d+):(\\d+.\\d+)/ # ffmpeg 0.8 and above style\n time = ($1.to_i * 3600) + ($2.to_i * 60) + $3.to_f\n elsif line =~ /time=(\\d+.\\d+)/ # ffmpeg 0.7 and below style\n time = $1.to_f\n else # in case of unexpected output\n time = 0.0\n end\n progress = time / @video.duration\n Hook.exec :in_convert, @video, progress # callbacks\n end\n end\n end\n\n raise ProcessError, output.split(\"\\n\").last if convert_error # exit on error\n\n # callbacks\n unless error = encoding_invalid?\n Hook.exec :convert_success, @video, @output_file\n else\n Hook.exec :convert_error, @video, error, output\n raise ProcessError, error # raise exception in error\n end\n\n encoded\n end",
"def perform(url = nil)\n # 以此影片為範例,出處: Videvo\n url = 'https://cdn.videvo.net/videvo_files/video/free/2013-05/originalContent/DigitalCountdownTimerVidevo.mov'\n video_name = parse_video_name(url)\n video_file_path(video_name)\n download_video(url)\n converter\n rescue StandardError => e\n logger.error \"[Video::HandleVideoWorker] ERROR:\\n #{e.inspect}\\n #{e.backtrace}\"\n end",
"def convert_command\n\t\t\tflv = File.join(File.dirname(self.video.path), \"#{self.video_file_name}.flv\")\n\t\t\tmpeg4 = File.join(File.dirname(self.video.path), \"#{self.video_file_name}.mp4\")\n\t\t\tFile.open(flv, 'w')\n\t\t\tFile.open(mpeg4, 'w')\n\t\t\t#command = \"cd log/ && ffmpeg -i #{ self.video.path } -ar 22050 -ab 32 -s 480x360 -vcodec flv -r 25 -qscale 8 -f flv -y #{ flv }; ffmpeg -i #{ self.video.path } -an -pass 1 -vcodec libx264 -vpre fastfirstpass -b 1024k -bt 1024k -threads 0 -y #{ mpeg4 }\"\n\t\t\tcommand = \"cd log/ && ffmpeg -i '#{ self.video.path }' -ar 22050 -ab 32 -s 480x360 -vcodec flv -r 25 -qscale 8 -f flv -y '#{ flv }'; ffmpeg -threads 4 -i '#{ self.video.path }' -r 29.97 -vcodec libx264 -flags +loop -cmp +chroma -deblockalpha 0 -deblockbeta 0 -crf 24 -bt 256k -refs 1 -coder 0 -subq 5 -g 250 -keyint_min 25 -level 30 -qmin 10 -qmax 51 -sc_threshold 40 -i_qfactor 0.71 -acodec libfaac -ab 128k -ar 48000 -ac 2 '#{ mpeg4 }'\"\n\n\t\t\tcommand.gsub!(/\\s+/, \" \")\n\t\t\tlogger.debug command\n\t\tend",
"def make\n App.out.make_audio_file\nend",
"def encode(file=\"output.avi\")\n puts \"encoding video #{file}\"\n MEncoder.encode do |mencoder|\n mencoder.input = \"mf://#{@frames_dir.file_list(@date, @hour, @length, @frame_type).join(',')}\"\n mencoder.mf.fps = 2\n mencoder.mf.type = \"jpg\"\n mencoder.output_video_codec = :lavc\n mencoder.lavc.vcodec = \"mpeg4\"\n mencoder.lavc.mbd = 2\n mencoder.lavc.trell = true\n mencoder.output_audio_codec = 'copy'\n mencoder.output = file\n end\n end",
"def multiplex(movie, video_file, audio_file)\n codecs = ['xvid', 'mpeg2', 'mp4']\n codec = 'xvid'\n if codecs.include?(movie.format)\n codec = movie.format\n end\n \n if(codec == \"xvid\")\n multiplexer = XvidMultiplexer.new\n multiplexer.multiplex(movie, video_file, audio_file)\n elsif(codec == \"mpeg2\")\n multiplexer = Mpeg2Multiplexer.new\n multiplexer.multiplex(movie, video_file, audio_file)\n elsif(codec == \"mp4\")\n multiplexer = Mp4Multiplexer.new\n multiplexer.multiplex(movie, video_file, audio_file)\n end\n \n end",
"def index\n #@deck = Powerpoint::Presentation.new\n # Creating an introduction slide:\n # title = 'Bicycle Of the Mind'\n # subtitle = 'created by Steve Jobs'\n # @deck.add_intro title, subtitle\n\n # Creating a text-only slide:\n # Title must be a string.\n # Content must be an array of strings that will be displayed as bullet items.\n # title = 'Why Mac?'\n # content = ['Its cool!', 'Its light.']\n # @deck.add_textual_slide title, content\n\n # Creating an image Slide:\n # It will contain a title as string.\n # and an embeded image\n #title = 'Everyone loves Macs:'\n #subtitle = 'created by Steve Jobs'\n #content = ['Its cool!', 'Its light.']\n #image_path = ActionController::Base.helpers.asset_path('/app/assets/images/ss.png').to_s\n #image = view_context.image_path 'ss.png'\n #url = 'http://localhost:3000' + image\n #image = view_context.image_path 'https://res.cloudinary.com/indoexchanger/image/upload/v1501168483/qxbvro2yhvibid0ra5rp.jpg'\n #puts image\n #@deck.add_pictorial_slide title, url\n #@deck.add_textual_slide title, subtitle\n #\n\n # Specifying coordinates and image size for an embeded image.\n # x and y values define the position of the image on the slide.\n # cx and cy define the width and height of the image.\n # x, y, cx, cy are in points. Each pixel is 12700 points.\n # coordinates parameter is optional.\n # coords = {x: 124200, y: 3356451, cx: 2895600, cy: 1013460}\n # @deck.add_pictorial_slide title, image_path, coords\n\n # Saving the pptx file to the current directory.\n #@deck.save('mps.pptx')\n # @products = Product.all\n # \n \n @presentation = RubySlides::Presentation.new\n \n chart_title = \"Chart Slide exported from ruby\"\n chart_series = [\n {\n column: \"Col1\",\n rows: [\"Lorem\", \"Ipsum\", \"Dolar\", \"Ismet\"],\n values: [\"1\", \"3\", \"5\", \"7\"]\n },\n {\n column: \"Col2\",\n color: 'FF9800',\n rows: [\"A\", \"B\", \"C\", \"D\"],\n values: [\"2\", \"4\", \"6\", \"8\"]\n }\n ]\n @presentation.chart_slide chart_title, chart_series\n\n @presentation.save('mps.pptx')\n\n @products = Product.order('created_at DESC')\n respond_to do |format|\n format.html\n format.xlsx {\n response.headers['Content-Disposition'] = 'attachment; filename=\"all_products.xlsx\"'\n }\n end\n end",
"def create\n @event = Event.new(event_params)\n sync = \"\"\n respond_to do |format|\n if @event.save\n if @event.ppts_url != nil\n #@event.has_ppts = true\n #Crea carpeta para guardar ppts\n `mkdir public/uploads/event/ppts/#{@event.id}/ppt`\n #Convierte ppts en imagenes\n `convert public/uploads/event/ppts/#{@event.id}/event.pdf public/uploads/event/ppts/#{@event.id}/ppt/ppt.jpg`\n #Cuenta el numero de diapositivas\n file_count = Dir.glob(File.join(\"public/uploads/event/ppts/#{@event.id}/ppt\", '**', '*')).select { |file| File.file?(file) }.count\n pptss = \"\"\n #Crea un string con las rutas de las imagenes y inicializa las sincronizacion en 0\n for i in 0..(file_count - 1)\n pptss = pptss + \"/uploads/event/ppts/#{@event.id}/ppt/ppt-#{i}.jpg,\"\n sync = sync + \"0,\"\n end\n @event.slides = pptss\n @event.sync = sync\n end\n if @event.video_url != nil\n tv = `ffprobe -v error -select_streams v:0 -show_entries stream=duration \\ -of default=noprint_wrappers=1:nokey=1 public/uploads/event/video/#{@event.id}/default.mp4`\n tvi = (tv.to_i/2)\n puts tvi\n tvisi = Time.at(tvi).utc.strftime(\"%H:%M:%S\")\n puts tvisi\n `ffmpeg -i public/uploads/event/video/#{@event.id}/default.mp4 -r 1 -ss #{tvisi} -t 1 public/uploads/event/video/#{@event.id}/screamshot.jpg` if !@event.event_type\n end\n a = (\"a\"..\"z\")\n b = (0..9)\n c = a.to_a + b.to_a\n key = c.shuffle[0,20].join\n @event.iframe = \"JGrix\" + key\n @event.save\n format.html {\n if @event.state == 4\n redirect_to events_ondemand_path, notice: 'El Evento se creo correctamente'\n else\n redirect_to events_path, notice: 'El Evento se creo correctamente'\n\n end\n }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def play; end",
"def upload(file)\n logger.info 'Downloading video...'\n path = file.download.path\n movie = FFMPEG::Movie.new(path)\n @mp4_path = encode('mp4', movie, '-vcodec libx264 -strict -2')\n @webm_path = encode('webm', movie, '-vcodec libvpx -acodec libvorbis -f webm -deadline realtime -s 640x480')\n end",
"def capture\n filename = Time.now.to_f.to_s + '.png'\n \n file = \"#{dir}/#{filename}\"\n \n capture_time = Time.now\n \n @frame_capture.call(file)\n volume = @audio_sampler.call if @audio_sampler\n \n File.exist? file or raise \"Couldn't capture frame\"\n\n sample = Lava::Sample.new( :file => file, :time => capture_time, :last => samples.last, :volume => volume )\n samples << sample\n sample\n end",
"def startPlayback\n end",
"def quick_transcode(input, options={})\n quality = options[:quality] || 19\n log = options[:log]\n output = input.gsub(/\\.[^.]*$/, '.m4v')\n\n # TODO Next time this is needed, make the options below detect its use.\n pcm_input = nil\n # extract the audio to PCM with ffmpeg first because sometimes HandBrakeCLI has problems\n # pcm_input = \"#{input}-temp.avi\"\n # command = <<-EOS\n # nice -n 19 ffmpeg -i \"#{input}\" -acodec adpcm_ms -vcodec copy \"#{pcm_input}\"\n # EOS\n # input = pcm_input # we no longer care about the original.\n # command = command.strip\n # # log.info \"Extracting audio to PCM with ffmpeg...\"\n # puts \"Prepping with ffmpeg using: #{command}\"\n # system(command)\n\n # x264opts will be passed to the '-x' argument of HandBrakeCLI\n # I took these from the advanced tab of the HandBrake 0.9.5 x86_64 (2011010300) GUI for the AppleTV preset\n x264opts = {\n :'cabac' => '0',\n :'ref' => '2',\n :'me' => 'umh',\n :'b-pyramid' => 'none',\n :'b-adapt' => '2',\n :'weightb' => '0',\n :'trellis' => '0',\n :'weightp' => '0',\n :'vbv-maxrate' => '9500',\n :'vbv-bufsize' => '9500' }\n\n options = {\n :'-i' => %{\"#{input}\"},\n :'-o' => %{\"#{output}\"},\n :'--crop' => '0:0:0:0',\n :'-X' => '1280',\n :'-Y' => '720',\n :'-e' => 'x264',\n :'-q' => quality,\n :'--loose-anamorphic' => nil,\n :'--markers' => nil, # chapter markers\n :'-x' => x264opts.map{|k,v| \"#{k}=#{v}\"}.join(':') }\n\n # Now transcode the video and re-mux / transcode in the audio extracted by ffmpeg\n command = \"nice -n 19 HandBrakeCLI #{options.map{|k,v| \"#{k} #{v}\"}.join(\" \")}\"\n command = command.gsub(/ +/, ' ').strip\n # puts \"doing it!: #{command}\"\n system(command) # backticks wont work here.\n\n # if we're using the intermediate pcm-audio step, clean up after ourselves.\n if pcm_input\n # log.info \"Cleaning up ffmpeg intermediate step...\"\n File.delete(pcm_input)\n end\n\n if options[:source_type] == \"mkv\"\n mkv_options = []\n mkvoptions[:log] = log if log\n mkv_file = MkvFile.new(source_file, mkv_options)\n ##### TODO extract any chapter info and import it\n\n if mkv_file.subtitles?\n srt_file = mkv_file.export_subtitles_as_srt\n\n ##### Mux the M4V and SRT files\n log.info \"Muxing subtitles into .M4V file '#{m4v_file}' ...\" if log\n `SublerCLI -i \"#{m4v_file}\" -s \"#{srt_file}\"`\n\n mkv_file.cleanup_subtitle_files\n end\n end\nend",
"def play\n @selected_slide_key = @interface.current_slide.short_name\n respond_to do |format|\n format.html { render :play, layout: 'etm' }\n format.js\n end\n end",
"def main_audio ; end",
"def create\n @store = Store.new(params[:store])\n @store.save\n unless params[:image].nil?\n params[:image].each_value do |image|\n unless image.nil? || image[:photo].nil?\n @picture = Image.new\n @picture.source_file_name = image[:photo].original_filename\n @picture.source_content_type = image[:photo].original_filename.split(\".\").last\n #@picture.source_file_size = File.size(params[:image][:photo])\n @picture.source_updated_at =Time.now\n\n @picture.photo = image[:photo]\n @picture.save\n\n @asset=Asset.new\n @asset.assetable_id = @picture.id\n @asset.assetable_type = \"image\"\n @asset.price = image[:price][:price]\n @asset.store_id = @store.id\n @asset.save!\n end\n end\n end\n\n unless params[:video].nil?\n params[:video].each_value do |video|\n unless video.nil? || video[:file].nil?\n file = video[:file]\n @movie=Video.new\n name= video[:file].original_filename\n dir= RAILS_ROOT + \"/public/movies\"\n Dir.mkdir(dir) unless File.directory?(dir)\n path=File.join(dir,name)\n if File.extname(path) == \".swf\" || File.extname(path) == \".mpeg\" || File.extname(path) == \".wmv\" || File.extname(path) == \".flv\" || File.extname(path) == \".mpeg4\" || File.extname(path) == \".mpg\" || File.extname(path) == \".avi\"\n parse_file = File.open(path, \"wb\") { |f| f.write(file.read) }\n\n @video=Video.new(:source_file_name => name, :source_file_size => File.new(path).size, :source_updated_at => Time.now, :source_content_type => File.extname(path))\n @video.title = video[:title]\n @video.description = video[:description]\n @video.save!\n @video.category_videos.create(:category_id => video[:category][:category_id].to_i)\n set_video_search(@video.id,video[:title], video[:description])\n image_file=video[:image][:photo]\n @image=VideoImage.new\n dir=RAILS_ROOT + \"/public/video_image\"\n name= video[:image][:photo].original_filename\n path=File.join(dir,name)\n Dir.mkdir(dir) unless File.directory?(dir)\n parse_file = File.open(path, \"wb\") { |f| f.write(image_file.read) }\n system(\"convert #{path} -resize 400x225\\! #{path}\")\n @image.source_file_name = video[:image][:photo].original_filename\n @image.source_content_type = video[:image][:photo].original_filename.split(\".\").last\n @image.photo = video[:image][:photo]\n # @image.source_file_size = File.size(video[:image][:photo])\n @image.source_updated_at =Time.now\n @image.video_id = @video.id\n @image.save!\n\n @asset = Asset.new\n @asset.assetable_id = @video.id\n @asset.assetable_type = \"video\"\n @asset.store_id = @store.id\n @asset.price = video[:price][:price]\n @asset.save!\n end\n end\n end\n end\n respond_to do |format|\n format.html { redirect_to stores_path }\n format.xml { render :xml => @store, :status => :created, :location => @store }\n end\n end",
"def create_video_object(obj)\n return content_tag(:div, content_tag(:iframe, \"\", :src => obj.link, :width => \"100%\"), :style => \"position:absolute; top: #{obj.y}px; left: #{obj.x}px;\")\n end",
"def forwardvideo\n Pusher['photo-call'].trigger('next-video' , {\n control: \"1\"\n })\n render text: \"ok\"\n end",
"def video\n first_stream_of :video\n end",
"def screencast(duration: 6, scale: 1, window: true)\n \n fileout = @file_out.sub(/\\.\\w+$/,'%d.png')\n \n puts 'fileout: ' + fileout if @debug\n \n x4ss = X4ss.new fileout, mouse: true, window: true\n mode = window ? :window : :screen\n sleep 2; x4ss.record duration: duration, mode: mode\n x4ss.save\n \n fileout2 = fileout.sub(/(?=%)/,'b')\n EasyImgUtils.new(fileout, fileout2).scale(scale) unless scale == 1\n EasyImgUtils.new(fileout2, @file_out).animate\n \n end",
"def show\n @iframe = @video.iFrame_Source.html_safe\n end",
"def copy_audio(stream, index)\n disposition = (index == 0) ? 'default' : 'none'\n title = (stream[:channels] > 2) ? 'Surround Track' : 'Stereo Track'\n return [ \"-map 0:a:#{stream[:index]}\",\n \"-metadata:s:a:#{index} title='#{title}'\",\n \"-metadata:s:a:#{index} language=#{stream[:language]}\",\n \"-disposition:a:#{index} #{disposition}\",\n \"-codec:a:#{index} copy\" ]\nend",
"def convert(file_info)\n input_name = Shellwords.escape(file_info[:filename])\n input_suffix = File.extname input_name\n output_name = File.basename input_name, input_suffix\n output_suffix = \"mp4\"\n command = [ \"ffmpeg\", \"-y\", \"-i #{input_name}\", \"-max_muxing_queue_size 9999\", \"-map_chapters -1\" ]\n\n if (file_info[:video].empty? && !file_info[:audio].empty?) || input_suffix == '.flac' || input_suffix == '.mp3' || input_suffix == '.aiff'\n #\n # Audio-only files are converted to either ALAC if the source was FLAC, or\n # AAC for all other formats.\n #\n stream = file_info[:audio][0]\n case stream[:codec]\n when \"alac\"\n command << \"-map 0:a:#{stream[:index]}\" << \"-codec:a copy\"\n when \"flac\"\n command << \"-map 0:a:#{stream[:index]}\" << \"-codec:a alac\"\n when \"mp3\"\n command << \"-map 0:a:#{stream[:index]}\" << \"-codec:a alac\"\n else\n command << \"-map 0:a:#{stream[:index]}\" << \"-codec:a aac\" << \"-ar:a:0 48k\" << \"-ab:a 256k\"\n end\n output_suffix = \"m4a\"\n elsif !file_info[:video].empty? && !file_info[:audio].empty?\n # Removes all of the default metadata that junks up the final file.\n command << \"-map_metadata -1\"\n \n # Maps the video track\n command << \"-map 0:v:0\" << \"-metadata:s:v:0 language=und\" << \"-metadata:s:v:0 title='Video Track'\"\n\n #\n # The video track is copied if the codec is h265 (hevc) and a video tag\n # is added so that Apple products understand the format. Otherwise, the\n # video track is copied if it's in h264 format and the frame size is\n # to remain the same, or it's converted to h264 using high-quality\n # settings.\n #\n if \"hevc\" == file_info[:video][:codec]\n command << \"-codec:v copy -vtag hvc1\"\n elsif \"h264\" == file_info[:video][:codec] && !Options.options[:P480] && !Options.options[:P720]\n command << \"-codec:v copy\"\n else\n # This converts the video using settings that provide nearly visual\n # lossless results.\n output_suffix = \"mp4\"\n command << \"-codec:v libx265\" << \"-vtag hvc1\" << \"-preset:v slow\" << \"-profile:v main\" << \"-crf:v 18\" << \"-threads:v 0\"\n\n # Converts HD video to wide-screen 720P if necessary.\n command << \"-vf:v scale=1280:-1\" if Options.options[:P720]\n\n # Converts HD video to wide-screen 480P if necessary.\n command << \"-vf:v scale=854:-1\" if Options.options[:P480]\n end\n\n # Convert all of the audio tracks to AAC (stereo) and AC3 (multi-channel)\n index = 0\n file_info[:audio].each do |stream|\n index, c = convert_audio(stream, index)\n command << c\n end\n\n if file_info.key?(:subtitle) && !file_info[:subtitle].nil? && !file_info[:subtitle].empty?\n command << \"-map 0:s:#{file_info[:subtitle][:index]}\" << \"-metadata:s:s:0 language=eng\" << \"-metadata:s:s:0 title='Subtitle Track'\"\n command << ('dvd_subtitle' == file_info[:subtitle][:codec] ? \"-codec:s:0 copy\" : \"-codec:s:0 mov_text\")\n end\n\n end\n\n command << \"#{output_name}.#{output_suffix}\"\n\n if Options.options[:dump]\n puts command.join(' ')\n exit\n end\n\n #\n # Starts the transcoding process.\n #\n puts file_info[:filename]\n progress = ProgressBar.create(:format => \"%t |%B| %e\",\n :total => file_info[:duration] + 1,\n :title => \"Encoding Progress\")\n execute(command, true) do |line|\n begin\n line.match /time=(\\d\\d):(\\d\\d):(\\d\\d)/ do |match|\n if match.length == 4\n time = match[1].to_i * 3600 + match[2].to_i * 60 + match[3].to_i\n progress.progress = time\n end\n end\n rescue\n # Some UTF-8 characters can cause match to throw, but these characters are not used by this script.\n end\n end\n progress.finish\nend",
"def test01()\n sourceMovie = File.join($directory, \"images/418_clip5_SD.m4v\")\n begin \n # Create the list of commands object, ready to have commands added to it.\n theCommands = SmigCommands.new\n theCommands.saveresultstype = :lastcommandresult\n\n # 1. Create movie importer and assign frame to image collection.\n # Basically after the first block of commands is run, the movie importer\n # is closed automatically in the cleanup commands.\n movieImporterName = SecureRandom.uuid\n movieObject = theCommands.make_createmovieimporter(sourceMovie,\n name: movieImporterName)\n\n frameTime = MovieTime.make_movietime(timescale: 600, timevalue: 900)\n trackID = MovieTrackIdentifier.make_movietrackid_from_mediatype(\n mediatype: :vide, trackindex: 0)\n \n imageId = SecureRandom.uuid\n assignFrameCommand = CommandModule.make_assignimage_frommovie_tocollection(\n movieObject, frametime: frameTime, tracks: [trackID], identifier: imageId)\n theCommands.add_command(assignFrameCommand)\n \n # 2. Create the window context\n winRect = MIShapes.make_rectangle(origin: { x: 100, y: 50 },\n size: { width: 400, height: 252 })\n windowObject = theCommands.make_createwindowcontext(rect: winRect,\n addtocleanup: false)\n \n # 3. Draw the image in the image collection to the window context.\n drawImageElement = MIDrawImageElement.new()\n drawImageElement.set_imagecollection_imagesource(identifier: imageId)\n drawImageElement.destinationrectangle = MIShapes.make_rectangle(width: 400,\n height: 252)\n drawElementCommand = CommandModule.make_drawelement(\n windowObject, drawinstructions: drawImageElement, createimage: false)\n theCommands.add_command(drawElementCommand)\n Smig.perform_commands(theCommands)\n \n # The first lot of commands to be run have run. I've split up the performing\n # of commands so that we get to see the content actually drawn to the window.\n # 4. Create the new command list.\n theCommands = SmigCommands.new\n theCommands.saveresultstype = :lastcommandresult\n \n # 5. Draw the image in image collection to the window context\n theCommands.add_command(drawElementCommand)\n \n # 6. Remove the image from the image collection\n removeCommand = CommandModule.make_removeimage_fromcollection(imageId)\n theCommands.add_command(removeCommand)\n Smig.perform_commands(theCommands)\n \n # 7. Now attempt to draw the image again.\n begin\n Smig.perform_command(drawElementCommand)\n puts \"We shouldn't get here as perform command should have an exception\"\n puts \"File: #{$filename}, Line: #{__LINE__}\"\n rescue\n end\n \n # 8. Now close the window context.\n Smig.close_object(windowObject)\n\n rescue RuntimeError => e\n $errorcode = Smig.exitvalue\n unless $errorcode.zero?\n puts \"Exit string: \" + Smig.exitstring\n puts \" Exit status: \" + $errorcode.to_s\n end\n puts e.message\n puts e.backtrace.to_s\n end\nend",
"def define_youtube_player_tag(c,data)\n c.define_tag 'player' do |tag|\n width=(tag.attr['width']||(data[:video].width.to_i > 0 ? data[:video].width.to_i : nil)||400).to_i\n height=(tag.attr['height']||(data[:video].height.to_i > 0 ? data[:video].height.to_i : nil)||300).to_i\n color=tag.attr['bg'] || \"#FFFFFF\"\n if !editor?\n if data[:video].thumbnail_file_id && !tag.attr['no_thumb']\n thumbnail_file = DomainFile.find_by_id(data[:video].thumbnail_file_id)\n img_src = \"<a href='javascript:void(0);' onclick='writeVideoPlayer#{paragraph.id}();'><img src='#{thumbnail_file.url}' width='#{width}' height='#{height}'/></a>\"\n autoplay='1'\n else\n autoplay='0'\n end\n autoplay='1' if data[:video].autoplay\n \n <<-PLAYER_CODE\n <div id='video_player_#{paragraph.id}' style='width:#{width}px;height:#{height}px;'>#{img_src}</div>\n <script type=\"text/javascript\">\n function writeVideoPlayer#{paragraph.id}() {\n swfobject.embedSWF(\"http#{\"s\" if request.ssl?}://www.youtube.com/v/#{data[:video].video_id}&rel=0&autoplay=#{autoplay}\",\"video_player_#{paragraph.id}\",\"#{width}\",\"#{height}\",\"8\",\"\",\n { playerMode: \"embedded\" },\n { wmode: \"transparent\", bgcolor: \"#{color}\" });\n }\n #{\"writeVideoPlayer#{paragraph.id}();\" if tag.attr['no_thumb'] || !thumbnail_file}\n </script>\n PLAYER_CODE\n else\n \"<div id='video_player_#{paragraph.id}' style='width:#{width}px;height:#{height}px;'></div>\"\n end\n end \n end",
"def embedyoutube(videonumber)\n %{\n <body style=\"margin:0;\">\n <object height=\"100%\" width=\"100%\"><param name=\"movie\" value=\"http://www.youtube.com/v/#{videonumber}&autoplay=1\" /><embed height=\"100%\" src=\"http://www.youtube.com/v/#{videonumber}&autoplay=1\" type=\"application/x-shockwave-flash\" width=\"100%\"></embed></object>\n </body>\n }\n end"
] |
[
"0.6927799",
"0.6225185",
"0.6198179",
"0.6175752",
"0.61704004",
"0.60580444",
"0.6045214",
"0.6028644",
"0.5981926",
"0.5957051",
"0.5941192",
"0.5835128",
"0.58052325",
"0.5803109",
"0.5773791",
"0.56421083",
"0.5614227",
"0.55597156",
"0.5538567",
"0.5537054",
"0.5532856",
"0.5528561",
"0.54960966",
"0.5492019",
"0.5467071",
"0.5467071",
"0.54513955",
"0.5444293",
"0.5433737",
"0.5428514",
"0.540026",
"0.5383101",
"0.5363657",
"0.5356443",
"0.5353641",
"0.53519183",
"0.5351255",
"0.53508514",
"0.53458244",
"0.5321939",
"0.5297688",
"0.5288196",
"0.5272566",
"0.5263748",
"0.5254152",
"0.524472",
"0.52380115",
"0.52288425",
"0.52262133",
"0.52156156",
"0.52020496",
"0.5192423",
"0.51915485",
"0.51888067",
"0.51874876",
"0.51758003",
"0.51704335",
"0.51642597",
"0.5159835",
"0.51470214",
"0.51445246",
"0.5140761",
"0.5133498",
"0.5131296",
"0.5118887",
"0.51073664",
"0.51059777",
"0.5104673",
"0.50760865",
"0.50694245",
"0.5066158",
"0.50536907",
"0.5049205",
"0.5037244",
"0.50369716",
"0.50350845",
"0.5022886",
"0.50227267",
"0.5019567",
"0.50167847",
"0.5010327",
"0.5008001",
"0.50003105",
"0.49994388",
"0.49991524",
"0.4998441",
"0.4993518",
"0.4981653",
"0.49790728",
"0.49782842",
"0.49764502",
"0.49720633",
"0.4961206",
"0.49587944",
"0.4958459",
"0.49577013",
"0.49541682",
"0.4953662",
"0.4948705",
"0.49390483"
] |
0.78131044
|
0
|
Concatenate slide videos together into one video
|
def combine_video(presentation)
term = presentation['term']
args = []
for slide in presentation['slides']
args.push command_arg(slide['video'])
end
args = args.join(' ')
combined_arg = command_arg("#{BUILD_DIR}/#{term}/#{term}-combined.mpg")
final = "#{DIST_DIR}/#{term}/#{term}.avi"
final_arg = command_arg(final)
`cat #{args} > #{combined_arg}`
`ffmpeg -y -i #{combined_arg} -r 25 -qscale:v 1 #{final_arg}`
presentation['video'] = final
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def mergeVideos()\n pathToIntermediates=\"#{$PATHTOGENERATEINTERMEDIATES}/#{@meetingData.meetingId}\"\n vidList=\"#{pathToIntermediates}/vidList.txt\"\n # Create a txt file with the lists of all videos to concatenate\n system \"echo >#{vidList}\"\n (0...@objects.length).each do |e|\n system \"echo file \\'#{pathToIntermediates}/vid-#{e}.mp4\\' >> #{vidList}\" \n end\n # Concatenate videos from the txt file\n system \"ffmpeg -f concat -safe 0 -i #{vidList} -c copy #{pathToIntermediates}/output.mp4 -loglevel quiet\"\n end",
"def combine_video(movie)\n \n trimmed_visuals = \"\"\n contents = movie.visual_sequence.visuals\n contents.each{|visual|\n trimmed_visuals += \" #{visual.file}\"\n }\n video_file = movie.project.final + \"/videotrack.avi\"\n cmd = @settings['video_combine'].dup\n cmd.sub!('<source>', trimmed_visuals)\n cmd.sub!('<target>', video_file)\n puts \"Combining videos\"\n puts cmd\n system(cmd)\n return video_file\n end",
"def combine_files files\n tempfile = Tempfile.new(\"video\")\n path = tempfile.path\n tempfile.close\n `cat #{files.join(\" \")} > #{path}.avi`\n path\n end",
"def video_gen(slide)\n term = slide['term']\n kind = slide['kind']\n index = slide['index']\n audio = slide['audio']\n image = slide['image']\n raise \"audio is required fof #{term}\" unless audio\n raise \"image is required fof #{term}\" unless image\n file_name = file_name_gen(slide, \".mpg\")\n audio = command_arg(slide['audio'])\n image = command_arg(slide['image'])\n video = command_arg(file_name)\n `ffmpeg -loop 1 -y -i #{image} -i #{audio} -acodec libmp3lame -vcodec mpeg4 -shortest -qscale:v 1 #{video}`\n slide['video'] = file_name\nend",
"def convertSlidesToVideo(presentationSlidesStart)\n presentationSlidesStart.each do |item|\n # Path to original svg\n originalLocation = File.join(item[\"filepath\"], item[\"filename\"])\n # Save conversion with similar path in tmp\n dirname = File.join(TMP_PATH, item[\"presentationName\"], \"svgs\")\n finalLocation = File.join(dirname, changeFileExtensionTo(item[\"filename\"], \"mp4\"))\n\n if (!File.exists?(finalLocation))\n # Create path to save conversion to\n unless File.directory?(dirname)\n FileUtils.mkdir_p(dirname)\n end\n\n # Convert to png\n image = MiniMagick::Image.open(originalLocation)\n image.format 'png'\n pathToImage = File.join(dirname, changeFileExtensionTo(item[\"filename\"], \"png\"))\n image.write pathToImage\n\n # Convert to video\n # Scales the output to be divisible by 2\n system \"ffmpeg -loglevel quiet -nostdin -nostats -y -r 30 -i #{pathToImage} -vf crop='trunc(iw/2)*2:trunc(ih/2)*2' #{finalLocation}\"\n end\n\n item[\"filepath\"] = dirname\n item[\"filename\"] = finalLocation.split('/').last\n end\n\n return presentationSlidesStart\nend",
"def video(filename, opts = {})\n n = input(filename, opts)\n @videos << n\n n\n end",
"def add_videos(gallery_name, video_url_list = [\"http://www.youtube.com/watch?v=Jr-ubPWN7n4\", \"http://www.youtube.com/watch?v=K-KkSiIjlm0\"], _browser = @browser)\n Log.logger.info(\"Adding New Videos into the Gallery.\")\n add_media_action(gallery_name, video_url_list, _browser)\n end",
"def do_video_job(*inputs)\n puts \"Creating output movie: #{@output}\"\n do_system(\"cp\", inputs.first, @output) # FIXME\n # TODO: http://ffmpeg.org/trac/ffmpeg/wiki/How%20to%20concatenate%20%28join,%20merge%29%20media%20files\n # do_system\n # dir & .work -> output to: @output\n end",
"def video_background_with_features(slides, options={})\n default_options = { hide_for_small: true, hide_arrow: false, pattern_overlay: true }\n options = default_options.merge options\n\n hide_for_small = (options[:hide_for_small]) ? \"hide-for-small\" : \"\"\n ret = \"\"\n\n if slides.size > 0\n if slides.pluck(:slide_file_name).find{|f| /^(.*)\\.webm|mp4$/ =~ f}\n fname = $1\n\n video_sources = \"\"\n if webm = slides.find{|f| /webm/i =~ f.slide_content_type && /^#{fname}\\./ =~ f.slide_file_name }\n video_sources += \"<source src='#{ webm.slide.url }' type='#{ webm.slide_content_type }'/>\"\n end\n\n if ogv = slides.find{|f| /ogv/i =~ f.slide_content_type && /^#{fname}\\./ =~ f.slide_file_name }\n video_sources += \"<source src='#{ ogv.slide.url }' type='video/ogg ogv' codecs='theora, vorbis'/>\"\n end\n\n if mp4 = slides.find{|f| /mp4/i =~ f.slide_content_type && /^#{fname}\\./ =~ f.slide_file_name }\n video_sources += \"<source src='#{ mp4.slide.url }' type='#{ mp4.slide_content_type }'/>\"\n end\n poster = slides.find{|f| /jpg|jpeg|png/i =~ f.slide_content_type && /^#{fname}\\./ =~ f.slide_file_name }\n\n ret += content_tag(:video, video_sources.html_safe,\n poster: (poster) ? poster.slide.url : '',\n id: \"video_background\",\n preload: \"auto\",\n autoplay: \"true\",\n loop: \"loop\",\n muted: \"true\",\n volume: 0)\n\n if options[:pattern_overlay]\n ret += content_tag(:div, \"\", id: \"video_pattern\")\n end\n\n if anim = slides.find{|f| /gif/i =~ f.slide_content_type && /^#{fname}\\./ =~ f.slide_file_name }\n ret += content_tag(:div, class: \"bg-gif\") do\n image_tag( anim.slide.url, lazy: false )\n end\n elsif poster\n ret += content_tag(:div, class: \"bg-gif\") do\n image_tag( poster.slide.url, lazy: false )\n end\n end\n\n if website.homepage_headline\n if website.homepage_headline_product_id\n headline_slide = content_tag(:h1, website.homepage_headline)\n product = Product.find(website.homepage_headline_product_id)\n if product.name.match(/^\\d*$/)\n headline_slide += content_tag(:p, \"#{product.name} #{product.short_description_1}\")\n else\n headline_slide += content_tag(:p, product.name)\n end\n headline_slide += link_to(\"Learn More\", product, class: \"secondary button\")\n if product.in_production?\n headline_slide += buy_it_now_link(product, html_button: true)\n end\n elsif website.homepage_headline_product_family_id\n product_family = ProductFamily.find(website.homepage_headline_product_family_id)\n headline_slide = content_tag(:h1, product_family.name.titleize)\n headline_slide += content_tag(:p, website.homepage_headline)\n headline_slide += link_to(\"Learn More\", product_family, class: \"button\")\n else\n headline_slide = content_tag(:h1, website.homepage_headline)\n end\n headline_class = website.homepage_headline_overlay_class || \"large-6 small-12 columns\"\n ret += content_tag(:div, class: 'row headline_slide') do\n content_tag(:div, headline_slide, class: headline_class )\n end\n else\n ret += content_tag(:div, class: \"container\", id: \"feature_spacer\") do\n if options[:tagline]\n content_tag(:h1, website.tagline, id: \"tagline\")\n end\n end\n end\n\n ret = content_tag(:div, ret.html_safe, id: \"video-container\", class: hide_for_small)\n ret += content_tag(:div, \"\", class: \"bouncing-arrow\") unless options[:hide_arrow]\n @leftover_slides = slides.reject{|f| /^#{fname}\\./ =~ f.slide_file_name }\n\n else\n\n ret += content_tag(:div, class: \"row\") do\n content_tag(:div, class: \"large-12 #{ hide_for_small } columns\") do\n orbit_slideshow(slides: slides, duration: 6000, navigation_arrows: false, transition: \"fade\")\n end\n end\n\n end\n end\n\n raw(ret)\n end",
"def show\n @videos = @video.responses\n @videos.unshift @video\n end",
"def generateVideos()\n #GENERATE AN INTERMEDIARY DIRECTORY WHERE WE'D STORE THE VIDEO FRAGMENTS\n pathToIntermediates=\"#{$PATHTOGENERATEINTERMEDIATES}/#{@meetingData.meetingId}\"\n puts \"generating intermediate videos in #{pathToIntermediates}\"\n createDirectoryIfNotExists(pathToIntermediates)\n \n dsPath=\"#{$PATHTOPUBLISHED}/#{@meetingData.meetingId}/deskshare\"\n presentationPath=\"#{$PATHTOPUBLISHED}/#{@meetingData.meetingId}/presentation\"\n \n #Scale to optimal resolution\n maxW=0\n maxH=0\n if Dir.exist?dsPath then\n maxW, maxH = getMaxResolution(dsPath)\n else \n maxW, maxH = getMaxResolution()\n end\n\n\n @objects.each_with_index{\n |val, index|\n puts \"Generating a #{val.class} video in interval [#{val.start_timestamp}, #{val.stop_timestamp}]\"\n val.generateVideo(pathToIntermediates, index, maxW, maxH)\n } \n end",
"def addWebCam()\n pathToWebcam = \"#{$PATHTOPUBLISHED}/#{@meetingData.meetingId}/video/webcams.webm\"\n pathToIntermediates= \"#{$PATHTOGENERATEINTERMEDIATES}/#{@meetingData.meetingId}\"\n\n # resize the webcam video\n puts \" Resizing webcam recording \"\n system \"ffmpeg -i #{pathToWebcam} -vcodec libx264 -vf scale=200:-1 #{pathToIntermediates}/webcamResized.mp4 -loglevel quiet\"\n \n # create a directory to store the final video(inside the published)\n pathToCompleteRecording=\"#{$PATHTOPUBLISHED}/#{@meetingData.meetingId}/completeVideo\"\n createDirectoryIfNotExists(pathToCompleteRecording)\n\n puts \"Adding webcam into final video\"\n #merge it with the presentation+deskshare video\n system \"ffmpeg -i #{pathToIntermediates}/output.mp4 -i #{pathToIntermediates}/webcamResized.mp4 -filter_complex \\' overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10 \\' #{pathToCompleteRecording}/finalcut.mp4 -loglevel quiet\"\n end",
"def concat other_frames\n raise TypeError unless other_frames.kind_of?(Frames)\n @avi.process_movi do |this_indices, this_movi|\n this_size = this_movi.size\n this_movi.pos = this_size\n other_frames.avi.process_movi do |other_indices, other_movi|\n while d = other_movi.read(BUFFER_SIZE) do\n this_movi.print d\n end\n other_meta = other_indices.collect do |m|\n x = m.dup\n x[:offset] += this_size\n x\n end\n this_indices.concat other_meta\n [other_indices, other_movi]\n end\n [this_indices, this_movi]\n end\n\n self\n end",
"def + other_frames\n r = self.to_avi\n r.frames.concat other_frames\n r.frames\n end",
"def video(*sources)\n options = sources.extract_options!.symbolize_keys\n sources = sources.shift if sources.size == 1\n\n if options[:poster]\n options[:poster] = asset_path(options[:poster])\n end\n\n if size = options.delete(:size)\n options[:width], options[:height] = size =~ /^\\d+x\\d+$/ ? size.split('x') : size\n end\n\n if sources.is_a?(Array)\n content_tag(:video, options) do\n sources.collect { |source| tag(:source, src: asset_path(source)) }.join(\"\\n\")\n end\n else\n tag(:video, options.reverse_merge(src: asset_path(sources)))\n end\n end",
"def render_video_directly options={}\n # render video player\n content_tag(:div) do\n options[:value].collect do |video_md5|\n l1 = video_md5[0..1]\n l2 = video_md5[2..3]\n content_tag(:video,\n content_tag(:source, \"I'm sorry; your browser doesn't support HTML5 video in MP4 with H.264.\",\n src: \"https://cspace-prod-02.ist.berkeley.edu/#TENANT#_nuxeo/data/#{l1}/#{l2}/#{video_md5}\",\n id: 'video_md5',\n type: 'video/mp4'),\n controls: 'controls',\n style: 'width: 640px;')\n end.join.html_safe\n end\n end",
"def combine(file,chapter)\n\t`ffmpeg -f concat -i \"#{file}\" -c copy chapters/Chapter\"#{chapter}\".aiff`\nend",
"def youtube_movie_embed\n str1 = \"http://www.youtube.com/v/\" \n str2 = movie_home_url.split('v=',2).last unless movie_home_url.nil?\n str3 = \"&hl=en_US&fs=1&\"\n return [str1,str2,str3].join \n end",
"def slide_video_tag(slide, field)\n if current_page?(controller: 'signs', action: 'play')\n if field == :background\n video_tag(slide.background, id: \"js-background-video\", class: \"ui-slide-background\", preload: \"auto\", loop: true)\n else\n video_tag(slide.foreground, id: \"js-foreground-video\", class: \"ui-slide-foreground\", preload: \"auto\", loop: true)\n end\n else\n if field == :background\n video_tag(slide.background, controls: true, muted: true, id: \"js-background-video\", class: \"ui-slide-background\", preload: \"auto\", loop: true)\n else\n video_tag(slide.foreground, controls: true, muted: true, id: \"js-foreground-video\", class: \"ui-slide-foreground\", preload: \"auto\", loop: true)\n end\n end\n end",
"def videos\n @hot_video_mapper.build_video_items(@list_data['items'])\n end",
"def fetch_videos(range = nil)\n channel = Yt::Channel.new url: self.url\n range ||= self.last_fetched.to_datetime..DateTime.now\n\n videos = channel.videos.where(\n published_after: range.first,\n published_before: range.last\n )\n\n self.last_fetched = DateTime.now\n self.save\n\n videos.map do |video|\n self.videos.create yt_id: video.id\n end\n end",
"def create_videos\n end",
"def media(filename, opts = {})\n n = input(filename, opts)\n @videos << n\n @audios << n\n n\n end",
"def gen_highlights_for_multi_sessions(session_count, video_dir, txt_dir, dst_video)\n mpg_videos = []\n seg_filenames = []\n k = 1\n (1..session_count).each do |i|\n src_video = File.join(video_dir, \"session#{i}.mp4\")\n txt_file = File.join(txt_dir, \"session#{i}.txt\")\n pairs = get_time_pairs(txt_file)\n pairs.each do |pair|\n outmp4 = File.join($tmp_folder, \"#{k}.mp4\")\n outmpg = File.join($tmp_folder, \"#{k}.mpg\")\n seg_filenames << outmpg\n cmd_str = \"#{$ffmpeg} -ss #{pair[0]} -t #{pair[1] - pair[0] + 2} -i \\\"#{src_video}\\\" #{outmp4}\"\n p cmd_str\n system(cmd_str) unless File.exists? outmp4\n cmd_str = \"#{$ffmpeg} -i #{outmp4} -qscale:v 1 #{outmpg}\"\n p cmd_str\n system(cmd_str) unless File.exists? outmpg\n k = k + 1\n end\n end\n all_segs = seg_filenames.join('|')\n mpg_all = File.join($tmp_folder, 'all.mpg')\n cmd_str = \"#{$ffmpeg} -i \\\"concat:#{all_segs}\\\" -c copy #{mpg_all}\"\n p cmd_str\n system(cmd_str) unless File.exists? mpg_all\n cmd_str = \"#{$ffmpeg} -i #{mpg_all} -qscale:v 1 #{dst_video}\"\n p cmd_str\n system(cmd_str)\nend",
"def add_titles_to_video\n\n\t@durations_array = @sentences_to_extract.map{|s| convert_to_duration(s.start_at + (CARD_LENGTH*1000))}\n\n\tp @durations_array\n\t# @durations_array.each |duration|\n\n\t# end\nend",
"def videos_test\n end",
"def copy_videos_to_output_dir\n section_entities.each do |section_id, section_name|\n unit_entities_in_section(section_id).each do |unit_id, unit_name|\n unit_video_output_dir = \"#{VIDEO_OUTPUT_DIR}/#{section_id}_#{unit_id}/\"\n FileUtils.mkdir_p unit_video_output_dir\n video_in_unit(section_id, unit_id).each do |video_name|\n output_path = unit_video_output_dir + video_name\n input_path = \"#{unit_path(section_id, unit_id, unit_name)}/video/#{video_name}\"\n FileUtils.cp(input_path, output_path)\n end\n end\n end\nend",
"def add_subtitles(movie)\n video_file_res = movie.project.final + \"/video.avi\"\n video_file = movie.project.final + \"/videotrack.avi\"\n cmd = @settings['subtitles'].dup\n cmd.sub!('<source>', video_file)\n cmd.sub!('<target>', video_file_res)\n cmd.sub!('<subtitles>', movie.subtitles)\n puts \"Adding subtitles\"\n puts cmd\n system(cmd)\n return video_file_res\n end",
"def video_list\n self.video_list = videos.map { |video| video[\"title\"] }\n end",
"def show\n gon.videos = []\n gon.videos_urls = []\n gon.tags = []\n @course.holes.each do |hole|\n gon.videos << hole.video if hole.video.present?\n gon.videos_urls << hole.video.video if hole.video.present?\n gon.tags << hole.video.tags if hole.video.present?\n end\n end",
"def concat(tivo_listings)\n @folders.concat(tivo_listings.folders)\n @videos.concat(tivo_listings.videos)\n end",
"def saveAllVideos(directory, useDescription=false)\n\t\tprefix = \"video\"\n\t\tvideos = getVideos\n\t\tmakeDirectory(directory)\n\n\t\tfor i in 0...videos.size\n\t\t\tif useDescription and videos[i].info[\"description\"] != \"\"\n vid = videos[i].info[\"description\"] + \".mp4\"\n else\n vid = prefix + i.to_s + \".mp4\"\n end\n videos[i].saveVideo(File.join(directory, vid))\n\t\tend\n\n\tend",
"def reprocess(opts={})\n @parent.remove_external_videos unless @parent.external_videos.empty?\n video = ArchivalVideo.find(self.sip.pid)\n @parent = video\n self.process\n end",
"def producer_public_videos(page_token = '')\n\n @producer_public_videos ||= begin\n result = []\n\n channels_response = get_channel_data\n uploads_list_id = channels_response.data.items.first['contentDetails']['relatedPlaylists']['uploads']\n\n public_uploads = get_public_uploads(uploads_list_id, page_token) \n playlist_items = public_uploads.items\n video_ids = playlist_items.map { |item| item[\"snippet\"][\"resourceId\"][\"videoId\"] }\n\n metadata_list = get_metadata(video_ids)\n duration_hash = metadata_list.map do |metadata|\n { metadata[\"id\"] => metadata[\"contentDetails\"][\"duration\"] }\n end.reduce(&:merge)\n\n view_hash = metadata_list.map do |metadata|\n { metadata[\"id\"] => metadata[\"statistics\"][\"viewCount\"] }\n end.reduce(&:merge)\n\n { \n :next_page_token => public_uploads.next_page_token, \n :items => serialize_playlist_items(playlist_items, duration_hash, view_hash)\n }\n end\n end",
"def slide!(uploaded: nil, duration: nil)\n # we remove all except sufficient files so that the duration\n # is at least 3 times greater than the target duration\n media_segments.each do | ms |\n return if (@playlist.total_duration - ms.duration) \\\n < minimum_duration(duration)\n delete_media_segment(ms.path)\n end\n return unless uploaded\n\n media_segment.each do | ms |\n msg = \"WARNING! Media Segment #{ms.path} in slide window has NOT \"\\\n 'been uploaded. Upload bandwidth insufficient for live stream!'\n handle_error(msg) unless uploaded.include?(ms.path)\n end\n end",
"def enhance(video:, output_dir: append_enhanced(File.join(video.base_dir, video.name_no_ext)),\n make_content_frames: false,\n output_content_dir: append_content(File.join(video.base_dir, video.name_no_ext)))\n frames = get_frames(video.frame_dir)\n frame_dir_setup(output_dir)\n frame_dir_setup(output_content_dir) if make_content_frames\n output_content_dir = nil unless make_content_frames\n frames.each_slice(num_procs).with_index(1) do |elements, i|\n elements.each do |frame|\n fork do\n combined_file = Pathname.new('').join(output_dir, File.basename(frame))\n content_file = Pathname.new('').join(output_content_dir, File.basename(frame))\n enhance_frame(frame: frame, footer_height: video.footer_height,\n content_file: content_file, combined_file: combined_file)\n end\n end\n Process.waitall\n print \"\\tEnhancing frames from #{video.name}: #{(i * elements.size / frames.size.to_f * 100).truncate(1)}%\\r\"\n end\n puts\n output_name = append_enhanced(video.name_no_ext) + video.extension\n output_content_name = append_enhanced(video.name_no_ext) + '_content' + video.extension\n video.class.frames_to_video(frame_dir: output_dir, duration: video.duration, name: output_name)\n video.class.frames_to_video(frame_dir: output_content_dir, duration: video.duration, name: output_content_name)\n # TODO: Return both SEMVideo objects\n end",
"def generate_black_video(movie, visual)\n #Render an image and create a video file from it\n @generated_videos += 1\n filename = movie.project.trimmed + \"/generated-#{@generated_videos}.avi\"\n cmd = @settings['still_video'].dup\n length = visual.end_point - visual.start_point\n cmd.sub!('<frames>', length.to_frames(25).to_s)\n cmd.sub!('<source>', VREConfig.instance.vre_root + \"resources/black_box.png\")\n cmd.sub!('<resolution>', movie.resolution)\n cmd.sub!('<target>', filename)\n system(cmd)\n filename\n end",
"def valid_videos\n self.videos.select{ |video|\n video.exist? && video.embed? && video.auto_play?\n }\n end",
"def recent_videos\n videos = self.videos\n\n return [] unless videos\n videos.first(6)\n end",
"def videos( params={} )\n videos = get_connections(\"videos\", params)\n return map_connections videos, :to => Facebook::Graph::Video\n end",
"def add_videos_to_album album_id, videos\n body = {}\n body['videos'] = videos if videos.is_a? String\n body['videos'] = videos.join(',') if videos.is_a? Array\n put(\"/albums/#{album_id}/videos\", body:body, code: 201)\n end",
"def next_video\n if episode?\n episode = content.next_ep\n unless episode.nil?\n return episode.video\n end\n end\n end",
"def video\n @streams.select { |stream| stream.is_a? VideoStream }\n end",
"def videos_upload\n\n file_extname = File.extname self.file_upload.original_filename\n new_file_name = \"#{Time.now.strftime(\"%Y%m%d%H%M%S\")}#{self[:employee_id]}#{file_extname}\"\n folder_path = \"/videos/#{Time.now.strftime(\"%Y\") }/#{Time.now.strftime(\"%m\") }/#{Time.now.strftime(\"%d\") }/\"\n url_path = folder_path + new_file_name\n full_folder_path = \"#{Rails.root.to_s}/public#{folder_path}\"\n new_file_path = \"#{Rails.root.to_s}/public#{url_path}\"\n unless File.exist? full_folder_path\n `mkdir -p #{full_folder_path}`\n end\n\n Dir.mkdir(full_folder_path) unless File.exists?(full_folder_path)\n\n if !self.file_upload.original_filename.empty?\n self.status = Document::ENCODE_PROCESS\n self.original = url_path\n #`touch #{new_file_path}`\n File.open(new_file_path, \"wb\") do |f|\n f.write(self.file_upload.read)\n f.close\n end\n self.save!\n # async encoding video files\n begin\n Backburner.enqueue Document, \"#{Rails.root.to_s}/public\", url_path, self.id\n rescue => ex\n puts 'async task fail'\n puts ex\n self.status = Document::ENCODE_FAILED\n self.save\n end\n end\n\n end",
"def create_black_video(movie, visual)\n #Render an image and create a video file from it\n @generated_videos += 1\n filename = movie.project.trimmed + \"/generated-#{@generated_videos}.avi\"\n cmd = @settings['still_video'].dup\n length = visual.end_point - visual.start_point\n cmd.sub!('<frames>', length.to_frames(25).to_s)\n cmd.sub!('<source>', VREConfig.instance.vre_root + \"resources/black_box.png\")\n cmd.sub!('<resolution>', movie.resolution)\n cmd.sub!('<target>', filename)\n system(cmd)\n visual.file = filename\n visual.type = \"video\"\n visual.mute = true\n filename\n end",
"def composite_movie(movie, position = 0, duration = 0, &block)\n select(position, duration)\n add_into_selection(movie, &block)\n deselect\n end",
"def add_multiple_videos\n\n @notice = \"\"\n @video_playlist = VideoPlaylist.find(params[:playlist_id])\n video_ids = params[:video_ids]\n\n video_ids.each do |video_id|\n @video_playlist_item_position = VideoPlaylistItem.where(\"video_playlist_id=?\", params[:playlist_id])\n .order(\"position ASC\")\n .find(:last)\n @video_playlist_item_position = @video_playlist_item_position.nil? ? 1 : @video_playlist_item_position.position + 1\n @video_playlist_item = VideoPlaylistItem.new(video_playlist_id: params[:playlist_id],\n video_id: video_id,\n position: @video_playlist_item_position)\n\n @video_to_add = Video.find(video_id)\n if @video_playlist_item.save\n flash[:notice] = 'Videos were successfully added.'\n session[:videos_search] = collection_to_id_array(@video_playlist.videos)\n end\n end # loop through video ids\n\n end",
"def greedy_cycle_glue(photos, name: \"Greedy Glue\")\n slide_chunks = []\n\n chunk_size = 50\n chunk_count = (photos.size / chunk_size.to_f).ceil\n chunk_count.times do |chunk_num|\n low = chunk_num * chunk_size\n high = low + chunk_size\n chunk = photos[low..high]\n slideshow = greedy_cycle(chunk)\n slide_chunks << slideshow.slides\n end\n\n # Then let's put the chunks back together in an optimized way? Maybe that's not important\n # We can squeeze a little bit of extra perf out of this if there are a reasonable number of chunks\n\n # chunk_cycle lol\n curr_chunk = slide_chunks.shift\n slides = curr_chunk\n while slide_chunks.size > 0\n best_score = -1\n best_chunk = nil\n best_chunk_index = -1\n\n slide_chunks.each_with_index do |chunk, index|\n glue_score = SlideShow.transition_score(curr_chunk.last, chunk.first)\n\n if glue_score > best_score\n best_score = glue_score\n best_chunk = chunk\n best_chunk_index = index\n end\n end\n\n slides += best_chunk\n curr_chunk = best_chunk\n slide_chunks.delete_at(best_chunk_index)\n end\n\n SlideShow.new(slides: slides, name: name)\n end",
"def videos_from_url_array(url_array)\n return [] unless url_array.is_a?(Array) and !url_array.empty?\n \n videos = []\n url_array.each { |url| videos << GT::VideoManager.get_or_create_videos_for_url(url)[:videos][0] }\n \n return videos.compact\n end",
"def videos options={}\n response = client.get(\"/#{id}/videos\", options)\n end",
"def public_videos\n Video.joins(:video_graph).where(:video_graphs => { :status => VideoGraph.get_status_number(:ready) }).where(:channel_id => self.channels.where(:private => false).collect(&:id))\n end",
"def index\n @traditional_route_videos = TraditionalRouteVideo.all\n end",
"def videos\n video_ids = []\n @list_data['items'].each do |top_video|\n video_ids.push(top_video['id']['videoId']) unless top_video['id']['videoId'].nil?\n end\n\n # since we need to call youtube/api/videos to get the embed_link\n videos_data = @gateway.certain_id_videos_data(video_ids)\n @top_video_mapper.build_video_items(videos_data['items'])\n end",
"def video\n \"#{self.video_file_name}\"\n end",
"def index\n @medio_videos = MedioVideo.all\n end",
"def each\n @videos.each do |video|\n yield video\n end\n end",
"def load_videos2\n json = File.read(VIDEOS2_FILE)\n array = JSON.parse(json)\n array[\"videos\"].map! { |v| {\"postId\" => v[\"postId\"], \"wordList\" => v[\"wordList\"]}}\n array[\"videos\"]\n end",
"def next_video_or_show\n ep = next_video\n if ep.nil?\n return content.show\n else\n return ep\n end\n end",
"def embed\n \"#{video.__embed__}#{tracker(true)}\"\n end",
"def verts(photos, name: \"Vert Aware\")\n # Let's say that we ahve only vertical ones.\n # Can we try a dumb way to see if we get anything better?\n # If s1 is large but s2 and s3 are small in a transition\n # then adding a vertical photo that has a large s2,s3 is optimal\n # how do we find that?\n\n # Is there some useful heuristic about having common and rare tags?\n slides = []\n\n tag_average = 0\n\n tag_count = 0\n\n photos.each do |photo|\n tag_count += photo.tags.size\n end\n\n included = {}\n\n tag_average = tag_count / photos.size\n tag_min = (tag_average / 3) * 2\n\n shorties = []\n photos.each do |photo|\n if photo.vertical? && photo.tags.size <= tag_min\n shorties << photo\n included[photo] = true\n end\n end\n\n index = 0\n while index < shorties.size\n p1 = shorties[index]\n p2 = shorties[index + 1]\n\n photo_array = [p1]\n\n if p2 != nil\n photo_array << p2\n end\n\n slides << Slide.new(photo_array)\n index += 2\n end\n\n photos.each do |photo|\n if !included.key?(photo)\n slides << Slide.new([photo])\n end\n end\n\n # We may need to break score down into a smaller piece\n\n # Find vertical photos on their own slide with low transition scores for slides before and after\n\n # Then extract those photos\n # Then add those to other slides where they can do good?\n\n # One of the general issues that we're having is that we don't\n # know if putting it there is gogin to be helpful before putting it there\n # Let's find the ideal place to put it before inserting it?\n\n # Seed by using another realtiveyl fast approach?\n\n SlideShow.new(slides: slides, name: name)\n end",
"def embedded_video_url\n self.video_url.sub 'watch?v=', 'embed/'\n end",
"def autoplay_embed\n \"#{video.__autoplay_embed__}#{tracker(true)}\"\n end",
"def video_names \n\t\tvideos.map{|v| v.name}\n\tend",
"def compose\n create_log_folder\n in_tmp_dir do\n concats = {}\n\n Queue.run *@params[:components].each_with_index.map { |component, i|\n proc {\n concats.store i,\n case component[:type]\n when Parameters::VIDEO_COMPONENT\n compose_video *component.values_at(:video, :from, :to), i\n when Parameters::IMAGE_COMPONENT\n compose_image *component.values_at(:image, :duration), i\n when Parameters::TEXT_COMPONENT\n compose_text *component.values_at(:content, :duration, :text_color, :background_color), i\n else\n raise Error.new(\"wrong component type\", type: component[:type])\n end\n }\n }\n\n concats_sorted = concats.sort\n Queue.run *concats_sorted[0, concats_sorted.size-1].map { |i, concat|\n next_i = i+1\n next_concat = concats_sorted[next_i][1]\n proc {\n transition_i = (i+next_i)/2.0\n concats.store transition_i, Transition.new(concat, next_concat, tmp_path(transition_i.to_s), log_folder('transitions', transition_i.to_s)).run\n }\n }\n\n concat = tmp_path 'concat'\n outputs = Concat.new(concats.sort.map{ |_,c| c }, concat, log_folder('concat')).run\n\n if audio\n audios = Hash[ Media::Audio::FORMATS.map{ |f| [f, audio.media.path(f)] } ]\n outputs = ReplaceAudio.new(outputs, audios, tmp_path('replace_audio'), log_folder('replace_audio')).run\n end\n\n video.media = outputs.merge(filename: video.title)\n video.composing = nil\n video.metadata.old_fields = nil\n\n ActiveRecord::Base.transaction do\n video.save!\n video.enable_lessons_containing_me\n Notification.send_to(\n video.user_id,\n I18n.t(\"notifications.video.compose.#{notification_translation_key}.ok.title\"),\n I18n.t(\"notifications.video.compose.#{notification_translation_key}.ok.message\", :item => video.title),\n ''\n )\n video.user.video_editor_cache!\n end\n end\n end",
"def each_turns_next_video\n videos = user_rota.all.map{ |user| Video.next_for(user) }.compact\n if videos.any?\n videos\n else\n Video.pending\n end\n end",
"def compileSubsplashResponse(response)\n batch = ''\n response[\"_embedded\"][\"media-items\"].each do |r|\n youtube_id = extractYouTubeID(r[\"youtube_url\"])\n batch << youtube_id + ',' unless youtube_id == ''\n video = Video.new.tap do |v|\n v.youtube_id = youtube_id\n v.youtube_url = r[\"youtube_url\"]\n v.title = r[\"title\"]\n v.duration = nil\n v.views = nil\n v.reach = r[\"reach\"]\n v.save\n end\n end \n batch.chop!()\n callYouTubeAPI(batch)\n end",
"def download_all_videos_from_pl id,d_name\n\tmy_directory = \"#{@dir}#{d_name}\"\n\n\t videos_already_saved_array = get_all_titles_from_dir my_directory\n\n\t videos_already_saved_titles, videos_already_saved_paths = \n\t \t\t\t\t\tvideos_already_saved_array.map{|e| e[0]}, videos_already_saved_array.map{|e| e[2]}\n\n\t@current_playlist_video_titles.each do |v|\n\t\t\tsource = 'youtube'\n\t\t\tindex = @current_playlist_video_titles.index(v)\n\t\t\tp index\n\t\t\tvid = @current_playlist_video_ids[index]\n\t\t\tp vid\n\n\t\tif !videos_already_saved_titles.include?(v)\t\n\t\t\t\n\t\t\tvideo_string = \"http://www.youtube.com/watch?v=#{vid}\"\n\t\t\tdownload_video = \"viddl-rb #{video_string} -d 'aria2c' -s '#{my_directory}'\"\n\n\t\t\tcaptured_stdout = ''\n\t\t\tcaptured_stderr = ''\n\t\t\tstdin, stdout, stderr, wait_thr = Open3.popen3(\"#{download_video}\")\n\t\t\tpid = wait_thr.pid\n\t\t\tstdin.close\n\t\t\tcaptured_stdout = stdout.gets(nil)\n\t\t\taborted = captured_stdout.include? \"Download aborted\"\n \t\t\t# captured_stderr = stderr.read\n\t\t\twait_thr.value # Process::Status object returned\n\n\t# extract the info we need\n\t\t\tputs \"STDOUT: \" + captured_stdout\n\t\t\t# puts \"STDERR: \" + captured_stderr\n\n\t\t\t# go to Vimeo to download if it doesnt work\n\t\t\tif aborted\n\t\t\t\tartist_match_results = match_best v, @rule_artists\n\t\t\t\t@song_artist = artist_match_results[0]\n\t\t\t\tremaining_words = artist_match_results[1]\n\t\t\t\tsong_match_results = match_best remaining_words, @rule_titles\n\t\t\t\t@song_title = song_match_results[0]\n\n\t\t\t\tsource='vimeo'\n\t\t\t\tget_vimeo_manually @song_artist,@song_title,@mydir,\"vimeo\"\n\t\t\t\t# Process.kill(\"KILL\", stream.pid)\n\t\t\t\t# get_vimeo_manually v,my_directory,source \n\t\t\tend\n\n\t\t\tp \"already have it\" if videos_already_saved_titles.include?(v)\n\t\tend\n\n\n\tend\n\n\t\nend",
"def create\n if !params[:video][:video].nil?\n videoName = params[:video][:video].original_filename.gsub(/\\s/,'_') \n @video = Video.new({:title => params[:video][:title], :video => \"/worshipvideos/#{videoName}\"})\n else\n @video = Video.new({:title => params[:video][:title]})\n end\n\n if !params[:video][:video].nil?\n tmp = params[:video][:video].tempfile\n file = File.join(\"public/worshipvideos\", videoName)\n FileUtils.cp tmp.path, file\n FileUtils.rm tmp\n end\n\n respond_to do |format|\n if @video.save\n if !params[:video][:video].nil?\n #logger.debug \"./createVideoPics.sh '#{videoName}'\"\n #fork do\n #system(\"./createVideoPics.sh '#{videoName}'\")\n #exec(\"ffmpeg -i 'public/worshipvideos/#{videoName}' -an -ss 00:00:20 -r 1 -vframes 1 -f mjpeg -y 'app/assets/images/worship_pics/#{videoName}_1.jpg'\")\n #logger.debug \"ffmpeg -i 'public/worshipvideos/#{videoName}' -an -ss 00:00:20 -r 1 -vframes 1 -f mjpeg -y 'app/assets/images/worship_pics/#{videoName}_1.jpg'\"\n #exec(\"ffmpeg -i 'public/worshipvideos/#{videoName}' -an -ss 00:00:40 -r 1 -vframes 1 -f mjpeg -y 'app/assets/images/worship_pics/#{videoName}_2.jpg'\")\n #logger.debug \"ffmpeg -i 'public/worshipvideos/#{videoName}' -an -ss 00:00:40 -r 1 -vframes 1 -f mjpeg -y 'app/assets/images/worship_pics/#{videoName}_2.jpg'\"\n #exec(\"ffmpeg -i 'public/worshipvideos/#{videoName}' -an -ss 00:01:00 -r 1 -vframes 1 -f mjpeg -y 'app/assets/images/worship_pics/#{videoName}_3.jpg'\")\n #logger.debug \"ffmpeg -i 'public/worshipvideos/#{videoName}' -an -ss 00:01:00 -r 1 -vframes 1 -f mjpeg -y 'app/assets/images/worship_pics/#{videoName}_3.jpg'\"\n #end\n\n @video.update_attribute(\"pic1\", \"worship_pics/#{videoName}_1.jpg\")\n @video.update_attribute(\"pic2\", \"worship_pics/#{videoName}_2.jpg\")\n @video.update_attribute(\"pic3\", \"worship_pics/#{videoName}_3.jpg\")\n end\n\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def forwardvideo\n Pusher['photo-call'].trigger('next-video' , {\n control: \"1\"\n })\n render text: \"ok\"\n end",
"def resources\n videos\n end",
"def videos_for(items, key, options)\n items.body['items'].map{|item| item['id'] = item[key]['videoId']}\n\n if options[:parts] == %i(id)\n items\n else\n options[:ids] = items.body['items'].map{|item| item['id']}\n options[:offset] = nil\n fetch('/youtube/v3/videos', resource_params(options)).tap do |response|\n response.body['nextPageToken'] = items.body['nextPageToken']\n end\n end\n end",
"def index\n @adm_videos = Adm::Video.all\n end",
"def video\n first_stream_of :video\n end",
"def remove_encoded_videos\n video_files.each do |videofile|\n \n unless videofile.url.blank?\n \n# AWS::S3::Base.establish_connection!(\n# :access_key_id => zencoder_setting[\"s3_output\"][\"access_key_id\"],\n# :secret_access_key => zencoder_setting[\"s3_output\"][\"secret_access_key\"]\n# )\n# AWS::S3::S3Object.delete(File.basename(output_url), zencoder_setting[\"s3_output\"][\"bucket\"])\n # there is no real concept of folders in S3, they are just labels, essentially\n# AWS::S3::S3Object.delete(\"/thumbnails_#{self.id}/frame_0000.png\", zencoder_setting[\"s3_output\"][\"bucket\"])\n \n #XXX TODO remove transcoded files!\n \n end\n \n end\n end",
"def get_uploads2( subscription_url )\n #raise ActiveSupport::Base64.decode64( subscription_url ).to_yaml\n movie = {}\n\n status = \"false\"\n count = ''\n upload_index = ''\n upload_counts = ''\n upload_index = \"1\"\n while status = \"false\"\n url = \"#{subscription_url}?start-index=#{upload_index}\"\n # uploadされている動画ごとのURLを配列で取得\n upload_counts,upload_index,item_counts_per_page,upload_feed_urls = \n get_uploads_entry_url( url )\n\n count = upload_counts - upload_index\n\n if item_counts_per_page > count\n status = \"true\"\n else\n upload_feed_urls.each do |upload_feed_url|\n upload_feed_xml = get_channnel_xml( upload_feed_url ) \n doc = REXML::Document.new( upload_feed_xml )\n # http://gdata.youtube.com/feeds/api/users/playyouhousejp/uploads/M8nu4gkOlbI\n id = doc.elements[\"/entry/id\"].text\n movie_title = doc.elements[\"/entry/media:group/media:title/\"].text\n movie_thumbnail = doc.elements[\"/entry/media:group/media:thumbnail/\"].attributes['url']\n movie_play_url = doc.elements[\"/entry/media:group/media:player/\"].attributes['url']\n\n # 各movie情報をIDをキーにして値に情報群のハッシュを配列構造を持たせる\n movie_array = [\n \"movie_title\" => movie_title,\n \"movie_thumbnail\" => movie_thumbnail,\n \"movie_play_url\" => movie_play_url,\n ]\n movie[\"#{id}\"] = movie_array\n end\n\n upload_index += 1\n end\n end\n\n return movie\n end",
"def slides\n @slides = Array.new\n @files.each do |f|\n if f.name.include? 'ppt/slides/slide'\n @slides.push Slide.new(self, f.name)\n end\n end\n @slides.sort{|a,b| a.slide_num <=> b.slide_num}\n end",
"def convert_command\n\t\t\tflv = File.join(File.dirname(self.video.path), \"#{self.video_file_name}.flv\")\n\t\t\tmpeg4 = File.join(File.dirname(self.video.path), \"#{self.video_file_name}.mp4\")\n\t\t\tFile.open(flv, 'w')\n\t\t\tFile.open(mpeg4, 'w')\n\t\t\t#command = \"cd log/ && ffmpeg -i #{ self.video.path } -ar 22050 -ab 32 -s 480x360 -vcodec flv -r 25 -qscale 8 -f flv -y #{ flv }; ffmpeg -i #{ self.video.path } -an -pass 1 -vcodec libx264 -vpre fastfirstpass -b 1024k -bt 1024k -threads 0 -y #{ mpeg4 }\"\n\t\t\tcommand = \"cd log/ && ffmpeg -i '#{ self.video.path }' -ar 22050 -ab 32 -s 480x360 -vcodec flv -r 25 -qscale 8 -f flv -y '#{ flv }'; ffmpeg -threads 4 -i '#{ self.video.path }' -r 29.97 -vcodec libx264 -flags +loop -cmp +chroma -deblockalpha 0 -deblockbeta 0 -crf 24 -bt 256k -refs 1 -coder 0 -subq 5 -g 250 -keyint_min 25 -level 30 -qmin 10 -qmax 51 -sc_threshold 40 -i_qfactor 0.71 -acodec libfaac -ab 128k -ar 48000 -ac 2 '#{ mpeg4 }'\"\n\n\t\t\tcommand.gsub!(/\\s+/, \" \")\n\t\t\tlogger.debug command\n\t\tend",
"def encode_movie(m)\r\n\tmovie_path = m[0..(m.length-2)].join('\\\\')\r\n\tmovie_folder = m[m.length-1]\r\n\r\n\tprint movie_folder + \", path:\" +movie_path+ \"\\n\"\r\n\r\n\tmovie_data_path = movie_path + \"\\\\\" + movie_folder + \"\\\\Pos0\\\\\"\r\n\tout_file = movie_data_path + \"..\\\\\" + movie_folder\r\n\tffmpeg_cmd = \"ffmpeg32 -framerate 30 -threads 2 -report -i \\\"#{movie_data_path}\\\\img_%09d_Default_000.tif\\\" -pix_fmt yuv420p \\\"#{out_file}.m4v\\\"\"\r\n\tprint \"#{ffmpeg_cmd}\\n=>\\n\"\r\n\t`#{ffmpeg_cmd}`\r\n\treturn [movie_path, \"#{out_file}.m4v\", movie_folder]\r\nend",
"def index\n \n unless params[:run]\n #@runs = Run.find(:all, :conditions => {:showvideos => true})\n\n # INIT\n\n @today = Date.today\n @year = (params[:year].to_s.to_i > 0 ? @year = params[:year].to_i : @year = @today.year)\n @runs = Run.find(:all, :conditions => [\"showvideos = 1 and year(eventday) = ?\", @year], :order => \"eventday desc\")\n\n # PAST RUNS\n\n @pr_ar = []\n\n @runs.each do |run|\n\n actual_month = run.eventday.month\n @pr_ar[actual_month] ||= [] # INIT if necesarry\n @pr_ar[actual_month] << run\n\n end\n\n @pr_ar.reverse!.compact!\n\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @videos }\n end\n end\n \n if params[:run] && params[:run].to_i > 0\n @run = Run.find(params[:run].to_i)\n @video = Video.find(:first, :conditions => {:run_id => @run.id}, :order => \"name desc\")\n \n redirect_to(:controller => :videos, :action => :show, :id => @video.id)\n \n end\n \n end",
"def index\n @congratulations_videos = CongratulationsVideo.all\n end",
"def index\n @game_videos = GameVideo.all\n end",
"def show\n @video = Video.new\n @competition_videos = Competition.find(params[:id]).videos\n #@competition_videos = Competition.find(params[:id]).videos.order(created_at: :desc).paginate(page: params[:page],per_page:50)\n end",
"def index\n @videos = Video.where(project_id: @project.id)\n end",
"def index\n @college_videos = CollegeVideo.all\n end",
"def itunes\n @videos = Video.mais_novos.publicados.com_podcast\n end",
"def add_video(video)\n @videos << video\n return true\n end",
"def index\n @videos = @palestrante.videos.mais_novos\n end",
"def show; @video.show; end",
"def ffmpeg_libvpx_cmd(input_path, output_path, bitrate, output_size, force=false)\n replace = force ? \"-y\" : \"\"\n return [\n \"ffmpeg -i '#{input_path}' -threads 8\",\n \"-c:v libvpx -pix_fmt yuv420p -crf 10 -b:v #{bitrate} -s #{output_size} -movflags +faststart -r 29.97 -c:a libvorbis -aq 5 #{replace} '#{output_path}'\"\n ]\nend",
"def video_xml\n xml = Builder::XmlMarkup.new(:indent => 2)\n xml.instruct! :xml, :version => '1.0', :encoding => nil\n xml.entry :xmlns => 'http://www.w3.org/2005/Atom',\n 'xmlns:media' => 'http://search.yahoo.com/mrss/',\n 'xmlns:yt' => 'http://gdata.youtube.com/schemas/2007' do\n xml.media :group do\n xml.media :title, @opts[:title], :type => 'plain'\n xml.media :description, @opts[:description], :type => 'plain'\n xml.media :category, @opts[:category], :scheme => 'http://gdata.youtube.com/schemas/2007/categories.cat'\n @opts[:developer_tags].each do |developer_tag|\n xml.media :category, developer_tag, :scheme => 'http://gdata.youtube.com/schemas/2007/developertags.cat'\n end\n xml.tag! 'media:keywords', @opts[:keywords].join(\",\")\n end\n end\n xml.target!\n end",
"def video_xml\n xml = Builder::XmlMarkup.new(:indent => 2)\n xml.instruct! :xml, :version => '1.0', :encoding => nil\n xml.entry :xmlns => 'http://www.w3.org/2005/Atom',\n 'xmlns:media' => 'http://search.yahoo.com/mrss/',\n 'xmlns:yt' => 'http://gdata.youtube.com/schemas/2007' do\n xml.media :group do\n xml.media :title, @opts[:title], :type => 'plain'\n xml.media :description, @opts[:description], :type => 'plain'\n xml.media :category, @opts[:category], :scheme => 'http://gdata.youtube.com/schemas/2007/categories.cat'\n @opts[:developer_tags].each do |developer_tag|\n xml.media :category, developer_tag, :scheme => 'http://gdata.youtube.com/schemas/2007/developertags.cat'\n end\n xml.tag! 'media:keywords', @opts[:keywords].join(\",\")\n end\n end\n xml.target!\n end",
"def queue_video(file)\n if video?(file) or contains_any?(file, :avi, :mpg, :mkv, :rm, :mp4)\n puts ''\n puts file\n local = \"/Volumes/Samba/clamps/\"\n dir = prompt_for_path(local)\n \n remote_path = \"#{ REMOTE_VIDEO_PATH }#{ dir[local.length, dir.length] }#{ Pathname.new(file).basename }\"\n QUEUE << [ file, remote_path ]\n end\nend",
"def populate\n @video = Video.find(params[:video_id])\n render :nothing => true and return if @collection.videos.include? @video\n @collection << @video\n\n respond_to do |format|\n format.html { redirect_to :back, :notice => \"Video added to your reel.\" }\n format.js\n end\n end",
"def add_video\n @new_video = Video.new(params[:video])\n @new_video.save\n @video = Video.find_all_by_appliance_id_and_brand_id_and_appliance_problem_id(params[:video][:appliance_id], params[:video][:brand_id], params[:video][:appliance_problem_id])\n render(:partial => 'video', :collection => @video)\n end",
"def split_movie(file_path)\n OSX.require_framework(\"QTKit\")\n splitted_files = Array.new\n movie, error = OSX::QTMovie.movieWithFile_error(file_path) # Load in the original movie\n if(error != nil || movie == nil) # Check if we can load the movie\n $stderr.puts \"Could not open #{file_path}, #{error.localizedDescription}\"\n exit(-1)\n end\n \n # a QTTime structure has a timeValue and timeScale we need\n # to dived the timeValue by the timeScale to get the time\n # in seconds. If we devide that by 60 we get the time in\n # minutes\n time_scale = movie.duration.timeScale\n total_time = (movie.duration.timeValue / time_scale) / 60\n \n # If the total time is below 10 minutes we don't have to\n # split the movie\n if(total_time < 10)\n splitted_files.push(file_path)\n return splitted_files\n end\n \n # If the totol time is above 10 minutes we have to calculate\n # how many parts we need to make. No part can be over 10 minutes.\n parts = total_time.to_i / 10\n \n if(total_time.modulo(10) != 0)\n parts = parts + 1\n end\n \n # Parts are always 10 minutes long (or shorter)\n part_duration = OSX::QTMakeTime(600 * time_scale, time_scale)\n temp_dir = Dir.tmpdir()\n attributes = OSX::NSDictionary.dictionaryWithObjectsAndKeys(OSX::NSNumber.numberWithBool(true), \"QTMovieFlatten\", nil)\n movies = Array.new\n \n # For every part we extract the time selection out of the original movie\n # and write it out to a new, temporary file. We store the paths to the\n # temporary files\n parts.times do |i|\n begin_time = OSX::QTMakeTime(i * 600 * time_scale, time_scale)\n range = OSX::QTMakeTimeRange(begin_time, part_duration)\n movie_part, error = movie.movieWithTimeRange_error(range)\n \n if(error != nil || movie_part == nil)\n $stderr.puts \"Could not generate subclip, #{error.localizedDescription}\"\n exit(-1)\n end\n \n # Writing out the temporary file and storing the path in the movies array\n temp_file_path = temp_dir + \"/\" + File.basename(file_path, File.extname(file_path)) + \"-\" + i.to_s + \".mov\"\n movie_part.writeToFile_withAttributes(temp_file_path, attributes)\n movies.push(temp_file_path)\n end\n return movies \n end",
"def get_recent_videos\n # Array to hold all videos for the category\n category_videos = Array.new\n cat_subs = CategorySubscription.where(category_id: self)\n cat_subs.each do |cs|\n # Array to hold target videos for the channel\n sub = Subscription.find(cs.subscription_id)\n channel_id = sub.channel_id\n channel_videos = YTClient.getChannelVideos(channel_id)\n # Push each chanel video into the category videos array\n channel_videos.each { |video| category_videos << video }\n end\n category_videos.sort! { |a,b| b.snippet.published_at <=> a.snippet.published_at }\n category_video_ids = Array.new\n category_videos.each do |v|\n category_video_ids.push(v.id)\n end\n return category_video_ids\n end",
"def video_download_links(document, video_files)\n file = video_files.first\n video_links = []\n attachments_json = JSON.parse(file['attachments_ss'])\n %w(video_access_mp4 video_access_webm).each do |v_id|\n next unless attachments_json[v_id]\n\n video_links << file_download_link(file['id'],\n download_link_title(document, attachments_json),\n attachments_json,\n v_id,\n download_link_options)\n end\n video_links\n end",
"def index\n @video_on_main_pages = VideoOnMainPage.all\n end",
"def wp_get_video_extensions()\n # Filters the list of supported video formats.\n apply_filters('wp_video_extensions', ['mp4', 'm4v', 'webm', 'ogv', 'flv'])\n end",
"def render_video_csid options={}\n # render video player\n content_tag(:div) do\n options[:value].collect do |video_csid|\n content_tag(:video,\n content_tag(:source, \"I'm sorry; your browser doesn't support HTML5 video in MP4 with H.264.\",\n src: \"https://webapps.cspace.berkeley.edu/#TENANT#/imageserver/blobs/#{video_csid}/content\",\n id: 'video_csid',\n type: 'video/mp4'),\n controls: 'controls',\n style: 'width: 640px;')\n end.join.html_safe\n end\n end"
] |
[
"0.73224336",
"0.7141569",
"0.6384308",
"0.62886745",
"0.60178113",
"0.59477186",
"0.5943647",
"0.5934862",
"0.5877982",
"0.58245325",
"0.57119554",
"0.56690454",
"0.5609804",
"0.5609109",
"0.5550787",
"0.5529381",
"0.55183834",
"0.55170727",
"0.55033576",
"0.5500784",
"0.5457989",
"0.5394751",
"0.53558713",
"0.53378063",
"0.5327311",
"0.53016955",
"0.52930725",
"0.5281511",
"0.5268199",
"0.5260691",
"0.5237957",
"0.52307534",
"0.5223634",
"0.51975214",
"0.5172608",
"0.5158035",
"0.5150387",
"0.51364815",
"0.5132779",
"0.5129461",
"0.5129443",
"0.51089156",
"0.5108053",
"0.50943184",
"0.5089058",
"0.5083138",
"0.5071736",
"0.50605893",
"0.50567853",
"0.5055907",
"0.505105",
"0.5049977",
"0.5048555",
"0.50461316",
"0.5017837",
"0.5016358",
"0.5012961",
"0.5003745",
"0.49997187",
"0.49978423",
"0.4987949",
"0.49878418",
"0.4980968",
"0.4974214",
"0.49670124",
"0.4964568",
"0.49457845",
"0.49444726",
"0.4940306",
"0.493906",
"0.49310654",
"0.49309707",
"0.49243948",
"0.4923248",
"0.49052128",
"0.4888017",
"0.48777467",
"0.48760012",
"0.48600012",
"0.48594022",
"0.48573473",
"0.4854991",
"0.4852535",
"0.4851508",
"0.4850143",
"0.48467395",
"0.4835694",
"0.48350206",
"0.4825183",
"0.48163837",
"0.48163837",
"0.48141",
"0.48112077",
"0.48053566",
"0.47975764",
"0.47886902",
"0.47868997",
"0.47853228",
"0.4783334",
"0.4782409"
] |
0.776836
|
0
|
Gets a collection of available promotions
|
def list(from_date: nil, to_date: nil, continuation_token: nil, headers: {})
payload = {
fromDate: from_date,
toDate: to_date,
continuationtoken: continuation_token
}.select { |_, v| !v.nil? }
@client.rest_get_with_token('/promotions', payload, headers)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def promotions\n @promotions ||= order.promotions\n end",
"def pending_promotions\n @pending_promotions ||= []\n end",
"def existing_promotions\n @existing_promotions ||= []\n end",
"def new_promotions\n @new_promotions ||= []\n end",
"def api_promotions_get(params, opts = {})\n data, _status_code, _headers = api_promotions_get_with_http_info(params, opts)\n return data\n end",
"def checkout_promotions\n @checkout_promotions ||= Promotion.active.code_based\n end",
"def index\n @promotions = current_shop_owner.promotions.all\n end",
"def index\n @promotions = Promotion.all\n end",
"def index\n @promotions = Promotion.all\n end",
"def index\n @promotions = Promotion.all\n end",
"def current_promotions\n promotions.where([\"start_on IS NOT NULL AND start_on <= ? AND (end_on >= ? OR end_on IS NULL OR end_on = '')\", Date.today, Date.today]).order(\"start_on\")\n end",
"def promotions\n Spree::Promotion.find_by_sql(\"#{order.promotions.active.to_sql} UNION #{Spree::Promotion.active.where(code: nil, path: nil).to_sql}\")\n connected_order_promotions | sale_promotions\n end",
"def promoted_products\n promoted.is_a?(Product) ? [promoted] : promoted.products.all\n end",
"def promotions\n adjustments.where( promotion: true )\n end",
"def pending_promotions?\n !pending_promotions.empty?\n end",
"def apply_promotions!\n raise PromotionApplyError unless pending_promotions.empty?\n @promotion_results = Promotion.active.apply!(self)\n apply_adjustments!\n\n # Convert all the applied promotions into an array of decorated\n # promotions.\n @pending_promotions = applied_promotions.map {|p| ::Promotions::Decorator.new(p.promotion)}\n\n # If no promotions have been added to the order, they're all new.\n # Otherwise generate a new collection which is the difference between the\n # existing ones and the new ones.\n if previous_promotion_ids.empty?\n @new_promotions = pending_promotions\n else\n @new_promotions = pending_promotions.reject {|p| previous_promotion_ids.include?(p.id)}\n @existing_promotions = pending_promotions.select {|p| previous_promotion_ids.include?(p.id)}\n end\n\n pending_promotions\n end",
"def profils()\n return @profils\n end",
"def check_promotions\n line_items.each do |item|\n Spree::ItemAdjustments.new(item).calculate_promo_total\n end\n end",
"def existing_promotions?\n !existing_promotions.empty?\n end",
"def promotion_for(item)\n @promotions ||= []\n @promotions.sort_by(&:priority).reverse.detect{|pr| pr.can_apply_to?(item)}\\\n || Promotion.new( NoPromote.new )\n end",
"def index\n @cpanel_promotions = Cpanel::Promotion.all\n end",
"def get_promotions_list\n # get params for paging\n unless params[:id].blank?\n @client_id = params[:id]\n else\n @client_id = @clients[0].id\n end\n\n rows = Array.new\n rows = get_rows(Promotion.get_by_client(@client_id).active.\n order_id_desc.page(params[:page]).per(params[:rp]), @client_id)\n count = Promotion.get_by_client(@client_id).active.order_by_promotion_name.count\n\n render json: {page: params[:page], total: count, rows: rows}\n end",
"def promoter_shows\n Show.where(promoter_id: id)\n end",
"def index\n @product_promotions = ProductPromotion.all\n end",
"def procs\n @procs\n end",
"def related_promotions\n @related_promotions ||= Promotions::Relevance.to_category(self)\n end",
"def pending_carpools\n @pending_carpools = trips.where('pools.is_pending': true)\n end",
"def index\n if params[:product_id]\n @promotions = Product.find(params[:product_id]).promotions\n else\n @promotions = Promotion.all\n end\n\n render json: @promotions\n end",
"def pifs\n p = []\n __pifs.each do |pif|\n p << connection.pifs.get(pif)\n end\n p\n end",
"def users\n User.in(id: user_promotions.pluck(:user_id))\n end",
"def get_available_pnics\n pnics_in_use = []\n pnics_available = []\n\n # Get pnics in use in standard switches\n @item.config.network.vswitch.each do |vs|\n vs.pnic.each do |pnic|\n pnic.slice!(\"key-vim.host.PhysicalNic-\")\n pnics_in_use << pnic\n end\n end\n\n # Get pnics in host\n self['config.network'].pnic.each do |pnic|\n pnics_available << pnic.device if !pnics_in_use.include?(pnic.device)\n end\n\n return pnics_available\n end",
"def index\n @promoters = Promoter.find(:all).sort_by{|p| p.name_or_contact_info}\n end",
"def producers\n to_array search_by_itemprop 'producer'\n end",
"def promoted\n @users = User.valid_users.promoted.page(params[:page])\n end",
"def matching_products\n if compute_on_promotion?\n calculable.promotion.rules.map do |rule|\n rule.respond_to?(:products) ? rule.products : []\n end.flatten\n end\n end",
"def promotions\n # Promotion.in(id: user_promotions.pluck(:promotion_id))\n Promotion.where({'id'=> {'$in'=> UserPromotion.pluck(:promotion_id)}, 'end_date'=> {'$gt'=> DateTime.now}, 'start_date'=> {'$lt'=> DateTime.now}})\n end",
"def index\n @title = t('admin.promotions.index.title')\n @promotions = ( @product ? @product.promotions : Promotion.all )\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @promotions }\n end\n end",
"def related_promotions?\n !related_promotions.empty?\n end",
"def available_partitions\n partitions.select(&:available?)\n end",
"def index\n @promotions = Promotion.paginate(:page => params[:page], :per_page => 10)\n .order(\"due_date DESC\")\n end",
"def getDeliverables\n readDeliverables\n\n return @Deliverables\n end",
"def index\n @promotions = Promotion.where(active: true)\n @all_promotions = Promotion.all\n respond_to do |format|\n format.html \n format.json { render json: @all_promotions }\n end\n end",
"def index\n if @customer.nil?\n @promotions = Promotion.all\n else \n @promotions = @customer.promotions\n end\n render 'promotions/promotions', :locals => { :promotions => @promotions }\n end",
"def coupons\n @items = @product.product_coupons\n end",
"def new_promotions?\n !new_promotions.empty?\n end",
"def list_processes\n check_connection\n @fields = @protocol.process_info_command\n @result_exist = true\n store_result\n end",
"def minions\r\n @minions.list\r\n end",
"def get_cout_ha_produits\n\t sum = 0\n\t self.putoparcelles.each do |putoparcelle|\n \t\tputoparcelle.pulve.putoproduits.each do |putoproduit|\n \t\t\tsum += putoproduit.get_cout_ha_parcelle(self)\n end\n end\n sum\n end",
"def load_data\n @promotions = Promotion.find(:all)\n @products = Product.find(:all, :conditions => ProductFilter.website_conditions(@website))\n end",
"def friends_proposals\n # get all friend ids\n # friend_ids = Friendship.select(:friend_id).where user_id: self.id\n # friend_ids ||= []\n # User.where.not( id: friend_ids).where.not( id: self.id) # get all user that are not are not in the list of friend ids\n\n sent_ids = self.sent_friend_requests.map { |friend| friend.id} || []\n received_ids = self.received_friend_requests.map { |friend| friend.id} || []\n friend_ids = self.friends.map { |friend| friend.id } || []\n\n ids = friend_ids + received_ids + sent_ids\n ids +=[-1] if ids.size == 0 # edge case: if ids is empty this corresponds to null!\n # dirty hack: assume that no user will ever have an negative id.\n\n User.where('id NOT IN (?) AND id != ?', ids, self.id).limit(10).order(\"RANDOM()\")\n\n end",
"def promotion_results\n @promotion_results ||= Promotions::CheckResultCollection.new\n end",
"def minionList\n self['minions'].transform_values {|v| v.pub_key }\n end",
"def processed_promos\n respond_to do |format|\n @taken_promos = TakenPromo.get_taken_promos_for_user current_user\n format.html { }\n end\n end",
"def deliverables\n return Deliverable.where(project_id: @project.id)\n end",
"def processes\n request('getAllProcessInfo')\n end",
"def get_mpset( queries, o = {} )\n #debugger #puts \"[get_mpset] #{q}\" ; \n queries.map{|q| marr2hash get_map_prob(q, o)}\n end",
"def get_all_parallels_vms(options)\n message = \"Information:\\tListing Parallels VMs\"\n command = \"prlctl list --all |grep -v UUID |awk '{print $4}'\"\n vm_list = execute_command(options,message,command)\n vm_list = vm_list.split(\"\\n\")\n return vm_list\nend",
"def promotable_accounts(id = nil, opts = {})\n load_resource(Creative::PromotedAccount, id, opts)\n end",
"def quota_active_provisions_by_group(options)\n quota_provision_stats(:quota_find_active_prov_request_by_group, options.merge(:nil_vm_id_only => true))\n end",
"def promotion_id_dump\n pending_promotions.map(&:id)\n end",
"def get_possible_pools( query )\n pools = SwimmingPoolFinder.new( params[:query] ).search()\n pools.each do |pool|\n @result << {\n class: 'SwimmingPool',\n id: pool.id,\n description: pool.get_verbose_name,\n date: Format.a_date( pool.updated_at )\n }\n end\n pools\n end",
"def available_service_providers\n ServiceProvider.includes(:provision_services).\n where(:provision_services => {:product_category_id => self.service_request.product_category_id,\n :product_brand_id => self.service_request.product_brand_id }\n ) if self.service_request\n end",
"def proposed_purchases\n PurchaseRequest.find(:all,:conditions => {\n :purchase_requester_id => self.id \n })\n end",
"def list_of_pending_instances(list = list_of_nonterminated_instances)\n list.select {|a| a.pending? }\n end",
"def get_available_tasks\n tasks_to_return = []\n @tasks_names.each{ |t_name|\n tasks_to_return.push(@tasks[t_name])\n } \n return tasks_to_return\n end",
"def list_of_pending_instances(list = list_of_nonterminated_instances)\n list.select {|a| a if a.pending? }\n end",
"def percentage_of_promoters\n calculator.percentage_of_promoters\n end",
"def checkout_promotions?\n !checkout_promotions.empty?\n end",
"def propositional_symbols\n symbols = []\n @classified.each do |el|\n symbols.push el if el.instance_of? Proposition\n end\n symbols\n end",
"def get_prizes\n @prizes = Prize.all.shuffle.first(6)\n end",
"def get_all_scoped_privileges_and_prohibitions(user_or_attribute, object_or_attribute, options = {})\n if policy_machine_storage_adapter.respond_to?(:scoped_privileges)\n policy_machine_storage_adapter.scoped_privileges(user_or_attribute.stored_pe, object_or_attribute.stored_pe, options).map do |op|\n operation = PM::Operation.convert_stored_pe_to_pe(op, policy_machine_storage_adapter, PM::Operation)\n [user_or_attribute, operation, object_or_attribute]\n end\n else\n operations.grep(->operation{is_privilege_ignoring_prohibitions?(user_or_attribute, operation, object_or_attribute)}) do |op|\n [user_or_attribute, op, object_or_attribute]\n end\n end\n end",
"def list\n @processors.keys\n end",
"def sent_proposals\n reversed_matches = Array.new(@group_size)\n @best_proposals.each_with_index do |e, i|\n reversed_matches[e] = i if e\n end\n reversed_matches\n end",
"def filter_by_accepting_proposals(collection)\n collection.where(\"request_for_proposals.state = ?\", 'pending')\n end",
"def get_products_bought\n res = []\n\n @data.product_qty.each do |prd_id, qty|\n qty = qty.to_i\n if qty > 0\n res << [ qty, @data.products.with_id(prd_id) ]\n end\n end\n\n res\n end",
"def index\r\n @models_have_products = []\r\n @models_no_products = []\r\n Model.all.each do |model|\r\n if products_available(model)\r\n @models_have_products << model\r\n else\r\n @models_no_products << model\r\n end\r\n end \r\n @models = Model.all.order(:priority)\r\n end",
"def charges\n charges = []\n self.students.each do |student|\n student.charges.each do |charge|\n if charge.promotion_id == self.id\n charges << charge\n end\n end\n end\n return charges\n end",
"def participatory_processes\n @participatory_processes ||= filtered_processes.includes(attachments: :file_attachment)\n end",
"def index\n @proposals = current_user.proposals\n end",
"def get_proposals_from_barclamps(barclamps)\n modules = {}\n active = RoleObject.active\n barclamps.each do |name, details|\n props = ProposalObject.find_proposals name\n modules[name] = { :description=>details['description'] || t('not_set'), :order=> details['order'], :proposals=>{}, :expand=>false, :members=>(details['members'].nil? ? 0 : details['members'].length) }\n begin\n modules[name][:allow_multiple_proposals] = Kernel.const_get(\"#{name.camelize}Service\").method(:allow_multiple_proposals?).call\n rescue\n Rails.logger.debug \"WARNING: could not resolve barclamp #{name}. Please correct the naming to be the object name when camelized\"\n modules[name][:allow_multiple_proposals] = false\n modules[name][:description] = \"#{modules[name][:description]} !Dev Mode Note: Barlcamp does not have matching #{name.camelize}Service object. You may want to set 'barclamp:\\\\user_managed: false' in the crowbar.yml file\" if RAILS_ENV === 'development'\n end\n ProposalObject.find_proposals(name).each do |prop| \n # active is ALWAYS true if there is a role and or status maybe true if the status is ready, unready, or pending.\n status = ([\"unready\", \"pending\"].include?(prop.status) or active.include?(\"#{name}_#{prop.name}\")) \n @count += 1 unless @count<0 #allows caller to skip incrementing by initializing to -1\n modules[name][:proposals][prop.name] = {:id=>prop.id, :description=>prop.description, :status=>(status ? prop.status : \"hold\"), :active=>status}\n if prop.status === \"failed\"\n modules[name][:proposals][prop.name][:message] = prop.fail_reason \n modules[name][:expand] = true\n end\n end \n end\n modules\n end",
"def collection\n @collection ||= participatory_processes\n end",
"def GetPackages\n ProbeKernel() if !@kernel_probed\n deep_copy(@kernel_packages)\n end",
"def unique_prots(prot_groups)\n all_prots = []\n prot_groups.each do |pg|\n pg.prots.each do |prt|\n all_prots << prt\n end\n end\n all_prots.hash_by(:protein_name).map{|name,prot_arr| prot_arr.first }\n end",
"def available_service_providers\n @providers = ServiceProvider.order(rating: :desc).order(rating_count: :desc)\n end",
"def jobs\r\n @profession_kinds = Profession.find(:all)\r\n end",
"def provision_groups\n @attributes[:provision_groups]\n end",
"def chargeable_profiles\n profile ? [profile] : []\n end",
"def index\n if current_user\n @user = User.find(current_user.id)\n end\n\n if current_user && @user.role == \"account_user\" #account_user - not currently used\n @venues = Venue.where(account_id: current_user.account_id)\n @promotions = Promotion.where(venue_id: @venues)\n elsif current_user && @user.role == \"admin\" #admin\n #get all promotions for all venues that the user is registered with\n @venues = Venue.where(account_id: current_user.account_id)\n @promotions = Promotion.where(venue_id: @venues)\n elsif current_user && @user.role == \"hypedrive_employee\"\n @promotions = Promotion.all\n else\n @promotions = Promotion.where('active=:isActive and (start_time >= :time_now or end_time >= :time_now)',\n :isActive => true,\n :time_now => Time.now)\n end\n render json: @promotions\n end",
"def matching_products\n # Regression check for #1596\n # Calculator::PerItem can be used in two cases.\n # The first is in a typical promotion, providing a discount per item of a particular item\n # The second is a ShippingMethod, where it applies to an entire order\n #\n # Shipping methods do not have promotions attached, but promotions do\n # Therefore we must check for promotions\n if self.calculable.respond_to?(:promotion)\n self.calculable.promotion.rules.map(&:products).flatten\n end\n end",
"def products\n @products ||= rules.of_type('Spree::Promotion::Rules::Product').map(&:products).flatten.uniq\n end",
"def quota_provisions_by_group(options)\n quota_provision_stats(:quota_find_provision_by_group, options)\n end",
"def products\n @products ||= rules.of_type('Promotion::Rules::Product').map(&:products).flatten.uniq\n end",
"def shared_contributions\n list = []\n self.permissions.each do |p|\n p.policy.contributions.each do |c|\n list << c unless c.nil? || c.contributable.nil?\n end\n end\n list\n end",
"def products\n products_at_market = []\n vendors_at_market = self.vendors\n vendors_at_market.each do |vendor|\n products_at_market << vendor.products\n end\n return products_at_market.flatten\n end",
"def list_pids\n access_processes do |processes|\n processes.keys\n end\n end",
"def available_delivery_services\n delivery_service_prices.map(&:delivery_service).uniq\n end",
"def get_allowed_property_details\n allowed_property_details = []\n selectable_property_details = PropertyDetail.where(:selectable => true)\n selectable_property_details.each do |pd|\n allowed_property_details.push(pd[:msgid])\n end\n\n return allowed_property_details\n end",
"def available_members()\n # added some logic in here to check whether the class is peak, and only supply a list\n # of premium members. Also want to check to see if there are available spaces for the\n # class, if not - return an empty array.\n if @spaces > 0\n if is_peak()\n sql = \"SELECT * from members WHERE id NOT IN (SELECT member_id FROM bookings WHERE gymclass_id = $1) AND premium = TRUE;\"\n else\n sql = \"SELECT * from members WHERE id NOT IN (SELECT member_id FROM bookings WHERE gymclass_id = $1);\"\n end\n values = [@id]\n results = SqlRunner.run(sql, values)\n return results.map {|member| Member.new(member)}\n else\n return []\n end\n end",
"def available_properties\n @properties ||= list.properties\n end",
"def products()\n return filter_products()\n end"
] |
[
"0.7514177",
"0.74915934",
"0.74653226",
"0.70019376",
"0.6686318",
"0.6671471",
"0.658188",
"0.6534694",
"0.6534694",
"0.6534694",
"0.6451523",
"0.6208908",
"0.6132559",
"0.6059759",
"0.5972661",
"0.5970665",
"0.59209746",
"0.59192353",
"0.5913861",
"0.5838913",
"0.58188444",
"0.5812609",
"0.57117236",
"0.5677627",
"0.56557816",
"0.56421053",
"0.5613492",
"0.55682045",
"0.55594385",
"0.5546153",
"0.55212414",
"0.5504814",
"0.5486333",
"0.5475007",
"0.54525477",
"0.5447306",
"0.54321873",
"0.5418575",
"0.54030454",
"0.538809",
"0.53670365",
"0.5357827",
"0.5356197",
"0.53265756",
"0.5321577",
"0.5302343",
"0.5297482",
"0.5295644",
"0.5289249",
"0.52494967",
"0.524139",
"0.51916164",
"0.5146929",
"0.5123145",
"0.5117493",
"0.511471",
"0.51101816",
"0.50883836",
"0.5063288",
"0.5061979",
"0.5061133",
"0.50522494",
"0.50353706",
"0.5033301",
"0.5020726",
"0.50194186",
"0.50182897",
"0.5014672",
"0.50087345",
"0.50011533",
"0.499185",
"0.49874043",
"0.49868026",
"0.4985912",
"0.49683097",
"0.49671677",
"0.49656862",
"0.49548802",
"0.49489942",
"0.49423575",
"0.49421966",
"0.49378663",
"0.49378282",
"0.49358055",
"0.493078",
"0.49299648",
"0.49170583",
"0.49152064",
"0.49140996",
"0.49122894",
"0.49120343",
"0.49105883",
"0.4910139",
"0.49085554",
"0.48922372",
"0.48878554",
"0.488727",
"0.4885289",
"0.48817807",
"0.48802942"
] |
0.5901234
|
19
|
Basecamp helper method returns an instance specific basecamp object if valid connection credentials exist. Otherwise, returns nil.
|
def basecamp
return nil unless establish_connection!
@basecamp ||= Basecamp.new
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def basecamp_connection\n return unless establish_connection!\n Basecamp.connection\n end",
"def establish_connection!\n return if [app_path, username, password].select{|f| f.blank? }.length > 0\n Basecamp.establish_connection!(app_path, username, password, true) unless @connection_established\n @connection_established = true\n end",
"def initialize(basecamp_id, auth_hash, user_agent)\n self.class.base_uri \"https://basecamp.com/#{basecamp_id}/api/v1\"\n self.class.headers 'User-Agent' => user_agent\n self.auth = auth_hash\n end",
"def people\n return [] if company_id.blank? || !basecamp\n @people ||= basecamp.people(company_id)\n end",
"def set_campus_user\n @campus_user = FortyTwo::CampusUser.find(params[:id])\n end",
"def host\n \"#{account}.campfirenow.com\"\n end",
"def set_camp\n @camp = Camp.find(params[:id])\n end",
"def set_camp\n @camp = Camp.find(params[:id])\n end",
"def set_camp\n @camp = Camp.find(params[:campid])\n end",
"def company\n @company ||= Harvest::API::Company.new(credentials)\n end",
"def account\n @account ||= Harvest::API::Account.new(credentials)\n end",
"def set_campus\n @campus = FortyTwo::Campus.find(params[:id])\n end",
"def set_campsite\n @campsite = Campsite.find(params[:id])\n end",
"def find_with_login_instead_of_default(required_attributes={}, attributes={}, error=:invalid)\n resource = nil\n scope_field = self.basecamper[:scope_field]\n login_fields = self.basecamper[:login_fields]\n\n attributes = devise_parameter_filter.filter(attributes)\n\n login_fields.each do |login_field|\n login_field = login_field.downcase.to_sym\n\n resource = to_adapter.find_first({\n login_field => attributes[:login],\n scope_field => attributes[scope_field]\n })\n\n break unless resource.nil?\n end\n\n unless resource\n resource = new\n\n required_attributes.each do |key|\n unless key == self.basecamper[:subdomain_field]\n value = attributes[key]\n resource.send(\"#{key}=\", value)\n resource.errors.add(key, value.present? ? error : :blank)\n end\n end\n end\n\n return resource\n end",
"def validate!\r\n if Billomat.account.nil?\r\n raise 'No Account set, use Billomat.account='\r\n end\r\n if !Billomat.key.nil? || ( !Billomat.email.nil? && !Billomat.password.nil? )\r\n !!Billomat::Myself.find\r\n else\r\n raise 'No authentication info set, set either Billomat.key XOR use Billomat.authenticate(email, password)'\r\n end\r\n end",
"def set_campanium\n @campanium = Campanium.find(params[:id])\n end",
"def bwapi\n abort \"You have no current user set!\".yellow unless current_user_exists?\n abort \"There is no access token set for the current user\".yellow if config.current_user.access_token.nil?\n abort \"There is no environment set for the current user\".yellow if config.current_user.environment.nil?\n\n return @bwapi ||= BWAPI::Client.new(:username => current_user.username, :password => decrypt_password(current_user.username, current_user.password), :api_endpoint => api_endpoint)\n end",
"def set_camp\n\t\t\t@camp = Camp.find(params[:id])\n\t\tend",
"def companies\n return [] unless basecamp\n @companies ||= basecamp.companies\n end",
"def quip_auth\n self.authentications.where(provider: 'quip').first\n end",
"def set_campsite\n @campsite = Campsite.find(params[:id])\n end",
"def set_mailchimp\n @mailchimp = Mailchimp.first\n end",
"def base_credential; end",
"def initialize(subdomain, options = {})\n options = { :ssl => false }.merge(options)\n @cookie = nil\n @subdomain = subdomain\n @uri = URI.parse(\"#{options[:ssl] ? 'https' : 'http' }://#{subdomain}.campfirenow.com\")\n if options[:proxy]\n uri = URI.parse(options[:proxy])\n @http = Net::HTTP::Proxy(uri.host, uri.port, uri.user, uri.password)\n else\n @http = Net::HTTP\n end\n @logged_in = false\n end",
"def credentials\n @credentials || self.class.credentials\n end",
"def cobrand_login\n @cobrand_login || YodleeApi.cobrand_login\n end",
"def set_campingsite\n @campingsite = Campingsite.find(params[:id])\n end",
"def get_company\n @company ||= current_company\n end",
"def show\n # Gets us one row, and returns it as an object\n # (an instance of the Campsite model class)\n @campsite = Campsite.find params[:id]\n end",
"def set_camping\n @camping = Camping.find(params[:id])\n end",
"def set_camp_request\n @camp_request = CampRequest.find(params[:id])\n end",
"def get_crunchbase_info\n begin\n info = Crunchbase::Company.get(self.name)\n self.process_logo_upload = true\n self.website = info.homepage_url\n self.num_employees = info.number_of_employees\n self.public = info.ipo ? true : false\n self.description = info.overview.present? ? info.overview : info.description\n self.founded = info.founded\n self.total_money_raised = info.total_money_raised\n self.tags = info.tags\n self.remote_logo_url = \"http://crunchbase.com/#{info.image.first.flatten[-1]}\" if info.image\n self.competitors = info.competitions.map { |company| company[\"competitor\"][\"name\"] } if info.competitions\n rescue Exception => e\n logger.error \"Company #get_crunchbase_info error #{e}\"\n ensure\n self.save\n end\n end",
"def projects\n return [] unless basecamp\n @projects ||= basecamp.projects\n end",
"def current_profile\n @current_profile ||= Account.find_by(subdomain: current_subdomain) if current_subdomain\n end",
"def base_url\n self.class.base_url\n end",
"def campsite\n CampsiteSerializer.new(object.campsite)\n end",
"def get\n\n BabboBackend.instance ||= BabboBackend.new\n end",
"def authenticate_for_profile\n begin\n Garb::Session.login(HHD::Config.analytics_email, HHD::Config.analytics_pwd)\n Garb::Profile.first(HHD::Config.analytics_profile)\n rescue\n nil\n end\n end",
"def get_robocall_campaign\n\t\tbegin\n @robocall_campaign = current_political_campaign.robocall_campaigns.find(params[:id]) unless current_political_campaign.nil?\n\t if current_political_campaign.nil? && current_user.is_admin?\n\t\t @robocall_campaign = Campaign.find(params[:id])\n\t\t session[:current_political_campaign] = @robocall_campaign.political_campaign\n\t\t\tend \n rescue ActiveRecord::RecordNotFound\n \tflash[:error] = \"The requested Robocall Campaign was not found.\"\n \tredirect_back_or_default customer_control_panel_url\n end\n\tend",
"def base_url\n self.class.base_url\n end",
"def connection\n @connection ||= if authenticated?\n RestClient::Resource.new(api_uri.to_s, @username, @password)\n else\n RestClient::Resource.new(api_uri.to_s)\n end\n end",
"def new\n @camp_registration = CampRegistration.new\n end",
"def credentials\n authenticating_with_api? ? {:api_key => api_key} : super\n end",
"def connection\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"base_url=#{base_url}\",\n \"username=#{username}\",\n # \"password=#{password}\",\n \"\" ], bold_puts: debug_verbose_puts if debug_verbose\n rv = Faraday.new(url: base_url) do |c|\n c.basic_auth(username, password)\n c.adapter(Faraday.default_adapter)\n end\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"rv=#{rv}\",\n \"\" ], bold_puts: debug_verbose_puts if debug_verbose\n return rv\n end",
"def email; default_profile.try :email; end",
"def base_url\n @base_url||=@options['base_url']\n end",
"def me_api_key\n api_key = ApiKey.find(me.api_key_id) if auth?\n api_key.api_key || ''\n end",
"def show\n if current_user.type != 'Administrator'\t\n check_privilege(@institution)\n end\n @campus = Campu.where(institution_id: @institution.id).find_each\n @campu = Campu.new\n end",
"def api_client( )\n if self.session_token?\n db_session = DropboxSession.deserialize(self.session_token)\n begin\n return DropboxClient.new(db_session, ACCESS_TYPE)\n rescue DropboxAuthError => e\n \tRails.logger.info(\"Could not authenticate DropBox Account\" )\n end\n else\n \tRails.logger.info(\"User does not have a DropBox Account\" )\n end\n\n \treturn nil \n\tend",
"def set_campus\n @campus = Campus.find(params[:id])\n end",
"def set_campus\n @campus = Campus.find(params[:id])\n end",
"def facebook\n FbConnection\n end",
"def connection\n BigRecord::Base.connection\n end",
"def connection\n BigRecord::Base.connection\n end",
"def connection_base?\n @base || @connection_specification\n end",
"def mongo_connection\n # Returns the connection if it is already established\n return $db_connection if $db_connection\n\n db = URI.parse(ENV['MONGOHQ_URL'])\n db_name = db.path.gsub(/^\\//, '')\n $db_connection = Mongo::Connection.new(db.host, db.port).db(db_name)\n\n unless db.user.nil? || db.password.nil?\n $db_connection.authenticate(db.user, db.password)\n end\n\n $db_connection\nend",
"def connection\n @connection ||= Gandi::Connection.new(apikey, url)\n end",
"def github\n self.account.blank? ? nil : GitHub::API.user(self.account)\n end",
"def connection\n retrieve_connection\n end",
"def get_connection\n return @db_connection if @db_connection\n mongo_client = MongoClient.new(\"localhost\", 27017)\n @db_connection = mongo_client.db(\"robocoder2\")\n end",
"def default_campus_id\n unless @current_campus_id\n #campus_found = nil\n #campus_count = {}\n #last_3_campuses = WeeklyReport.find(:all, :include => [:week], :conditions => {:staff_id => get_current_staff_id}, :limit => 3, :order => \"#{Week.__(:end_date)} DESC\").collect{|wr| wr[:campus_id]}\n #last_3_campuses.each do |c|\n # campus_count[c] ||= 0\n # campus_count[c] += 1\n #end\n#\n# last_3_campuses.each do |cf|\n# campus_found = cf if campus_found.nil? || campus_count[cf] >= campus_count[campus_found]\n# end\n# @current_campus_id ||= campus_found\n\n # if person's most recently submitted stats are at a campus they no longer have involvements at\n # if @current_campus_id.nil? || @my.ministries.index(Campus.find(@current_campus_id).derive_ministry).nil?\n @current_campus_id = user_campuses_with_new_prc_permission.first.id\n # end\n\n end\n @current_campus_id\n end",
"def initialize(subdomain, options = {})\n options = { :ssl => false }.merge(options)\n @subdomain = subdomain\n @uri = URI.parse(\"#{options[:ssl] ? \"https\" : \"http\"}://#{subdomain}.campfirenow.com\")\n @room = nil\n @directory = \".\"\n @agent = WWW::Mechanize.new\n @agent.user_agent_alias = \"Mac FireFox\"\n @logged_in = false\n end",
"def current_company\n Company.find(:first)\nend",
"def get_contestorganization\n @contestorganization = Contestorganization.find_by_id(params[:id])\n return if check_nil_object(@contestorganization)\n end",
"def find_or_initialize_court\n c100_application.court || Court.find_by(slug: slug_fixture) || Court.new(court_fixture)\n end",
"def initialize(username, password, base_url)\n self.username = username\n self.password = password\n self.base_url = base_url\n end",
"def current_account\n begin\n super\n rescue ActiveRecord::RecordNotFound\n # Could be in 2nd step of account signup where account saved but not active\n # Will raise error if no session id or account not found\n Account.find(session[:account_id]) \n end\n end",
"def current_company\n Company.find(1)\n end",
"def current_person\n unless @cp and @request.session[:user_id]\n @cp = User.get(@request.session[:user_id])\n end\n @cp\n end",
"def set_campanha\n @campanha = Campanha.find(params[:id])\n end",
"def bc_client_id\n ENV['BC_CLIENT_ID']\nend",
"def setup_bicho\n Bicho.client = Bicho::Client.new(BUGZILLA_URL)\nend",
"def setup_bicho\n Bicho.client = Bicho::Client.new(BUGZILLA_URL)\nend",
"def initialize\n super('Basic')\n @cred = nil\n @auth = {}\n @force_auth = false\n end",
"def initialize\n login = self.read_login_data\n @base_url = login['base_url']\n @user = login['user']\n @password = login['password']\n end",
"def client\n @admin ||= User.find_by(is_admin: true)\n @auth_record ||= @admin.auth_record\n @client ||= CiscoAmpApi::V1::Client.new(@auth_record.api_client, @auth_record.api_key )\n end",
"def get_current_account_and_membership\n if !@current_membership || !@current_account\n account_id = params[:account_id]\n authenticate_user! unless current_user\n @current_membership = Landlord::Membership.find_by(user_id: current_user.id, account_id: account_id) if account_id\n @current_account = @current_membership.account if @current_membership\n end\n end",
"def site\n if [@api_key, @password, @subdomain].any? do |v|\n v.nil? || !defined?(v)\n end\n raise AuthorityLabs::ArgumentError.new(\n \"The API key, password, and subdomain must be defined.\"\n )\n else\n \"http://#{@api_key}:#{@password}@#{@subdomain}.authoritylabs.com/\"\n end\n end",
"def initialize(base=nil)\r\n get(base)\r\n end",
"def initialize\n @key = ENV['CLOUDCUBE_ACCESS_KEY_ID']\n @secret = ENV['CLOUDCUBE_SECRET_ACCESS_KEY']\n @url = ENV['CLOUDCUBE_URL']\n end",
"def current_account(raise_on_not_found = true)\n @current_account ||= Account.find_by_full_domain(request.host) || (Rails.env.development? ? Account.first : nil)\n raise ActiveRecord::RecordNotFound if !@current_account && raise_on_not_found\n @current_account\n end",
"def current_baby\n if (baby_id = session[:baby_id])\n @current_baby ||= Baby.find_by(id: baby_id)\n elsif (baby_id = cookies.encrypted[:baby_id])\n baby = Baby.find_by(id: baby_id)\n if baby && baby.authenticated?(cookies[:remember_token])\n log_in baby\n @current_baby = baby\n end\n end\n end",
"def current_account\n begin\n super\n rescue ActiveRecord::RecordNotFound\n # Could be in 2nd step of account signup where account saved but not active\n # Will raise error if no session id or account not found\n Account.find_by_id(session[:account_id])\n end\n end",
"def current_company\n if (company_id = session[:company_id])\n @current_company ||= Company.find_by(id: company_id)\n elsif (company_id = cookies.signed[:company_id])\n company = Company.find_by(id: company_id)\n if company && company.authenticated?(:remember, cookies[:remember_token])\n log_in company\n @current_company = company\n end\n end\n end",
"def auth\n @auth ||= EbanqApi::Auth.new(self)\n end",
"def cobrand_password\n @cobrand_password || YodleeApi.cobrand_password\n end",
"def connection\n return nil unless has_connection?\n ActiveRecord::Base.connection\n end",
"def get_mail_account\n\n return nil if self.mail_account_id.nil?\n\n return MailAccount.find_by_id(self.mail_account_id)\n end",
"def profile\n @profile ||= GATEWAY.get_profile_details(self.profile_id) unless profile_id.nil?\n end",
"def connection\n @connection || Connection.new\n end",
"def get_api_creds\n\t\t#account = Account.first\n\t\tp 1111111111111\n\t\tRails.logger.info \"get api details\"\n\t\tRails.logger.debug \"#{params}\"\n\t\taccount = Account.find_by(:domain_name => params[\"domain_name\"])\n\t\t@api_domain = account.try(:api_domain)\n\t\t@api_key = account.try(:api_key)\n\tend",
"def base_url\n if ENV['BASE_URL']\n ENV['BASE_URL']\n else\n 'https://beam.pro/'\n end\n end",
"def base_url\n Thread.current[\"GopDataTrust/Api/@base_url\"] || connect\n raise \"Must Connect To GOP Data Trust\" if Thread.current[\"GopDataTrust/Api/@base_url\"].nil?\n Thread.current[\"GopDataTrust/Api/@base_url\"]\n end",
"def current_company\n current_user ? current_user.company : nil\n end",
"def hominid\n @hominid ||= Hominid::API.new(configuration.mailchimp_api_key)\n end",
"def campus_only?\n access == 'Campus Only Access (No Proxy)'\n end",
"def connection\n @connection || Counterparty.connection\n end",
"def api\n # Should return an instance of the API instantiated \n # with the credentials passed into the initialized.\n # Raise an error to warn it isn't implemented.\n raise NotImplementedError.new \n end",
"def initialize\n load_site\n load_creds\n end",
"def me\n CircleCi.request(conf, '/me').get\n end"
] |
[
"0.7672671",
"0.59911245",
"0.5626143",
"0.51805216",
"0.517009",
"0.5117425",
"0.5108495",
"0.5108495",
"0.50839883",
"0.5073246",
"0.5069892",
"0.5067903",
"0.5064274",
"0.5042828",
"0.5038577",
"0.5032745",
"0.50205684",
"0.49857393",
"0.49834186",
"0.4960603",
"0.4952047",
"0.49327245",
"0.49265668",
"0.49228653",
"0.49153966",
"0.4908948",
"0.49061656",
"0.48995632",
"0.48982558",
"0.48730692",
"0.4862165",
"0.48599616",
"0.48544145",
"0.4848892",
"0.48351717",
"0.4828874",
"0.4814147",
"0.48105222",
"0.47825179",
"0.47753766",
"0.47711274",
"0.47699186",
"0.47544873",
"0.47544235",
"0.4748936",
"0.47453508",
"0.4730366",
"0.4724864",
"0.4723897",
"0.47153333",
"0.47153333",
"0.4710155",
"0.4701249",
"0.4701249",
"0.46941143",
"0.46904153",
"0.4687704",
"0.4684339",
"0.46789095",
"0.4674858",
"0.46652666",
"0.46559918",
"0.4644292",
"0.46434796",
"0.46412873",
"0.46410707",
"0.46295735",
"0.4628923",
"0.46249315",
"0.46246713",
"0.4624292",
"0.46221936",
"0.46221936",
"0.46089914",
"0.46057728",
"0.46051675",
"0.45882702",
"0.45860988",
"0.4585",
"0.4584465",
"0.45843446",
"0.45792308",
"0.45765275",
"0.4573754",
"0.45730653",
"0.45678964",
"0.45660096",
"0.45639494",
"0.45595986",
"0.45557958",
"0.45555046",
"0.45532686",
"0.4547148",
"0.45379463",
"0.4535578",
"0.4533407",
"0.45248038",
"0.45212522",
"0.4519734",
"0.4518652"
] |
0.8374647
|
0
|
Estbalished a connection to basecamp using the configured account details. Returns nil if any of the account details is missing.
|
def establish_connection!
return if [app_path, username, password].select{|f| f.blank? }.length > 0
Basecamp.establish_connection!(app_path, username, password, true) unless @connection_established
@connection_established = true
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def basecamp_connection\n return unless establish_connection!\n Basecamp.connection\n end",
"def basecamp\n return nil unless establish_connection!\n @basecamp ||= Basecamp.new\n end",
"def account\n @account ||= Harvest::API::Account.new(credentials)\n end",
"def setupCoinbase\n if ENV['RACK_ENV'] == \"development\"\n secrets_json = File.read('secrets.json')\n secrets_hash = JSON.parse( secrets_json )\n key = secrets_hash['key']\n secret = secrets_hash['secret']\n else\n key = ENV[\"CB_KEY\"]\n secret = ENV[\"CB_SECRET\"]\n end\n\n @@client = Coinbase::Wallet::Client.new(api_key: key, api_secret: secret)\n @@account = @@client.primary_account\n\nend",
"def show_account_configuration\n bla = Account.new @base\n puts \"done #{bla}\"\n end",
"def account\n @account = current_account_settings\n end",
"def account(fields: nil)\n params = build_fields_params fields\n res = @connection.get account_path, params\n Account.new res.body, self\n end",
"def test_bank_acct_profile\r\n\r\n @place_holder.login_and_assert_profile(PropertiesReader.get_bank_acct_profile_url)\r\n\r\n end",
"def account\n @details ||= fetch_details\n @details[:account]\n end",
"def account(params = {})\n make_get_request('/account', params)\n end",
"def account\n @account ||= AccountContext.new(self, @domain.client.account_sid)\n end",
"def account_info(opts = {})\n params = {\n account: opts.delete(:account) || client_account,\n strict: opts[:strict].nil?? true : opts[:strict],\n ledger_hash: opts[:ledger_hash],\n ledger_index: opts[:ledger_index] || \"validated\",\n }\n post(:account_info, params)\n end",
"def account\n @account ||= Account.find(accountRef)\n end",
"def settlement_account(params)\n # Validation\n params = validate_input(params, @exception_array += %w[account_name bank_ref bank_branch_ref account_number currency value])\n # The Request Body Parameters\n settlement_body = {\n account_name: params['account_name'],\n bank_ref: params['bank_ref'],\n bank_branch_ref: params['bank_branch_ref'],\n account_number: params['account_number']\n }\n settlement_hash = K2Transfer.make_hash('merchant_bank_accounts', 'POST', @access_token, 'Transfer', settlement_body)\n @threads << Thread.new do\n sleep 0.25\n @location_url = K2Connect.to_connect(settlement_hash)\n end\n @threads.each(&:join)\n end",
"def establish_connection\n end",
"def account_info()\n response = @session.do_get build_url(\"/account/info\")\n parse_response(response)\n end",
"def bank_account\n response = JSON.parse(@client.get(\"users/#{send(:id)}/bank_accounts\").body)\n Promisepay::BankAccount.new(@client, response['bank_accounts'])\n rescue Promisepay::UnprocessableEntity\n nil\n end",
"def connection\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"base_url=#{base_url}\",\n \"username=#{username}\",\n # \"password=#{password}\",\n \"\" ], bold_puts: debug_verbose_puts if debug_verbose\n rv = Faraday.new(url: base_url) do |c|\n c.basic_auth(username, password)\n c.adapter(Faraday.default_adapter)\n end\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"rv=#{rv}\",\n \"\" ], bold_puts: debug_verbose_puts if debug_verbose\n return rv\n end",
"def account; Account.get(self.account_id); end",
"def account; Account.get(self.account_id); end",
"def account; Account.get(self.account_id); end",
"def account; Account.get(self.account_id); end",
"def account; Account.get(self.account_id); end",
"def account; Account.get(self.account_id); end",
"def account; Account.get(self.account_id); end",
"def account; Account.get(self.account_id); end",
"def account; Account.get(self.account_id); end",
"def account; Account.get(self.account_id); end",
"def initialize\n @site_name = ENV['SITE_NAME']\n @api_key = ENV['API_KEY']\n @api_secret = ENV['API_SECRET']\n raise LoginRadius::Error.new, \"'site_name' is a required option for Account class initialization.\" \\\n unless @site_name != '' && @site_name != nil\n raise LoginRadius::Error.new, \"'api_key' is a required option for Account class initialization.\" \\\n unless @api_key != '' && @api_key != nil\n raise LoginRadius::Error.new, \"'api_secret is a required option for Account class initialization.\" \\\n unless @api_secret != '' && @api_secret != nil\n end",
"def initialize\n @site_name = ENV['SITE_NAME']\n @api_key = ENV['API_KEY']\n @api_secret = ENV['API_SECRET']\n raise LoginRadius::Error.new, \"'site_name' is a required option for Account class initialization.\" \\\n unless @site_name != '' && @site_name != nil\n raise LoginRadius::Error.new, \"'api_key' is a required option for Account class initialization.\" \\\n unless @api_key != '' && @api_key != nil\n raise LoginRadius::Error.new, \"'api_secret is a required option for Account class initialization.\" \\\n unless @api_secret != '' && @api_secret != nil\n end",
"def initialize\n @site_name = ENV['SITE_NAME']\n @api_key = ENV['API_KEY']\n @api_secret = ENV['API_SECRET']\n raise LoginRadius::Error.new, \"'site_name' is a required option for Account class initialization.\" \\\n unless @site_name != '' && @site_name != nil\n raise LoginRadius::Error.new, \"'api_key' is a required option for Account class initialization.\" \\\n unless @api_key != '' && @api_key != nil\n raise LoginRadius::Error.new, \"'api_secret is a required option for Account class initialization.\" \\\n unless @api_secret != '' && @api_secret != nil\n end",
"def initialize\n @site_name = ENV['SITE_NAME']\n @api_key = ENV['API_KEY']\n @api_secret = ENV['API_SECRET']\n raise LoginRadius::Error.new, \"'site_name' is a required option for Account class initialization.\" \\\n unless @site_name != '' && @site_name != nil\n raise LoginRadius::Error.new, \"'api_key' is a required option for Account class initialization.\" \\\n unless @api_key != '' && @api_key != nil\n raise LoginRadius::Error.new, \"'api_secret is a required option for Account class initialization.\" \\\n unless @api_secret != '' && @api_secret != nil\n end",
"def initialize\n @site_name = ENV['SITE_NAME']\n @api_key = ENV['API_KEY']\n @api_secret = ENV['API_SECRET']\n raise LoginRadius::Error.new, \"'site_name' is a required option for Account class initialization.\" \\\n unless @site_name != '' && @site_name != nil\n raise LoginRadius::Error.new, \"'api_key' is a required option for Account class initialization.\" \\\n unless @api_key != '' && @api_key != nil\n raise LoginRadius::Error.new, \"'api_secret is a required option for Account class initialization.\" \\\n unless @api_secret != '' && @api_secret != nil\n end",
"def account\n self\n end",
"def current_account\n begin\n super\n rescue ActiveRecord::RecordNotFound\n # Could be in 2nd step of account signup where account saved but not active\n # Will raise error if no session id or account not found\n Account.find(session[:account_id]) \n end\n end",
"def getaccountaddress(account)\n coind.getaccountaddress account\n end",
"def host\n \"#{account}.campfirenow.com\"\n end",
"def account\n get('account')\n end",
"def card_account\n response = JSON.parse(@client.get(\"users/#{send(:id)}/card_accounts\").body)\n Promisepay::CardAccount.new(@client, response['card_accounts'])\n rescue Promisepay::UnprocessableEntity\n nil\n end",
"def akamai_client\n\n unless File.exist?(@edgerc)\n @log.warn(\"\\t The configuration file '#{@edgerc}' does not exist or cannot be read.\")\n return nil\n end\n\n config = IniFile.load(@edgerc)\n\n if(config[@akamai_profile].empty?)\n @log.warn(\"\\t The configuration file '#{@edgerc}' does not contain a '[#{@akamai_profile}]' profile.\")\n return nil\n end\n\n api_config = config[@akamai_profile]\n api_endpoint = URI(\"https://#{api_config['host']}\")\n\n #\n # Currently we only support clearing the 'production' cache as we do not have a staging cache.\n #\n @fast_purge_api_endpoint = \"#{api_endpoint.to_s}/ccu/v3/invalidate/url/production\"\n\n api_client = Akamai::Edgegrid::HTTP.new(\n address = api_endpoint.host,\n port = api_endpoint.port\n )\n api_client.setup_edgegrid(\n client_token: api_config['client_token'],\n client_secret: api_config['client_secret'],\n access_token: api_config['access_token']\n )\n api_client.open_timeout = 20\n api_client.read_timeout = 20\n api_client\n\n end",
"def establish_connection(config=nil)\n super\n ensure_logger\n connection.connect\n # Make irb users happy with a 'true'\n true\n end",
"def fetch_zendesk_account\n # Pull the subdomain from the ?account query param.\n env[\"rack.request.query_hash\"].fetch(\"account\") do\n # No param 'account' was found, throw an error.\n raise AccountError.new \"account key needed in query string\"\n end\n end",
"def current_account\n ENV['CURRENT_ACCOUNT']\n #BlOCKCHAIN_CLIENT.eth_accounts['result'][0]\n #'0x1f9334BAE0acC7a86834f60488d0C6Fa89B4590b'\n end",
"def connect\n debug \"setting up.. jid #{base.config[:account_jid]}\" \n cl = Jabber::Client.new(Jabber::JID::new(base.config[:account_jid]))\n @client = cl\n begin\n debug \"connect\"\n cl.connect \n debug \"auth\"\n cl.auth base.config[:account_password]\n # XXX should catch only proper exception types (including Jabber::ClientAuthenticationFailure)\n rescue Exception => ex \n debug \"EX: #{ex.class} \"\n debug ex.backtrace\n @base.auth_failure \n end\n \n @roster = Jabber::Roster::Helper.new cl \n @roster.add_presence_callback do |item,oldpres,pres|\n pres = Jabber::Presence.new unless pres\n oldpres = Jabber::Presence.new unless oldpres \n status = pres.status.to_s\n presence = pres.show || :available\n jid = item.jid\n # XXX unavaliable\n presence = :unavailable if pres.status.to_s == 'unavailable'\n debug \"item #{jid} chaged presence to #{presence} status #{status}\"\n base.item_presence_change(jid.to_s,presence,status)\n end\n \n @base.roster_items = get_roster_items\n\n @client.send Jabber::Presence.new\n \n set_presence\n\n cl.add_message_callback do |m|\n if m.type != :error\n debug \"message received from #{m.from} type #{m.type}\"\n @base.message_received(m.from.to_s,m.body)\n end\n end\n end",
"def set_broker_acct\n #@broker_acct = current_account.meta\n end",
"def initialize(basecamp_id, auth_hash, user_agent)\n self.class.base_uri \"https://basecamp.com/#{basecamp_id}/api/v1\"\n self.class.headers 'User-Agent' => user_agent\n self.auth = auth_hash\n end",
"def current_account\n begin\n super\n rescue ActiveRecord::RecordNotFound\n # Could be in 2nd step of account signup where account saved but not active\n # Will raise error if no session id or account not found\n Account.find_by_id(session[:account_id])\n end\n end",
"def find_account\n @account = current_account\n end",
"def retrieve_account_details\n\t\taccount = $twitter.user(\"#{self.handle}\")\n\t\tself.name = account.name\n\t\tself.avatar_url = account.profile_image_uri\n\tend",
"def set_connected_account\n @connected_account = ConnectedAccount.find(params[:id])\n end",
"def initialize_account\n if employer_profile_account.blank?\n self.build_employer_profile_account\n employer_profile_account.next_premium_due_on = (published_plan_year.start_on.last_month) + (Settings.aca.shop_market.binder_payment_due_on).days\n employer_profile_account.next_premium_amount = 100\n # census_employees.covered\n save\n end\n end",
"def check_account_params\n raise NoGoogleAnalyticsAccountError unless @utmac\n raise NoGoogleAnalyticsDomainError unless @utmhn\n end",
"def check_account_params\n raise NoGoogleAnalyticsAccountError unless @utmac\n raise NoGoogleAnalyticsDomainError unless @utmhn\n end",
"def account\n\n end",
"def set_account\n response = @account_api.find(params[:id])\n @account = response[:account]\n end",
"def getaccount(coinaddress)\n coind.getaccount coinaddress\n end",
"def account\n @account ||= current_customer.account\n end",
"def test_bank_profile\r\n\r\n @place_holder.login_and_assert_profile(PropertiesReader.get_bank_profile_url)\r\n\r\n end",
"def accounts\n @accounts ||= EbanqApi::Accounts.new(self)\n end",
"def setup_new_bank_account(bank_code, credentials, country = 'de', options = {})\n data = { \"bank_code\" => bank_code,\n \"country\" => country,\n \"credentials\" => credentials\n }\n data = data.merge(options)\n query_api \"/rest/accounts\", data, \"POST\"\n end",
"def connect \\\n config,\n blurb,\n options: nil,\n &block\n request = {\n config: config,\n blurb: blurb\n }.delete_if { |_, v| v.nil? }\n request = Google::Gax.to_proto request, Google::Showcase::V1alpha3::ConnectRequest\n @connect.call(request, options, &block)\n end",
"def set_b_account\n @b_account = BAccount.find(params[:id])\n end",
"def fetch_accounts\n log 'fetch_accounts'\n data = get(PRODUCTS_ENDPOINT, fields: { carteras: false,listaSolicitada: 'TODOS',indicadorSaldoPreTarj: false })\n cuentas = data['datosSalidaCuentas']['cuentas'].zip(data['datosSalidaCodIban']['datosIban'])\n cuentas.map{ |data| build_account(data) }\n end",
"def initialize(account={})\n @deferrable_args = [self]\n @account_apikey = account[:apikey]\n end",
"def authenticate_account\n self.password ||= ''\n self.match = Account.find_by_email_address_and_password(self.site_id, self.email_address, self.password)\n if self.match\n self.account_id ||= self.match.id\n end\n end",
"def getbalance(account = nil, minconf = 1)\n coind.getbalance account, minconf\n end",
"def account_info(options = {})\n request :account, :get, 'account', options\n end",
"def find_account\n @current_account = Account.find_by_short_name(account_subdomain)\n if !@current_account\n logger.info(\"There's no account with short name #{account_subdomain}, redirecting to the home\")\n redirect_to public_home_page_url\n elsif @current_account.blocked?\n logger.info(\"Access attempt by blocked account #{account_subdomain}, redirecting to the home\")\n redirect_to public_home_page_url\n else\n logger.info(\"Request for account #{@current_account.short_name}\")\n handle_direct_login if @current_account.direct_login?\n end\n end",
"def autofill_from_config\n self.pid ||= Config.credentials[:PID] if self.respond_to?(:pid=)\n self.pak ||= Config.credentials[:PAK] if self.respond_to?(:pak=)\n \n # Note: URLs are optional fields, but prefilling from config anyway\n self.cancel_url ||= Config.endpoints[:cancel] if self.respond_to?(:cancel_url=)\n self.success_url ||= Config.endpoints[:success] if self.respond_to?(:success_url=)\n self.failure_url ||= Config.endpoints[:failure] if self.respond_to?(:failure_url=)\n end",
"def validate!\r\n if Billomat.account.nil?\r\n raise 'No Account set, use Billomat.account='\r\n end\r\n if !Billomat.key.nil? || ( !Billomat.email.nil? && !Billomat.password.nil? )\r\n !!Billomat::Myself.find\r\n else\r\n raise 'No authentication info set, set either Billomat.key XOR use Billomat.authenticate(email, password)'\r\n end\r\n end",
"def set_account\n\t # I made changes to this so if something broke, check here first\n\t if params[:id] != nil\n @account = Account.find(params[:id])\n\t elsif params[:account] != nil\n\t @account = Account.find(params[:account][:id])\n\t end\n\t rescue ActiveRecord::RecordNotFound\n redirect_to \"/home/index\"\n end",
"def manage_connect\n Puppet.debug \"calling manage_connect\"\n @options = load_fog_options\n acct = setup_account\n\n @accounts.set_cred(@account_name, setup_creds(acct))\n # write to get catalog info\n @accounts.write(@account_name)\n\n avl1_zone_parts = []\n avl1_zone_parts = (@options[:hp_avl_zone] || @options[:avl_zone]).split('.')\n avl1_zone_parts.shift if ( avl1_zone_parts[0] =~ /^az(.*)/ )\n\n region = avl1_zone_parts.join('.')\n Puppet.debug(\"Manager::HP::Connection using region => #{region}\")\n set_region(@accounts.read(@account_name), region)\n\n # validate these settings\n validate(@account_name)\n\n @accounts.write(@account_name)\n use_account(@account_name)\n Puppet.debug \"done calling manage_connect\"\n end",
"def fetch_trades_for_account!(account_hash)\n CmeFixListener::Client.new(account_hash).establish_session!\n rescue StandardError => e\n notify_admins_of_error(e, \"Error fetching trades for #{account_hash['id']}: #{e.message}\", nil)\n nil\n end",
"def setup()\n sess_acc = account_setup\n log_to_sheet(sess_acc)\n return sess_acc\nend",
"def account\n\t\t@email = params[:vitalsource][:email]\n\t\t@password = params[:vitalsource][:password]\n\t\tdoc = Builder::XmlMarkup.new(:target => out_string = \"\", :indent =>2)\n\t\t#----------user login request body------------------------------------------------------------------------\n\t\tdoc.credentials{\n\t\t\tdoc.credential(\"email\" => @email, \"password\" => @password)\n\t\t}\n\t\t#user login request url\n\t\trequest_url = \"/v3/credentials.xml\"\n\t\t# #return: \n\t\t# #{\"credentials\"=>{\"credential\"=>{\"access_token\"=>\"4e2503801317d29a915895b17d560c54\", \"reference\"=>\"\", \"guid\"=>\"B2EY7AGYKNNMER76H56M\", \"email\"=>\"lemon_victor@hotmail.com\", \"__content__\"=>\"\\n \"}}}\n\t\t@request = out_string\n\t\turi = URI.parse(\"https://api.vitalsource.com\")\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\thttp.use_ssl = true\n\t\thttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\t\trequest = Net::HTTP::Post.new(request_url)\t\t\n\t\trequest.add_field('X-VitalSource-API-Key', 'YNBWZXTN743PWCZG')\n\t\trequest.body = out_string\n\t\tresponse = http.request(request)\n\t\tbody = Hash.from_xml(response.body)\n\t\tif(!body.has_key?(\"error\"))\n\t\t\t@err = body[\"credentials\"][\"error\"]\n\t\tend\n\t\tif(!body.has_key?(\"credential\"))\n\t\t\t@user = body[\"credentials\"][\"credential\"]\n\t\tend\n\tend",
"def auto_login(account)\n request.env[\"keycard.authentication\"] = notary.waive(account)\n setup_session\n end",
"def twitter_connect\n access_token = OAuth::AccessToken.new(UserSession.oauth_consumer, self.oauth_token, self.oauth_secret)\n user_info = JSON.parse(access_token.get(\"https://twitter.com/account/verify_credentials.json\").body)\n\n self.login = user_info['screen_name']\n self.twitter_name = user_info['name']\n self.password = \"5uttr33_#{self.login}\"\n self.signup_source = 'twitter'\n self.save\n end",
"def create\n #@broker_acct = BrokerAcct.new(broker_acct_params)\n #@broker_acct.account = current_account\n @acct = BrokerAcct.new(broker_acct_params)\n @acct.email = current_account.email if @acct.email.blank?\n @acct.account = current_account\n\n respond_to do |format|\n if @acct.save\n format.html { render :profile, notice: 'Broker Account was successfully created.' }\n format.json { render :profile, status: :created, location: @acct }\n else\n format.html { render :new }\n format.json { render json: @acct.errors, status: :unprocessable_entity }\n end\n end\n end",
"def initialize(account={})\n @client_id = account[:client_id]\n @client_secret = account[:client_secret]\n @username = account[:username]\n @password = account[:password]\n @access_token = account[:token]\n @deferrable_args = [self]\n end",
"def adapter\n account.adapter\n end",
"def create_account(account_number)\n begin\n #if account does not exist, a NotFound Error will be thrown\n accountNumber = account_number\n\n puts \"Creating new account with account number: #{accountNumber}\"\n\n account = Recurly::Account.create(\n :account_code => accountNumber,\n :email => 'verena@example.com',\n :first_name => 'Verena',\n :last_name => 'Example',\n :shipping_addresses => [\n {\n :nickname => 'Work',\n :first_name => 'Verena',\n :last_name => 'Example',\n :company => 'Recurly Inc',\n :phone => '555-222-1212',\n :email => 'verena@example.com',\n :address1 => '123 Main St.',\n :address2 => 'Suite 101',\n :city => 'San Francisco',\n :state => 'CA',\n :zip => '94105',\n :country => 'US'\n },\n {\n :nickname => 'Home',\n :first_name => 'Verena',\n :last_name => 'Example',\n :phone => '555-867-5309',\n :email => 'verena@example.com',\n :address1 => '123 Fourth St.',\n :address2 => 'Apt. 101',\n :city => 'San Francisco',\n :state => 'CA',\n :zip => '94105',\n :country => 'US'\n }\n ]\n )\n\n account = Recurly::Account.find(accountNumber)\n account.billing_info = {\n :first_name => 'Verena',\n :last_name => 'Example',\n :number => '4111-1111-1111-1111',\n :verification_value => '123',\n :month => 11,\n :year => 2019,\n :address1 => '1234 fake st',\n :city => 'Omaha',\n :state => 'NE',\n :zip => '68135',\n :country => 'US'\n\n }\n account.billing_info.save!\n\n #output account to make sure it saved with billing_info\n #account = Recurly::Account.find accountNumber\n #puts \"Account: #{account.inspect}\"\n\n rescue Recurly::Resource::NotFound => e\n puts e.message\n rescue Recurly::API::UnprocessableEntity => e\n puts e.message\n end\n\n end",
"def get_account(account_number)\r\n # the base uri for api requests\r\n query_builder = Configuration.base_uri.dup\r\n\r\n # prepare query string for API call\r\n query_builder << '/accounts/{account_number}'\r\n\r\n # process optional query parameters\r\n query_builder = APIHelper.append_url_with_template_parameters query_builder, {\r\n 'account_number' => account_number\r\n }\r\n\r\n # validate and preprocess url\r\n query_url = APIHelper.clean_url query_builder\r\n\r\n # prepare headers\r\n headers = {\r\n 'user-agent' => 'APIMATIC 2.0',\r\n 'accept' => 'application/json',\r\n 'X-Auth-Token' => Configuration.x_auth_token\r\n }\r\n\r\n # invoke the API call request to fetch the response\r\n response = Unirest.get query_url, headers: headers\r\n\r\n # Error handling using HTTP status codes\r\n if response.code == 401\r\n raise APIException.new 'You are not authenticated', 401, response.raw_body\r\n elsif response.code == 403\r\n raise APIException.new 'This action needs a valid WSSE header', 403, response.raw_body\r\n elsif response.code == 404\r\n raise APIException.new 'Resource not found', 404, response.raw_body\r\n elsif response.code == 400\r\n raise APIException.new 'Http bad request', 400, response.raw_body\r\n elsif !response.code.between?(200, 206) # [200,206] = HTTP OK\r\n raise APIException.new 'HTTP Response Not OK', response.code, response.raw_body\r\n end\r\n\r\n response.body\r\n end",
"def twitter_connect\n access_token = OAuth::AccessToken.new(UserSession.oauth_consumer, self.oauth_token, self.oauth_secret)\n user_info = JSON.parse(access_token.get(\"https://twitter.com/account/verify_credentials.json\").body)\n self.twitter_name = user_info['name']\n self.twitter_screen_name = user_info['screen_name']\n self.login = 'twitter_' + user_info['screen_name']\n self.password = \"5uttr33_#{self.login}\"\n self.signup_source = 'twitter'\n self.save\n end",
"def set_broker_account\n @broker_account = BrokerAccount.find(params[:id])\n end",
"def initialize_active_merchant\n require 'active_merchant'\n\n ::ActiveMerchant::Billing::Gateway.logger = @@logger\n\n am_config = @@glob_config[@@gateway_name.to_sym]\n if am_config.is_a?(Array)\n default_gateway_config = {}\n am_config.each_with_index do |gateway_config, idx|\n gateway_account_id = gateway_config[:account_id]\n if gateway_account_id.nil?\n @@logger.warn \"Skipping config #{gateway_config} -- missing :account_id\"\n else\n default_gateway_config = gateway_config if idx == 0 || gateway_account_id == :default\n end\n end\n am_config = default_gateway_config\n end\n am_config ||= {\n # Sane defaults\n :test => true\n }\n\n if am_config[:test]\n ::ActiveMerchant::Billing::Base.mode = :test\n end\n\n if am_config[:log_file]\n ::ActiveMerchant::Billing::Gateway.wiredump_device = File.open(am_config[:log_file], 'w')\n else\n log_method = am_config[:quiet] ? :debug : :info\n ::ActiveMerchant::Billing::Gateway.wiredump_device = ::Killbill::Plugin::ActiveMerchant::Utils::KBWiredumpDevice.new(@@logger, log_method)\n end\n ::ActiveMerchant::Billing::Gateway.wiredump_device.sync = true\n\n ::ActiveMerchant::Billing::Gateway.open_timeout = am_config[:open_timeout] unless am_config[:open_timeout].nil?\n ::ActiveMerchant::Billing::Gateway.read_timeout = am_config[:read_timeout] unless am_config[:read_timeout].nil?\n ::ActiveMerchant::Billing::Gateway.retry_safe = am_config[:retry_safe] unless am_config[:retry_safe].nil?\n ::ActiveMerchant::Billing::Gateway.ssl_strict = am_config[:ssl_strict] unless am_config[:ssl_strict].nil?\n ::ActiveMerchant::Billing::Gateway.ssl_version = am_config[:ssl_version] unless am_config[:ssl_version].nil?\n ::ActiveMerchant::Billing::Gateway.max_retries = am_config[:max_retries] unless am_config[:max_retries].nil?\n ::ActiveMerchant::Billing::Gateway.proxy_address = am_config[:proxy_address] unless am_config[:proxy_address].nil?\n ::ActiveMerchant::Billing::Gateway.proxy_port = am_config[:proxy_port] unless am_config[:proxy_port].nil?\n\n # Configure the ActiveMerchant HTTP backend\n connection_type = (@@glob_config[:active_merchant] || am_config)[:connection_type]\n if connection_type == :typhoeus\n require 'killbill/ext/active_merchant/typhoeus_connection'\n end\n end",
"def get_testrail_connection()\n @tr_con = nil\n @tr_case_types = nil\n @tr_case_fields = nil\n\n print \"Connecting to TestRail system at:\\n\"\n print \"\\tURL : #{$my_testrail_url}\\n\"\n print \"\\tUser : #{$my_testrail_user}\\n\"\n\n # ------------------------------------------------------------------\n # Set up a TestRail connection packet.\n #\n @tr_con = TestRail::APIClient.new($my_testrail_url)\n @tr_con.user = $my_testrail_user\n @tr_con.password = $my_testrail_password\n\n print \"\\nValidated by TestRail system:\\n\"\n print \"\\tUser : #{@tr_con.user}\\n\"\nend",
"def my_account_url\n get_institution_or_default(:eshelf_url) + '/account'\n end",
"def initialize base_url, api_key\n\t\t\t\t\t@connection = Freshdesk::Api::Client::Request.new base_url, api_key\n\t\t\t\tend",
"def set_connection()\n ::Jenkins::Client.configure do |c|\n c.username = self[:username]\n c.password = self[:password]\n c.url = self[:url]\n end\n end",
"def connection\n\n @hash_connection = {\n :connection => {\n :domain => @domain,\n :store_id => @profile,\n :service_user => @seller_profile,\n :service_password => @password\n }\n }\n\n end",
"def set_account\n @account = Account.find(params[:account_id])\n end",
"def connect\n connector = StripeConnect.new( current_user )\n connect_url, error = connector.connect_url( redirect_uri: confirm_users_url )\n\n if connect_url.nil?\n flash[:error] = error\n redirect_to user_path( current_user )\n else\n redirect_to connect_url\n end\n end",
"def print_account\n # Account\n if valid_file?(@heroku_credentials.file_path) && valid_file?(@ssh_identity.public_file) && valid_file?(@ssh_identity.private_file)\n shell.say \"Current Account Settings:\"\n shell.say \" - Login: #{@heroku_credentials.login}\" \n shell.say \" - Password: #{'*' * @heroku_credentials.password.size}\"\n shell.say \" - Credentials: #{@heroku_credentials.file_path}\"\n shell.say \" - SSH ID (private): #{@ssh_identity.private_file}\\n\"\n shell.say \" - SSH ID (public): #{@ssh_identity.public_file}\"\n else\n shell.say \"ERROR: Heroku account credentials and/or SSH identity not found!\"\n end\n\n # Project\n if File.exists? @git_config_file\n shell.say \"\\nCurrent Project Settings:\"\n shell.say \" - Mode: #{@settings[:mode]}\"\n shell.say \" - App: #{application}\"\n end\n end",
"def connection\n @connection ||= Faraday.new(\"#{URL_PREFIX}\", connection_options) do |conn|\n conn.basic_auth(api_key, nil)\n end\n end",
"def set_baka_account\n @baka_account = BakaAccount.find(params[:id])\n end",
"def account\n find('Account', account_id)\n end",
"def populate\n unless populated? || @institution.nil?\n raise \"The account id must not be nil when populating an account\" if id.nil?\n @institution.populate_account(id)\n end\n end",
"def bridgepay_config\n Hash(\n username: ::BridgePay.username,\n password: ::BridgePay.password,\n merchant_code: ::BridgePay.code,\n merchant_account: ::BridgePay.account\n ) \n end",
"def ensure_connection!\n fail \"Must have active connection\" unless connection\n end",
"def ensure_connection!\n fail \"Must have active connection\" unless connection\n end"
] |
[
"0.6976862",
"0.6860208",
"0.5943242",
"0.57305324",
"0.55482745",
"0.549334",
"0.5433841",
"0.5402015",
"0.53892326",
"0.5338543",
"0.5319351",
"0.5318238",
"0.528531",
"0.52840114",
"0.52208185",
"0.5201174",
"0.51998717",
"0.51969326",
"0.51912296",
"0.51912296",
"0.51912296",
"0.51912296",
"0.51912296",
"0.51912296",
"0.51912296",
"0.51912296",
"0.51912296",
"0.51912296",
"0.51685363",
"0.51685363",
"0.51685363",
"0.51685363",
"0.51685363",
"0.5145409",
"0.5126096",
"0.51232296",
"0.5118616",
"0.5116115",
"0.50911146",
"0.5085488",
"0.50825936",
"0.50823075",
"0.50816864",
"0.50776213",
"0.5072073",
"0.5059487",
"0.50368875",
"0.50331825",
"0.50305974",
"0.50270647",
"0.502401",
"0.5017991",
"0.5017991",
"0.50037456",
"0.5000552",
"0.49891722",
"0.4980653",
"0.4976336",
"0.49760953",
"0.49745628",
"0.49696684",
"0.49267253",
"0.49252722",
"0.49175474",
"0.49155417",
"0.49138027",
"0.4912067",
"0.49042428",
"0.48965466",
"0.48928398",
"0.48908055",
"0.48749655",
"0.48685676",
"0.48674065",
"0.48660716",
"0.4854518",
"0.48523828",
"0.48464745",
"0.48446727",
"0.48415244",
"0.48388654",
"0.483541",
"0.48337656",
"0.4833102",
"0.48175663",
"0.48111728",
"0.48072928",
"0.4803399",
"0.48033434",
"0.4797043",
"0.47942886",
"0.47941512",
"0.47922075",
"0.47901526",
"0.4786736",
"0.47772884",
"0.47771958",
"0.47751492",
"0.47638753",
"0.47638753"
] |
0.6769966
|
2
|
Returns a basecamp connection object. Ensures that a connection is established first, otherwise returns nil
|
def basecamp_connection
return unless establish_connection!
Basecamp.connection
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def basecamp\n return nil unless establish_connection!\n @basecamp ||= Basecamp.new\n end",
"def connection\n @connection ||= make_connection\n end",
"def connection\n @connection ||= build_connection\n end",
"def connection\n raise ConnectionNotEstablished unless @@connection\n return @@connection\n end",
"def connection\n @connection ||= Connection.new(nil)\n end",
"def establish_connection!\n return if [app_path, username, password].select{|f| f.blank? }.length > 0\n Basecamp.establish_connection!(app_path, username, password, true) unless @connection_established\n @connection_established = true\n end",
"def connection\n retrieve_connection\n end",
"def connection\n @connection || Connection.new\n end",
"def connection\n return nil unless has_connection?\n ActiveRecord::Base.connection\n end",
"def connection\n @connection = create_connection! unless connected?\n @connection\n end",
"def connection\n @connection || Counterparty.connection\n end",
"def conn\n\t\treturn @conn ||= self.connect\n\tend",
"def aquire_connection\n conn = if @connection_pool\n @connection_pool.aquire_connection\n else\n @connection\n end\n @status = nil unless conn.connected?\n conn\n end",
"def get_connection\n return @db_connection if @db_connection\n mongo_client = MongoClient.new(\"localhost\", 27017)\n @db_connection = mongo_client.db(\"robocoder2\")\n end",
"def connection\n @connection ||= Bunny.new RabidMQ::Config.load_config\n end",
"def connection\n @connection ||= Gandi::Connection.new(apikey, url)\n end",
"def conn\n #if @conn exists and is open\n if @conn and begin @conn.status rescue PGError false end then\n return @conn\n else\n return @conn = connect_to_database\n end\n end",
"def get_db_connection\n config = read_database_config\n if config.dig(:adapter) == 'postgresql'\n config[:user] = config.delete(:username) if config[:username]\n config[:dbname] = config.delete(:database) if config[:database]\n config.delete(:adapter)\n valid_param_keys = PG::Connection.conndefaults_hash.keys + [:requiressl]\n config.slice!(*valid_param_keys)\n @db ||= PG::Connection.new(config)\n elsif config.dig(:adapter) == 'mysql2'\n @db ||= Mysql2::Client.new(config)\n else\n @db ||= SQLite3::Database.open(\"spectacles-#{Rails.env}.db\")\n end\n end",
"def connection\n ConnectionMutex.synchronize do\n @connection ||= SearchFlip::Connection.new(base_url: SearchFlip::Config[:base_url])\n end\n end",
"def connection\n @connection ||= Oedipus::Connection.new(host: \"127.0.0.1\", port: 9399, verify: false)\n end",
"def connection\n @connection ||= if authenticated?\n RestClient::Resource.new(api_uri.to_s, @username, @password)\n else\n RestClient::Resource.new(api_uri.to_s)\n end\n end",
"def connection\n self.class.connection\n end",
"def connection\n self.class.connection\n end",
"def connection\n self.class.connection\n end",
"def connection\n self.class.connection\n end",
"def connection\n self.class.connection\n end",
"def conn\n @conn ||=\n begin\n if @@require_pg\n require 'pg'\n @@require_pg = false\n end\n initialize_copy nil\n c = PG.connect(arguments)\n @conn_owned = true if c\n c\n end\n end",
"def connection\n @connection ||= Faraday.new(base_url) do |builder|\n build_middleware(builder)\n builder.adapter Faraday.default_adapter\n end\n end",
"def connection\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"base_url=#{base_url}\",\n \"username=#{username}\",\n # \"password=#{password}\",\n \"\" ], bold_puts: debug_verbose_puts if debug_verbose\n rv = Faraday.new(url: base_url) do |c|\n c.basic_auth(username, password)\n c.adapter(Faraday.default_adapter)\n end\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"rv=#{rv}\",\n \"\" ], bold_puts: debug_verbose_puts if debug_verbose\n return rv\n end",
"def connection\n return unless @url\n\n @connection ||= Faraday::Connection.new(@url) do |b|\n b.request :url_encoded\n b.adapter :net_http\n end\n\n @connection.basic_auth(*@basic_auth) if @basic_auth\n @connection\n end",
"def connection\n return unless @url\n\n @connection ||= Faraday::Connection.new(@url) do |b|\n b.request :url_encoded\n b.adapter :net_http\n end\n\n proc_or_username = @basic_auth.first\n if proc_or_username.respond_to?(:call)\n username_password = proc_or_username.call\n @connection.basic_auth(*username_password)\n elsif proc_or_username\n @connection.basic_auth(*basic_auth)\n end\n\n @connection\n end",
"def connection\n @connection ||= begin\n connection_options = {:builder => @middleware}\n connection_options[:ssl] = {:verify => true} if @endpoint[0..4] == 'https'\n Faraday.new(@endpoint, @connection_options.merge(connection_options))\n end\n end",
"def connection\r\n @connectoin ||= HTTPClient.new\r\n end",
"def connection\n @@connection\n end",
"def connection\n @connection\n end",
"def connection\n @connection ||= begin\n conn = Faraday.new(url: url)\n conn.build do |b|\n conn_build.call(b)\n end if conn_build\n conn\n end\n end",
"def connection\n if defined?(@active_connection_name) && (conn = active_connections[@active_connection_name])\n conn\n else\n # retrieve_connection sets the cache key.\n conn = retrieve_connection\n active_connections[@active_connection_name] = conn\n end\n end",
"def connection\n @connection ||= begin\n connection_options = { builder: @middleware }\n connection_options[:ssl] = { verify: true } if @endpoint[0..4] == 'https'\n Faraday.new(@endpoint, @connection_options.merge(connection_options))\n end\n end",
"def connection\n @connection ||= begin\n conn = Faraday.new(site, options[:connection_opts])\n conn.build do |b|\n options[:connection_build].call(b)\n end if options[:connection_build]\n conn\n end\n end",
"def connection\n settings.connection\n end",
"def connection #:nodoc:\n Thread.current['connection'] ||= retrieve_connection\n Thread.current['connection']\n end",
"def connection\n @connection_class.connection\n end",
"def connection\n @connection ||= begin\n connection_options = {:builder => @middleware}\n Faraday.new(@endpoint, @connection_options.merge(connection_options))\n end\n end",
"def amqp_connect\n\n ocon = opt('connection')\n\n if BOSS.connection && ( ! ocon)\n BOSS.connection\n else\n Bunny.new(Ruote.keys_to_sym(ocon || {}))\n end\n end",
"def connection\n @connection ||= begin\n active_record = Class.new(_orel_options.active_record)\n Orel::Connection.new(active_record)\n end\n end",
"def connection\n @connection ||= @bunny_client.session\n end",
"def connection\n @connection ||= Faraday.new(\"#{URL_PREFIX}\", connection_options) do |conn|\n conn.basic_auth(api_key, nil)\n end\n end",
"def connection\n @db = Connection.client\nend",
"def connection\n return unless @url\n\n @connection ||= Faraday::Connection.new(@url) do |b|\n middleware.each { |m, opts| b.use(m, opts) }\n b.request :url_encoded\n b.adapter :net_http\n end\n \n @connection.basic_auth(*@basic_auth) if @basic_auth\n @connection.token_auth(*@token_auth) if @token_auth\n @connection.authorization(*@authorization) if @authorization\n @connection\n end",
"def connection\n @connection ||= Connection.new(RESOURCE_PATH)\n end",
"def connection\n @connection ||= Connection.new(RESOURCE_PATH)\n end",
"def connection\n @connection ||= Connection.new(RESOURCE_PATH)\n end",
"def connection\n @connection ||= Connection.new(RESOURCE_PATH)\n end",
"def connect\n connection.connect\n nil\n end",
"def connection\n @connection\n end",
"def connection\n @connection ||= Faraday.new(url: base_url, headers: default_headers, ssl: {verify: false}) do |builder|\n builder.use Faraday::Request::UrlEncoded\n builder.use Faraday::Response::Mashify\n builder.use Faraday::Response::ParseJson\n builder.adapter Faraday.default_adapter\n end\n end",
"def retrieve_connection(klass) #:nodoc:\n self.ensure_ready\n pool = self.retrieve_connection_pool(klass)\n (pool && pool.connection) or raise ActiveRecord::ConnectionNotEstablished\n end",
"def connection\n @connection ||= if defined?(ActiveRecord)\n ActiveRecord::Base.connection.raw_connection\n else\n raise \"No connection established or discovered. Use Revenant::MySQL::connection=\"\n end\n end",
"def client_connection\n if respond_to?(:valid_raw_connection)\n valid_raw_connection\n elsif instance_variable_defined?(:@raw_connection)\n @raw_connection\n else\n @connection\n end\n end",
"def connection\n @connection\n end",
"def connection\n Connection.new(conn_spec)\n end",
"def connection\n @connection ||= Faraday.new(self.api_url, { ssl: { verify: false } })\n end",
"def connection\n adapter.connection\n end",
"def connect\n @connection_pool.get_connection\n end",
"def connection\n @connection ||= begin\n Faraday.new(:url => \"http://#{configuration.server}:#{configuration.port}\", &connection_block)\n end\n end",
"def connection\n @connection.connect\n end",
"def connect\n Connection.new\n end",
"def mongo_connection\n # Returns the connection if it is already established\n return $db_connection if $db_connection\n\n db = URI.parse(ENV['MONGOHQ_URL'])\n db_name = db.path.gsub(/^\\//, '')\n $db_connection = Mongo::Connection.new(db.host, db.port).db(db_name)\n\n unless db.user.nil? || db.password.nil?\n $db_connection.authenticate(db.user, db.password)\n end\n\n $db_connection\nend",
"def connection\n Connection.new(conn_spec)\n end",
"def connection\n BigRecord::Base.connection\n end",
"def connection\n BigRecord::Base.connection\n end",
"def establish_connection\n end",
"def connection\n @connection = begin\n connection_options = {:builder => @middleware}\n connection_options[:ssl] = {:verify => true} if @endpoint[0..4] == 'https'\n connection_options[:proxy] = @proxy if @proxy\n Faraday.new(@endpoint, @connection_options.merge(connection_options))\n end\n end",
"def connection\n params = {}\n @connection ||= Faraday::Connection.new(:url => api_url, :ssl => ssl, :params => params, :headers => default_headers) do |builder|\n @connection_middleware.each do |middleware|\n builder.use *middleware\n end\n builder.adapter Faraday.default_adapter\n end\n end",
"def open_connection\n if @sslca then\n @db = Mysql2::Client.new(\n host: @host, \n username: @username, \n password: @password, \n port: @port, \n database: @database_name,\n sslca: @sslca)\n else\n @db = Mysql2::Client.new(\n host: @host, \n username: @username, \n password: @password, \n port: @port, \n database: @database_name)\n end\n end",
"def connect_if_connection_initialized\n connection.connect if connection.initialized?\n end",
"def open_connection\n\tbegin\n\t\tdb = Mysql.new($db_hostname, $db_user, $db_pass)\n\trescue Mysql::Error\n\t\tabort \"Oops! Couldn't connect to database! Make sure you entered the correct information.\"\n\tend\n\treturn db\nend",
"def connection(refresh = false)\n if defined?(@connection) || superclass == Object\n @connection = Connection.new(site) if refresh || @connection.nil?\n @connection.namespace = namespace\n @connection.user = user if user\n @connection.password = password if password\n @connection\n else\n superclass.connection\n end\n end",
"def conn\n @conn ||= Faraday.new(url: authentication_uri.to_s) do |builder|\n builder.adapter Faraday.default_adapter\n end\n end",
"def open_connection\n\tbegin\n\t\tdb = Mysql.new $db_hostname, $db_user, $db_pass\n\trescue Mysql::Error\n\t\tabort \"Oops! Couldn't connect to database! Make sure you entered the correct information.\"\n\tend\n\treturn db\nend",
"def connection\n @connection ||= Faraday.new(url: PriceHubble.configuration.base_url,\n &method(:configure))\n end",
"def conn\n builder.conn || ::ActiveRecord::Base.connection\n end",
"def ensure_connection!\n fail \"Must have active connection\" unless connection\n end",
"def ensure_connection!\n fail \"Must have active connection\" unless connection\n end",
"def ensure_connection!\n fail \"Must have active connection\" unless connection\n end",
"def ensure_connection!\n fail \"Must have active connection\" unless connection\n end",
"def ensure_connection!\n fail \"Must have active connection\" unless connection\n end",
"def ensure_connection!\n fail \"Must have active connection\" unless connection\n end",
"def connection\n @connection || ActiveSdb::connection\n end",
"def connection\n @connection_pool\n end",
"def connection\n @connection ||= Faraday.new(@endpoint, @connection_options.merge(:builder => @middleware))\n end",
"def connection\n @connection ||= Faraday.new(@endpoint, @connection_options.merge(:builder => @middleware))\n end",
"def connection\n @connection ||= Faraday.new(@endpoint, @connection_options.merge(:builder => @middleware))\n end",
"def connection\n @connection ||= Faraday.new(@endpoint, @connection_options.merge(:builder => @middleware))\n end",
"def build_connection\n connection = Faraday.new(url: base_url)\n connection.adapter *connection_adapter\n end",
"def connection\n Faraday.new(api_url, ssl: { verify: true }) do |conn|\n conn.adapter Faraday.default_adapter\n end\n end",
"def connection(&blk)\n @connection ||= Connection.build endpoint.secret, &blk\n end",
"def connection\n @connection ||= Faraday.new(endpoint, connection_options)\n end",
"def connection\n @connection ||= RestClient::Resource.new(api_uri.to_s)\n end",
"def get_connection(fields = nil)\n # If some jackass sent us anything but an array, fuckem and make it an array\n if fields and fields.class != Array\n string = fields\n fields = Array.new\n fields << string\n end\n begin\n if fields\n connection = TransmissionApi::Client.new(\n :username => self.username,\n :password => self.password,\n :url => self.url,\n :fields => fields + TransmissionApi::Client::TORRENT_FIELDS\n )\n else\n connection = TransmissionApi::Client.new(\n :username => self.username,\n :password => self.password,\n :url => self.url\n )\n end\n rescue ENETUNREACH => e\n Rails.logger.error(\"Could not create connection to transmission backend: #{e.message}\")\n return false\n rescue => e\n Rails.logger.error(\"Could not create connection to transmission backend: #{e.message}\")\n return false\n end\n connection\n end"
] |
[
"0.83089864",
"0.6855643",
"0.6799865",
"0.6796116",
"0.6792206",
"0.67111826",
"0.66553694",
"0.6612947",
"0.6587227",
"0.6542022",
"0.64816594",
"0.64416236",
"0.64188665",
"0.63282216",
"0.6296006",
"0.62567365",
"0.6251459",
"0.61888725",
"0.6172135",
"0.6167632",
"0.61537904",
"0.6115472",
"0.6114718",
"0.6114718",
"0.6114718",
"0.6114718",
"0.60865986",
"0.6085322",
"0.6077416",
"0.60748667",
"0.6073358",
"0.60683894",
"0.6051601",
"0.6019825",
"0.6017686",
"0.60091794",
"0.60072845",
"0.6003428",
"0.5999647",
"0.59827983",
"0.598139",
"0.5968229",
"0.5963466",
"0.59516275",
"0.5940714",
"0.5936394",
"0.5913638",
"0.5902208",
"0.5899358",
"0.5888864",
"0.5888864",
"0.5888864",
"0.5888864",
"0.58869725",
"0.58765376",
"0.5872407",
"0.58641946",
"0.58640754",
"0.585896",
"0.58585787",
"0.5857569",
"0.5857439",
"0.5846247",
"0.58427894",
"0.58322406",
"0.58197325",
"0.580959",
"0.58041966",
"0.58041346",
"0.5793923",
"0.5793923",
"0.5789906",
"0.578544",
"0.5775199",
"0.5758617",
"0.5747181",
"0.5728",
"0.57182777",
"0.5717163",
"0.57149565",
"0.5714701",
"0.5707941",
"0.5697601",
"0.5697601",
"0.5697601",
"0.5697601",
"0.5697601",
"0.5697601",
"0.5696665",
"0.56936157",
"0.5686242",
"0.5686242",
"0.5686242",
"0.5686242",
"0.56687796",
"0.56489056",
"0.56450605",
"0.5642908",
"0.563749",
"0.561338"
] |
0.8500907
|
0
|
Returns a list of companies for the given account
|
def companies
return [] unless basecamp
@companies ||= basecamp.companies
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @account_companies = Account::Company.all\n end",
"def all\n endpoint = 'Companies'\n response = JSON.parse(@client.get(endpoint).body)\n companies = response.key?('Items') ? response['Items'] : []\n companies.map { |attributes| Unleashed::Company.new(@client, attributes) }\n end",
"def account_list\n return [] unless company\n [company] + company.sibling_accounts\n end",
"def list_portfolio_companies\n self.companies.map do |company_instance|\n company_instance.name\n end\n end",
"def companies\n\t\tEmpresa.all\n\tend",
"def companies\n company_ids = company_affiliations.with_access.map(&:company_id)\n Company.where(:id.in => company_ids)\n end",
"def companies\n signed_get(COMPANIES_PATH)\n end",
"def companies\n companies = Driver.find(params[:id]).company\n if companies.size == 0\n companies = Array.new\n end\n respond_with companies\n rescue ActiveRecord::RecordNotFound\n respond_with ActiveRecord::RecordNotFound\n end",
"def companies\n private_companies + major_companies\n end",
"def fetch_accounts\n log 'fetch_accounts'\n data = get(PRODUCTS_ENDPOINT, fields: { carteras: false,listaSolicitada: 'TODOS',indicadorSaldoPreTarj: false })\n cuentas = data['datosSalidaCuentas']['cuentas'].zip(data['datosSalidaCodIban']['datosIban'])\n cuentas.map{ |data| build_account(data) }\n end",
"def index\n @business_companies = Business::Company.all\n end",
"def index\n @credit_companies = CreditCompany.all.page(params[:page]).per(10)\n end",
"def fetch_accounts\n log 'fetch_accounts'\n\n custom_headers = {\n 'Content-Type' => 'application/json; charset=UTF-8',\n 'Contexto' => get_context\n }\n\n params = {\n \"peticionCuentasKYOSPaginadas\" => {\n \"favoritos\" => false,\n \"paginacion\" => \"0\"\n }\n }\n\n response = with_headers(custom_headers) do\n post(BASE_ENDPOINT + ACCOUNTS_ENDPOINT, fields: params.to_json)\n end\n\n json = JSON.parse(response)\n\n if json['respuestacuentas']['cuentas'].is_a? Array\n # TODO: test this with a user with multiple accounts\n json['respuestacuentas']['cuentas'].map { |data| build_account(data) }\n else\n [build_account(json['respuestacuentas']['cuentas'])]\n end\n end",
"def find_all_components_for_account(account = _get_nil_account, authorizer)\n debug \"central find_all_components_for_account: #{account.inspect} #{account.kind_of? Hash} #{account[:urn]}\"\n raise 'Method not implemented because the Central Manager just need to pass the same requisition to the other' \\\n ' brokers and create the concatenated results'\n end",
"def index\n @companies = ClientCompany.all\n end",
"def index\n @companions = current_user.companions.uniq\n end",
"def index\n # current_user.companies.\n @incidents = Incident.all\n end",
"def index\n @companions = Companion.all\n end",
"def company\n response = JSON.parse(@client.get(\"users/#{send(:id)}/companies\").body)\n Promisepay::Company.new(@client, response['companies'])\n rescue Promisepay::NotFound\n nil\n end",
"def index\n @customer_companies = CustomerCompany.all\n end",
"def index\n @companies = NewCompany.where(user: current_user)\n end",
"def index\n add_breadcrumb \"all\", nil, \"glyphicon-list\"\n\n @companies = current_user.account.companies || []\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def index\n @contact_companies = ContactCompany.all\n end",
"def index\n\t\t@companies = []\n if params[:query].nil?\n @products = []\n else\n @products = Product.search params[:query]\n @products.each do |product|\n product.companies.each do |company|\n if !@companies.include? company\n @companies << company\n end\n end\n end\n end\n\tend",
"def index\n\t\t@companies = Company.all\n\tend",
"def index\n\t\t@companies = Company.all\n\tend",
"def get_information_all_companies()\n\t\tpage = 275\n\t\tbegin\n\t\t\turl = create_url(\"organizations\",\"\",page)\n\t\t\tputs \"Reading #{url}\"\n\t\t\tresult = read_url(url)\n\t\t\t#save_json(result, [\"organizations\"])\n\n\t\t\tadd_organization_info(result,\"name\")\n\t\t\tadd_organization_info(result,\"path\")\n\t\t\t\n\t\t\tnext_url = result['data']['paging']['next_page_url']\n\t\t\tpage = page + 1\n\t\tend while next_url != nil\n\t\tcreate_permalink(@paths)\n\t\tsave_json(\"\", [\"names\", \"paths\", \"permalinks\"])\n\tend",
"def index\n @companies = Company.order(:name).page(params[:page]).per(10)\n end",
"def index\n @companies = Company.alphabetical.all\n end",
"def card_companies\n CARD_COMPANIES\n end",
"def index\n @companies = Company.all\n end",
"def index\n @companies = Company.all\n end",
"def index\n @companies = Company.all\n end",
"def index\n @companies = Company.all\n end",
"def index\n @companies = Company.all\n end",
"def index\n @companies = Company.all\n end",
"def pull_company(cfpb, iex)\n # Start with CFPB because it is way more brittle\n complaint = CFPBService.search_complaints cfpb\n stock = IEXService.search_stocks iex\n\n {\n cfpb_complaint_count: complaint[:complaint_count],\n cfpb_random_complaint: complaint[:comment],\n iex: stock\n }\n end",
"def index\n @companies = Company.paginate(page: params[:page]).per_page(10) # pagination (gem 'will_paginate')\n end",
"def index\n @companies = Company.all\n\n end",
"def advisor_companies\n companies.where(_type: AdvisorCompany)\n end",
"def search_company(name = \"\", limit = 50)\n\t\t@nutshell.search_company(name, limit)\n\tend",
"def index\n @compania = Companium.all\n end",
"def index\n @invoced_companies = InvocedCompany.all\n end",
"def all_companies_information\n\t\tbegin\n\t url = URI.parse(Rails.application.secrets[:api_endpoints]['onething']['url_company_info'])\n\t\t url_params = {}\n\t\t path = \"#{url.path}?#{url_params.collect { |k,v| \"#{k}=#{CGI::escape(v.to_s)}\"}.join('&')}\"\n\t\t request = Net::HTTP::Get.new(path) \n\t\t response = Net::HTTP.start(url.host, url.port, :use_ssl => false, :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http| \n\t\t http.request(request)\n\t\t end \n\t\t json_data = JSON.parse(response.body) rescue nil\n\t\t if !json_data.present?\n\t\t \treturn {}\n\t\t else\n\t\t return json_data\n\t\t end\n\t rescue => e\n\t \treturn {:message => 'Error in fetchng API data. Please try again.'}\t\n\t end\n\tend",
"def index\n\t @contentPageHeading = 'My Companies'\n\t @companies = current_user.companies\n\t @user_companies = UserCompany.where(:user_id => current_user.id)\n\t # @public_companies = Array.new\n\t # for user_company in @user_companies\n\t # \t@public_companies.push(user_company,Company.find(user_company.pc_id))\n\t # end\n\t\t# @public_companies = Company.find(:all, :order => 'name', :conditions => 'id IN (SELECT pc_id FROM user_companies WHERE user_id = '+current_user.id.to_s+')')\n end",
"def find_by_account(account)\n raise SecurityError if account.nil?\n projects = []\n if(account.is_a? Worker)\n account.worker_groups.each do |group| #TODO convert to this to a JOIN model to avoid N^2 hits to the db\n group.projects.each do |project|\n projects << project\n end\n end\n else\n account.client_groups.each do |group| #TODO convert to this to a JOIN model to avoid N^2 hits to the db\n group.projects.each do |project|\n projects << project\n end\n end\n end\n return projects\n end",
"def index\n @companies_info = Company.display_information\n end",
"def index\n @companies = NasdaqCompany.all_companies\n respond_with(@companies)\n end",
"def index\n if current_user.admin?\n @companies = Company.all.order(:name).page(params[:page]).per(10)\n else\n @companies = current_user.company\n end\n end",
"def list(companies)\n companies.each {|company| puts \"#{company.name} - #{company.size}\"}\nend",
"def index\n @guarantee_companies = GuaranteeCompany.all\n end",
"def auctionable_companies\n @config.fetch('auction').map do |abbreviation|\n companies.find do |company|\n company.abbreviation.eql? abbreviation\n end\n end\n end",
"def get_customers()\n customers = Customer.where(company_id: self.id).order(:name)\n\n return customers\n end",
"def get_customers()\n customers = Customer.where(company_id: self.id).order(:name)\n\n return customers\n end",
"def get_customers()\n customers = Customer.where(company_id: self.id).order(:name)\n\n return customers\n end",
"def listaccounts(minconf = 1)\n coind.listaccounts minconf\n end",
"def accounts\n account_data = request('listaccounts')\n account_data.map do |account_name, account_value|\n Account.new(self, account_name, account_value, false)\n end\n end",
"def show\n @companies = Company.all\n end",
"def get_accounts\n @accounts = Account.all\n end",
"def index\n @employees = Employee.all.order(created_at: :desc).group(\"employees.company_id, id\").paginate(page: params[:page], per_page: 15)\n @companies = Company.where(id: @employees.pluck(:company_id).uniq.sort)\n end",
"def get_expense_companies\n res = {\n :total => nil,\n :success => true,\n :data => []\n }\n entities = OrderEntity.find_all_by_order_id(params[:id], :include => [:company])\n entities.each do |e|\n res[:data].push([e.id, e.company.name])\n end\n\n render :json => res.to_json, :layout => false\n\n end",
"def index\n if params[:company_type]\n @search = @community.companies.where(:company_type => params[:company_type]).search(params[:q])\n else\n @search = @community.companies.search(params[:q])\n end\n @companies = @search.result\n\n @tab_name = \"companies\"\n @page_title = \"Companies\"\n @page_subtitle = \"Loyal Businesses\"\n @page_description = \"\"\n\n add_breadcrumb \"Companies\", companies_path, :title => \"#{@community.name} Companies\"\n end",
"def index\n @companies = Company.order(:name).confirmed.paginate(:page => params[:page], :per_page => 15)\n end",
"def index\n @companies = companies_scope\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def index\n @companies = Company.all.page params[:page]\n end",
"def index\n if request.format.to_sym == :html\n @companies = Company.page(params[:page]).order(\"LOWER(name)\")\n else\n @companies = Company.all\n end\n respond_with(@companies)\n end",
"def set_account_company\n @account_company = Account::Company.find(params[:id])\n end",
"def index\n @couts = Cout.order(:code)\n @company = Company.find(1)\n end",
"def company\n @company ||= Harvest::API::Company.new(credentials)\n end",
"def index\n @company_names = CompanyName.all\n end",
"def index\n @travel_companions = TravelCompanion.all\n end",
"def get_accounts()\n http_get(accounts_url)\n end",
"def list_contacts_by_company(companyId, options={}) path = \"/api/v2/companies/#{companyId}/contacts\"\n get(path, options, AvaTax::VERSION) end",
"def advisor_companies\n Company.where(:id.in => advisor_company_ids)\n end",
"def index\n @page_id = 'companyList'\n @banners = Banner.companies.where('start_at <= ? and end_at >= ?', Time.now, Time.now).where(:language => params[:locale] == 'en' ? [0, 1] : [0, 2])\n @company_classifies = CompanyClassify.design\n @companies = params[:company_classify_id].present? ? Company.joins(:company_classify_relations).where('company_classify_relations.company_classify_id = ?', params[:company_classify_id]).design.allow.human_order : Company.design.allow.human_order\n end",
"def index\n @company_clients = CompanyClient.where(company: params[:company]).first\n end",
"def index\n @heroku_accounts = Heroku::Account.all\n end",
"def index\n @group_companies = GroupCompany.all\n end",
"def fetch_accounts\n acc_obj_arr = []\n accounts.each do |link|\n link.click\n puts \"Accessing account: #{acc_name}\"\n wait_to_load\n puts 'Loading transactions data'\n scroll_to_bottom\n puts '>Transactions data successfully loaded'\n puts 'Fetching transactions'\n tr = TransFetch.new(@bank_page).fetch_trans\n acc_obj_arr << Account.new(acc_name, acc_currency, acc_balance,\n 'Credit Card', tr)\n puts \">Successfully retrieved data for #{acc_name} account\"\n end\n acc_obj_arr\n end",
"def documents_list_for_company(company_account_id)\n\n end",
"def index\n @company_users = CompanyUser.all\n end",
"def index\n organizations = if params[:q]\n CclaSignature.search(params[:q])\n else\n Organization.includes(:ccla_signatures)\n end\n\n respond_to do |format|\n format.json do\n render json: organizations.to_json(only: [:id], methods: [:company])\n end\n end\n end",
"def index\n @production_companies = ProductionCompany.all\n end",
"def company\n @company ||= research_param(:company) || company_list.first\n end",
"def accounts\n\n if params[:cost_ctr]\n # looks like something may have changed\n @cc = params[:cost_ctr]\n session[:cc] = params[:cost_ctr]\n end\n @cod_accounts = CodAccount.where(cost_ctr: session[:cc]).where(logistics_completed: true).where.not(accounting_completed: true)\n end",
"def index\n @hiring_companies = HiringCompany.all\n end",
"def search_account\n data=params\n search_result =[]\n unless data[:q].blank?\n search_result = @company.accounts.search data[:q], :star => true, :limit => 10000\n else\n search_result = @company.accounts.all(:order => 'name ASC')\n end\n render :partial=> 'account_auto_complete', :locals => {:search_result => search_result}\n end",
"def index\n @inc_stable_accounts = IncStableAccount.all\n end",
"def get_Company(name=nil)\n\n getElement_text(\"cust_vendors\").click\n\n getElement_text(\"Customers\").click\n\n if(name!=nil)\n getElement_text_direct(name).click\n else\n getElement_text(\"company_name_data\").click\n end\n end",
"def index\n @company = Company.all\n end",
"def listaccounts(minconf = 1)\n @api.request 'listaccounts', minconf\n end",
"def list_accounts(client, options)\n accounts = get_accounts(client, options)\n if accounts.nil?\n return\n end\n\n accounts.each do |acc|\n print_account(acc)\n end\nend",
"def index\n @b_accounts = BAccount.all\n end",
"def get_account_quotas()\n session_url = '/sessions?page=0&pageSize=1'\n response = self.class.get(session_url, @options)\n response.headers.select { |k, _v| k.to_s.start_with? 'nexosis-account' }\n end",
"def portfolio_accounts\n data = call_api(method: \"get\", url: \"/portfolio/accounts\" )\n @accountId = data.first[\"accountId\"]\n @accountId\n end",
"def getaddressesbyaccount(account)\n coind.getaddressesbyaccount account\n end",
"def index\n @api_v1_accounts = Api::V1::Account.all\n end",
"def generate_list_of_companies companies\n companies.map { |company| \"#{company.name} - #{company.size}\" }\n end",
"def index\n @baskets = current_user.baskets\n @coupons = @baskets.map {|basket| basket.coupon}\n @companies = Company.all\n\n end",
"def accounts\n request = request(method: :get, path: \"/Account.json\")\n response = request.perform\n instantiate(response[\"Account\"], Lightspeed::Account)\n end"
] |
[
"0.7457216",
"0.7338584",
"0.68966895",
"0.68879056",
"0.6848547",
"0.67665553",
"0.6718682",
"0.66369927",
"0.6603573",
"0.655943",
"0.6526628",
"0.64747506",
"0.64237154",
"0.6416138",
"0.63980734",
"0.63814276",
"0.6356874",
"0.6324887",
"0.63061035",
"0.63015676",
"0.6281931",
"0.62074924",
"0.61876863",
"0.6172171",
"0.6160984",
"0.6160984",
"0.6157607",
"0.6153644",
"0.6150385",
"0.6140497",
"0.61373764",
"0.61373764",
"0.61373764",
"0.61373764",
"0.61373764",
"0.61373764",
"0.6114636",
"0.60955024",
"0.60863847",
"0.6079548",
"0.60709846",
"0.60706043",
"0.6051975",
"0.6027846",
"0.60156184",
"0.6012788",
"0.5995563",
"0.59867984",
"0.59857863",
"0.5981305",
"0.5964154",
"0.5960151",
"0.5938239",
"0.5938239",
"0.5938239",
"0.5924521",
"0.5922284",
"0.5921725",
"0.5897601",
"0.58925146",
"0.588364",
"0.58765864",
"0.5871734",
"0.5860059",
"0.58581275",
"0.5850712",
"0.5848857",
"0.5844423",
"0.58381504",
"0.5830513",
"0.5826477",
"0.5808488",
"0.58074",
"0.5786027",
"0.5780138",
"0.5775387",
"0.5775293",
"0.57666504",
"0.5764458",
"0.5763899",
"0.57627916",
"0.5761801",
"0.5760982",
"0.57590634",
"0.5734442",
"0.57300884",
"0.57296205",
"0.57281584",
"0.5713689",
"0.5701854",
"0.56875336",
"0.56846476",
"0.5683192",
"0.56793445",
"0.5672318",
"0.5667258",
"0.5667011",
"0.5661154",
"0.56598336",
"0.56577975"
] |
0.68722683
|
4
|
Returns a list of people for the given account
|
def people
return [] if company_id.blank? || !basecamp
@people ||= basecamp.people(company_id)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def list_users_by_account(accountId, options={}) path = \"/api/v2/accounts/#{accountId}/users\"\n get(path, options, AvaTax::VERSION) end",
"def users\n user_arr = []\n accounts.each do |s|\n user_arr << User.find(s.user.id)\n end\n user_arr\n end",
"def scrape_people\n people = []\n lis = @browser.lis(css: \".mod.result.people\")\n lis.each do |li|\n user_id = li.attribute_value(\"data-li-entity-id\")\n\n bd = li.div(class: \"bd\")\n name = bd.h3.a.text\n if name =~ /linkedin member/i\n next\n end\n\n if bd.dl(class: \"snippet\").present?\n title = bd.dl(class: \"snippet\").dd.p.text\n else\n title = bd.div.text\n end\n\n full_url = bd.h3.a.href\n person = {\n user_id: user_id,\n name: name,\n full_url: full_url,\n title: title\n }\n people << person\n end\n people\nend",
"def people\n Sifter.\n get(api_people_url).\n fetch(\"people\", []).\n map { |p| Sifter::Person.new(p) }\n end",
"def people\n Sifter.\n get(api_people_url).\n fetch(\"people\", []).\n map { |p| Sifter::Person.new(p) }\n end",
"def listaccounts(minconf = 1)\n coind.listaccounts minconf\n end",
"def list_users_in_account(account_id,opts={})\n query_param_keys = [\n :search_term\n ]\n\n form_param_keys = [\n \n ]\n\n # verify existence of params\n raise \"account_id is required\" if account_id.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :account_id => account_id\n )\n\n # resource path\n path = path_replace(\"/v1/accounts/{account_id}/users\",\n :account_id => account_id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:get, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:get, path, query_params, form_params, headers)\n page_params_store(:get, path)\n response.map {|response|User.new(response)}\n end",
"def list_accounts\n HTTP.headers(:accept => @@accept).basic_auth(:user => ENV[\"API_USERNAME\"], :pass => ENV[\"API_PASSWORD\"])\n .get(\"#{@@base_url}/users/#{self.guid}/accounts\").parse[\"accounts\"]\n end",
"def listaccounts(minconf = 1)\n @api.request 'listaccounts', minconf\n end",
"def all_users\n result = []\n api.search(accounts_dn, ::LDAP::LDAP_SCOPE_SUBTREE, accounts_filter) do |user|\n result << user.to_hash\n end\n result\n end",
"def get_list_acc\n JSON.parse(curl_get(\"accounts\").body_str)\n end",
"def list(\n filter,\n *args,\n deadline: nil\n )\n return @accounts.list(\n filter,\n *args,\n deadline: deadline,\n )\n end",
"def accounts\n request = request(method: :get, path: \"/Account.json\")\n response = request.perform\n instantiate(response[\"Account\"], Lightspeed::Account)\n end",
"def list_accounts(client, options)\n accounts = get_accounts(client, options)\n if accounts.nil?\n return\n end\n\n accounts.each do |acc|\n print_account(acc)\n end\nend",
"def account_list\n return [] unless company\n [company] + company.sibling_accounts\n end",
"def fetch_accounts\n log 'fetch_accounts'\n\n custom_headers = {\n 'Content-Type' => 'application/json; charset=UTF-8',\n 'Contexto' => get_context\n }\n\n params = {\n \"peticionCuentasKYOSPaginadas\" => {\n \"favoritos\" => false,\n \"paginacion\" => \"0\"\n }\n }\n\n response = with_headers(custom_headers) do\n post(BASE_ENDPOINT + ACCOUNTS_ENDPOINT, fields: params.to_json)\n end\n\n json = JSON.parse(response)\n\n if json['respuestacuentas']['cuentas'].is_a? Array\n # TODO: test this with a user with multiple accounts\n json['respuestacuentas']['cuentas'].map { |data| build_account(data) }\n else\n [build_account(json['respuestacuentas']['cuentas'])]\n end\n end",
"def get_account(acct)\n\t\t$DB.where(account_name: acct).each do |t|\n\t\t\tputs \"#{t[:account_name]}: #{t[:balance]}\"\n\t\tend\n\tend",
"def find_by_account(account)\n raise SecurityError if account.nil?\n projects = []\n if(account.is_a? Worker)\n account.worker_groups.each do |group| #TODO convert to this to a JOIN model to avoid N^2 hits to the db\n group.projects.each do |project|\n projects << project\n end\n end\n else\n account.client_groups.each do |group| #TODO convert to this to a JOIN model to avoid N^2 hits to the db\n group.projects.each do |project|\n projects << project\n end\n end\n end\n return projects\n end",
"def get_accounts\n @accounts = Account.all\n end",
"def accounts\n get('/accounts')['accounts']\n end",
"def accounts\n account_data = request('listaccounts')\n account_data.map do |account_name, account_value|\n Account.new(self, account_name, account_value, false)\n end\n end",
"def get_accounts()\n http_get(accounts_url)\n end",
"def getaddressesbyaccount(account)\n coind.getaddressesbyaccount account\n end",
"def index\n @account_users = AccountUser.account_users_for(current_user.id)\n end",
"def list\n token = SocialService::Facebook.renew_token(token_params)\n\n accounts =\n SocialService::Facebook\n .accounts(token)\n .reject { |a| a[:id].in?(facebook_account_ids) }\n\n render json: { accounts: accounts }\n end",
"def getaddressesbyaccount(account)\n @api.request 'getaddressesbyaccount', account\n end",
"def users(params = {})\n make_get_request('/account/users', params)\n end",
"def index\n @people = current_organization.people.all\n end",
"def find_persons(regx = \"\")\n return nil if regx.nil?\n\n res = []\n if regx == \"\"\n return [me_id]\n else\n regx = enc_cmd(regx)\n res = people.select{|id, login| login.mb_chars.downcase =~ /#{regx.mb_chars.strip.downcase}/i}\n end\n\n if !res.empty?\n res.map &:first\n else\n say \"no peoples matched #{regx}\"\n []\n end\n end",
"def search(name)\n\t\tresult = []\n\t\tpeople.each do |person|\n\t\t \tif person.name.include?(name)\n\t\t \tputs \"tel: #{person.phone}\"\n\t\t \tresult << person\n\t\t\tend\n\t\tend\n\t\tresult\n\tend",
"def index\n @account = Account.find(params[:account_id])\n @users = @account.users\n respond_to do |format|\n format.json { render json: @account.users.paginate(page: @page, per_page: @per_page) }\n end\n end",
"def get_people\n return @people\n end",
"def accounts(query = nil)\n exec(\"accounts #{query if query}\").split(\"\\n\")\n end",
"def usernames\n users = PadmaUser.paginate(account_name: self.name, per_page: 100)\n users.nil? ? nil : users.map(&:username)\n end",
"def get_account\n as_json(get_results('/account'))\n end",
"def account_details(*paramaters)\n accounts = []\n unless self.list_accounts.blank?\n self.list_accounts.each do |account|\n details = {} \n account.each do |key, value|\n if paramaters.include? key\n details[key] = value\n end\n end\n accounts << details\n end\n accounts\n end\n end",
"def list_accounts\n\ttp Account.all\nend",
"def index\n @accounts = current_user.person.linked_in_accounts\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @accounts }\n end\n end",
"def getaddressesbyaccount(account)\n request :getaddressesbyaccount, account\n end",
"def accounts\n response = query_api(\"/rest/accounts\")\n return response[\"accounts\"].map {|account| Account.new(self, account)}\n end",
"def find_names(names)\n query = names.to_query('displayName').delete('%5B%5D') # delete '[]'\n uri = URI.parse(\"https://developer-paragon.epicgames.com/v1/accounts/find?#{query}\")\n request = Net::HTTP::Get.new(uri)\n request.add_field(\"X-Epic-ApiKey\", ENV[\"API_KEY\"])\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n response = http.request(request)\n return JSON.parse response.body\n end",
"def users(domain, opts = USERS_OPTIONS.merge(:client => GoodData.connection))\n result = []\n\n offset = 0 || opts[:offset]\n uri = \"/gdc/account/domains/#{domain}/users?offset=#{offset}&limit=#{opts[:limit]}\"\n loop do\n break unless uri\n tmp = client(opts).get(uri)\n tmp['accountSettings']['items'].each do |account|\n result << client(opts).create(GoodData::Profile, account)\n end\n uri = tmp['accountSettings']['paging']['next']\n end\n\n result\n end",
"def get_people_info(page_size=2)\n\t\toptions = {\n\t\t\theaders: headers,\n\t\t\tquery: { page_size: page_size }\n\t\t}\n\t\tresult = self.class.get(\"/people/#{display_name}/#{email_address}/#{title}\", options)\n\tend",
"def users(domain, opts = USERS_OPTIONS.merge(:client => GoodData.connection))\n result = []\n\n offset = 0 || opts[:offset]\n uri = \"/gdc/account/domains/#{domain}/users?offset=#{offset}&limit=#{opts[:limit]}\"\n loop do\n break unless uri\n tmp = client(opts).get(uri)\n tmp['accountSettings']['items'].each do |account|\n result << client(opts).create(GoodData::Profile, account)\n end\n break if opts[:limit] && result.length >= opts[:limit]\n uri = tmp['accountSettings']['paging']['next']\n end\n\n result\n end",
"def people(query={})\n response = self.simple_client.get(\"/api/v1/people?#{query.to_query}\")\n # TODO modularize, re-use\n if response[\"page\"]\n return WillPaginate::Collection.create(response[\"page\"],response[\"per_page\"]) do |pager|\n pager.replace(response[\"people\"])\n pager.total_entries = response[\"total_entries\"]\n end\n else\n return response\n end\n end",
"def get_accounts_by_user\n return User.find(params[:user_id]).accounts\n end",
"def accounts\n\t\treturn @accounts\n\tend",
"def list \n @people.each_with_index do |a,i|\n puts \"Entry \" + (i+1).to_s + \": \" + a.fullname\n end\n end",
"def list\n log \"retrieving users list from #{users_path}\"\n response = identity_client.get(users_path)\n records = JSON.load(response.body)[\"users\"]\n records.map { |record|\n record[\"username\"]\n }.map { |username|\n Raca::User.new(@account, username)\n }\n end",
"def account_return\n direct_login = []\n users = []\n ulist = Main.active.account_text.tr(\"\\n \",\",\").split(\",\")\n ulist.each do |n| \n n.strip!\n case n\n when /^.*@[0-9]{2,3}$/ \n direct_login << n.split(\"@\")\n when /^.{1,8}$/\n users << n\n end\n end\n #p Account.find_accounts(users).private.other_accounts.flatten\n accounts = users.empty? ? [] : Account.find_accounts_or_initialize(users)\n accounts.collect! { |account| account.all_accounts } if accounts\n accounts.flatten! if accounts\n if !accounts.empty?\n fill_accounts(accounts)\n else\n Main.active.status = [\"#{users}\", \"existiert nicht\", \"important\", -1]\n end\n end",
"def fetch_accounts\n log 'fetch_accounts'\n data = get(PRODUCTS_ENDPOINT, fields: { carteras: false,listaSolicitada: 'TODOS',indicadorSaldoPreTarj: false })\n cuentas = data['datosSalidaCuentas']['cuentas'].zip(data['datosSalidaCodIban']['datosIban'])\n cuentas.map{ |data| build_account(data) }\n end",
"def listaccounts\n return {} unless node.wallet\n accounts = {}\n node.wallet.accounts.each do |a|\n accounts[a.name] = node.wallet.get_balance(a)\n end\n accounts\n end",
"def index\n @organizations = Organization.all.alphabetical\n @participant = Participant.new\n @users = User.all.map{|user| user} #Individual.all.map{|indiv| indiv.user.id}\n @names_from_users = []\n @users.each do |user|\n # if user does not have an individual, then just use email\n if user.individual.nil?\n @names_from_users << [user.email, user.id]\n else\n @names_from_users << [user.individual.name, user.id]\n end\n end\n @names_from_users.sort!\n end",
"def get_full_name_of_everyone(people)\n people.each do |person|\n puts \"#{person[:first_name]} #{person[:last_name]}\"\n end\nend",
"def all\n @dealing_platform.gather 'accounts', :accounts, Account\n end",
"def list_org\n __log_activity\n __debug_route\n prm = paginator.initial_parameters.except(*Paginator::NON_SEARCH_KEYS)\n org = current_org and current_org!(prm, org)\n terms = prm.delete(:like)\n found = { list: get_accounts(*terms, **prm) }\n @list = paginator.finalize(found, **prm)\n opt = { locals: { name: org&.label } }\n respond_to do |format|\n format.html { render 'account/index', **opt }\n format.json { render 'account/index', **opt }\n format.xml { render 'account/index', **opt }\n end\n end",
"def find_people\n @query = '%' + params[:project_members_search] + '%'\n if @query.length > 3\n @project = Project.find(params[:id])\n people_ids = @project.people.map {|person| person.id }\n ids = ''\n people_ids.each do |id|\n ids << id.to_s << ','\n end\n logger.debug('***' + ids)\n ids = ids[0,ids.length-1]\n\n # if a project doesn't have a project team members\n # search results are not checked against\n # existing project team members\n ids_check = ''\n if !@project.people.empty?\n ids_check = 'AND person_id NOT IN (' + ids + ')'\n end\n @results = Person.find(:all,\n :conditions => [\"( LOWER(last_name) ILIKE ? OR LOWER(first_names) ILIKE ?) \" + ids_check, @query.downcase, @query.downcase],\n :limit => 10,\n :order => 'last_name, first_names')\n render :layout => false\n else\n render :text => 'Please enter at least 3 characters'\n end\n end",
"def accounts\n return [] if self.id.nil?\n @accounts ||= \n OrgSync::Base.request(\"#{self.class.endpoint}/#{self.id}/accounts\", {}, @api_key).map { |json| \n OrgSync::Account.new(json, @api_key) \n }\n end",
"def all_accounts\n puts params[:id]\n accounts = []\n user = User.find params[:id]\n user.accounts.each do |f|\n accounts << {id:f.id, title: f.title}\n end\n render json: accounts\n end",
"def account_list(user)\n (user.account_lists & account_lists).first\n end",
"def find_account(accounts, email)\n accounts.each do |acc|\n if acc.email == email\n return acc\n end\n end\n\n return nil\nend",
"def search_people(term, start_index=0, max_results=25)\n get_object_list \"People\", get(\"catalog/people\", {term: term, start_index: start_index, max_results: max_results})\n end",
"def list params={}\n params[:fields] = params[:fields].join(',') if params[:fields]\n params[:record_type] ||= 'person'\n @nimble.get \"contacts\", params\n end",
"def list(account)\n matches = @db.find(account)\n title = \"Title\"\n username = \"Username\"\n add_info = \"Additional Information\"\n if matches.size > 0 then\n lengths = {\n :title => (matches.collect { |f| f.title.length } << title.length).max,\n :username => (matches.collect { |f| f.username.length } << username.length).max,\n :additional_info => add_info.length\n }\n\n header = \" # #{\"Title\".ljust(lengths[:title])} #{\"Username\".ljust(lengths[:username])} #{add_info}\"\n hsay header, :header\n # 3 spaces for number column + 1 space after and 4 spaces between\n # each other column\n hsay\"-\" * (header.length), :header_bar\n\n matches.each_with_index do |match,i|\n line_number = sprintf(\"%3d\", i + 1)\n # toggle colors\n color = [:even_row, :odd_row][i % 2]\n columns = []\n [:title, :username, :additional_info].each do |f|\n t = match.send(f)\n t = \"-\" if t.nil? or t.length == 0 \n columns << t.ljust(lengths[f])\n end\n cdata = columns.join(\" \" * 4)\n @highline.say(\"<%= color('#{line_number}',:line_number) %> <%= color(%Q{#{cdata}},'#{color}') %>\")\n end\n else\n hsay \"No matching records were found.\", :information\n end\n end",
"def get_account\n account_id_array = []\n account_id = nil\n accounts = Bank::Account.create_accounts(\"./support/accounts.csv\")\n CSV.foreach(\"./support/account_owners.csv\") do |line|\n if line[1].to_i == @id\n account_id = line[0].to_i\n instance_of_account = Bank::Account.find(account_id)\n account_id_array << instance_of_account\n end\n end\n return account_id_array\n end",
"def send_user_list(path)\n path = path[1..-1]\n path = path[0..-2] if path.ends_with?(\"/\")\n results = []\n I3.directory.find_people(:groups, path).each do |uuid|\n p = I3.directory.read_person(uuid)\n result = I3::SharedObject.new\n result.account_name = p.account_name.to_s.downcase\n result.first_name = p.first_name.to_s\n result.last_name = p.last_name.to_s\n result.description = p.description.to_s\n results << result\n end #each\n I3.server.send_object(results)\n end",
"def account_info(*fields)\n get(\"/me#{field_selector(fields)}\")\n end",
"def get_people(detail_page)\n first_table = detail_page.search('div#ctl00_MainBodyContent_group_17 table.ContentPanel')\n people_array = [] \n if first_table\n list_tr = first_table.search('tr')\n for i in 1..list_tr.length-1\n list_td = list_tr[i].search('td')\n people_obj = {}\n people_obj[:role] = clean_whitespace(list_td[0].inner_text)\n people_obj[:name] = clean_whitespace(list_td[1].inner_text)\n people_obj[:address] = clean_whitespace(list_td[2].inner_text)\n \n people_array << people_obj\n end\n else\n return \"\"\n end\n return people_array\nend",
"def get_people(detail_page)\n first_table = detail_page.search('div#ctl00_MainBodyContent_group_17 table.ContentPanel')\n people_array = [] \n if first_table\n list_tr = first_table.search('tr')\n for i in 1..list_tr.length-1\n list_td = list_tr[i].search('td')\n people_obj = {}\n people_obj[:role] = clean_whitespace(list_td[0].inner_text)\n people_obj[:name] = clean_whitespace(list_td[1].inner_text)\n people_obj[:address] = clean_whitespace(list_td[2].inner_text)\n \n people_array << people_obj\n end\n else\n return \"\"\n end\n return people_array\nend",
"def list_user_names(iam)\r\n list_users_response = iam.list_users\r\n list_users_response.users.each do |user|\r\n puts user.user_name\r\n end\r\nend",
"def accounts\n period.accounts\n end",
"def accounts\n @browser.lis(data_semantic: 'account-item')\n end",
"def search\n return @accounts.select{|el| el.created_at.to_s.starts_with?(params[:search_account]) || el.id.to_s.starts_with?(params[:search_account]) ||\n el.user_id.to_s.starts_with?(params[:search_account]) ||\n el.sortCode.to_s.starts_with?(params[:search_account]) || el.balance.to_s.starts_with?(params[:search_account]) ||\n el.currency.to_s.starts_with?(params[:search_account])}\n end",
"def list_of_people\n array_of_lines(people_path)\n end",
"def people\n #TODO: look into doing this with a scope or direct query\n res = work_groups.collect(&:people).flatten.uniq.compact\n #TODO: write a test to check they are ordered\n res.sort_by{|a| (a.last_name.blank? ? a.name : a.last_name)}\n end",
"def list\n @mailing_list.contacts(limit: 10000).map{|contact| contact.email}\n end",
"def index\n @authorized_people = AuthorizedPerson.all\n end",
"def people(company_id, project_id=nil)\n url = project_id ? \"/projects/#{project_id}\" : \"\"\n url << \"/contacts/people/#{company_id}\"\n records \"person\", url\n end",
"def people(company_id, project_id=nil)\n url = project_id ? \"/projects/#{project_id}\" : \"\"\n url << \"/contacts/people/#{company_id}\"\n records \"person\", url\n end",
"def people(term, params = {})\n args = '&' + paramify(params) unless params.empty?\n get(\"/catalog/people?term=#{term}#{args}\")\n end",
"def index\n @accounts = Account.alumni.paginate(:page => params[:page], :per_page => 50)\n end",
"def get_character_list account\n end",
"def get_persons\n @all_persons\n end",
"def find_facebook_friends_with_accounts\n load_facebook_api\n friends = @facebook_api.get_connections('me', 'friends')\n \n friend_ids = []\n friends.each { |friend| friend_ids << friend['id'] }\n\n auths = Authorization.where(:provider => 'facebook', :uid => friend_ids)\n\n output = []\n auths.each { |auth| output << auth.user }\n\n output\n end",
"def get_account_names(data)\n new_accounts_hash = {}\n api = QboApi.new(oauth_data)\n JSON.parse(data).each do |k,v|\n this_account = api.get :account, v\n new_accounts_hash[k] = {val: v, name: this_account[\"Name\"]}\n end\n new_accounts_hash\n end",
"def cmd_people_names\n\t\tquery_json do\n\t\t\t\"SELECT DISTINCT ?name\n\t\t\tWHERE {\n\t\t\t\t?p a foaf:Person .\n\t\t\t\t?p foaf:name ?name .\n\t\t\t}\n\t\t\tORDER BY ?name\"\n\t\tend\n\tend",
"def search_people(query)\n get(\"/v1/search/people\", query: query)\n end",
"def account\n get('account')\n end",
"def print_account(account)\n puts \"Email: #{account.email}\"\n puts \"Username: #{account.username}\"\n puts \"First name: #{account.given_name}\"\n puts \"Last name: #{account.surname}\"\n puts \"Status: #{account.status}\"\nend",
"def account(params = {})\n make_get_request('/account', params)\n end",
"def people\n\t\t\t\t\tif @people.nil?\n\t\t\t\t\t\t@people = self.class.people(self.ref, self.params)\n\t\t\t\t\tend\n\t\t\t\t\treturn @people\n\t\t\t\tend",
"def find_account(name)\n return (accounts.select { |a| a[:name] == name }).first\n end",
"def forEachUser(list = nil) \n list = @accountList if list == nil\n list.each do |account|\n yield account\n end\n end",
"def accounts( params={} )\n accounts = get_connections(\"accounts\", params)\n return map_connections accounts, :to => Facebook::Graph::Generic\n end",
"def find_people\n @users=[]\n session[:search_opt] = params[:user]\n if request.post?\n @users = @login_user.search_query(params[:user],1)\n flash[:notice] = \"No results found.\" if @users.empty?\n end\n end",
"def get_user_list\n return User.find(:all, :order => 'last_name ASC').collect {|user| [user.full_name, user.id]}\n end",
"def activedirectory_users(opts, accountname_expr = 'jturner')\n\n ldap = Net::LDAP.new :host => opts[:ldaphost],\n\t:port => opts[:ldapport],\n\t:auth => {\n\t:method => :simple,\n\t:username => opts[:binddn],\n\t:password => opts[:bindpassword]\n \n }\n\n filter = Net::LDAP::Filter.construct(\"(&(objectCategory=Person)(sAMAccountName=#{accountname_expr}))\")\n\n ldap.search(\n\t:base => opts[:basedn],\n\t:filter => filter,\n\t:attributes => [:samaccountname, :displayname, :mail, :telephonenumber, :description, :department, :company, :physicaldeliveryofficename, :streetaddress, :l, :st, :postalcode, :co, :thumbnailPhoto]\n ) \nend",
"def index\n @people = do_search_people(@person, :friends, :with_tags => !request.xhr?,\n :url => hash_for_contacts_path)\n end",
"def index\n @accounts = current_user.person.phone_accounts\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @accounts }\n end\n end",
"def list_org\n @users = User.where(organization: true)\n\n render \"list_org\"\n end"
] |
[
"0.6486989",
"0.6377817",
"0.6348578",
"0.63434523",
"0.63434523",
"0.63380414",
"0.6305658",
"0.6301055",
"0.62170017",
"0.6181082",
"0.617207",
"0.6159096",
"0.61541176",
"0.61496466",
"0.6146521",
"0.6133326",
"0.6130597",
"0.61137235",
"0.6099743",
"0.6027982",
"0.6027908",
"0.6004255",
"0.6004043",
"0.60036486",
"0.598905",
"0.59866",
"0.59826535",
"0.5978151",
"0.5978046",
"0.5973455",
"0.59682393",
"0.5947111",
"0.5945651",
"0.5937546",
"0.5934542",
"0.59327215",
"0.59285575",
"0.5920116",
"0.59113634",
"0.5910996",
"0.5902099",
"0.59004295",
"0.58855003",
"0.5879744",
"0.58794594",
"0.5872216",
"0.586739",
"0.5860564",
"0.5859016",
"0.5854922",
"0.5854271",
"0.5852421",
"0.58428806",
"0.58420473",
"0.5839388",
"0.58356583",
"0.58350605",
"0.58340573",
"0.58331794",
"0.5824953",
"0.5824366",
"0.581951",
"0.58073205",
"0.58046955",
"0.5800726",
"0.5794352",
"0.5792286",
"0.5786092",
"0.5786092",
"0.57843363",
"0.5782288",
"0.57790506",
"0.5777713",
"0.5777305",
"0.57754886",
"0.57615125",
"0.5758912",
"0.5758175",
"0.5758175",
"0.57557535",
"0.5750776",
"0.5746006",
"0.5745828",
"0.57419616",
"0.57388985",
"0.5710556",
"0.5709643",
"0.5695823",
"0.56922364",
"0.5687478",
"0.56870323",
"0.56832904",
"0.56740516",
"0.5673641",
"0.56653076",
"0.5664718",
"0.56627345",
"0.5655292",
"0.56539387",
"0.5653874"
] |
0.6113757
|
17
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.